diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8e1241f --- /dev/null +++ b/.gitattributes @@ -0,0 +1,14 @@ +# Default behavior +* text=auto + +# Text files +*.php text +*.css text +*.js text +*.md text + +# Binary files +*.png binary +*.jpg binary +*.gif binary +*.ico binary diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..54c0329 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.DS_Store +Thumbs.db +.svn +node_modules/ \ No newline at end of file diff --git a/.svnignore b/.svnignore new file mode 100644 index 0000000..b74f328 --- /dev/null +++ b/.svnignore @@ -0,0 +1,5 @@ +.git +.gitignore +.gitattributes +.svnignore +node_modules diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..e1e6b1e --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,96 @@ +'use strict'; + +module.exports = function(grunt) { + + // Load tasks + require('load-grunt-tasks')(grunt); + + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + + + // Dependencies + + // PHP + + // Lint .php files for syntax errors + phplint: { + all: [ '*.php', 'lib/**/*.php' ] + }, + + + // I18n + + // Add text domain as last argument of i18n functions + addtextdomain: { + php: { + files: { + src: [ + '*.php', + 'lib/**/*.php' + ] + } + } + }, + + // Check text domain is last argument of i18n functions + checktextdomain: { + options: { + text_domain: '<%= pkg.name %>', + keywords: [ + '__:1,2d', + '_e:1,2d', + '_x:1,2c,3d', + '_ex:1,2c,3d', + '_n:1,2,4d', + '_nx:1,2,4c,5d', + '_n_noop:1,2,3d', + '_nx_noop:1,2,3c,4d', + 'esc_attr__:1,2d', + 'esc_html__:1,2d', + 'esc_attr_e:1,2d', + 'esc_html_e:1,2d', + 'esc_attr_x:1,2c,3d', + 'esc_html_x:1,2c,3d' + ] + }, + files: { + expand: true, + src: [ + '*.php', + 'lib/**/*.php' + ] + } + }, + + + // Build language .pot file + makepot: { + plugin: { + options: { + domainPath: '/languages', + processPot: function( pot ) { + pot.headers['report-msgid-bugs-to'] = 'StudioPress '; + pot.headers['last-translator'] = 'StudioPress '; + pot.headers['language-team'] = 'English '; + pot.headers['plural-forms'] = 'nplurals=2; plural=n != 1;'; + pot.headers['x-generator'] = 'grunt-wp-i18n 0.4.4'; + pot.headers['x-poedit-basepath'] = '.'; + pot.headers['x-poedit-language'] = 'English'; + pot.headers['x-poedit-country'] = 'UNITED STATES'; + pot.headers['x-poedit-sourcecharset'] = 'utf-8'; + pot.headers['x-poedit-keywordslist'] = '__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;'; + pot.headers['x-poedit-bookmarks'] = ''; + pot.headers['x-poedit-searchpath-0'] = '.'; + pot.headers['x-textdomain-support'] = 'yes'; + return pot; + }, + type: 'wp-plugin' + } + } + }, + + + }); + +}; diff --git a/includes/class-featured-listings-widget.php b/includes/class-featured-listings-widget.php old mode 100755 new mode 100644 index 0985c44..c1d97b8 --- a/includes/class-featured-listings-widget.php +++ b/includes/class-featured-listings-widget.php @@ -8,10 +8,10 @@ */ class AgentPress_Featured_Listings_Widget extends WP_Widget { - function AgentPress_Featured_Listings_Widget() { + function __construct() { $widget_ops = array( 'classname' => 'featured-listings', 'description' => __( 'Display grid-style featured listings', 'agentpress-listings' ) ); $control_ops = array( 'width' => 300, 'height' => 350 ); - $this->WP_Widget( 'featured-listings', __( 'AgentPress - Featured Listings', 'agentpress-listings' ), $widget_ops, $control_ops ); + parent::__construct( 'featured-listings', __( 'AgentPress - Featured Listings', 'agentpress-listings' ), $widget_ops, $control_ops ); } function widget( $args, $instance ) { diff --git a/includes/class-listings.php b/includes/class-listings.php old mode 100755 new mode 100644 index 8c0c61d..79f4620 --- a/includes/class-listings.php +++ b/includes/class-listings.php @@ -1,279 +1,279 @@ -property_details = apply_filters( 'agentpress_property_details', array( - 'col1' => array( - __( 'Price:', 'agentpress-listings' ) => '_listing_price', - __( 'Address:', 'agentpress-listings' ) => '_listing_address', - __( 'City:', 'agentpress-listings' ) => '_listing_city', - __( 'State:', 'agentpress-listings' ) => '_listing_state', - __( 'ZIP:', 'agentpress-listings' ) => '_listing_zip' - ), - 'col2' => array( - __( 'MLS #:', 'agentpress-listings' ) => '_listing_mls', - __( 'Square Feet:', 'agentpress-listings' ) => '_listing_sqft', - __( 'Bedrooms:', 'agentpress-listings' ) => '_listing_bedrooms', - __( 'Bathrooms:', 'agentpress-listings' ) => '_listing_bathrooms', - __( 'Basement:', 'agentpress-listings' ) => '_listing_basement' - ) - ) ); - - add_action( 'init', array( $this, 'create_post_type' ) ); - - add_filter( 'manage_edit-listing_columns', array( $this, 'columns_filter' ) ); - add_action( 'manage_posts_custom_column', array( $this, 'columns_data' ) ); - - add_action( 'admin_menu', array( $this, 'register_meta_boxes' ), 5 ); - add_action( 'save_post', array( $this, 'metabox_save' ), 1, 2 ); - - add_shortcode( 'property_details', array( $this, 'property_details_shortcode' ) ); - add_shortcode( 'property_map', array( $this, 'property_map_shortcode' ) ); - add_shortcode( 'property_video', array( $this, 'property_video_shortcode' ) ); - - #add_action( 'admin_head', array( $this, 'admin_style' ) ); - add_action( 'admin_enqueue_scripts', array( $this, 'admin_js' ) ); - - add_filter( 'search_template', array( $this, 'search_template' ) ); - - add_filter( 'genesis_build_crumbs', array( $this, 'breadcrumbs' ), 10, 2 ); - - } - - /** - * Creates our "Listing" post type. - */ - function create_post_type() { - - $args = apply_filters( 'agentpress_listings_post_type_args', - array( - 'labels' => array( - 'name' => __( 'Listings', 'agentpress-listings' ), - 'singular_name' => __( 'Listing', 'agentpress-listings' ), - 'add_new' => __( 'Add New', 'agentpress-listings' ), - 'add_new_item' => __( 'Add New Listing', 'agentpress-listings' ), - 'edit' => __( 'Edit', 'agentpress-listings' ), - 'edit_item' => __( 'Edit Listing', 'agentpress-listings' ), - 'new_item' => __( 'New Listing', 'agentpress-listings' ), - 'view' => __( 'View Listing', 'agentpress-listings' ), - 'view_item' => __( 'View Listing', 'agentpress-listings' ), - 'search_items' => __( 'Search Listings', 'agentpress-listings' ), - 'not_found' => __( 'No listings found', 'agentpress-listings' ), - 'not_found_in_trash' => __( 'No listings found in Trash', 'agentpress-listings' ) - ), - 'public' => true, - 'query_var' => true, - 'menu_position' => 6, - 'menu_icon' => 'dashicons-admin-home', - 'has_archive' => true, - 'supports' => array( 'title', 'editor', 'comments', 'thumbnail', 'genesis-seo', 'genesis-layouts', 'genesis-simple-sidebars' ), - 'rewrite' => array( 'slug' => 'listings' ), - ) - ); - - register_post_type( 'listing', $args ); - - } - - function register_meta_boxes() { - - add_meta_box( 'listing_details_metabox', __( 'Property Details', 'agentpress-listings' ), array( &$this, 'listing_details_metabox' ), 'listing', 'normal', 'high' ); - - } - - function listing_details_metabox() { - include( dirname( __FILE__ ) . '/views/listing-details-metabox.php' ); - } - - function metabox_save( $post_id, $post ) { - - if ( ! isset( $_POST['agentpress_details_metabox_nonce'] ) || ! isset( $_POST['ap'] ) ) - return; - - /** Verify the nonce */ - if ( ! wp_verify_nonce( $_POST['agentpress_details_metabox_nonce'], 'agentpress_details_metabox_save' ) ) - return; - - /** Run only on listings post type save */ - if ( 'listing' != $post->post_type ) - return; - - /** Don't try to save the data under autosave, ajax, or future post */ - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) return; - if ( defined( 'DOING_CRON' ) && DOING_CRON ) return; - - /** Check permissions */ - if ( ! current_user_can( 'edit_post', $post_id ) ) - return; - - $property_details = $_POST['ap']; - - /** Store the custom fields */ - foreach ( (array) $property_details as $key => $value ) { - - /** Save/Update/Delete */ - if ( $value ) { - update_post_meta($post->ID, $key, $value); - } else { - delete_post_meta($post->ID, $key); - } - - } - - //* extra check for price that can create a sortable value - if ( isset( $property_details['_listing_price'] ) && ! empty( $property_details['_listing_price'] ) ) { - - $price_sortable = preg_replace( '/[^0-9\.]/', '', $property_details['_listing_price'] ); - update_post_meta( $post_id, '_listing_price_sortable', floatval( $price_sortable ) ); - - } else { - delete_post_meta( $post_id, '_listing_price_sortable' ); - } - - } - - /** - * Filter the columns in the "Listings" screen, define our own. - */ - function columns_filter ( $columns ) { - - $columns = array( - 'cb' => '', - 'listing_thumbnail' => __( 'Thumbnail', 'agentpress-listings' ), - 'title' => __( 'Listing Title', 'agentpress-listings' ), - 'listing_details' => __( 'Details', 'agentpress-listings' ), - 'listing_features' => __( 'Features', 'agentpress-listings' ), - 'listing_categories' => __( 'Categories', 'agentpress-listings' ) - ); - - return $columns; - - } - - /** - * Filter the data that shows up in the columns in the "Listings" screen, define our own. - */ - function columns_data( $column ) { - - global $post, $wp_taxonomies; - - switch( $column ) { - case "listing_thumbnail": - printf( '

%s

', genesis_get_image( array( 'size' => 'thumbnail' ) ) ); - break; - case "listing_details": - foreach ( (array) $this->property_details['col1'] as $label => $key ) { - printf( '%s %s
', esc_html( $label ), esc_html( get_post_meta($post->ID, $key, true) ) ); - } - foreach ( (array) $this->property_details['col2'] as $label => $key ) { - printf( '%s %s
', esc_html( $label ), esc_html( get_post_meta($post->ID, $key, true) ) ); - } - break; - case "listing_features": - echo get_the_term_list( $post->ID, 'features', '', ', ', '' ); - break; - case "listing_categories": - foreach ( (array) get_option( $this->settings_field ) as $key => $data ) { - printf( '%s: %s
', esc_html( $data['labels']['singular_name'] ), get_the_term_list( $post->ID, $key, '', ', ', '' ) ); - } - break; - } - - } - - function property_details_shortcode( $atts ) { - - global $post; - - $output = ''; - - $output .= '
'; - - $output .= '
'; - foreach ( (array) $this->property_details['col1'] as $label => $key ) { - $output .= sprintf( '%s %s
', esc_html( $label ), esc_html( get_post_meta($post->ID, $key, true) ) ); - } - $output .= '
'; - foreach ( (array) $this->property_details['col2'] as $label => $key ) { - $output .= sprintf( '%s %s
', esc_html( $label ), esc_html( get_post_meta($post->ID, $key, true) ) ); - } - $output .= '
'; - $output .= sprintf( '

%s
%s

', __( 'Additional Features:', 'agentpress-listings' ), get_the_term_list( $post->ID, 'features', '', ', ', '' ) ); - - $output .= '
'; - - return $output; - - } - - function property_map_shortcode( $atts ) { - - return genesis_get_custom_field( '_listing_map' ); - - } - - function property_video_shortcode( $atts ) { - - return genesis_get_custom_field( '_listing_video' ); - - } - - function admin_js() { - - wp_enqueue_script( 'accesspress-admin-js', APL_URL . 'includes/js/admin.js', array(), APL_VERSION, true ); - - } - - function search_template( $template ) { - - $post_type = get_query_var( 'post_type' ); - - if ( is_array( $post_type ) || 'listing' != $post_type ) { - return $template; - } - - $listing_template = locate_template( array( 'archive-listing.php' ), false ); - - return $listing_template ? $listing_template : $template; - - } - - function breadcrumbs( $crumbs, $args ) { - - $post_type = get_query_var( 'post_type' ); - - if ( is_array( $post_type ) || 'listing' != $post_type ) { - return $crumbs; - } - - array_pop( $crumbs ); - - $crumbs[] = __( 'Listing Search Results', 'agentpress-listings' ); - - return $crumbs; - - } - -} \ No newline at end of file +property_details = apply_filters( 'agentpress_property_details', array( + 'col1' => array( + __( 'Price:', 'agentpress-listings' ) => '_listing_price', + __( 'Address:', 'agentpress-listings' ) => '_listing_address', + __( 'City:', 'agentpress-listings' ) => '_listing_city', + __( 'State:', 'agentpress-listings' ) => '_listing_state', + __( 'ZIP:', 'agentpress-listings' ) => '_listing_zip' + ), + 'col2' => array( + __( 'MLS #:', 'agentpress-listings' ) => '_listing_mls', + __( 'Square Feet:', 'agentpress-listings' ) => '_listing_sqft', + __( 'Bedrooms:', 'agentpress-listings' ) => '_listing_bedrooms', + __( 'Bathrooms:', 'agentpress-listings' ) => '_listing_bathrooms', + __( 'Basement:', 'agentpress-listings' ) => '_listing_basement' + ) + ) ); + + add_action( 'init', array( $this, 'create_post_type' ) ); + + add_filter( 'manage_edit-listing_columns', array( $this, 'columns_filter' ) ); + add_action( 'manage_posts_custom_column', array( $this, 'columns_data' ) ); + + add_action( 'admin_menu', array( $this, 'register_meta_boxes' ), 5 ); + add_action( 'save_post', array( $this, 'metabox_save' ), 1, 2 ); + + add_shortcode( 'property_details', array( $this, 'property_details_shortcode' ) ); + add_shortcode( 'property_map', array( $this, 'property_map_shortcode' ) ); + add_shortcode( 'property_video', array( $this, 'property_video_shortcode' ) ); + + #add_action( 'admin_head', array( $this, 'admin_style' ) ); + add_action( 'admin_enqueue_scripts', array( $this, 'admin_js' ) ); + + add_filter( 'search_template', array( $this, 'search_template' ) ); + + add_filter( 'genesis_build_crumbs', array( $this, 'breadcrumbs' ), 10, 2 ); + + } + + /** + * Creates our "Listing" post type. + */ + function create_post_type() { + + $args = apply_filters( 'agentpress_listings_post_type_args', + array( + 'labels' => array( + 'name' => __( 'Listings', 'agentpress-listings' ), + 'singular_name' => __( 'Listing', 'agentpress-listings' ), + 'add_new' => __( 'Add New', 'agentpress-listings' ), + 'add_new_item' => __( 'Add New Listing', 'agentpress-listings' ), + 'edit' => __( 'Edit', 'agentpress-listings' ), + 'edit_item' => __( 'Edit Listing', 'agentpress-listings' ), + 'new_item' => __( 'New Listing', 'agentpress-listings' ), + 'view' => __( 'View Listing', 'agentpress-listings' ), + 'view_item' => __( 'View Listing', 'agentpress-listings' ), + 'search_items' => __( 'Search Listings', 'agentpress-listings' ), + 'not_found' => __( 'No listings found', 'agentpress-listings' ), + 'not_found_in_trash' => __( 'No listings found in Trash', 'agentpress-listings' ) + ), + 'public' => true, + 'query_var' => true, + 'menu_position' => 6, + 'menu_icon' => 'dashicons-admin-home', + 'has_archive' => true, + 'supports' => array( 'title', 'editor', 'comments', 'thumbnail', 'genesis-seo', 'genesis-layouts', 'genesis-simple-sidebars' ), + 'rewrite' => array( 'slug' => 'listings' ), + ) + ); + + register_post_type( 'listing', $args ); + + } + + function register_meta_boxes() { + + add_meta_box( 'listing_details_metabox', __( 'Property Details', 'agentpress-listings' ), array( &$this, 'listing_details_metabox' ), 'listing', 'normal', 'high' ); + + } + + function listing_details_metabox() { + include( dirname( __FILE__ ) . '/views/listing-details-metabox.php' ); + } + + function metabox_save( $post_id, $post ) { + + if ( ! isset( $_POST['agentpress_details_metabox_nonce'] ) || ! isset( $_POST['ap'] ) ) + return; + + /** Verify the nonce */ + if ( ! wp_verify_nonce( $_POST['agentpress_details_metabox_nonce'], 'agentpress_details_metabox_save' ) ) + return; + + /** Run only on listings post type save */ + if ( 'listing' != $post->post_type ) + return; + + /** Don't try to save the data under autosave, ajax, or future post */ + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; + if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) return; + if ( defined( 'DOING_CRON' ) && DOING_CRON ) return; + + /** Check permissions */ + if ( ! current_user_can( 'edit_post', $post_id ) ) + return; + + $property_details = $_POST['ap']; + + /** Store the custom fields */ + foreach ( (array) $property_details as $key => $value ) { + + /** Save/Update/Delete */ + if ( $value ) { + update_post_meta($post->ID, $key, $value); + } else { + delete_post_meta($post->ID, $key); + } + + } + + //* extra check for price that can create a sortable value + if ( isset( $property_details['_listing_price'] ) && ! empty( $property_details['_listing_price'] ) ) { + + $price_sortable = preg_replace( '/[^0-9\.]/', '', $property_details['_listing_price'] ); + update_post_meta( $post_id, '_listing_price_sortable', floatval( $price_sortable ) ); + + } else { + delete_post_meta( $post_id, '_listing_price_sortable' ); + } + + } + + /** + * Filter the columns in the "Listings" screen, define our own. + */ + function columns_filter ( $columns ) { + + $columns = array( + 'cb' => '', + 'listing_thumbnail' => __( 'Thumbnail', 'agentpress-listings' ), + 'title' => __( 'Listing Title', 'agentpress-listings' ), + 'listing_details' => __( 'Details', 'agentpress-listings' ), + 'listing_features' => __( 'Features', 'agentpress-listings' ), + 'listing_categories' => __( 'Categories', 'agentpress-listings' ) + ); + + return $columns; + + } + + /** + * Filter the data that shows up in the columns in the "Listings" screen, define our own. + */ + function columns_data( $column ) { + + global $post, $wp_taxonomies; + + switch( $column ) { + case "listing_thumbnail": + printf( '

%s

', genesis_get_image( array( 'size' => 'thumbnail' ) ) ); + break; + case "listing_details": + foreach ( (array) $this->property_details['col1'] as $label => $key ) { + printf( '%s %s
', esc_html( $label ), esc_html( get_post_meta($post->ID, $key, true) ) ); + } + foreach ( (array) $this->property_details['col2'] as $label => $key ) { + printf( '%s %s
', esc_html( $label ), esc_html( get_post_meta($post->ID, $key, true) ) ); + } + break; + case "listing_features": + echo get_the_term_list( $post->ID, 'features', '', ', ', '' ); + break; + case "listing_categories": + foreach ( (array) get_option( $this->settings_field ) as $key => $data ) { + printf( '%s: %s
', esc_html( $data['labels']['singular_name'] ), get_the_term_list( $post->ID, $key, '', ', ', '' ) ); + } + break; + } + + } + + function property_details_shortcode( $atts ) { + + global $post; + + $output = ''; + + $output .= '
'; + + $output .= '
'; + foreach ( (array) $this->property_details['col1'] as $label => $key ) { + $output .= sprintf( '%s %s
', esc_html( $label ), esc_html( get_post_meta($post->ID, $key, true) ) ); + } + $output .= '
'; + foreach ( (array) $this->property_details['col2'] as $label => $key ) { + $output .= sprintf( '%s %s
', esc_html( $label ), esc_html( get_post_meta($post->ID, $key, true) ) ); + } + $output .= '
'; + $output .= sprintf( '

%s
%s

', __( 'Additional Features:', 'agentpress-listings' ), get_the_term_list( $post->ID, 'features', '', ', ', '' ) ); + + $output .= '
'; + + return $output; + + } + + function property_map_shortcode( $atts ) { + + return genesis_get_custom_field( '_listing_map' ); + + } + + function property_video_shortcode( $atts ) { + + return genesis_get_custom_field( '_listing_video' ); + + } + + function admin_js() { + + wp_enqueue_script( 'accesspress-admin-js', APL_URL . 'includes/js/admin.js', array(), APL_VERSION, true ); + + } + + function search_template( $template ) { + + $post_type = get_query_var( 'post_type' ); + + if ( is_array( $post_type ) || 'listing' != $post_type ) { + return $template; + } + + $listing_template = locate_template( array( 'archive-listing.php' ), false ); + + return $listing_template ? $listing_template : $template; + + } + + function breadcrumbs( $crumbs, $args ) { + + $post_type = get_query_var( 'post_type' ); + + if ( is_array( $post_type ) || 'listing' != $post_type ) { + return $crumbs; + } + + array_pop( $crumbs ); + + $crumbs[] = __( 'Listing Search Results', 'agentpress-listings' ); + + return $crumbs; + + } + +} diff --git a/includes/class-property-search-widget.php b/includes/class-property-search-widget.php old mode 100755 new mode 100644 index acd7b4d..99ba032 --- a/includes/class-property-search-widget.php +++ b/includes/class-property-search-widget.php @@ -8,10 +8,10 @@ */ class AgentPress_Listings_Search_Widget extends WP_Widget { - function AgentPress_Listings_Search_Widget() { + function __construct() { $widget_ops = array( 'classname' => 'property-search', 'description' => __( 'Display property search dropdown', 'agentpress-listings' ) ); $control_ops = array( 'width' => 200, 'height' => 250, 'id_base' => 'property-search' ); - $this->WP_Widget( 'property-search', __( 'AgentPress - Listing Search', 'agentpress-listings' ), $widget_ops, $control_ops ); + parent::__construct( 'property-search', __( 'AgentPress - Listing Search', 'agentpress-listings' ), $widget_ops, $control_ops ); } function widget( $args, $instance ) { diff --git a/includes/class-taxonomies.php b/includes/class-taxonomies.php old mode 100755 new mode 100644 index 474a73b..ec7defc --- a/includes/class-taxonomies.php +++ b/includes/class-taxonomies.php @@ -1,294 +1,311 @@ -settings_field, $this->settings_field ); - add_option( $this->settings_field, __return_empty_array(), '', 'yes' ); - - } - - function settings_init() { - - add_submenu_page( 'edit.php?post_type=listing', __( 'Register Taxonomies', 'agentpress-listings' ), __( 'Register Taxonomies', 'agentpress-listings' ), 'manage_options', $this->menu_page, array( &$this, 'admin' ) ); - - } - - function actions() { - - if ( ! isset( $_REQUEST['page'] ) || $_REQUEST['page'] != $this->menu_page ) { - return; - } - - /** This section handles the data if a new taxonomy is created */ - if ( isset( $_REQUEST['action'] ) && 'create' == $_REQUEST['action'] ) { - $this->create_taxonomy( $_POST['agentpress_taxonomy'] ); - } - - /** This section handles the data if a taxonomy is deleted */ - if ( isset( $_REQUEST['action'] ) && 'delete' == $_REQUEST['action'] ) { - $this->delete_taxonomy( $_REQUEST['id'] ); - } - - /** This section handles the data if a taxonomy is being edited */ - if ( isset( $_REQUEST['action'] ) && 'edit' == $_REQUEST['action'] ) { - $this->edit_taxonomy( $_POST['agentpress_taxonomy'] ); - } - - } - - function admin() { - - echo '
'; - - if ( isset( $_REQUEST['view'] ) && 'edit' == $_REQUEST['view'] ) { - require( dirname( __FILE__ ) . '/views/edit-tax.php' ); - } - else { - require( dirname( __FILE__ ) . '/views/create-tax.php' ); - } - - echo '
'; - - } - - function create_taxonomy( $args = array() ) { - - /**** VERIFY THE NONCE ****/ - - /** No empty fields */ - if ( ! isset( $args['id'] ) || empty( $args['id'] ) ) { - wp_die( __( 'Please complete all required fields.', 'agentpress-listings' ) ); - } - if ( ! isset( $args['name'] ) || empty( $args['name'] ) ) { - wp_die( __( 'Please complete all required fields.', 'agentpress-listings' ) ); - } - if ( ! isset( $args['singular_name'] ) || empty( $args['singular_name'] ) ) { - wp_die( __( 'Please complete all required fields.', 'agentpress-listings' ) ); - } - - //* Sanitize id - $sanitized_id = sanitize_key( $args['id'] ); - - //* Bail, if not a valid ID after sanitization - if ( ! $sanitized_id || is_numeric( $sanitized_id ) ) { - wp_die( __( 'You have given this taxonomy an invalid slug/ID. Please try again.', 'agentpress-listings' ) ); - } - - $labels = array( - 'name' => strip_tags( $args['name'] ), - 'singular_name' => strip_tags( $args['singular_name'] ), - 'menu_name' => strip_tags( $args['name'] ), - - 'search_items' => sprintf( __( 'Search %s', 'agentpress-listings' ), strip_tags( $args['name'] ) ), - 'popular_items' => sprintf( __( 'Popular %s', 'agentpress-listings' ), strip_tags( $args['name'] ) ), - 'all_items' => sprintf( __( 'All %s', 'agentpress-listings' ), strip_tags( $args['name'] ) ), - 'edit_item' => sprintf( __( 'Edit %s', 'agentpress-listings' ), strip_tags( $args['singular_name'] ) ), - 'update_item' => sprintf( __( 'Update %s', 'agentpress-listings' ), strip_tags( $args['singular_name'] ) ), - 'add_new_item' => sprintf( __( 'Add New %s', 'agentpress-listings' ), strip_tags( $args['singular_name'] ) ), - 'new_item_name' => sprintf( __( 'New %s Name', 'agentpress-listings' ), strip_tags( $args['singular_name'] ) ), - 'add_or_remove_items' => sprintf( __( 'Add or Remove %s', 'agentpress-listings' ), strip_tags( $args['name'] ) ), - 'choose_from_most_used' => sprintf( __( 'Choose from the most used %s', 'agentpress-listings' ), strip_tags( $args['name'] ) ) - ); - - $args = array( - 'labels' => $labels, - 'hierarchical' => true, - 'rewrite' => array( 'slug' => $sanitized_id ), - 'editable' => 1 - ); - - $tax = array( $sanitized_id => $args ); - - $options = get_option( $this->settings_field ); - - /** Update the options */ - update_option( $this->settings_field, wp_parse_args( $tax, $options ) ); - - /** Flush rewrite rules */ - $this->register_taxonomies(); - flush_rewrite_rules(); - - /** Redirect with notice */ - apl_admin_redirect( 'register-taxonomies', array( 'created' => 'true' ) ); - exit; - - } - - function delete_taxonomy( $id = '' ) { - - /**** VERIFY THE NONCE ****/ - - /** No empty ID */ - if ( ! isset( $id ) || empty( $id ) ) - wp_die( __( "Nice try, partner. But that taxonomy doesn't exist. Click back and try again.", 'agentpress-listings' ) ); - - $options = get_option( $this->settings_field ); - - /** Look for the ID, delete if it exists */ - if ( array_key_exists( $id, (array) $options ) ) { - unset( $options[$id] ); - } else { - wp_die( __( "Nice try, partner. But that taxonomy doesn't exist. Click back and try again.", 'agentpress-listings' ) ); - } - - /** Update the DB */ - update_option( $this->settings_field, $options ); - - apl_admin_redirect( 'register-taxonomies', array( 'deleted' => 'true' ) ); - exit; - - } - - function edit_taxonomy( $args = array() ) { - - /**** VERIFY THE NONCE ****/ - - /** No empty fields */ - if ( ! isset( $args['id'] ) || empty( $args['id'] ) ) - wp_die( __( 'Please complete all required fields.', 'agentpress-listings' ) ); - if ( ! isset( $args['name'] ) || empty( $args['name'] ) ) - wp_die( __( 'Please complete all required fields.', 'agentpress-listings' ) ); - if ( ! isset( $args['singular_name'] ) || empty( $args['singular_name'] ) ) - wp_die( __( 'Please complete all required fields.', 'agentpress-listings' ) ); - - $labels = array( - 'name' => strip_tags( $args['name'] ), - 'singular_name' => strip_tags( $args['singular_name'] ), - 'menu_name' => strip_tags( $args['name'] ), - - 'search_items' => sprintf( __( 'Search %s', 'agentpress-listings' ), strip_tags( $args['name'] ) ), - 'popular_items' => sprintf( __( 'Popular %s', 'agentpress-listings' ), strip_tags( $args['name'] ) ), - 'all_items' => sprintf( __( 'All %s', 'agentpress-listings' ), strip_tags( $args['name'] ) ), - 'edit_item' => sprintf( __( 'Edit %s', 'agentpress-listings' ), strip_tags( $args['singular_name'] ) ), - 'update_item' => sprintf( __( 'Update %s', 'agentpress-listings' ), strip_tags( $args['singular_name'] ) ), - 'add_new_item' => sprintf( __( 'Add New %s', 'agentpress-listings' ), strip_tags( $args['singular_name'] ) ), - 'new_item_name' => sprintf( __( 'New %s Name', 'agentpress-listings' ), strip_tags( $args['singular_name'] ) ), - 'add_or_remove_items' => sprintf( __( 'Add or Remove %s', 'agentpress-listings' ), strip_tags( $args['name'] ) ), - 'choose_from_most_used' => sprintf( __( 'Choose from the most used %s', 'agentpress-listings' ), strip_tags( $args['name'] ) ) - ); - - $args = array( - 'labels' => $labels, - 'hierarchical' => true, - 'rewrite' => array( 'slug' => $id ), - 'editable' => 1 - ); - - $tax = array( $id => $args ); - - $options = get_option( $this->settings_field ); - - update_option( $this->settings_field, wp_parse_args( $tax, $options ) ); - - apl_admin_redirect( 'register-taxonomies', array( 'edited' => 'true' ) ); - exit; - - } - - function notices() { - - if ( ! isset( $_REQUEST['page'] ) || $_REQUEST['page'] != $this->menu_page ) { - return; - } - - $format = '

%s

'; - - if ( isset( $_REQUEST['created'] ) && 'true' == $_REQUEST['created'] ) { - printf( $format, __('New taxonomy successfully created!', 'agentpress-listings') ); - return; - } - - if ( isset( $_REQUEST['edited'] ) && 'true' == $_REQUEST['edited'] ) { - printf( $format, __('Taxonomy successfully edited!', 'agentpress-listings') ); - return; - } - - if ( isset( $_REQUEST['deleted'] ) && 'true' == $_REQUEST['deleted'] ) { - printf( $format, __('Taxonomy successfully deleted.', 'agentpress-listings') ); - return; - } - - return; - - } - - /** - * Register the property features taxonomy, manually. - */ - function property_features_taxonomy() { - - $name = 'Features'; - $singular_name = 'Feature'; - - return array( - 'features' => array( - 'labels' => array( - 'name' => strip_tags( $name ), - 'singular_name' => strip_tags( $singular_name ), - 'menu_name' => strip_tags( $name ), - - 'search_items' => sprintf( __( 'Search %s', 'agentpress-listings' ), strip_tags( $name ) ), - 'popular_items' => sprintf( __( 'Popular %s', 'agentpress-listings' ), strip_tags( $name ) ), - 'all_items' => sprintf( __( 'All %s', 'agentpress-listings' ), strip_tags( $name ) ), - 'edit_item' => sprintf( __( 'Edit %s', 'agentpress-listings' ), strip_tags( $singular_name ) ), - 'update_item' => sprintf( __( 'Update %s', 'agentpress-listings' ), strip_tags( $singular_name ) ), - 'add_new_item' => sprintf( __( 'Add New %s', 'agentpress-listings' ), strip_tags( $singular_name ) ), - 'new_item_name' => sprintf( __( 'New %s Name', 'agentpress-listings' ), strip_tags( $singular_name ) ), - 'add_or_remove_items' => sprintf( __( 'Add or Remove %s', 'agentpress-listings' ), strip_tags( $name ) ), - 'choose_from_most_used' => sprintf( __( 'Choose from the most used %s', 'agentpress-listings' ), strip_tags( $name ) ) - ), - 'hierarchical' => 0, - 'rewrite' => array( 'features' ), - 'editable' => 0 - ) - ); - - } - - /** - * Create the taxonomies. - */ - function register_taxonomies() { - - foreach( (array) $this->get_taxonomies() as $id => $data ) { - register_taxonomy( $id, array( 'listing' ), $data ); - } - - } - - /** - * Get the taxonomies. - */ - function get_taxonomies() { - - return array_merge( $this->property_features_taxonomy(), (array) get_option( $this->settings_field ) ); - - } +settings_field, $this->settings_field ); + add_option( $this->settings_field, __return_empty_array(), '', 'yes' ); + + } + + function settings_init() { + + add_submenu_page( 'edit.php?post_type=listing', __( 'Register Taxonomies', 'agentpress-listings' ), __( 'Register Taxonomies', 'agentpress-listings' ), 'manage_options', $this->menu_page, array( &$this, 'admin' ) ); + + } + + function actions() { + + if ( ! isset( $_REQUEST['page'] ) || $_REQUEST['page'] != $this->menu_page ) { + return; + } + + /** This section handles the data if a new taxonomy is created */ + if ( isset( $_REQUEST['action'] ) && 'create' == $_REQUEST['action'] ) { + $this->create_taxonomy( $_POST['agentpress_taxonomy'] ); + } + + /** This section handles the data if a taxonomy is deleted */ + if ( isset( $_REQUEST['action'] ) && 'delete' == $_REQUEST['action'] ) { + $this->delete_taxonomy( $_REQUEST['id'] ); + } + + /** This section handles the data if a taxonomy is being edited */ + if ( isset( $_REQUEST['action'] ) && 'edit' == $_REQUEST['action'] ) { + $this->edit_taxonomy( $_POST['agentpress_taxonomy'] ); + } + + } + + function admin() { + + echo '
'; + + if ( isset( $_REQUEST['view'] ) && 'edit' == $_REQUEST['view'] ) { + require( dirname( __FILE__ ) . '/views/edit-tax.php' ); + } + else { + require( dirname( __FILE__ ) . '/views/create-tax.php' ); + } + + echo '
'; + + } + + function create_taxonomy( $args = array() ) { + + /**** VERIFY THE NONCE ****/ + + /** No empty fields */ + if ( ! isset( $args['id'] ) || empty( $args['id'] ) ) { + wp_die( __( 'Please complete all required fields.', 'agentpress-listings' ) ); + } + if ( ! isset( $args['name'] ) || empty( $args['name'] ) ) { + wp_die( __( 'Please complete all required fields.', 'agentpress-listings' ) ); + } + if ( ! isset( $args['singular_name'] ) || empty( $args['singular_name'] ) ) { + wp_die( __( 'Please complete all required fields.', 'agentpress-listings' ) ); + } + + //* Sanitize id + $sanitized_id = sanitize_key( $args['id'] ); + + //* Bail, if not a valid ID after sanitization + if ( ! $sanitized_id || is_numeric( $sanitized_id ) ) { + wp_die( __( 'You have given this taxonomy an invalid slug/ID. Please try again.', 'agentpress-listings' ) ); + } + + $labels = array( + 'name' => strip_tags( $args['name'] ), + 'singular_name' => strip_tags( $args['singular_name'] ), + 'menu_name' => strip_tags( $args['name'] ), + + 'search_items' => sprintf( __( 'Search %s', 'agentpress-listings' ), strip_tags( $args['name'] ) ), + 'popular_items' => sprintf( __( 'Popular %s', 'agentpress-listings' ), strip_tags( $args['name'] ) ), + 'all_items' => sprintf( __( 'All %s', 'agentpress-listings' ), strip_tags( $args['name'] ) ), + 'edit_item' => sprintf( __( 'Edit %s', 'agentpress-listings' ), strip_tags( $args['singular_name'] ) ), + 'update_item' => sprintf( __( 'Update %s', 'agentpress-listings' ), strip_tags( $args['singular_name'] ) ), + 'add_new_item' => sprintf( __( 'Add New %s', 'agentpress-listings' ), strip_tags( $args['singular_name'] ) ), + 'new_item_name' => sprintf( __( 'New %s Name', 'agentpress-listings' ), strip_tags( $args['singular_name'] ) ), + 'add_or_remove_items' => sprintf( __( 'Add or Remove %s', 'agentpress-listings' ), strip_tags( $args['name'] ) ), + 'choose_from_most_used' => sprintf( __( 'Choose from the most used %s', 'agentpress-listings' ), strip_tags( $args['name'] ) ) + ); + + $args = array( + 'labels' => $labels, + 'hierarchical' => true, + 'rewrite' => array( 'slug' => $sanitized_id ), + 'editable' => 1 + ); + + $tax = array( $sanitized_id => $args ); + + $options = get_option( $this->settings_field ); + + /** Update the options */ + update_option( $this->settings_field, wp_parse_args( $tax, $options ) ); + + /** Flush rewrite rules */ + $this->register_taxonomies(); + flush_rewrite_rules(); + + /** Redirect with notice */ + apl_admin_redirect( 'register-taxonomies', array( 'created' => 'true' ) ); + exit; + + } + + function delete_taxonomy( $id = '' ) { + + /**** VERIFY THE NONCE ****/ + + $options = get_option( $this->settings_field ); + + /** Remove any IDs that were somehow made or left blank */ + if ( ! isset( $id ) || empty( $id ) ){ + + $opts = array(); + + foreach( $options as $key => $value ){ + + if( ! empty( $key ) ){ + + $opts[$key] = $value; + + } + + } + + update_option( $this->settings_field, $opts ); + + } + + /** Look for the ID, delete if it exists */ + if ( array_key_exists( $id, (array) $options ) ) { + unset( $options[$id] ); + } else { + wp_die( __( "Nice try, partner. But that taxonomy doesn't exist. Click back and try again.", 'agentpress-listings' ) ); + } + + /** Update the DB */ + update_option( $this->settings_field, $options ); + + apl_admin_redirect( 'register-taxonomies', array( 'deleted' => 'true' ) ); + exit; + + } + + function edit_taxonomy( $args = array() ) { + + /**** VERIFY THE NONCE ****/ + + /** No empty fields */ + if ( ! isset( $args['id'] ) || empty( $args['id'] ) ) + wp_die( __( 'Please complete all required fields.', 'agentpress-listings' ) ); + if ( ! isset( $args['name'] ) || empty( $args['name'] ) ) + wp_die( __( 'Please complete all required fields.', 'agentpress-listings' ) ); + if ( ! isset( $args['singular_name'] ) || empty( $args['singular_name'] ) ) + wp_die( __( 'Please complete all required fields.', 'agentpress-listings' ) ); + + $id = $args['id']; + + $labels = array( + 'name' => strip_tags( $args['name'] ), + 'singular_name' => strip_tags( $args['singular_name'] ), + 'menu_name' => strip_tags( $args['name'] ), + + 'search_items' => sprintf( __( 'Search %s', 'agentpress-listings' ), strip_tags( $args['name'] ) ), + 'popular_items' => sprintf( __( 'Popular %s', 'agentpress-listings' ), strip_tags( $args['name'] ) ), + 'all_items' => sprintf( __( 'All %s', 'agentpress-listings' ), strip_tags( $args['name'] ) ), + 'edit_item' => sprintf( __( 'Edit %s', 'agentpress-listings' ), strip_tags( $args['singular_name'] ) ), + 'update_item' => sprintf( __( 'Update %s', 'agentpress-listings' ), strip_tags( $args['singular_name'] ) ), + 'add_new_item' => sprintf( __( 'Add New %s', 'agentpress-listings' ), strip_tags( $args['singular_name'] ) ), + 'new_item_name' => sprintf( __( 'New %s Name', 'agentpress-listings' ), strip_tags( $args['singular_name'] ) ), + 'add_or_remove_items' => sprintf( __( 'Add or Remove %s', 'agentpress-listings' ), strip_tags( $args['name'] ) ), + 'choose_from_most_used' => sprintf( __( 'Choose from the most used %s', 'agentpress-listings' ), strip_tags( $args['name'] ) ) + ); + + $args = array( + 'labels' => $labels, + 'hierarchical' => true, + 'rewrite' => array( 'slug' => $id ), + 'editable' => 1 + ); + + $tax = array( $id => $args ); + + $options = get_option( $this->settings_field ); + + update_option( $this->settings_field, wp_parse_args( $tax, $options ) ); + + apl_admin_redirect( 'register-taxonomies', array( 'edited' => 'true' ) ); + exit; + + } + + function notices() { + + if ( ! isset( $_REQUEST['page'] ) || $_REQUEST['page'] != $this->menu_page ) { + return; + } + + $format = '

%s

'; + + if ( isset( $_REQUEST['created'] ) && 'true' == $_REQUEST['created'] ) { + printf( $format, __('New taxonomy successfully created!', 'agentpress-listings') ); + return; + } + + if ( isset( $_REQUEST['edited'] ) && 'true' == $_REQUEST['edited'] ) { + printf( $format, __('Taxonomy successfully edited!', 'agentpress-listings') ); + return; + } + + if ( isset( $_REQUEST['deleted'] ) && 'true' == $_REQUEST['deleted'] ) { + printf( $format, __('Taxonomy successfully deleted.', 'agentpress-listings') ); + return; + } + + return; + + } + + /** + * Register the property features taxonomy, manually. + */ + function property_features_taxonomy() { + + $name = 'Features'; + $singular_name = 'Feature'; + + return array( + 'features' => array( + 'labels' => array( + 'name' => strip_tags( $name ), + 'singular_name' => strip_tags( $singular_name ), + 'menu_name' => strip_tags( $name ), + + 'search_items' => sprintf( __( 'Search %s', 'agentpress-listings' ), strip_tags( $name ) ), + 'popular_items' => sprintf( __( 'Popular %s', 'agentpress-listings' ), strip_tags( $name ) ), + 'all_items' => sprintf( __( 'All %s', 'agentpress-listings' ), strip_tags( $name ) ), + 'edit_item' => sprintf( __( 'Edit %s', 'agentpress-listings' ), strip_tags( $singular_name ) ), + 'update_item' => sprintf( __( 'Update %s', 'agentpress-listings' ), strip_tags( $singular_name ) ), + 'add_new_item' => sprintf( __( 'Add New %s', 'agentpress-listings' ), strip_tags( $singular_name ) ), + 'new_item_name' => sprintf( __( 'New %s Name', 'agentpress-listings' ), strip_tags( $singular_name ) ), + 'add_or_remove_items' => sprintf( __( 'Add or Remove %s', 'agentpress-listings' ), strip_tags( $name ) ), + 'choose_from_most_used' => sprintf( __( 'Choose from the most used %s', 'agentpress-listings' ), strip_tags( $name ) ) + ), + 'hierarchical' => 0, + 'rewrite' => array( 'features' ), + 'editable' => 0 + ) + ); + + } + + /** + * Create the taxonomies. + */ + function register_taxonomies() { + + foreach( (array) $this->get_taxonomies() as $id => $data ) { + register_taxonomy( $id, array( 'listing' ), $data ); + } + + } + + /** + * Get the taxonomies. + */ + function get_taxonomies() { + + return array_merge( $this->property_features_taxonomy(), (array) get_option( $this->settings_field ) ); + + } } \ No newline at end of file diff --git a/includes/functions.php b/includes/functions.php old mode 100755 new mode 100644 index ebce357..5793bd7 --- a/includes/functions.php +++ b/includes/functions.php @@ -1,31 +1,31 @@ - $value ) { - if ( isset( $key ) && isset( $value ) ) { - $url = add_query_arg( $key, $value, $url ); - } - } - - wp_redirect( esc_url_raw( $url ) ); - + $value ) { + if ( isset( $key ) && isset( $value ) ) { + $url = add_query_arg( $key, $value, $url ); + } + } + + wp_redirect( esc_url_raw( $url ) ); + } \ No newline at end of file diff --git a/includes/js/admin.js b/includes/js/admin.js old mode 100755 new mode 100644 diff --git a/includes/views/create-tax.php b/includes/views/create-tax.php old mode 100755 new mode 100644 index 9223779..5b6dd2a --- a/includes/views/create-tax.php +++ b/includes/views/create-tax.php @@ -1,102 +1,102 @@ - -

- -
- -
-
- - settings_field ) ); ?> - -

- - - - - - - - - - - - - - - - - - - - property_features_taxonomy(), get_option( $this->settings_field ) ); - - foreach ( (array) $listing_taxonomies as $id => $data ) : - ?> - - > - - - - - - - - -
- - - ' . esc_html( $id ) . '

'; ?> - - - -
- -
- | - -
- - -
- -
-
- -
-
- -
-

- -
- - -
- - -

(no spaces, underscores, or special characters)', 'agentpress-listings' ); ?>

-
- -
- - -

-
- -
- - -

-
- - -
-
- -
-
- + +

+ +
+ +
+
+ + settings_field ) ); ?> + +

+ + + + + + + + + + + + + + + + + + + + property_features_taxonomy(), get_option( $this->settings_field ) ); + + foreach ( (array) $listing_taxonomies as $id => $data ) : + ?> + + > + + + + + + + + +
+ + + ' . esc_html( $id ) . '

'; ?> + + + +
+ +
+ | + +
+ + +
+ +
+
+ +
+
+ +
+

+ +
+ + +
+ + +

(no spaces, underscores, or special characters)', 'agentpress-listings' ); ?>

+
+ +
+ + +

+
+ +
+ + +

+
+ + +
+
+ +
+
+
\ No newline at end of file diff --git a/includes/views/edit-tax.php b/includes/views/edit-tax.php old mode 100755 new mode 100644 index f026f54..85a807f --- a/includes/views/edit-tax.php +++ b/includes/views/edit-tax.php @@ -1,42 +1,42 @@ -settings_field ); - -if ( array_key_exists( $_REQUEST['id'], (array) $options ) ) { - $taxonomy = stripslashes_deep( $options[$_REQUEST['id']] ); -} else { - wp_die( __( "Nice try, partner. But that taxonomy doesn't exist or can't be edited. Click back and try again.", 'agentpress-listings' ) ); -} -?> - - -

- -
- - - - - - - - - - - - - - - - - - -
- - -

-

-

- - - +settings_field ); + +if ( array_key_exists( $_REQUEST['id'], (array) $options ) ) { + $taxonomy = stripslashes_deep( $options[$_REQUEST['id']] ); +} else { + wp_die( __( "Nice try, partner. But that taxonomy doesn't exist or can't be edited. Click back and try again.", 'agentpress-listings' ) ); +} +?> + + +

+ + + + + + + + + + + + + + + + + + + + +
+ + +

+

+

+ + +
\ No newline at end of file diff --git a/includes/views/listing-details-metabox.php b/includes/views/listing-details-metabox.php old mode 100755 new mode 100644 diff --git a/languages/agnetpress-listings.pot b/languages/agentpress-listings.pot similarity index 50% rename from languages/agnetpress-listings.pot rename to languages/agentpress-listings.pot index 3b6cdc4..0da9eb9 100755 --- a/languages/agnetpress-listings.pot +++ b/languages/agentpress-listings.pot @@ -1,30 +1,28 @@ -# Copyright (C) 2014 StudioPress -# This file is distributed under the GPL-2.0+. +# Copyright (C) 2015 StudioPress +# This file is distributed under the GNU General Public License v2.0 (or later). msgid "" msgstr "" -"Project-Id-Version: AgentPress Listings 1.2.0\n" +"Project-Id-Version: AgentPress Listings 1.2.6\n" "Report-Msgid-Bugs-To: StudioPress \n" -"POT-Creation-Date: 2014-06-03 13:07:32+00:00\n" +"POT-Creation-Date: 2015-10-12 02:19:49+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n" +"PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n" "Last-Translator: StudioPress \n" "Language-Team: English \n" +"X-Generator: grunt-wp-i18n 0.4.4\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" - -#: plugin.php:30 -#, php-format -msgid "" -"Sorry, you can't activate unless you have installed Genesis" -msgstr "" - -#: plugin.php:35 -#, php-format -msgid "" -"Sorry, you cannot activate without Genesis %s or greater" -msgstr "" +"X-Poedit-Basepath: .\n" +"X-Poedit-Language: English\n" +"X-Poedit-Country: UNITED STATES\n" +"X-Poedit-SourceCharset: utf-8\n" +"X-Poedit-KeywordsList: " +"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_" +"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n" +"X-Poedit-Bookmarks: \n" +"X-Poedit-SearchPath-0: .\n" +"X-Textdomain-Support: yes\n" #: includes/class-featured-listings-widget.php:12 msgid "Display grid-style featured listings" @@ -34,228 +32,227 @@ msgstr "" msgid "AgentPress - Featured Listings" msgstr "" -#: includes/class-featured-listings-widget.php:55 -#: includes/class-listings.php:53 includes/class-listings.php:54 +#: includes/class-featured-listings-widget.php:91 +#: includes/class-listings.php:79 includes/class-listings.php:80 msgid "View Listing" msgstr "" -#: includes/class-featured-listings-widget.php:80 -#: includes/class-property-search-widget.php:69 +#: includes/class-featured-listings-widget.php:116 +#: includes/class-property-search-widget.php:77 msgid "Title:" msgstr "" -#: includes/class-featured-listings-widget.php:82 +#: includes/class-featured-listings-widget.php:118 msgid "How many results should be returned?" msgstr "" -#: includes/class-listings.php:46 -msgid "Listings" +#: includes/class-listings.php:28 +msgid "Price:" msgstr "" -#: includes/class-listings.php:47 -msgid "Listing" +#: includes/class-listings.php:29 +msgid "Address:" msgstr "" -#: includes/class-listings.php:48 -msgid "Add New" +#: includes/class-listings.php:30 +msgid "City:" msgstr "" -#: includes/class-listings.php:49 -msgid "Add New Listing" +#: includes/class-listings.php:31 +msgid "State:" msgstr "" -#: includes/class-listings.php:50 includes/views/create-tax.php:50 -msgid "Edit" +#: includes/class-listings.php:32 +msgid "ZIP:" msgstr "" -#: includes/class-listings.php:51 -msgid "Edit Listing" +#: includes/class-listings.php:35 +msgid "MLS #:" msgstr "" -#: includes/class-listings.php:52 -msgid "New Listing" +#: includes/class-listings.php:36 +msgid "Square Feet:" msgstr "" -#: includes/class-listings.php:55 -msgid "Search Listings" +#: includes/class-listings.php:37 +msgid "Bedrooms:" msgstr "" -#: includes/class-listings.php:56 -msgid "No listings found" +#: includes/class-listings.php:38 +msgid "Bathrooms:" msgstr "" -#: includes/class-listings.php:57 -msgid "No listings found in Trash" +#: includes/class-listings.php:39 +msgid "Basement:" msgstr "" -#: includes/class-listings.php:73 -msgid "Property Details" +#: includes/class-listings.php:72 +msgid "Listings" msgstr "" -#: includes/class-listings.php:123 -msgid "Thumbnail" +#: includes/class-listings.php:73 +msgid "Listing" msgstr "" -#: includes/class-listings.php:124 -msgid "Listing Title" +#: includes/class-listings.php:74 +msgid "Add New" msgstr "" -#: includes/class-listings.php:125 -msgid "Details" +#: includes/class-listings.php:75 +msgid "Add New Listing" msgstr "" -#: includes/class-listings.php:126 -msgid "Features" +#: includes/class-listings.php:76 includes/views/create-tax.php:50 +msgid "Edit" msgstr "" -#: includes/class-listings.php:127 -msgid "Categories" +#: includes/class-listings.php:77 +msgid "Edit Listing" msgstr "" -#: includes/class-listings.php:146 includes/class-listings.php:178 -#: includes/views/listing-details-metabox.php:15 -msgid "Price:" +#: includes/class-listings.php:78 +msgid "New Listing" msgstr "" -#: includes/class-listings.php:147 includes/class-listings.php:179 -#: includes/views/listing-details-metabox.php:16 -msgid "Address:" +#: includes/class-listings.php:81 +msgid "Search Listings" msgstr "" -#: includes/class-listings.php:148 includes/class-listings.php:180 -#: includes/views/listing-details-metabox.php:17 -msgid "City:" +#: includes/class-listings.php:82 +msgid "No listings found" msgstr "" -#: includes/class-listings.php:149 includes/class-listings.php:181 -#: includes/views/listing-details-metabox.php:18 -msgid "State:" +#: includes/class-listings.php:83 +msgid "No listings found in Trash" msgstr "" -#: includes/class-listings.php:150 includes/class-listings.php:182 -#: includes/views/listing-details-metabox.php:19 -msgid "ZIP:" +#: includes/class-listings.php:101 +msgid "Property Details" msgstr "" -#: includes/class-listings.php:151 includes/class-listings.php:184 -#: includes/views/listing-details-metabox.php:26 -msgid "MLS #:" +#: includes/class-listings.php:164 +msgid "Thumbnail" msgstr "" -#: includes/class-listings.php:152 includes/class-listings.php:185 -#: includes/views/listing-details-metabox.php:27 -msgid "Square Feet:" +#: includes/class-listings.php:165 +msgid "Listing Title" msgstr "" -#: includes/class-listings.php:153 includes/class-listings.php:186 -#: includes/views/listing-details-metabox.php:28 -msgid "Bedrooms:" +#: includes/class-listings.php:166 +msgid "Details" msgstr "" -#: includes/class-listings.php:154 includes/class-listings.php:187 -#: includes/views/listing-details-metabox.php:29 -msgid "Bathrooms:" +#: includes/class-listings.php:167 +msgid "Features" msgstr "" -#: includes/class-listings.php:155 includes/class-listings.php:188 -#: includes/views/listing-details-metabox.php:30 -msgid "Basement:" +#: includes/class-listings.php:168 +msgid "Categories" msgstr "" -#: includes/class-listings.php:190 +#: includes/class-listings.php:223 msgid "Additional Features:" msgstr "" -#: includes/class-property-search-widget.php:17 +#: includes/class-listings.php:273 +msgid "Listing Search Results" +msgstr "" + +#: includes/class-property-search-widget.php:12 msgid "Display property search dropdown" msgstr "" -#: includes/class-property-search-widget.php:19 +#: includes/class-property-search-widget.php:14 msgid "AgentPress - Listing Search" msgstr "" -#: includes/class-property-search-widget.php:71 +#: includes/class-property-search-widget.php:21 +#: includes/class-property-search-widget.php:69 +msgid "Search Properties" +msgstr "" + +#: includes/class-property-search-widget.php:79 msgid "Include these taxonomies in the search widget" msgstr "" +#: includes/class-property-search-widget.php:93 +msgid "Button Text:" +msgstr "" + #: includes/class-taxonomies.php:39 msgid "Register Taxonomies" msgstr "" -#: includes/class-taxonomies.php:87 includes/class-taxonomies.php:89 -#: includes/class-taxonomies.php:91 includes/class-taxonomies.php:160 -#: includes/class-taxonomies.php:162 includes/class-taxonomies.php:164 +#: includes/class-taxonomies.php:87 includes/class-taxonomies.php:90 +#: includes/class-taxonomies.php:93 includes/class-taxonomies.php:190 +#: includes/class-taxonomies.php:192 includes/class-taxonomies.php:194 msgid "Please complete all required fields." msgstr "" -#: includes/class-taxonomies.php:100 includes/class-taxonomies.php:173 -#: includes/class-taxonomies.php:244 -#, php-format +#: includes/class-taxonomies.php:101 +msgid "You have given this taxonomy an invalid slug/ID. Please try again." +msgstr "" + +#: includes/class-taxonomies.php:109 includes/class-taxonomies.php:203 +#: includes/class-taxonomies.php:274 msgid "Search %s" msgstr "" -#: includes/class-taxonomies.php:101 includes/class-taxonomies.php:174 -#: includes/class-taxonomies.php:245 -#, php-format +#: includes/class-taxonomies.php:110 includes/class-taxonomies.php:204 +#: includes/class-taxonomies.php:275 msgid "Popular %s" msgstr "" -#: includes/class-taxonomies.php:102 includes/class-taxonomies.php:175 -#: includes/class-taxonomies.php:246 -#, php-format +#: includes/class-taxonomies.php:111 includes/class-taxonomies.php:205 +#: includes/class-taxonomies.php:276 msgid "All %s" msgstr "" -#: includes/class-taxonomies.php:103 includes/class-taxonomies.php:176 -#: includes/class-taxonomies.php:247 -#, php-format +#: includes/class-taxonomies.php:112 includes/class-taxonomies.php:206 +#: includes/class-taxonomies.php:277 msgid "Edit %s" msgstr "" -#: includes/class-taxonomies.php:104 includes/class-taxonomies.php:177 -#: includes/class-taxonomies.php:248 -#, php-format +#: includes/class-taxonomies.php:113 includes/class-taxonomies.php:207 +#: includes/class-taxonomies.php:278 msgid "Update %s" msgstr "" -#: includes/class-taxonomies.php:105 includes/class-taxonomies.php:178 -#: includes/class-taxonomies.php:249 -#, php-format +#: includes/class-taxonomies.php:114 includes/class-taxonomies.php:208 +#: includes/class-taxonomies.php:279 msgid "Add New %s" msgstr "" -#: includes/class-taxonomies.php:106 includes/class-taxonomies.php:179 -#: includes/class-taxonomies.php:250 -#, php-format +#: includes/class-taxonomies.php:115 includes/class-taxonomies.php:209 +#: includes/class-taxonomies.php:280 msgid "New %s Name" msgstr "" -#: includes/class-taxonomies.php:107 includes/class-taxonomies.php:180 -#: includes/class-taxonomies.php:251 -#, php-format +#: includes/class-taxonomies.php:116 includes/class-taxonomies.php:210 +#: includes/class-taxonomies.php:281 msgid "Add or Remove %s" msgstr "" -#: includes/class-taxonomies.php:108 includes/class-taxonomies.php:181 -#: includes/class-taxonomies.php:252 -#, php-format +#: includes/class-taxonomies.php:117 includes/class-taxonomies.php:211 +#: includes/class-taxonomies.php:282 msgid "Choose from the most used %s" msgstr "" -#: includes/class-taxonomies.php:135 includes/class-taxonomies.php:143 +#: includes/class-taxonomies.php:173 msgid "" -"Nice try, partner. But that taxonomy doesn't exist. Click back and try again." +"Nice try, partner. But that taxonomy doesn't exist. Click back and try " +"again." msgstr "" -#: includes/class-taxonomies.php:211 +#: includes/class-taxonomies.php:241 msgid "New taxonomy successfully created!" msgstr "" -#: includes/class-taxonomies.php:216 +#: includes/class-taxonomies.php:246 msgid "Taxonomy successfully edited!" msgstr "" -#: includes/class-taxonomies.php:221 +#: includes/class-taxonomies.php:251 msgid "Taxonomy successfully deleted." msgstr "" @@ -310,8 +307,8 @@ msgstr "" #: includes/views/edit-tax.php:7 msgid "" -"Nice try, partner. But that taxonomy doesn't exist or can't be edited. Click " -"back and try again." +"Nice try, partner. But that taxonomy doesn't exist or can't be edited. " +"Click back and try again." msgstr "" #: includes/views/edit-tax.php:12 @@ -334,22 +331,49 @@ msgstr "" msgid "Custom text shows on the featured listings widget image." msgstr "" -#: includes/views/listing-details-metabox.php:20 -#: includes/views/listing-details-metabox.php:38 -#: includes/views/listing-details-metabox.php:46 +#: includes/views/listing-details-metabox.php:18 +#: includes/views/listing-details-metabox.php:34 +#: includes/views/listing-details-metabox.php:42 msgid "Send to text editor" msgstr "" -#: includes/views/listing-details-metabox.php:36 -#, php-format +#: includes/views/listing-details-metabox.php:32 msgid "" "

" msgstr "" -#: includes/views/listing-details-metabox.php:44 -#, php-format +#: includes/views/listing-details-metabox.php:40 msgid "" -"

" +"

" +msgstr "" + +#: plugin.php:33 +msgid "" +"Sorry, you can't activate unless you have installed Genesis" +msgstr "" + +#: plugin.php:41 +msgid "Sorry, you cannot activate without Genesis %s or greater" msgstr "" + +#. Plugin Name of the plugin/theme +msgid "AgentPress Listings" +msgstr "" + +#. Author URI of the plugin/theme +msgid "http://www.studiopress.com/" +msgstr "" + +#. Description of the plugin/theme +msgid "" +"AgentPress Listings is a plugin which adds a Listings custom post type for " +"Real Estate agents." +msgstr "" + +#. Author of the plugin/theme +msgid "StudioPress" +msgstr "" \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..24682ec --- /dev/null +++ b/package.json @@ -0,0 +1,37 @@ +{ + "name": "agentpress-listings", + "description": "Development files for the AgentPress Listings plugin.", + "repository": { + "type": "git", + "url": "https://github.com/copyblogger/agentpress-listings" + }, + "dependencies": {}, + "devDependencies": { + "grunt": "*", + "grunt-autoprefixer": "*", + "grunt-checktextdomain": "*", + "grunt-contrib-cssmin": "*", + "grunt-contrib-imagemin": "*", + "grunt-contrib-jshint": "*", + "grunt-contrib-uglify": "*", + "grunt-contrib-watch": "*", + "grunt-csscomb": "*", + "grunt-jsbeautifier": "*", + "grunt-jsvalidate": "*", + "grunt-phplint": "*", + "grunt-styledocco": "*", + "grunt-wp-i18n": "*", + "load-grunt-tasks": "*" + }, + "plugin": { + "name": "AgentPress Listings", + "uri": "https://github.com/copyblogger/agentpress-listings", + "description": "AgentPress Listings is a plugin which adds a Listings custom post type for Real Estate agents.", + "author": "StudioPress", + "authoruri": "http://www.studiopress.com/", + "version": "1.2.7", + "license": "GPL-2.0+", + "licenseuri": "http://www.gnu.org/licenses/gpl-2.0.html", + "textdomain": "agentpress-listings" + } +} diff --git a/plugin.php b/plugin.php old mode 100755 new mode 100644 index 851adb3..a53bc56 --- a/plugin.php +++ b/plugin.php @@ -1,107 +1,109 @@ -Genesis', 'agentpress-listings' ), 'http://my.studiopress.com/themes/genesis/' ) ); - - } - - if ( version_compare( wp_get_theme( 'genesis' )->get( 'Version' ), $latest, '<' ) ) { - - //* Deactivate ourself - deactivate_plugins( plugin_basename( __FILE__ ) ); /** Deactivate ourself */ - wp_die( sprintf( __( 'Sorry, you cannot activate without Genesis %s or greater', 'agentpress-listings' ), 'http://www.studiopress.com/support/showthread.php?t=19576', $latest ) ); - - } - - /** Flush rewrite rules */ - if ( ! post_type_exists( 'listing' ) ) { - - agentpress_listings_init(); - global $_agentpress_listings, $_agentpress_taxonomies; - $_agentpress_listings->create_post_type(); - $_agentpress_taxonomies->register_taxonomies(); - - } - - flush_rewrite_rules(); - -} - -add_action( 'after_setup_theme', 'agentpress_listings_init' ); -/** - * Initialize AgentPress Listings. - * - * Include the libraries, define global variables, instantiate the classes. - * - * @since 0.1.0 - */ -function agentpress_listings_init() { - - /** Do nothing if a Genesis child theme isn't active */ - if ( ! function_exists( 'genesis_get_option' ) ) - return; - - global $_agentpress_listings, $_agentpress_taxonomies; - - define( 'APL_URL', plugin_dir_url( __FILE__ ) ); - define( 'APL_VERSION', '1.0.0' ); - - /** Load textdomain for translation */ - load_plugin_textdomain( 'agentpress-listings', false, basename( dirname( __FILE__ ) ) . '/languages/' ); - - /** Includes */ - require_once( dirname( __FILE__ ) . '/includes/functions.php' ); - require_once( dirname( __FILE__ ) . '/includes/class-listings.php' ); - require_once( dirname( __FILE__ ) . '/includes/class-taxonomies.php' ); - require_once( dirname( __FILE__ ) . '/includes/class-featured-listings-widget.php' ); - require_once( dirname( __FILE__ ) . '/includes/class-property-search-widget.php' ); - - /** Instantiate */ - $_agentpress_listings = new AgentPress_Listings; - $_agentpress_taxonomies = new AgentPress_Taxonomies; - - add_action( 'widgets_init', 'agentpress_register_widgets' ); - -} - -/** - * Register Widgets that will be used in the AgentPress Listings plugin - * - * @since 0.1.0 - */ -function agentpress_register_widgets() { - - $widgets = array( 'AgentPress_Featured_Listings_Widget', 'AgentPress_Listings_Search_Widget' ); - - foreach ( (array) $widgets as $widget ) { - register_widget( $widget ); - } - -} - +Genesis', 'agentpress-listings' ), 'http://my.studiopress.com/themes/genesis/' ) ); + + } + + if ( version_compare( wp_get_theme( 'genesis' )->get( 'Version' ), $latest, '<' ) ) { + + //* Deactivate ourself + deactivate_plugins( plugin_basename( __FILE__ ) ); /** Deactivate ourself */ + wp_die( sprintf( __( 'Sorry, you cannot activate without Genesis %s or greater', 'agentpress-listings' ), 'http://www.studiopress.com/support/showthread.php?t=19576', $latest ) ); + + } + + /** Flush rewrite rules */ + if ( ! post_type_exists( 'listing' ) ) { + + agentpress_listings_init(); + global $_agentpress_listings, $_agentpress_taxonomies; + $_agentpress_listings->create_post_type(); + $_agentpress_taxonomies->register_taxonomies(); + + } + + flush_rewrite_rules(); + +} + +add_action( 'after_setup_theme', 'agentpress_listings_init' ); +/** + * Initialize AgentPress Listings. + * + * Include the libraries, define global variables, instantiate the classes. + * + * @since 0.1.0 + */ +function agentpress_listings_init() { + + /** Do nothing if a Genesis child theme isn't active */ + if ( ! function_exists( 'genesis_get_option' ) ) + return; + + global $_agentpress_listings, $_agentpress_taxonomies; + + define( 'APL_URL', plugin_dir_url( __FILE__ ) ); + define( 'APL_VERSION', '1.2.6' ); + + /** Load textdomain for translation */ + load_plugin_textdomain( 'agentpress-listings', false, basename( dirname( __FILE__ ) ) . '/languages/' ); + + /** Includes */ + require_once( dirname( __FILE__ ) . '/includes/functions.php' ); + require_once( dirname( __FILE__ ) . '/includes/class-listings.php' ); + require_once( dirname( __FILE__ ) . '/includes/class-taxonomies.php' ); + require_once( dirname( __FILE__ ) . '/includes/class-featured-listings-widget.php' ); + require_once( dirname( __FILE__ ) . '/includes/class-property-search-widget.php' ); + + /** Instantiate */ + $_agentpress_listings = new AgentPress_Listings; + $_agentpress_taxonomies = new AgentPress_Taxonomies; + + add_action( 'widgets_init', 'agentpress_register_widgets' ); + +} + +/** + * Register Widgets that will be used in the AgentPress Listings plugin + * + * @since 0.1.0 + */ +function agentpress_register_widgets() { + + $widgets = array( 'AgentPress_Featured_Listings_Widget', 'AgentPress_Listings_Search_Widget' ); + + foreach ( (array) $widgets as $widget ) { + register_widget( $widget ); + } + +} diff --git a/readme.txt b/readme.txt old mode 100755 new mode 100644 index 45887ab..b20208d --- a/readme.txt +++ b/readme.txt @@ -1,9 +1,9 @@ === Plugin Name === -Contributors: nathanrice, wpmuguru, studiopress +Contributors: nathanrice, wpmuguru, studiopress, nick_thegeek Tags: real estate, agentpress, genesis, genesiswp -Requires at least: 3.8 -Tested up to: 4.0 -Stable tag: 1.2.2 +Requires at least: 4.0.0 +Tested up to: 4.8.3 +Stable tag: 1.2.7 This plugin adds a Listings custom post type for Real Estate agents. @@ -27,11 +27,48 @@ No, but that doesn't necessarily mean it's perfect. Please report any bugs to us == Changelog == -= 0.1.0 = -* Initial beta release += 1.2.7 = +* WordPress compatibility. -= 0.9.0 = -* Public beta release += 1.2.6 = +* Add plugin header i18n + += 1.2.5 = +* Fix typo + += 1.2.4 = +* PHP7 compatibility + += 1.2.3 = +* Fixed issue where existing taxonomies could not be edited +* Fixed typo in the language .pot filename + += 1.2.2 = +* Fixed issue with incorrect usage of `array_pop()` + += 1.2.1 = +* Fixed bug with listing search results using wrong template +* Fixed issue with breadcrumbs on listing search results page + += 1.2.0 = +* Update textdomain +* Prevent invalid taxonomy slugs +* Fix PHP notices and warnings +* Fix link to edit taxonomy +* Conditionally output markup in listing widget +* Use wp_get_theme() instead of get_theme_data() + += 1.1.0 = +* Fix spacing issues +* Update Listings menu icon + += 1.0.0 = +* Localized the property details labels +* Fixes typo +* Change the property details filter name +* Enable comments on listings post type +* Fix admin redirect bug +* Tag for public release = 0.9.1 = * Flush rewrite rules when plugin is activated, or taxonomies are created. @@ -44,22 +81,8 @@ No, but that doesn't necessarily mean it's perfect. Please report any bugs to us * Make the property details (label and custom field key) filterable. * Make the loop output filterable in Featured Listings. -= 1.0.0 = -* Localized the property details labels -* Fixes typo -* Change the property details filter name -* Enable comments on listings post type -* Fix admin redirect bug -* Tag for public release - -= 1.1.0 = -* Fix spacing issues -* Update Listings menu icon += 0.9.0 = +* Public beta release -= 1.2.0 = -* Update textdomain -* Prevent invalid taxonomy slugs -* Fix PHP notices and warnings -* Fix link to edit taxonomy -* Conditionally output markup in listing widget -* Use wp_get_theme() instead of get_theme_data() += 0.1.0 = +* Initial beta release