Пример #1
0
 /**
  * Init
  */
 public function __construct()
 {
     /** Ajax pagination for property_overview */
     add_action("wp_ajax_wpp_property_overview_pagination", array($this, "ajax_handler"));
     add_action("wp_ajax_nopriv_wpp_property_overview_pagination", array($this, "ajax_handler"));
     $custom_attributes = ud_get_wp_property('property_stats', array());
     $image_sizes = array('' => __('No Image', ud_get_wp_property('domain')));
     foreach (get_intermediate_image_sizes() as $name) {
         $sizes = \WPP_F::image_sizes($name);
         if (!$sizes) {
             continue;
         }
         $image_sizes[$name] = $name . ' (' . $sizes['width'] . 'x' . $sizes['height'] . 'px)';
     }
     $sort_by = array('post_date' => sprintf(__('Post Date (%s)', ud_get_wp_property('domain')), 'post_date'), 'post_modified' => sprintf(__('Modified Date (%s)', ud_get_wp_property('domain')), 'post_modified'), 'random' => sprintf(__('Random (%s)', ud_get_wp_property('domain')), 'random'), 'menu_order' => sprintf(__('Menu Order (%s)', ud_get_wp_property('domain')), 'menu_order'));
     $sortable_atts = ud_get_wp_property('sortable_attributes', array());
     if (!empty($sortable_atts) && is_array($sortable_atts)) {
         foreach ($sortable_atts as $attr) {
             if (array_key_exists($attr, $custom_attributes)) {
                 $sort_by[$attr] = $custom_attributes[$attr] . ' (' . $attr . ')';
             }
         }
     }
     $options = array('id' => 'property_overview', 'params' => array('property_id' => array('name' => __('Property ID', ud_get_wp_property()->domain), 'description' => __('If not empty, result will show particular property, which ID is set.', ud_get_wp_property()->domain), 'type' => 'text', 'default' => ''), 'post_parent' => array('name' => sprintf(__('Parent %s', ud_get_wp_property('domain')), \WPP_F::property_label()), 'description' => sprintf(__('If not empty, result will show children of particular property, which ID is set. You can use dynamic attributes instead of ID such as %1$s or %2$s.<br/>%1$s - to list all the listings that are a child of the current %3$s.<br/>%2$s - to list all listings that are children of the same parent (i.e. siblings) of the current %3$s', ud_get_wp_property('domain')), '<b>post_id</b>', '<b>post_parent</b>', \WPP_F::property_label()), 'type' => 'text', 'default' => ''), 'property_type' => array('name' => sprintf(__('%s Type', ud_get_wp_property('domain')), \WPP_F::property_label()), 'description' => sprintf(__('The list of %s types to be included. If no type checked, all available %s will be shown.', ud_get_wp_property('domain')), \WPP_F::property_label(), \WPP_F::property_label('plural')), 'type' => 'multi_checkbox', 'options' => ud_get_wp_property('property_types')), 'featured' => array('name' => sprintf(__('Show only Featured %s', ud_get_wp_property('domain')), \WPP_F::property_label('plural')), 'type' => 'checkbox'), 'custom_query' => array('name' => __('Custom Query by Attributes Values', ud_get_wp_property()->domain), 'description' => sprintf(__('Setup your custom query by providing values for specific attributes. Empty values will be ignored. Example:<br/>- to list only %1$s which have minimum 2 and maximum 4 bedrooms, you should set <b>2-4</b> value for your Bedrooms attribute.<br/>- to list only %1$s which have 1 or 3 bathrooms, you should set <b>1,3</b> value for your Batrooms attribute.', ud_get_wp_property('domain')), \WPP_F::property_label()), 'type' => 'custom_attributes', 'options' => $custom_attributes), 'show_children' => array('name' => __('Show Children', ud_get_wp_property()->domain), 'description' => sprintf(__('Switches children %s displaying.', ud_get_wp_property()->domain), \WPP_F::property_label()), 'type' => 'select', 'options' => array('true' => __('Yes', ud_get_wp_property()->domain), 'false' => __('No', ud_get_wp_property()->domain)), 'default' => 'true'), 'child_properties_title' => array('name' => sprintf(__('Child %s Title', ud_get_wp_property()->domain), \WPP_F::property_label('plural')), 'description' => sprintf(__('Title for Child %s section.', ud_get_wp_property()->domain), \WPP_F::property_label('plural')), 'type' => 'text', 'default' => __('Floor plans at location:', ud_get_wp_property()->domain)), 'fancybox_preview' => array('name' => __('Fancybox Preview', ud_get_wp_property()->domain), 'description' => __('Use fancybox preview.', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('true' => __('Yes', ud_get_wp_property()->domain), 'false' => __('No', ud_get_wp_property()->domain)), 'default' => 'true'), 'bottom_pagination_flag' => array('name' => __('Bottom Pagination', ud_get_wp_property()->domain), 'description' => __('Show Bottom Pagination.', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('true' => __('Yes', ud_get_wp_property()->domain), 'false' => __('No', ud_get_wp_property()->domain)), 'default' => 'false'), 'thumbnail_size' => array('name' => __('Thumbnail Size', ud_get_wp_property()->domain), 'description' => __('Show image with specific image size', ud_get_wp_property()->domain), 'type' => 'select', 'options' => $image_sizes, 'default' => 'thumbnail'), 'sort_by_text' => array('name' => __('Sort By Text', ud_get_wp_property()->domain), 'description' => __('Renames "Sort By:" text.', ud_get_wp_property()->domain), 'type' => 'text', 'default' => __('Sort By', ud_get_wp_property()->domain)), 'sort_by' => array('name' => __('Sort By', ud_get_wp_property()->domain), 'description' => sprintf(__('Sets sorting by sortable attribute or %s.', ud_get_wp_property()->domain), 'post_date, menu_order, random'), 'type' => 'select', 'options' => $sort_by, 'default' => 'post_date'), 'sort_order' => array('name' => __('Sort Order', ud_get_wp_property()->domain), 'description' => __('Sort Order', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('DESC' => 'DESC', 'ASC' => 'ASC'), 'default' => 'DESC'), 'template' => array('name' => __('Template', ud_get_wp_property()->domain), 'description' => sprintf(__('Sets layout using PHP template name. Your custom template should be stored in your theme\'s root directory. Example:<br/>if your custom template is called %s, the value of template must be %s.', ud_get_wp_property('domain')), '<b>property-overview-grid.php</b>', '<b>grid</b>'), 'type' => 'text'), 'sorter_type' => array('name' => __('Sorter Type', ud_get_wp_property()->domain), 'description' => __('Sorter Type', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('none' => __('None', ud_get_wp_property()->domain), 'buttons' => __('Buttons', ud_get_wp_property()->domain), 'dropdown' => __('Dropdown', ud_get_wp_property()->domain)), 'default' => 'buttons'), 'sorter' => array('name' => __('Sorter', ud_get_wp_property()->domain), 'description' => __('Show Sort UI', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('on' => __('On', ud_get_wp_property()->domain), 'off' => __('Off', ud_get_wp_property()->domain)), 'default' => 'on'), 'pagination' => array('name' => __('Pagination', ud_get_wp_property()->domain), 'description' => __('Show Pagination', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('on' => __('On', ud_get_wp_property()->domain), 'off' => __('Off', ud_get_wp_property()->domain)), 'default' => 'on'), 'pagination_type' => array('name' => __('Pagination Type', ud_get_wp_property()->domain), 'description' => __('Determine pagination UI', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('slider' => __('slider', ud_get_wp_property()->domain), 'numeric' => __('numeric', ud_get_wp_property()->domain)), 'default' => ud_get_wp_property('configuration.property_overview.pagination_type') ? ud_get_wp_property('configuration.property_overview.pagination_type') : 'slider'), 'per_page' => array('name' => __('Per Page', ud_get_wp_property()->domain), 'description' => sprintf(__('%s quantity per page.', ud_get_wp_property()->domain), \WPP_F::property_label()), 'type' => 'number', 'default' => 10), 'starting_row' => array('name' => __('Starting Row', ud_get_wp_property()->domain), 'description' => __('Sets starting row.', ud_get_wp_property()->domain), 'type' => 'number', 'default' => 0), 'detail_button' => array('name' => __('Detail Button', ud_get_wp_property()->domain), 'description' => __('Name of Detail Button. Button will not be shown if the value is empty.', ud_get_wp_property()->domain), 'type' => 'text'), 'hide_count' => array('name' => __('Hide Count', ud_get_wp_property()->domain), 'description' => __('Hide the "10 found." text.', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('true' => __('Yes', ud_get_wp_property()->domain), 'false' => __('No', ud_get_wp_property()->domain)), 'default' => 'false'), 'in_new_window' => array('name' => __('In new window?', ud_get_wp_property()->domain), 'description' => __('Open links in new window.', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('true' => __('Yes', ud_get_wp_property()->domain), 'false' => __('No', ud_get_wp_property()->domain)), 'default' => 'false'), 'strict_search' => array('name' => __('Strict Search', ud_get_wp_property()->domain), 'description' => __('Provides strict search', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('true' => __('Yes', ud_get_wp_property()->domain), 'false' => __('No', ud_get_wp_property()->domain)), 'default' => 'false')), 'description' => sprintf(__('Renders %s Attributes', ud_get_wp_property()->domain), \WPP_F::property_label()), 'group' => 'WP-Property');
     parent::__construct($options);
 }
 /**
  * Handle Bulk Action's request
  *
  */
 public function process_bulk_action()
 {
     global $wpdb;
     try {
         switch ($this->current_action()) {
             case 'unassign':
                 if (empty($_REQUEST['post_ids']) || !is_array($_REQUEST['post_ids'])) {
                     throw new \Exception(sprintf(__('Invalid request: no %s IDs provided.', ud_get_wp_property('domain')), \WPP_F::property_label()));
                 }
                 $post_ids = $_REQUEST['post_ids'];
                 foreach ($post_ids as $post_id) {
                     $post_id = (int) $post_id;
                     if (!$post_id) {
                         throw new \Exception(sprintf(__('Invalid request: incorrect %s IDs provided.', ud_get_wp_property('domain')), \WPP_F::property_label()));
                     }
                     $wpdb->query($wpdb->prepare("\n                  UPDATE {$wpdb->posts}\n                  SET post_parent = '0'\n                  WHERE ID = %d\n                ", $post_id));
                     clean_post_cache($post_id);
                 }
                 $label = count($post_ids) > 1 ? __('Children', ud_get_wp_property('domain')) : __('Child', ud_get_wp_property('domain'));
                 $this->message = sprintf(__('Selected %s have been successfully un-assigned from current %s.', ud_get_wp_property('domain')), $label, \WPP_F::property_label());
                 break;
             default:
                 //** Any custom action can be processed using action hook */
                 do_action('wpp::children_list_table::process_bulk_action', $this->current_action());
                 break;
         }
     } catch (\Exception $e) {
         $this->error = $e->getMessage();
     }
 }
Пример #3
0
/**
 * Add labels to system-generated attributes that do not have custom-set values
 *
 * @since 1.22.0
 */
function wpp_unique_key_labels($stats)
{
    if (empty($stats['property_type'])) {
        $stats['property_type'] = sprintf(__('%s Type', ud_get_wp_property()->domain), \WPP_F::property_label());
    }
    if (empty($stats['city'])) {
        $stats['city'] = __('City', ud_get_wp_property()->domain);
    }
    return $stats;
}
Пример #4
0
 /**
  * init
  */
 public function __construct()
 {
     $taxonomies = array();
     $_taxonomies = ud_get_wp_property('taxonomies', array());
     if (!empty($_taxonomies) && is_array($_taxonomies)) {
         foreach ($_taxonomies as $k => $v) {
             $taxonomies[$k] = !empty($v['label']) ? $v['label'] : $k;
         }
     }
     $options = array('id' => 'property_terms', 'params' => array('property_id' => array('name' => sprintf(__('%s ID', ud_get_wp_property('domain')), \WPP_F::property_label()), 'description' => sprintf(__('If not empty, result will show particular %s, which ID is set.', ud_get_wp_property('domain')), \WPP_F::property_label()), 'type' => 'text', 'default' => ''), 'taxonomy' => array('name' => __('Taxonomy', ud_get_wp_property()->domain), 'description' => sprintf(__('Renders %s terms of particular taxonomy', ud_get_wp_property('domain')), \WPP_F::property_label()), 'type' => 'select', 'options' => $taxonomies)), 'description' => sprintf(__('Renders %s Terms for specific taxonomy', ud_get_wp_property()->domain), \WPP_F::property_label()), 'group' => 'WP-Property');
     parent::__construct($options);
 }
 /**
  * Init
  */
 public function __construct()
 {
     $attributes = ud_get_wp_property('property_stats', array());
     /*
             $hidden_attributes = ud_get_wp_property( 'hidden_frontend_attributes', array() );
             foreach( $attributes as $k => $v ) {
               if( in_array( $k, $hidden_attributes ) ) {
                 unset( $attributes[$k] );
               }
             }
             //*/
     $options = array('id' => 'property_attributes', 'params' => array('sort_by_groups' => array('name' => __('Sort by groups', ud_get_wp_property()->domain), 'description' => __('Sort attributes by groups or not', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('true' => __('Yes', ud_get_wp_property()->domain), 'false' => __('No', ud_get_wp_property()->domain))), 'display' => array('name' => __('Display', ud_get_wp_property()->domain), 'description' => __('The way of displaying attributes', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('list' => __('Simple List', ud_get_wp_property()->domain), 'dl_list' => __('Definitions List', ud_get_wp_property()->domain), 'plain_list' => __('Plain List', ud_get_wp_property()->domain), 'detail' => __('Detailed List', ud_get_wp_property()->domain))), 'show_true_as_image' => array('name' => __('Show "True" as image', ud_get_wp_property()->domain), 'description' => __('Display boolean attributes like checkbox image.', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('false' => __('No', ud_get_wp_property()->domain), 'true' => __('Yes', ud_get_wp_property()->domain))), 'make_link' => array('name' => __('Make link', ud_get_wp_property()->domain), 'description' => __('Make URLs into clickable links', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('true' => __('Yes', ud_get_wp_property()->domain), 'false' => __('No', ud_get_wp_property()->domain))), 'hide_false' => array('name' => __('Hide false', ud_get_wp_property()->domain), 'description' => __('Hide attributes with false value', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('false' => __('No', ud_get_wp_property()->domain), 'true' => __('Yes', ud_get_wp_property()->domain))), 'return_blank' => array('name' => __('Return Blank', ud_get_wp_property()->domain), 'description' => __('Omit blank values or not.', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('false' => __('No', ud_get_wp_property()->domain), 'true' => __('Yes', ud_get_wp_property()->domain))), 'include' => array('name' => __('Include', ud_get_wp_property()->domain), 'description' => __('The list of attributes to be included. If no attribute checked, all available attributes will be shown.', ud_get_wp_property()->domain), 'type' => 'multi_checkbox', 'options' => $attributes), 'exclude' => array('name' => __('Exclude', ud_get_wp_property()->domain), 'description' => __('The list of attributes which will not be shown.', ud_get_wp_property()->domain), 'type' => 'multi_checkbox', 'options' => $attributes)), 'description' => sprintf(__('Renders %s Attributes List', ud_get_wp_property()->domain), \WPP_F::property_label()), 'group' => 'WP-Property');
     parent::__construct($options);
 }
Пример #6
0
 /**
  * Add Contextual help item
  *
  * @param type $data
  *
  * @return string
  * @author korotkov@ud
  */
 static function wpp_contextual_help($data)
 {
     $data['Developer'][] = '<h3>' . __('Developer', ud_get_wp_property()->domain) . '</h3>';
     $data['Developer'][] = '<p>' . __('The <b>slug</b> is automatically created from the title and is used in the back-end.  It is also used for template selection, example: floorplan will look for a template called property-floorplan.php in your theme folder, or default to property.php if nothing is found.', ud_get_wp_property()->domain) . '</p>';
     $data['Developer'][] = '<p>' . __('If <b>Searchable</b> is checked then the property will be loaded for search, and available on the property search widget.', ud_get_wp_property()->domain) . '</p>';
     $data['Developer'][] = '<p>' . __('If <b>Location Matters</b> is checked, then an address field will be displayed for the property, and validated against Google Maps API.  Additionally, the property will be displayed on the SuperMap, if the feature is installed.', ud_get_wp_property()->domain) . '</p>';
     $data['Developer'][] = '<p>' . sprintf(__('<b>Hidden Attributes</b> determine which attributes are not applicable to the given %s type, and will be grayed out in the back-end.', ud_get_wp_property()->domain), WPP_F::property_label()) . '</p>';
     $data['Developer'][] = '<p>' . __('<b>Inheritance</b> determines which attributes should be automatically inherited from the parent property', ud_get_wp_property()->domain) . '</p>';
     $data['Developer'][] = '<p>' . __('Property attributes are meant to be short entries that can be searchable, on the back-end attributes will be displayed as single-line input boxes. On the front-end they are displayed using a definitions list.', ud_get_wp_property()->domain) . '</p>';
     $data['Developer'][] = '<p>' . __('Making an attribute as "searchable" will list it as one of the searchable options in the Property Search widget settings.', ud_get_wp_property()->domain) . '</p>';
     $data['Developer'][] = '<p>' . __('Be advised, attributes added via add_filter() function supercede the settings on this page.', ud_get_wp_property()->domain) . '</p>';
     $data['Developer'][] = '<p>' . __('<b>Search Input:</b> Select and input type and enter comma-separated values that you would like to be used in property search, on the front-end.', ud_get_wp_property()->domain) . '</p>';
     $data['Developer'][] = '<p>' . __('<b>Data Entry:</b> Enter comma-separated values that you would like to use on the back-end when editing properties.', ud_get_wp_property()->domain) . '</p>';
     return $data;
 }
?>
"/>
  <a target="_blank" class="button" href="<?php 
echo $export_url;
?>
"><?php 
_e('Open', ud_get_wp_property()->domain);
?>
</a>
  <br/><br/>
  <?php 
_e('You may append the export URL with the following arguments:', ud_get_wp_property()->domain);
?>
  <ul style="margin: 15px 0 0 10px">
    <li><b>limit</b> - number</li>
    <li><b>per_page</b> - number</li>
    <li><b>starting_row</b> - number</li>
    <li><b>sort_order</b> - number</li>
    <li><b>sort_by</b> - number</li>
    <li><b>property_type</b> - string - <?php 
printf(__('Slug for the %s type.', ud_get_wp_property()->domain), \WPP_F::property_label());
?>
</li>
    <li><b>format</b> - string - "xml" <?php 
_e('or', ud_get_wp_property()->domain);
?>
 "json"</li>
  </ul>
  </li>
  </ul>
</div>
Пример #8
0
 /**
  * Init
  */
 public function __construct()
 {
     $options = array('id' => 'property_search', 'params' => array('searchable_attributes' => array('name' => __('Searchable Attributes', ud_get_wp_property()->domain), 'description' => __('CSV attributes list', ud_get_wp_property()->domain), 'type' => 'text', 'default' => ''), 'searchable_property_types' => array('name' => sprintf(__('Searchable %s Types', ud_get_wp_property()->domain), \WPP_F::property_label()), 'description' => __('CSV types list', ud_get_wp_property()->domain), 'type' => 'text', 'default' => ''), 'pagination' => array('name' => __('Pagination', ud_get_wp_property()->domain), 'description' => __('Use pagination?', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('on' => __('Yes', ud_get_wp_property()->domain), 'off' => __('No', ud_get_wp_property()->domain)), 'default' => 'on'), 'group_attributes' => array('name' => __('Group Attributes', ud_get_wp_property()->domain), 'description' => __('Group Attributes?', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('on' => __('Yes', ud_get_wp_property()->domain), 'off' => __('No', ud_get_wp_property()->domain)), 'default' => 'off'), 'per_page' => array('name' => __('Per Page', ud_get_wp_property()->domain), 'description' => __('Items per page', ud_get_wp_property()->domain), 'type' => 'number', 'min' => 1, 'default' => 10), 'strict_search' => array('name' => __('Strict Search', ud_get_wp_property()->domain), 'description' => __('Use strict search', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('true' => __('Yes', ud_get_wp_property()->domain), 'false' => __('No', ud_get_wp_property()->domain)), 'default' => 'false')), 'description' => sprintf(__('Renders %s Search form', ud_get_wp_property()->domain), \WPP_F::property_label()), 'group' => 'WP-Property');
     parent::__construct($options);
 }
Пример #9
0
 /**
  * Revalidate all addresses
  *
  * Revalidates addresses of all publishd properties.
  * If Google daily addres lookup is exceeded, breaks the function and notifies the user.
  *
  * @since 1.05
  *
  */
 public static function revalidate_all_addresses($args = '')
 {
     global $wp_properties, $wpdb;
     set_time_limit(0);
     ob_start();
     $args = wp_parse_args($args, array('property_ids' => false, 'echo_result' => 'true', 'skip_existing' => 'false', 'return_geo_data' => false, 'attempt' => 1, 'max_attempts' => 7, 'delay' => 0, 'increase_delay_by' => 0.25));
     extract($args, EXTR_SKIP);
     $delay = isset($delay) ? $delay : 0;
     $attempt = isset($attempt) ? $attempt : 1;
     $max_attempts = isset($max_attempts) ? $max_attempts : 10;
     $increase_delay_by = isset($increase_delay_by) ? $increase_delay_by : 0.25;
     $echo_result = isset($echo_result) ? $echo_result : 'true';
     $skip_existing = isset($skip_existing) ? $skip_existing : 'false';
     $return_geo_data = isset($return_geo_data) ? $return_geo_data : false;
     if (is_array($args['property_ids'])) {
         $all_properties = $args['property_ids'];
     } else {
         $all_properties = $wpdb->get_col("\n        SELECT ID FROM {$wpdb->posts} p\n        left outer join {$wpdb->postmeta} pm on (pm.post_id=p.ID and pm.meta_key='wpp::last_address_validation' )\n        WHERE p.post_type = 'property' AND p.post_status = 'publish'\n        ORDER by pm.meta_value DESC\n      ");
     }
     $return['updated'] = $return['failed'] = $return['over_query_limit'] = $return['over_query_limit'] = array();
     $google_map_localizations = WPP_F::draw_localization_dropdown('return_array=true');
     foreach ((array) $all_properties as $post_id) {
         if ($delay) {
             sleep($delay);
         }
         $result = WPP_F::revalidate_address($post_id, array('skip_existing' => $skip_existing, 'return_geo_data' => $return_geo_data));
         $return[$result['status']][] = $post_id;
         if ($return_geo_data) {
             $return['geo_data'][$post_id] = $result['geo_data'];
         }
     }
     $return['attempt'] = $attempt;
     /* // Instead of re-revalidate, must be overwritten UI: to dp separate AJAX request for every property and output results dynamicly.
         if ( !empty( $return[ 'over_query_limit' ] ) && $max_attempts >= $attempt && $delay < 2 ) {
     
           $_args = array(
               'property_ids' => $return[ 'over_query_limit' ],
               'echo_result' => false,
               'attempt' => $attempt + 1,
               'delay' => $delay + $increase_delay_by,
             ) + $args;
     
           $rerevalidate_result = self::revalidate_all_addresses( $_args );
     
           $return[ 'updated' ]          = array_merge( (array) $return[ 'updated' ], (array) $rerevalidate_result[ 'updated' ] );
           $return[ 'failed' ]           = array_merge( (array) $return[ 'failed' ], (array) $rerevalidate_result[ 'failed' ] );
           $return[ 'over_query_limit' ] = $rerevalidate_result[ 'over_query_limit' ];
     
           $return[ 'attempt' ] = $rerevalidate_result[ 'attempt' ];
         }
         //*/
     foreach (array('updated', 'over_query_limit', 'failed', 'empty_address') as $status) {
         $return[$status] = $echo_result == 'true' ? count(array_unique((array) $return[$status])) : array_unique((array) $return[$status]);
     }
     $return['success'] = 'true';
     $return['message'] = sprintf(__('Updated %1$d %2$s using the %3$s localization.', ud_get_wp_property()->domain), $echo_result == 'true' ? $return['updated'] : count($return['updated']), WPP_F::property_label('plural'), $google_map_localizations[$wp_properties['configuration']['google_maps_localization']]);
     if ($return['empty_address']) {
         $return['message'] .= "<br />" . sprintf(__('%1$d %2$s has empty address.', ud_get_wp_property()->domain), $echo_result == 'true' ? $return['empty_address'] : count($return['empty_address']), WPP_F::property_label('plural'));
     }
     if ($return['failed']) {
         $return['message'] .= "<br />" . sprintf(__('%1$d %2$s could not be updated.', ud_get_wp_property()->domain), $echo_result == 'true' ? $return['failed'] : count($return['failed']), WPP_F::property_label('plural'));
     }
     if ($return['over_query_limit']) {
         $return['message'] .= "<br />" . sprintf(__('%1$d %2$s was ignored because query limit was exceeded.', ud_get_wp_property()->domain), $echo_result == 'true' ? $return['over_query_limit'] : count($return['over_query_limit']), WPP_F::property_label('plural'));
     }
     //** Warning Silincer */
     ob_end_clean();
     if ($echo_result == 'true') {
         die(json_encode($return));
     } else {
         return $return;
     }
 }
Пример #10
0
 /**
  * Construct
  */
 function __construct()
 {
     $property_label = strtolower(WPP_F::property_label('plural'));
     parent::__construct(false, sprintf(__('Other %1s', ud_get_wp_property()->domain), WPP_F::property_label('plural')), array('description' => sprintf(__('Display a list of %1s that share a parent with the currently displayed property.', ud_get_wp_property()->domain), $property_label)), array('width' => 300));
 }
 /**
  * Init
  */
 public function __construct()
 {
     $options = array('id' => 'featured_properties', 'params' => array('property_type' => array('name' => sprintf(__('%s Type', ud_get_wp_property()->domain), \WPP_F::property_label()), 'description' => sprintf(__('%s Type', ud_get_wp_property()->domain), \WPP_F::property_label()), 'type' => 'text', 'default' => 'all'), 'type' => array('name' => __('Type', ud_get_wp_property()->domain), 'description' => __('Type', ud_get_wp_property()->domain), 'type' => 'text', 'default' => ''), 'class' => array('name' => __('Class', ud_get_wp_property()->domain), 'description' => __('CSS Class', ud_get_wp_property()->domain), 'type' => 'text', 'default' => 'shortcode_featured_properties'), 'per_page' => array('name' => __('Per Page', ud_get_wp_property()->domain), 'description' => __('Items per page', ud_get_wp_property()->domain), 'type' => 'number', 'default' => 6), 'sorter_type' => array('name' => __('Sorter Type', ud_get_wp_property()->domain), 'description' => __('Sorter Type', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('none' => __('None', ud_get_wp_property()->domain), 'buttons' => __('Buttons', ud_get_wp_property()->domain), 'dropdown' => __('Dropdown', ud_get_wp_property()->domain)), 'default' => 'none'), 'show_children' => array('name' => __('Show Children', ud_get_wp_property()->domain), 'description' => __('Show children or not.', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('true' => __('Yes', ud_get_wp_property()->domain), 'false' => __('No', ud_get_wp_property()->domain)), 'default' => 'false'), 'hide_count' => array('name' => __('Hide Count', ud_get_wp_property()->domain), 'description' => __('Hide Count', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('true' => __('Yes', ud_get_wp_property()->domain), 'false' => __('No', ud_get_wp_property()->domain)), 'default' => 'true'), 'fancybox_preview' => array('name' => __('Fancybox Preview', ud_get_wp_property()->domain), 'description' => __('Use fancybox preview.', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('true' => __('Yes', ud_get_wp_property()->domain), 'false' => __('No', ud_get_wp_property()->domain)), 'default' => 'false'), 'bottom_pagination_flag' => array('name' => __('Bottom Pagination', ud_get_wp_property()->domain), 'description' => __('Bottom Pagination.', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('true' => __('Yes', ud_get_wp_property()->domain), 'false' => __('No', ud_get_wp_property()->domain)), 'default' => 'false'), 'pagination' => array('name' => __('Pagination', ud_get_wp_property()->domain), 'description' => __('Pagination', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('on' => __('On', ud_get_wp_property()->domain), 'off' => __('Off', ud_get_wp_property()->domain)), 'default' => 'off'), 'stats' => array('name' => __('Stats', ud_get_wp_property()->domain), 'description' => __('CSV stats', ud_get_wp_property()->domain), 'type' => 'text', 'default' => ''), 'thumbnail_size' => array('name' => __('Thumbnail Size', ud_get_wp_property()->domain), 'description' => __('Thumbnail Size.', ud_get_wp_property()->domain), 'type' => 'text', 'default' => 'thumbnail')), 'description' => sprintf(__('Renders Featured %s', ud_get_wp_property()->domain), \WPP_F::property_label('plural')), 'group' => 'WP-Property');
     parent::__construct($options);
 }
Пример #12
0
 /**
  * Handle Bulk Action's request
  *
  */
 public function process_bulk_action()
 {
     try {
         switch ($this->current_action()) {
             case 'untrash':
                 if (empty($_REQUEST['post_ids']) || !is_array($_REQUEST['post_ids'])) {
                     throw new \Exception(sprintf(__('Invalid request: no %s IDs provided.', ud_get_wp_property('domain')), \WPP_F::property_label()));
                 }
                 $post_ids = $_REQUEST['post_ids'];
                 foreach ($post_ids as $post_id) {
                     $post_id = (int) $post_id;
                     wp_untrash_post($post_id);
                 }
                 $this->message = sprintf(__('Selected %s have been successfully restored from Trash.', ud_get_wp_property('domain')), \WPP_F::property_label('plural'));
                 break;
             case 'delete':
                 if (empty($_REQUEST['post_ids']) || !is_array($_REQUEST['post_ids'])) {
                     throw new \Exception(sprintf(__('Invalid request: no %s IDs provided.', ud_get_wp_property('domain')), \WPP_F::property_label()));
                 }
                 $post_ids = $_REQUEST['post_ids'];
                 $trashed = 0;
                 $deleted = 0;
                 foreach ($post_ids as $post_id) {
                     $post_id = (int) $post_id;
                     if (get_post_status($post_id) == 'trash') {
                         $deleted++;
                         wp_delete_post($post_id);
                     } else {
                         $trashed++;
                         wp_trash_post($post_id);
                     }
                 }
                 if ($trashed > 0 && $deleted > 0) {
                     $this->message = sprintf(__('Selected %s have been successfully moved to Trash or deleted.', ud_get_wp_property('domain')), \WPP_F::property_label('plural'));
                 } elseif ($trashed > 0) {
                     $this->message = sprintf(__('Selected %s have been successfully moved to Trash.', ud_get_wp_property('domain')), \WPP_F::property_label('plural'));
                 } elseif ($deleted > 0) {
                     $this->message = sprintf(__('Selected %s have been successfully deleted.', ud_get_wp_property('domain')), \WPP_F::property_label('plural'));
                 } else {
                     throw new \Exception(sprintf(__('No one %s was deleted.', ud_get_wp_property('domain')), \WPP_F::property_label()));
                 }
                 break;
             default:
                 //** Any custom action can be processed using action hook */
                 do_action('wpp::all_properties::process_bulk_action', $this->current_action());
                 break;
         }
     } catch (\Exception $e) {
         $this->error = $e->getMessage();
     }
 }
Пример #13
0
<?php

/**
 * Javascript Localization
 *
 * @version 0.1
 * @since 1.37.3.2
 * @author peshkov@UD
 * @package WP-Property
 */
$l10n = array('clone_property' => sprintf(__('Clone %s', ud_get_wp_property()->domain), WPP_F::property_label()), 'delete' => __('Delete', ud_get_wp_property()->domain), 'show' => __('Show', ud_get_wp_property()->domain), 'hide' => __('Hide', ud_get_wp_property()->domain), 'featured' => __('Featured', ud_get_wp_property()->domain), 'add_to_featured' => __('Add to Featured', ud_get_wp_property()->domain), 'undefined_error' => __('Undefined Error.', ud_get_wp_property()->domain), 'set_property_type_confirmation' => sprintf(__('You are about to set ALL your %s to the selected %s type. Are you sure?', ud_get_wp_property()->domain), WPP_F::property_label('plural'), WPP_F::property_label()), 'processing' => __('Processing...', ud_get_wp_property()->domain), 'geo_attribute_usage' => __('Attention! This attribute (slug) is used by Google Validator and Address Display functionality. It is set automatically and can not be edited on Property Adding/Updating page.', ud_get_wp_property()->domain), 'uploading' => __('Uploading', ud_get_wp_property()->domain), 'drop_file' => __('Drop files here to upload', ud_get_wp_property()->domain), 'upload_images' => __('Upload Image', ud_get_wp_property()->domain), 'cancel' => __('Cancel', ud_get_wp_property()->domain), 'fail' => __('Failed', ud_get_wp_property()->domain), 'dtables' => array('first' => __('First', ud_get_wp_property()->domain), 'previous' => __('Previous', ud_get_wp_property()->domain), 'next' => __('Next', ud_get_wp_property()->domain), 'last' => __('Last', ud_get_wp_property()->domain), 'processing' => __('Processing...', ud_get_wp_property()->domain), 'show_menu_entries' => sprintf(__('Show %s entries', ud_get_wp_property()->domain), '_MENU_'), 'no_m_records_found' => __('No matching records found', ud_get_wp_property()->domain), 'no_data_available' => __('No data available in table', ud_get_wp_property()->domain), 'loading' => __('Loading...', ud_get_wp_property()->domain), 'showing_entries' => sprintf(__('Showing %s to %s of %s entries', ud_get_wp_property()->domain), '_START_', '_END_', '_TOTAL_'), 'showing_entries_null' => sprintf(__('Showing % to % of % entries', ud_get_wp_property()->domain), '0', '0', '0'), 'filtered_from_total' => sprintf(__('(filtered from %s total entries)', ud_get_wp_property()->domain), '_MAX_'), 'search' => __('Search:', ud_get_wp_property()->domain), 'display' => __('Display:', ud_get_wp_property()->domain), 'records' => __('records', ud_get_wp_property()->domain), 'all' => __('All', ud_get_wp_property()->domain)), 'feps' => array('unnamed_form' => __('Unnamed Form', ud_get_wp_property()->domain), 'form_could_not_be_removed_1' => __('Form could not be removed because of some server error.', ud_get_wp_property()->domain), 'form_could_not_be_removed_2' => __('Form could not be removed because form ID is undefined.', ud_get_wp_property()->domain)), 'fbtabs' => array('unnamed_canvas' => __('Unnamed Canvas', ud_get_wp_property()->domain)));
Пример #14
0
 /**
  * Register Meta Box for taxonomies on Edit Property Page
  *
  * @param $meta_boxes
  * @return array
  */
 public function add_meta_box($meta_boxes)
 {
     if (!is_array($meta_boxes)) {
         $meta_boxes = array();
     }
     $type = false;
     if (isset($_REQUEST['post']) && is_numeric($_REQUEST['post'])) {
         $post_id = $_REQUEST['post'];
         $type = get_post_meta($post_id, 'property_type', true);
     }
     $taxonomies = $this->get('config.taxonomies', array());
     $groups = $this->get('config.groups', array());
     $types = $this->get('config.types', array());
     $hidden = array();
     $inherited = array();
     if ($type) {
         $hidden = $this->get('config.hidden.' . $type, array());
         $inherited = $this->get('config.inherited.' . $type, array());
     }
     $fields = array();
     foreach ($taxonomies as $k => $d) {
         $field = array();
         switch (true) {
             // Hidden
             case in_array($k, $hidden):
                 // Ignore field, since it's hidden.
                 break;
             case in_array($k, $inherited):
                 $field = array('name' => $d['label'], 'id' => $k, 'type' => 'wpp_taxonomy_inherited', 'desc' => sprintf(__('The terms are inherited from Parent %s.', $this->get('domain')), \WPP_F::property_label()), 'options' => array('taxonomy' => $k, 'type' => 'inherited', 'args' => array()));
                 break;
             default:
                 /** Do no add taxonomy field if native meta box is being used for it. */
                 if ($d['show_ui']) {
                     break;
                 }
                 $field = array('name' => $d['label'], 'id' => $k, 'type' => 'taxonomy', 'multiple' => isset($types[$k]) && $types[$k] == 'unique' ? false : true, 'options' => array('taxonomy' => $k, 'type' => isset($d['hierarchical']) && $d['hierarchical'] == true ? 'select_tree' : 'select_advanced', 'args' => array()));
                 break;
         }
         if (!empty($field)) {
             $group = !empty($groups[$k]) ? $groups[$k] : '_general';
             $pushed = false;
             foreach ($meta_boxes as $k => $meta_box) {
                 if ($group == $meta_box['id']) {
                     if (!isset($meta_boxes[$k]['fields']) || !is_array($meta_boxes[$k]['fields'])) {
                         $meta_boxes[$k]['fields'] = array();
                     }
                     array_push($meta_boxes[$k]['fields'], $field);
                     $pushed = true;
                     break;
                 }
             }
             if (!$pushed) {
                 array_push($fields, $field);
             }
         }
     }
     /** It may happen only if we could not find related group. */
     if (!empty($fields)) {
         $taxonomy_box = array('id' => '_terms', 'title' => __('Taxonomies', ud_get_wpp_terms()->domain), 'pages' => array('property'), 'context' => 'advanced', 'priority' => 'low', 'fields' => $fields);
         $_meta_boxes = array();
         $added = false;
         foreach ($meta_boxes as $meta_box) {
             /** We want to add Taxonomies under General Meta Box */
             array_push($_meta_boxes, $meta_box);
             if ($meta_box['id'] == '_general') {
                 array_push($_meta_boxes, $taxonomy_box);
                 $added = true;
             }
         }
         /* In case we did not add meta box, we do it at last. */
         if (!$added) {
             array_push($_meta_boxes, $taxonomy_box);
         }
         $meta_boxes = $_meta_boxes;
     }
     return $meta_boxes;
 }
 /**
  * Init
  */
 public function __construct()
 {
     parent::__construct('wpp_property_stats', $name = sprintf(__('%1s Attributes', ud_get_wp_property()->domain), \WPP_F::property_label()), array('description' => __('Widget for Single Property page that renders property attributes table.', ud_get_wp_property()->domain)));
 }
 /**
  * Add Meta Boxes to All Properties page.
  */
 public function add_meta_boxes()
 {
     $screen = get_current_screen();
     add_meta_box('posts_list', __('Overview', ud_get_wp_property('domain')), array($this, 'render_list_table'), $screen->id, 'normal');
     add_meta_box('posts_filter', sprintf(__('%s Search', ud_get_wp_property('domain')), \WPP_F::property_label('plural')), array($this, 'render_filter'), $screen->id, 'side');
 }
Пример #17
0
 /**
  *
  * @author peshkov@UD
  * @since 1.38
  */
 public static function feps_post_created($post_id, $args = array())
 {
     global $wp_post_statuses;
     $notification = self::_notification_template();
     $_property = WPP_F::get_property($post_id, array('get_children' => 'false'));
     $user_id = $_property['post_author'];
     $user = get_user_by('id', $user_id);
     $notification['trigger_action'] = 'pending_property_added';
     $notification['user'] = $user;
     $notification['subject'] = __('Submission Received', ud_get_wp_property()->domain);
     $notification['message'] = sprintf(__('Hello.%1$s%1$sYour %2$s has been received.%1$s%1$sYou can view it using this URL:%1$s[pending_url]', ud_get_wp_property()->domain), PHP_EOL, WPP_F::property_label('singular'));
     $notification['crm_log_message'] = sprintf(__('User submitted %1$s ([property_title]) using FEPS.', ud_get_wp_property()->domain), WPP_F::property_label('singular'));
     $notification['data']['notification_type'] = __('Submission Received', ud_get_wp_property()->domain);
     $notification['data']['display_name'] = $user->data->display_name;
     $notification['data']['user_email'] = $user->data->user_email;
     $notification['data']['site_url'] = site_url();
     $notification['data']['pending_url'] = class_wpp_feps::get_feps_permalink($_property, false);
     $notification['data']['title'] = $notification['data']['property_title'] = $_property['post_title'];
     $notification['data']['status'] = @$wp_post_statuses[$_property['post_status']]->label;
     $notification = WPP_F::array_merge_recursive_distinct($notification, $args);
     self::_send_notification($notification);
 }
Пример #18
0
    /**
     * @see WP_Widget::form
     */
    function form($instance)
    {
        global $wp_properties;
        $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
        $amount_items = isset($instance['amount_items']) ? esc_attr($instance['amount_items']) : false;
        $address_format = !empty($instance['address_format']) ? $instance['address_format'] : "[street_number] [street_name],[city], [state]";
        $instance_stats = isset($instance['stats']) ? $instance['stats'] : array();
        $image_type = isset($instance['image_type']) ? esc_attr($instance['image_type']) : false;
        $hide_image = isset($instance['hide_image']) ? $instance['hide_image'] : false;
        $show_title = isset($instance['show_title']) ? $instance['show_title'] : false;
        $enable_more = isset($instance['enable_more']) ? $instance['enable_more'] : false;
        $enable_view_all = isset($instance['enable_view_all']) ? $instance['enable_view_all'] : false;
        $property_stats = isset($wp_properties['property_stats']) ? $wp_properties['property_stats'] : array();
        if (!isset($property_stats['property_type'])) {
            $property_stats['property_type'] = sprintf(__('%s Type', ud_get_wp_property()->domain), WPP_F::property_label());
        }
        ?>
    <script type="text/javascript">
      //hide and show dropdown whith thumb settings
      jQuery( document ).ready( function ( $ ) {
        jQuery( 'input.check_me' ).change( function () {
          if ( $( this ).attr( 'checked' ) !== true ) {
            jQuery( 'p#choose_thumb' ).css( 'display', 'block' );
          } else {
            jQuery( 'p#choose_thumb' ).css( 'display', 'none' );
          }
        } );
      } );
    </script>
    <p>
      <label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title:', ud_get_wp_property()->domain);
        ?>
        <input class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
"
               name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text"
               value="<?php 
        echo !empty($title) ? $title : __('Latest Properties', ud_get_wp_property()->domain);
        ?>
"/>
      </label>
    </p>
    <p>
      <label for="<?php 
        echo $this->get_field_id('hide_image');
        ?>
">
        <input id="<?php 
        echo $this->get_field_id('hide_image');
        ?>
" class="check_me"
               name="<?php 
        echo $this->get_field_name('hide_image');
        ?>
" type="checkbox"
               value="on" <?php 
        if ($hide_image == 'on') {
            echo " checked='checked';";
        }
        ?>
 />
        <?php 
        _e('Hide Images?', ud_get_wp_property()->domain);
        ?>
      </label>
    </p>
    <p id="choose_thumb" <?php 
        echo $hide_image !== 'on' ? 'style="display:block;"' : 'style="display:none;"';
        ?>
>
      <label for="<?php 
        echo $this->get_field_id('image_type');
        ?>
"><?php 
        _e('Image Size:', ud_get_wp_property()->domain);
        ?>
        <?php 
        WPP_F::image_sizes_dropdown("name=" . $this->get_field_name('image_type') . "&selected=" . $image_type);
        ?>
      </label>
    </p>
    <p>
      <label for="<?php 
        echo $this->get_field_id('per_page');
        ?>
"><?php 
        _e('Listings to display?', ud_get_wp_property()->domain);
        ?>
        <input style="width:30px" id="<?php 
        echo $this->get_field_id('amount_items');
        ?>
"
               name="<?php 
        echo $this->get_field_name('amount_items');
        ?>
" type="text"
               value="<?php 
        echo empty($amount_items) ? 5 : $amount_items;
        ?>
"/>
      </label>
    </p>
    <p><?php 
        _e('Select stats you want to display', ud_get_wp_property()->domain);
        ?>
</p>
    <p>
      <label for="<?php 
        echo $this->get_field_id('show_title');
        ?>
">
        <input id="<?php 
        echo $this->get_field_id('show_title');
        ?>
"
               name="<?php 
        echo $this->get_field_name('show_title');
        ?>
" type="checkbox"
               value="on" <?php 
        if ($show_title == 'on') {
            echo " checked='checked';";
        }
        ?>
 />
        <?php 
        _e('Title', ud_get_wp_property()->domain);
        ?>
      </label>
      <?php 
        foreach ($property_stats as $stat => $label) {
            ?>
        <br/>
        <label for="<?php 
            echo $this->get_field_id('stats');
            ?>
_<?php 
            echo $stat;
            ?>
">
          <input id="<?php 
            echo $this->get_field_id('stats');
            ?>
_<?php 
            echo $stat;
            ?>
"
                 name="<?php 
            echo $this->get_field_name('stats');
            ?>
[]" type="checkbox" value="<?php 
            echo $stat;
            ?>
"
          <?php 
            if (is_array($instance_stats) && in_array($stat, $instance_stats)) {
                echo " checked ";
            }
            ?>
">
          <?php 
            echo $label;
            ?>
        </label>
      <?php 
        }
        ?>
    </p>
    <p>
      <label for="<?php 
        echo $this->get_field_id('address_format');
        ?>
"><?php 
        _e('Address Format:', ud_get_wp_property()->domain);
        ?>
        <textarea style="width: 100%" id="<?php 
        echo $this->get_field_id('address_format');
        ?>
"
                  name="<?php 
        echo $this->get_field_name('address_format');
        ?>
"><?php 
        echo $address_format;
        ?>
</textarea>
      </label>
    </p>
    <p>
      <label for="<?php 
        echo $this->get_field_id('enable_more');
        ?>
">
        <input id="<?php 
        echo $this->get_field_id('enable_more');
        ?>
"
               name="<?php 
        echo $this->get_field_name('enable_more');
        ?>
" type="checkbox"
               value="on" <?php 
        if ($enable_more == 'on') {
            echo " checked='checked';";
        }
        ?>
 />
        <?php 
        _e('Show "More" link?', ud_get_wp_property()->domain);
        ?>
      </label>
    </p>
    <p>
      <label for="<?php 
        echo $this->get_field_id('enable_view_all');
        ?>
">
        <input id="<?php 
        echo $this->get_field_id('enable_view_all');
        ?>
"
               name="<?php 
        echo $this->get_field_name('enable_view_all');
        ?>
" type="checkbox"
               value="on" <?php 
        if ($enable_view_all == 'on') {
            echo " checked='checked';";
        }
        ?>
 />
        <?php 
        _e('Show "View All" link?', ud_get_wp_property()->domain);
        ?>
      </label>
    </p>
  <?php 
    }
Пример #19
0
 /**
  * Init
  */
 public function __construct()
 {
     $options = array('id' => 'property_map', 'params' => array('property_id' => array('name' => sprintf(__('%s ID', ud_get_wp_property('domain')), \WPP_F::property_label()), 'description' => sprintf(__('If empty, current %s will be used.', ud_get_wp_property()->domain), \WPP_F::property_label()), 'type' => 'text', 'default' => ''), 'width' => array('name' => __('Width', ud_get_wp_property()->domain), 'description' => __('Set width of map. (e.g. 100%, 500px)', ud_get_wp_property()->domain), 'type' => 'text', 'default' => '100%'), 'height' => array('name' => __('Height', ud_get_wp_property()->domain), 'description' => __('Set height of map. (e.g. 500px)', ud_get_wp_property()->domain), 'type' => 'text', 'default' => '450px'), 'zoom_level' => array('name' => __('Zoom Level', ud_get_wp_property()->domain), 'description' => __('Set level of map zoom', ud_get_wp_property()->domain), 'type' => 'number', 'min' => '1', 'default' => '13'), 'hide_infobox' => array('name' => __('Hide Infobox', ud_get_wp_property()->domain), 'description' => __('Set infobox hidden or not', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('true' => __('Yes', ud_get_wp_property()->domain), 'false' => __('No', ud_get_wp_property()->domain)), 'default' => 'false')), 'description' => sprintf(__('Renders %s Map', ud_get_wp_property()->domain), \WPP_F::property_label()), 'group' => 'WP-Property');
     parent::__construct($options);
 }
Пример #20
0
 /**
  * Construct
  */
 function __construct()
 {
     parent::__construct(false, $name = sprintf(__('%1s Gallery', ud_get_wp_property()->domain), WPP_F::property_label()), array('description' => __('List of all images attached to the current property', ud_get_wp_property()->domain)));
 }
Пример #21
0
 /**
  * Init
  */
 public function __construct()
 {
     $options = array('id' => 'property_attribute', 'params' => array('attribute' => array('type' => 'text', 'name' => __('Attribute', ud_get_wp_property()->domain), 'description' => __('Renders single attribute data', ud_get_wp_property()->domain), 'default' => ''), 'before' => array('type' => 'text', 'name' => __('Before', ud_get_wp_property()->domain), 'description' => __('Before attribute', ud_get_wp_property()->domain), 'default' => ''), 'after' => array('type' => 'text', 'name' => __('After', ud_get_wp_property()->domain), 'description' => __('After attribute', ud_get_wp_property()->domain), 'default' => ''), 'if_empty' => array('type' => 'text', 'name' => __('If Empty', ud_get_wp_property()->domain), 'description' => __('What to show if attribute is empty', ud_get_wp_property()->domain), 'default' => ''), 'do_not_format' => array('type' => 'text', 'name' => __('Do not format', ud_get_wp_property()->domain), 'description' => __('Uh?', ud_get_wp_property()->domain), 'default' => ''), 'make_terms_links' => array('type' => 'select', 'name' => __('Make links of terms', ud_get_wp_property()->domain), 'description' => __('Make links of terms', ud_get_wp_property()->domain), 'options' => array('true' => __('Yes', ud_get_wp_property()->domain), 'false' => __('No', ud_get_wp_property()->domain)), 'default' => 'false'), 'separator' => array('type' => 'text', 'name' => __('Separator', ud_get_wp_property()->domain), 'description' => __('Separator', ud_get_wp_property()->domain), 'default' => ' '), 'strip_tags' => array('type' => 'text', 'name' => __('Strip Tags', ud_get_wp_property()->domain), 'description' => __('Strip tags', ud_get_wp_property()->domain), 'default' => '')), 'description' => sprintf(__('Renders %s Attribute', ud_get_wp_property()->domain), \WPP_F::property_label()), 'group' => 'WP-Property');
     parent::__construct($options);
 }
Пример #22
0
?>
</pre>
      </div>

      <div class="wpp_settings_block">
        <?php 
_e('Clear WPP Cache. Some shortcodes and widgets use cache, so the good practice is clear it after widget, shortcode changes.', ud_get_wp_property()->domain);
?>
        <input type="button" class="button" value="<?php 
_e('Clear Cache', ud_get_wp_property()->domain);
?>
" id="wpp_clear_cache">
      </div>

      <div class="wpp_settings_block"><?php 
printf(__('Set all %1s to same %2s type:', ud_get_wp_property()->domain), WPP_F::property_label('plural'), WPP_F::property_label('singular'));
?>
        <select id="wpp_ajax_max_set_property_type_type">
        <?php 
foreach ($wp_properties['property_types'] as $p_slug => $p_label) {
    ?>
          <option value="<?php 
    echo $p_slug;
    ?>
"><?php 
    echo $p_label;
    ?>
</option>
        <?php 
}
?>
Пример #23
0
    function draw_property_search_form($args = false)
    {
        global $wp_properties;
        WPP_F::force_script_inclusion('wpp-jquery-number-format');
        $args = wp_parse_args($args, array('search_attributes' => false, 'searchable_property_types' => false, 'use_pagination' => 'on', 'per_page' => '10', 'group_attributes' => false, 'strict_search' => false, 'instance_id' => false, 'sort_order' => false, 'cache' => true));
        if (empty($args['search_attributes']) && isset($args['searchable_attributes'])) {
            $args['search_attributes'] = $args['searchable_attributes'];
        }
        extract($args, EXTR_SKIP);
        $search_values = array();
        $property_type_flag = false;
        //** Bail if no search attributes passed */
        if (!is_array($args['search_attributes'])) {
            return;
        }
        $property_stats = $wp_properties['property_stats'];
        if (!isset($property_stats['property_type'])) {
            $property_stats['property_type'] = sprintf(__('%s Type', ud_get_wp_property()->domain), WPP_F::property_label());
        }
        //** Load search values for attributes (from cache, or generate) */
        if (!empty($search_attributes) && !empty($searchable_property_types)) {
            $search_values = WPP_F::get_search_values($search_attributes, $searchable_property_types, $args['cache'], $args['instance_id']);
        }
        //** This looks clumsy - potanin@UD */
        if (array_key_exists('property_type', array_fill_keys($search_attributes, 1)) && is_array($searchable_property_types) && count($searchable_property_types) > 1) {
            $spt = array_fill_keys($searchable_property_types, 1);
            if (!empty($wp_properties['property_types'])) {
                foreach ($wp_properties['property_types'] as $key => $value) {
                    if (array_key_exists($key, $spt)) {
                        $search_values['property_type'][$key] = $value;
                    }
                }
                if (isset($search_values['property_type']) && count($search_values['property_type']) <= 1) {
                    unset($search_values['property_type']);
                }
            }
        }
        ?>

    <form action="<?php 
        echo WPP_F::base_url($wp_properties['configuration']['base_slug']);
        ?>
" method="post" class="wpp_shortcode_search_form">
      <?php 
        do_action("draw_property_search_form", $args);
        ?>
      <?php 
        if ($sort_order) {
            ?>
        <input type="hidden" name="wpp_search[sort_order]" value="<?php 
            echo $sort_order;
            ?>
"/>
      <?php 
        }
        ?>
      <?php 
        if (!empty($sort_by)) {
            ?>
        <input type="hidden" name="wpp_search[sort_by]" value="<?php 
            echo $sort_by;
            ?>
"/>
      <?php 
        }
        ?>
      <?php 
        if (!empty($use_pagination)) {
            ?>
        <input type="hidden" name="wpp_search[pagination]" value="<?php 
            echo $use_pagination;
            ?>
"/>
      <?php 
        }
        ?>
      <?php 
        if (!empty($per_page)) {
            ?>
        <input type="hidden" name="wpp_search[per_page]" value="<?php 
            echo $per_page;
            ?>
"/>
      <?php 
        }
        ?>
      <?php 
        if (!empty($strict_search)) {
            ?>
        <input type="hidden" name="wpp_search[strict_search]" value="<?php 
            echo $strict_search;
            ?>
"/>
      <?php 
        }
        ?>
      <?php 
        //** If no property_type passed in search_attributes, we get defaults */
        if (is_array($searchable_property_types) && !array_key_exists('property_type', array_fill_keys($search_attributes, 1))) {
            echo '<input type="hidden" name="wpp_search[property_type]" value="' . implode(',', $searchable_property_types) . '" />';
        }
        ?>
      <ul class="wpp_search_elements">
    <?php 
        if (isset($group_attributes) && $group_attributes) {
            //** Get group data */
            $groups = $wp_properties['property_groups'];
            $_search_attributes = array();
            foreach ($search_attributes as $attr) {
                $_search_attributes[$attr] = $attr;
            }
            $search_groups = sort_stats_by_groups($_search_attributes);
            unset($_search_attributes);
        } else {
            //** Create an ad-hoc group */
            $search_groups['ungrouped'] = $search_attributes;
        }
        $main_stats_group = isset($wp_properties['configuration']['main_stats_group']) ? $wp_properties['configuration']['main_stats_group'] : false;
        $count = 0;
        foreach ($search_groups as $this_group => $search_attributes) {
            $count++;
            if ($this_group == 'ungrouped' || $this_group === 0 || $this_group == $main_stats_group) {
                $is_a_group = false;
                $this_group = 'not_a_group';
            } else {
                $is_a_group = true;
            }
            ?>
      <li class="wpp_search_group wpp_group_<?php 
            echo $this_group;
            ?>
">
      <?php 
            if ($is_a_group) {
                ?>
        <span class="wpp_search_group_title wpp_group_<?php 
                echo $this_group;
                ?>
_title"><?php 
                echo $groups[$this_group]['name'];
                ?>
</span>
      <?php 
            } elseif ($group_attributes && $count == count($search_groups)) {
                ?>
        <span class="wpp_search_group_title" style="height:1px;line-height:1px;">&nbsp;</span>
      <?php 
            }
            ?>
        <ul class="wpp_search_group wpp_group_<?php 
            echo $this_group;
            ?>
">
      <?php 
            //** Begin Group Attributes */
            foreach ($search_attributes as $attrib) {
                //** Override search values if they are set in the developer tab */
                if (!empty($wp_properties['predefined_search_values'][$attrib])) {
                    $maybe_search_values = explode(',', $wp_properties['predefined_search_values'][$attrib]);
                    if (is_array($maybe_search_values)) {
                        $using_predefined_values = true;
                        $search_values[$attrib] = $maybe_search_values;
                    } else {
                        $using_predefined_values = true;
                    }
                }
                //** Don't display search attributes that have no values */
                if (!apply_filters('wpp::show_search_field_with_no_values', isset($search_values[$attrib]), $attrib)) {
                    continue;
                }
                $label = apply_filters('wpp::search_attribute::label', empty($property_stats[$attrib]) ? WPP_F::de_slug($attrib) : $property_stats[$attrib], $attrib);
                ?>
        <li class="wpp_search_form_element seach_attribute_<?php 
                echo $attrib;
                ?>
  wpp_search_attribute_type_<?php 
                echo isset($wp_properties['searchable_attr_fields'][$attrib]) ? $wp_properties['searchable_attr_fields'][$attrib] : $attrib;
                ?>
 <?php 
                echo !empty($wp_properties['searchable_attr_fields'][$attrib]) && $wp_properties['searchable_attr_fields'][$attrib] == 'checkbox' ? 'wpp-checkbox-el' : '';
                echo !empty($wp_properties['searchable_attr_fields'][$attrib]) && ($wp_properties['searchable_attr_fields'][$attrib] == 'multi_checkbox' && count($search_values[$attrib]) == 1) || isset($wp_properties['searchable_attr_fields'][$attrib]) && $wp_properties['searchable_attr_fields'][$attrib] == 'checkbox' ? ' single_checkbox' : '';
                ?>
">
          <?php 
                $random_element_id = 'wpp_search_element_' . rand(1000, 9999);
                ?>

          <label for="<?php 
                echo $random_element_id;
                ?>
" class="wpp_search_label wpp_search_label_<?php 
                echo $attrib;
                ?>
"><?php 
                echo $label;
                ?>
<span class="wpp_search_post_label_colon">:</span></label>

          <div class="wpp_search_attribute_wrap">
            <?php 
                $value = isset($_REQUEST['wpp_search'][$attrib]) ? $_REQUEST['wpp_search'][$attrib] : '';
                ob_start();
                wpp_render_search_input(array('attrib' => $attrib, 'random_element_id' => $random_element_id, 'search_values' => $search_values, 'value' => $value));
                $this_field = ob_get_contents();
                ob_end_clean();
                echo apply_filters('wpp_search_form_field_' . $attrib, $this_field, $attrib, $label, $value, isset($wp_properties['searchable_attr_fields'][$attrib]) ? $wp_properties['searchable_attr_fields'][$attrib] : false, $random_element_id);
                ?>
          </div>
          <div class="clear"></div>
          </li>
      <?php 
            }
            //** End Group Attributes */
            ?>
      </ul>
      <div class="clear"></div>
      </li>
    <?php 
        }
        ?>
        <li class="wpp_search_form_element submit"><input type="submit" class="wpp_search_button submit btn btn-large" value="<?php 
        _e('Search', ud_get_wp_property()->domain);
        ?>
"/></li>
    </ul>
    </form>
  <?php 
    }
Пример #24
0
 /**
  * Creates new property based on existing one (clones).
  *
  * @param $args
  * @return array
  * @throws \Exception
  */
 public function action_wpp_clone_property($args)
 {
     if (empty($args['post_id']) || !is_numeric($args['post_id'])) {
         throw new \Exception(__('Invalid Post ID', ud_get_wp_property('domain')));
     }
     if (get_post_type($args['post_id']) !== 'property') {
         throw new \Exception(sprintf(__('Invalid Post ID. It does not belong to %s.', ud_get_wp_property('domain')), \WPP_F::property_label()));
     }
     $post = get_post($args['post_id'], ARRAY_A);
     /* Clone Property */
     $postmap = array('post_title', 'post_content', 'post_excerpt', 'ping_status', 'comment_status', 'post_type', 'post_status', 'comment_status', 'post_parent');
     $_post = array();
     foreach ($post as $k => $v) {
         if (in_array($k, $postmap)) {
             switch ($k) {
                 case 'post_title':
                     $v .= ' (' . __('Clone', ud_get_wp_property('domain')) . ')';
                 default:
                     $_post[$k] = $v;
                     break;
             }
         }
     }
     $post_id = wp_insert_post($_post);
     /* Clone Property Attributes and Meta */
     if (is_wp_error($post_id) || !$post_id) {
         throw new \Exception(__('Could not create new Post.', ud_get_wp_property('domain')));
     }
     $meta = array_unique(array_merge(array('property_type'), array_keys(ud_get_wp_property('property_stats', array())), array_keys(ud_get_wp_property('property_meta', array()))));
     foreach ($meta as $key) {
         $v = get_post_meta($post['ID'], $key, true);
         add_post_meta($post_id, $key, $v);
     }
     /* Probably add custom actions ( e.g. by Add-on ) */
     do_action('wpp::clone_property::action', $post, $post_id);
     return array('post_id' => $post_id, 'redirect' => admin_url('post.php?post=' . $post_id . '&action=edit'));
 }
Пример #25
0
 /**
  * init
  */
 public function __construct()
 {
     $options = array('id' => 'list_attachments', 'params' => array('type' => array('name' => __('Type', ud_get_wp_property()->domain), 'description' => __('Comma-separated list of file extensions that should be included in the list', ud_get_wp_property()->domain), 'type' => 'text', 'default' => ''), 'sort_order' => array('name' => __('Sort Order', ud_get_wp_property()->domain), 'description' => __('Indicate whether the list should be sorted in ascending or descending order.', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('ASC' => 'ASC', 'DESC' => 'DESC'), 'default' => 'ASC'), 'groupby' => array('name' => __('Group By', ud_get_wp_property()->domain), 'description' => sprintf(__('If you would like the list split into specific groups, you can indicate any of the WordPress post object parameters as the value of this %s. For instance, you can use a common <b>%s</b> for your attachments to organize them into groups. In that case, you would use <b>%s</b> as the <b>%s</b> parameter for this shortcode or widget.', ud_get_wp_property()->domain), \WPP_F::property_label(), 'description', 'post_content', 'groupby'), 'type' => 'text', 'default' => ''), 'opening' => array('name' => __('Opening List', ud_get_wp_property()->domain), 'description' => __('Any HTML code you want to appear before the list begins opening - the opening tag(s) for the list.', ud_get_wp_property()->domain), 'type' => 'text', 'default' => '<ul class="attachment-list wpp_attachment_list">'), 'closing' => array('name' => __('CLosing List', ud_get_wp_property()->domain), 'description' => __('The closing tag(s) for the list.', ud_get_wp_property()->domain), 'type' => 'text', 'default' => '</ul>'), 'before_item' => array('name' => __('Before Item', ud_get_wp_property()->domain), 'description' => __('The opening tag(s) for each item of the list.', ud_get_wp_property()->domain), 'type' => 'text', 'default' => '<li>'), 'after_item' => array('name' => __('After Item', ud_get_wp_property()->domain), 'description' => __('The closing tag(s) for each item of the list.', ud_get_wp_property()->domain), 'type' => 'text', 'default' => '</li>')), 'description' => sprintf(__('Used to display attachments of a %s, can also be used in a post. Ported over from List Attachments Shortcode plugin.  If plugin exists, the WP-Property version of shortcode is not loaded.', ud_get_wp_property()->domain), \WPP_F::property_label()), 'group' => 'WP-Property');
     parent::__construct($options);
 }
<?php

/**
 * Settings 'Developer' Tab
 * Section 'Meta'
 */
global $wp_properties;
?>
<h3><?php 
printf(__('%1s Meta', ud_get_wp_property()->domain), WPP_F::property_label());
?>
</h3>
<p><?php 
_e('Meta is used for descriptions,  on the back-end  meta fields will be displayed as textareas.  On the front-end they will be displayed as individual sections.', ud_get_wp_property()->domain);
?>
</p>
<p><i><?php 
_e('<b>Note!</b> Meta is deprecated from WP-Property 2.0. You can continue using it, however we recommend you to use Attribute with Data Entry \'Textarea\' or \'Text Editor\' instead of new meta fields.', ud_get_wp_property()->domain);
?>
</i></p>

<table id="wpp_inquiry_meta_fields" class="ud_ui_dynamic_table widefat">
  <thead>
  <tr>
    <th class='wpp_draggable_handle'>&nbsp;</th>
    <th class='wpp_attribute_name_col'><?php 
_e('Attribute Name', ud_get_wp_property()->domain);
?>
</th>
    <th class='wpp_attribute_slug_col'><?php 
_e('Attribute Slug', ud_get_wp_property()->domain);
    echo isset($wp_properties['configuration']['default_image']['types'][$property_slug]['url']) ? $wp_properties['configuration']['default_image']['types'][$property_slug]['url'] : '';
    ?>
">
          <input type="hidden" name="wpp_settings[configuration][default_image][types][<?php 
    echo $property_slug;
    ?>
][id]" class="input-image-id" value="<?php 
    echo isset($wp_properties['configuration']['default_image']['types'][$property_slug]['id']) ? $wp_properties['configuration']['default_image']['types'][$property_slug]['id'] : '';
    ?>
">
          <div class="image-actions">
            <input type="button" class="button-secondary button-setup-image" value="<?php 
    _e('Setup Image', ud_get_wp_property('domain'));
    ?>
" title="<?php 
    printf(__('If %1$s has no any image, the default one based on %1$s Type will be shown.', ud_get_wp_property('domain')), \WPP_F::property_label());
    ?>
">
          </div>
          <div class="image-wrapper"></div>
        </div>
      </td>

      <td>
        <ul>
          <li>
            <label for="<?php 
    echo $property_slug;
    ?>
_searchable_property_types">
              <input class="slug" id="<?php 
<?php

/**
 * Settings 'Developer' Tab
 * Section 'Attributes'
 */
global $wp_properties;
?>
<div>
  <h3 style="float:left;"><?php 
printf(__('%1s Attributes', ud_get_wp_property()->domain), WPP_F::property_label());
?>
</h3>
  <div class="wpp_property_stat_functions">
    <input type="button" class="wpp_all_advanced_settings button-secondary" action="expand" value="<?php 
_e('Expand all', ud_get_wp_property()->domain);
?>
" />
    <input type="button" class="wpp_all_advanced_settings button-secondary" action="collapse" value="<?php 
_e('Collapse all', ud_get_wp_property()->domain);
?>
" />
    <input type="button" class="sort_stats_by_groups button-secondary" value="<?php 
_e('Sort by Groups', ud_get_wp_property()->domain);
?>
"/>
  </div>
  <div class="clear"></div>
</div>

<table id="wpp_inquiry_attribute_fields" class="wpp_inquiry_attribute_fields ud_ui_dynamic_table widefat" allow_random_slug="true">
Пример #29
0
 /**
  * Constructor
  * Sets default data.
  *
  *
  * @todo For the love of god, only apply the defaults on installation. - potanin@UD
  * @param bool $args
  */
 public function __construct($args = false)
 {
     global $wp_properties;
     //** STEP 1. Default */
     parent::__construct($args);
     //** STEP 2. */
     $data = array();
     //** This slug will be used to display properties on the front-end.  Most likely overwriten by get_option('wpp_settings'); */
     $data['configuration'] = array('autoload_css' => 'true', 'automatically_insert_overview' => 'true', 'base_slug' => 'property', 'currency_symbol' => '$', 'address_attribute' => 'location', 'google_maps_localization' => 'en', 'display_address_format' => '[city], [state]');
     //** Default setings for [property_overview] shortcode */
     $data['configuration']['property_overview'] = array('thumbnail_size' => 'tiny_thumb', 'fancybox_preview' => 'true', 'display_slideshow' => 'false', 'show_children' => 'true');
     $data['configuration']['single_property_view'] = array('map_image_type' => 'tiny_thumb', 'gm_zoom_level' => '13');
     //** Default setings for admin UI */
     $data['configuration']['admin_ui'] = array('overview_table_thumbnail_size' => 'tiny_thumb');
     $data['default_coords']['latitude'] = '57.7973333';
     $data['default_coords']['longitude'] = '12.0502107';
     //** Geo type attributes are predefined and should not be editable on property adding/updating */
     // @notice All these fields are automatically added as post_meta on revalidation.
     $data['geo_type_attributes'] = array('formatted_address', 'street_number', 'route', 'district', 'city', 'county', 'state', 'state_code', 'country', 'country_code', 'postal_code');
     //** Image URLs. */
     $data['images']['map_icon_shadow'] = WPP_URL . "images/map_icon_shadow.png";
     $data['configuration']['google_maps']['infobox_settings'] = array('show_direction_link' => true, 'show_property_title' => true);
     //** Default attribute label descriptions for the back-end */
     $data['descriptions'] = array('descriptions' => array('property_type' => sprintf(__('The %s type will determine the layout.', ud_get_wp_property()->domain), \WPP_F::property_label()), 'custom_attribute_overview' => __('Customize what appears in search results in the attribute section.  For example: 1bed, 2baths, area varies slightly.', ud_get_wp_property()->domain), 'tagline' => __('Will appear on overview pages and on top of every listing page.', ud_get_wp_property()->domain)));
     $_stored_settings = $this->get();
     //** Merge with default data. */
     $this->set(\UsabilityDynamics\Utility::extend($data, $this->get()));
     // Check if settings have or have been upated. (we determine if configuration is good)
     // @todo Add a better _version_ check.
     if (isset($_stored_settings['_updated']) && isset($_stored_settings['version']) && $_stored_settings['version'] === '2.0.0') {
         return $wp_properties = $this->get();
     }
     // Continue on to load/enforce defaults.
     //** STEP 3. */
     //** Setup default property types to be used. */
     $d = $this->get('property_types', false);
     // Should only be set on install, not added on every request. These literally can not be removed from settings... -potanin@UD
     // It is adding these defaults only if types are empty (install) - korotkov@UD
     if (empty($d) || !is_array($d)) {
         $this->set('property_types', array('building' => __('Building', ud_get_wp_property()->domain), 'floorplan' => __('Floorplan', ud_get_wp_property()->domain), 'single_family_home' => __('Single Family Home', ud_get_wp_property()->domain)));
     }
     //** Setup property types to be used. */
     $d = !$this->get('property_inheritance', false);
     if (!$d || !is_array($d)) {
         $this->set('property_inheritance', array('floorplan' => array('street_number', 'route', 'state', 'postal_code', 'location', 'display_address', 'address_is_formatted')));
     }
     //** Property stats. Can be searchable, displayed as input boxes on editing page. */
     $d = $this->get('property_stats', false);
     if (!$d || !is_array($d)) {
         $this->set('property_stats', array('location' => __('Address', ud_get_wp_property()->domain), 'price' => __('Price', ud_get_wp_property()->domain), 'deposit' => __('Deposit', ud_get_wp_property()->domain), 'area' => __('Area', ud_get_wp_property()->domain), 'phone_number' => __('Phone Number', ud_get_wp_property()->domain)));
     }
     //** Property meta.  Typically not searchable, displayed as textarea on editing page. */
     $d = $this->get('property_meta', false);
     if (!$d || !is_array($d)) {
         $this->set('property_meta', array('lease_terms' => __('Lease Terms', ud_get_wp_property()->domain), 'pet_policy' => __('Pet Policy', ud_get_wp_property()->domain), 'school' => __('School', ud_get_wp_property()->domain), 'tagline' => __('Tagline', ud_get_wp_property()->domain)));
     }
     //** On property editing page - determines which fields to hide for a particular property type */
     $d = $this->get('hidden_attributes', false);
     if (!is_array($d)) {
         $this->set('hidden_attributes', array('floorplan' => array('location', 'parking', 'school'), 'building' => array('price', 'bedrooms', 'bathrooms', 'area', 'deposit'), 'single_family_home' => array('deposit', 'lease_terms', 'pet_policy')));
     }
     //** Determines property types that have addresses. */
     $d = $this->get('location_matters', false);
     if (!is_array($d)) {
         $this->set('location_matters', array('building', 'single_family_home'));
     }
     //** Determine which property types should actually be searchable. */
     $d = $this->get('searchable_property_types', false);
     if (!is_array($d)) {
         $this->set('searchable_property_types', array('floorplan', 'single_family_home'));
     }
     //** Attributes to use in searching. */
     $d = $this->get('searchable_attributes', false);
     if (!is_array($d)) {
         $this->set('searchable_attributes', array('area', 'deposit', 'bedrooms', 'bathrooms', 'city', 'price'));
     }
     //** Convert phrases to searchable values.  Converts string stats into numeric values for searching and filtering. */
     $d = $this->get('search_conversions', false);
     if (!is_array($d)) {
         $this->set('search_conversions', array('bedrooms' => array(__('Studio', ud_get_wp_property()->domain) => '0.5')));
     }
     //** Don't load defaults if settings exist in db */
     $d = $this->get('image_sizes', false);
     if (!is_array($d)) {
         $this->set('image_sizes', array('map_thumb' => array('width' => '75', 'height' => '75'), 'tiny_thumb' => array('width' => '100', 'height' => '100'), 'sidebar_wide' => array('width' => '195', 'height' => '130'), 'slideshow' => array('width' => '640', 'height' => '235')));
     }
     $d = $this->get('configuration.google_maps.infobox_attributes', false);
     if (!is_array($d)) {
         $this->set('configuration.google_maps.infobox_attributes', array('bedrooms', 'bathrooms', 'price'));
     }
     //** STEP 4. */
     $wp_properties = $this->get();
 }
Пример #30
0
 /**
  * Return RWMB Field for Property Type
  *
  */
 public function get_property_type_field($post)
 {
     $types = ud_get_wp_property('property_types', array());
     if (empty($types)) {
         return false;
     }
     if (count($types) > 1) {
         $types = array_merge(array('' => __('No Selected', ud_get_wp_property()->domain)), $types);
         $field = array('id' => 'property_type', 'name' => sprintf(__('%s Type', ud_get_wp_property()->domain), \WPP_F::property_label()), 'type' => 'select', 'options' => $types);
     } else {
         $field = array('id' => 'property_type', 'type' => 'hidden', 'std' => key($types));
     }
     return $field;
 }