コード例 #1
0
ファイル: class-upgrade.php プロジェクト: Juni4567/mycashflow
 /**
  * Run Upgrade Process
  *
  * @param $old_version
  * @param $new_version
  */
 public static function run($old_version, $new_version)
 {
     self::do_backup($old_version, $new_version);
     /**
      * WP-Property 1.42.4 and less compatibility
      */
     update_option("wpp_version", $new_version);
     /**
      * Specific upgrade conditions.
      */
     switch (true) {
         case version_compare($old_version, '2.1.1', '<'):
             /*
              * Enable Legacy Features
              */
             $settings = get_option('wpp_settings');
             if (!empty($settings['configuration'])) {
                 $settings['configuration']['enable_legacy_features'] = 'true';
             }
             update_option('wpp_settings', $settings);
             break;
     }
     /* Additional stuff can be handled here */
     do_action(ud_get_wp_property()->slug . '::upgrade', $old_version, $new_version);
 }
コード例 #2
0
 /**
  * Get meta value
  *
  * @param int $post_id
  * @param bool $saved
  * @param array $field
  *
  * @return mixed
  */
 static function meta($post_id, $saved, $field)
 {
     /**
      * For special fields like 'divider', 'heading' which don't have ID, just return empty string
      * to prevent notice error when displayin fields
      */
     if (empty($field['id'])) {
         return '';
     }
     /**
      * Maybe set value from parent
      */
     $post = get_post($post_id);
     if ($post && $post->post_parent > 0) {
         $property_inheritance = ud_get_wp_property('property_inheritance', array());
         $type = get_post_meta($post_id, 'property_type', true);
         if (isset($property_inheritance[$type]) && in_array($field['id'], $property_inheritance[$type])) {
             $meta = get_post_meta($post->post_parent, $field['id'], !$field['multiple']);
         }
     }
     if (!$meta) {
         $meta = get_post_meta($post_id, $field['id'], !$field['multiple']);
     }
     // Use $field['std'] only when the meta box hasn't been saved (i.e. the first time we run)
     $meta = !$saved && '' === $meta || array() === $meta ? $field['std'] : $meta;
     // Escape attributes
     $meta = call_user_func(array(RW_Meta_Box::get_class_name($field), 'esc_meta'), $meta);
     return $meta;
 }
コード例 #3
0
    /**
     * Renders form based on Shortcode's params
     *
     * @param array $instance
     */
    public function form($instance)
    {
        ?>
      <p>
        <label class="widefat" for="<?php 
        echo $this->get_field_id('_widget_title');
        ?>
"><?php 
        _e('Title', ud_get_wp_property('domain'));
        ?>
</label>
        <input class="widefat" id="<?php 
        echo $this->get_field_id('_widget_title');
        ?>
"
               name="<?php 
        echo $this->get_field_name('_widget_title');
        ?>
" type="text"
               value="<?php 
        echo !empty($instance['_widget_title']) ? $instance['_widget_title'] : '';
        ?>
"/>
        <span class="description"><?php 
        _e('Widget\'s Title', ud_get_wp_property('domain'));
        ?>
</span>
      </p>
      <?php 
        parent::form($instance);
    }
コード例 #4
0
 /**
  * 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();
     }
 }
コード例 #5
0
 /**
  * Run Upgrade Process
  *
  * @param $old_version
  * @param $new_version
  */
 public static function run($old_version, $new_version)
 {
     self::do_backup($old_version, $new_version);
     /**
      * WP-Property 1.42.4 and less compatibility
      */
     update_option("wpp_version", $new_version);
     /**
      * Specific upgrade conditions.
      */
     switch (true) {
         case version_compare($old_version, '2.1.1', '<'):
             /*
              * Enable Legacy Features
              */
             $settings = get_option('wpp_settings');
             if (!empty($settings['configuration'])) {
                 $settings['configuration']['enable_legacy_features'] = 'true';
             }
             update_option('wpp_settings', $settings);
         case version_compare($old_version, '2.1.3', '<'):
             /*
              * Set default pagination type 'slider'
              * to prevent issues on already existing sites.
              */
             $settings = get_option('wpp_settings');
             $settings['configuration']['property_overview']['pagination_type'] = 'slider';
             update_option('wpp_settings', $settings);
     }
     /* Additional stuff can be handled here */
     do_action(ud_get_wp_property()->slug . '::upgrade', $old_version, $new_version);
 }
コード例 #6
0
 /**
  * Get meta value
  *
  * @param int $post_id
  * @param bool $saved
  * @param array $field
  *
  * @return mixed
  */
 static function meta($post_id, $saved, $field)
 {
     $meta = array('value' => false, 'options' => array());
     if (empty($field['id']) || ud_get_wp_property('configuration.address_attribute') !== $field['id']) {
         return array();
     }
     /**
      * Maybe set value from parent
      */
     $post = get_post($post_id);
     if ($post && $post->post_parent > 0) {
         $property_inheritance = ud_get_wp_property('property_inheritance', array());
         $type = get_post_meta($post_id, 'property_type', true);
         if (!isset($property_inheritance[$type]) || !in_array($field['id'], $property_inheritance[$type])) {
             return array();
         }
         $meta['value'] = get_post_meta($post->post_parent, $field['id'], true);
         $attributes = array_keys(ud_get_wp_property('property_stats', array()));
         foreach (self::$map as $k) {
             // Ignore meta if property attribute with the same name exists
             if (in_array($k, $attributes)) {
                 continue;
             }
             $meta['options'][$k] = get_post_meta($post->post_parent, $k, true);
         }
     }
     return $meta;
 }
コード例 #7
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);
 }
コード例 #8
0
 /**
  * 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);
 }
コード例 #9
0
 /**
  * Determines template and renders it
  *
  *
  */
 public function get_template($template, $data, $output = true)
 {
     $name = apply_filters($this->id . '_template_name', array($template), $this);
     /* Set possible pathes where templates could be stored. */
     $path = apply_filters($this->id . '_template_path', array(ud_get_wp_property()->path('static/views', 'dir')));
     $path = \UsabilityDynamics\Utility::get_template_part($name, $path, array('load' => false));
     if ($output) {
         extract($data);
         include $path;
     } else {
         ob_start();
         extract($data);
         include $path;
         return ob_get_clean();
     }
 }
コード例 #10
0
 /**
  * @param string $atts
  * @return string|void
  */
 public function call($atts = "")
 {
     $atts = shortcode_atts(array('property_id' => '', 'include' => ''), $atts);
     $meta = array();
     if (!empty($atts['include'])) {
         $include = explode(',', $atts['include']);
         foreach ($include as $k) {
             $k = trim($k);
             $v = ud_get_wp_property("property_meta.{$k}");
             if (!empty($v)) {
                 $meta[$k] = $v;
             }
         }
     } else {
         $meta = ud_get_wp_property('property_meta');
     }
     if (!empty($atts['property_id']) && is_numeric($atts['property_id'])) {
         $post_id = $atts['property_id'];
     } else {
         global $post;
         $post_id = $post->ID;
     }
     return $this->get_template('property-meta', array('meta' => $meta, 'post_id' => $post_id), false);
 }
コード例 #11
0
        }
        ?>
       </ul>

        </div><?php 
        // .wpp_right_column
        ?>

    </div><?php 
        // .property_div
        ?>

    <?php 
    }
    /** end of the propertyloop. */
    ?>
    </div><?php 
    // .all-properties
    ?>
	</div><?php 
    // .wpp_row_view
} else {
    ?>
<div class="wpp_nothing_found">
   <p><?php 
    echo sprintf(__('Sorry, no properties found - try expanding your search, or <a href="%s">view all</a>.', ud_get_wp_property()->domain), site_url() . '/' . $wp_properties['configuration']['base_slug']);
    ?>
</p>
</div>
<?php 
}
コード例 #12
0
        ?>
              </label>
            </li>
          <?php 
    }
    ?>
          <?php 
    do_action('wpp::types::inherited_attributes', $property_slug);
    ?>
        </ul>
      </td>

    </tr>

  <?php 
}
?>
  </tbody>

  <tfoot>
  <tr>
    <td colspan='5'>
      <input type="button" class="wpp_add_row button-secondary" value="<?php 
_e('Add Row', ud_get_wp_property()->domain);
?>
"/>
    </td>
  </tr>
  </tfoot>

</table>
コード例 #13
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();
     }
 }
コード例 #14
0
ファイル: class-export.php プロジェクト: Juni4567/mycashflow
 /**
  * Exports all properties to CSV file
  */
 public function maybe_export_properties_to_scv()
 {
     if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'wpp_export_to_scv' && !empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'export_properties_to_scv')) {
         // output headers so that the file is downloaded rather than displayed
         header('Content-Type: text/csv; charset=utf-8');
         header('Content-Disposition: attachment; filename=properties.csv');
         $headings = array('ID' => __('ID', ud_get_wp_property('domain')), 'post_title' => __('Title', ud_get_wp_property('domain')), 'post_content' => __('Content', ud_get_wp_property('domain')), 'post_date' => __('Date', ud_get_wp_property('domain')), 'post_modified' => __('Modified Date', ud_get_wp_property('domain')), 'post_parent' => __('Falls Under', ud_get_wp_property('domain')), 'menu_order' => __('Menu Order', ud_get_wp_property('domain')), 'post_author' => __('Author', ud_get_wp_property('domain')), 'property_type_label' => __('Property Type', ud_get_wp_property('domain')));
         $headings = array_merge($headings, (array) ud_get_wp_property('property_stats', array()));
         $headings = array_merge($headings, (array) ud_get_wp_property('property_meta', array()));
         foreach ((array) ud_get_wp_property('geo_type_attributes', array()) as $k) {
             $headings[$k] = \WPP_F::de_slug($k);
         }
         $headings['latitude'] = __('Latitude', ud_get_wp_property('domain'));
         $headings['longitude'] = __('Longitude', ud_get_wp_property('domain'));
         $headings['permalink'] = __('Permalink', ud_get_wp_property('domain'));
         // create a file pointer connected to the output stream
         $output = fopen('php://output', 'w');
         // output the column headings
         fputcsv($output, array_values($headings));
         $ids = \WPP_F::get_properties();
         $keys = array_keys($headings);
         foreach ($ids as $id) {
             $property = Property_Factory::get($id, array('get_children' => 'false', 'load_gallery' => 'false', 'load_thumbnail' => 'true', 'load_parent' => 'false'));
             $data = array();
             foreach ($keys as $k) {
                 $v = isset($property[$k]) ? $property[$k] : '';
                 if (is_array($v)) {
                     $v = implode(',', $v);
                 }
                 switch ($k) {
                     case 'post_content':
                         $v = strip_shortcodes($v);
                         $v = apply_filters('the_content', $v);
                         $v = str_replace(']]>', ']]&gt;', $v);
                         $v = wp_trim_words($v, 55, '...');
                         break;
                     case 'author':
                         $v = get_the_author_meta('display_name', $v);
                         break;
                 }
                 $data[$k] = $v;
             }
             fputcsv($output, $data);
         }
         exit;
     }
 }
コード例 #15
0
 /**
  * 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');
 }
コード例 #16
0
 /**
  * WPP Contextual Help
  *
  * @global $current_screen
  *
  * @param $args
  *
  * @author korotkov@ud
  */
 function wpp_contextual_help($args = array())
 {
     global $contextual_help;
     $defaults = array('contextual_help' => array());
     extract(wp_parse_args($args, $defaults));
     //** If method exists add_help_tab in WP_Screen */
     if (is_callable(array('WP_Screen', 'add_help_tab'))) {
         //** Loop through help items and build tabs */
         foreach ((array) $contextual_help as $help_tab_title => $help) {
             //** Add tab with current info */
             get_current_screen()->add_help_tab(array('id' => sanitize_title($help_tab_title), 'title' => __($help_tab_title, ud_get_wp_property()->domain), 'content' => implode("\n", (array) $contextual_help[$help_tab_title])));
         }
         //** Add help sidebar with More Links */
         get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:', ud_get_wp_property()->domain) . '</strong></p>' . '<p>' . __('<a href="https://usabilitydynamics.com/products/wp-property/" target="_blank">WP-Property Product Page</a>', ud_get_wp_property()->domain) . '</p>' . '<p>' . __('<a href="https://usabilitydynamics.com/products/wp-property/forum/" target="_blank">WP-Property Forums</a>', ud_get_wp_property()->domain) . '</p>' . '<p>' . __('<a href="https://usabilitydynamics.com/help/" target="_blank">WP-Property Tutorials</a>', ud_get_wp_property()->domain) . '</p>');
     } else {
         global $current_screen;
         add_contextual_help($current_screen->id, '<p>' . __('Please upgrade Wordpress to the latest version for detailed help.', ud_get_wp_property()->domain) . '</p><p>' . __('Or visit <a href="https://usabilitydynamics.com/tutorials/wp-property-help/" target="_blank">WP-Property Help Page</a> on UsabilityDynamics.com', ud_get_wp_property()->domain) . '</p>');
     }
 }
コード例 #17
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();
 }
コード例 #18
0
            _e('Edit', ud_get_wp_property()->domain);
            ?>
</a>
              </li>
              <li>
                <a class="<?php 
            wpp_css('property_overview::button', 'button');
            ?>
" href="<?php 
            echo WPP_F::base_url(FEPS_VIEW_PAGE, array('feps' => $property['ID'], 'hash' => $property['wpp::feps::pending_hash'], 'action' => 'remove'));
            ?>
" onclick="return confirm('<?php 
            _e('Are you sure?', ud_get_wp_property()->domain);
            ?>
')"><?php 
            _e('Remove', ud_get_wp_property()->domain);
            ?>
</a>
              </li>
            </ul>
          </li>
          <?php 
        }
        ?>
        </ul>
      </div>
    </div>
  <?php 
    }
    ?>
コード例 #19
0
/**
 * Display latitude and longitude on listing edit page below address field
 *
 * Echos html content to be displayed after location attribute on property edit page
 *
 * @since 1.0
 * @uses WPP_F::get_coordinates() Creates an array from string $args.
 *
 * @param string $listing_id Listing ID must be passed
 */
function wpp_show_coords($listing_id = false)
{
    if (!$listing_id) {
        return;
    }
    // If latitude and logitude meta isn't set, returns false
    $coords = WPP_F::get_coordinates($listing_id);
    echo "<span class='description'>";
    if ($coords) {
        _e("Address was validated by Google Maps.", ud_get_wp_property()->domain);
    } else {
        _e("Address has not yet been validated, should be formatted as: street, city, state, postal code, country. Locations are validated through Google Maps.", ud_get_wp_property()->domain);
    }
    echo "</span>";
}
コード例 #20
0
        /**
         * Extend WP-Property settings:
         * - Extend Property Search with Taxonomies
         * - Adds Taxonomies to groups
         *
         */
        public function extend_wpp_settings()
        {
            global $wp_properties;
            /** STEP 1. Add taxonomies to searchable attributes */
            $taxonomies = $this->get('config.taxonomies', array());
            if (!isset($wp_properties['searchable_attributes']) || !is_array($wp_properties['searchable_attributes'])) {
                $wp_properties['searchable_attributes'] = array();
            }
            foreach ($taxonomies as $taxonomy => $data) {
                if (isset($data['public']) && $data['public']) {
                    array_push($wp_properties['searchable_attributes'], $taxonomy);
                }
            }
            ud_get_wp_property()->set('searchable_attributes', $wp_properties['searchable_attributes']);
            /** STEP 2. Add taxonomies to property stats groups */
            $groups = $this->get('config.groups', array());
            if (!isset($wp_properties['property_stats_groups']) || !is_array($wp_properties['property_stats_groups'])) {
                $wp_properties['property_stats_groups'] = array();
            }
            $wp_properties['property_stats_groups'] = array_merge($wp_properties['property_stats_groups'], $groups);
            ud_get_wp_property()->set('property_stats_groups', $wp_properties['property_stats_groups']);
            /** STEP 3. Extend Property Search form */
            add_filter('wpp::show_search_field_with_no_values', function ($bool, $slug) {
                $taxonomies = ud_get_wpp_terms('config.taxonomies', array());
                if (array_key_exists($slug, $taxonomies)) {
                    return true;
                }
                return $bool;
            }, 10, 2);
            /** Take care about Taxonomies fields */
            foreach ($taxonomies as $taxonomy => $data) {
                add_filter('wpp_search_form_field_' . $taxonomy, function ($html, $taxonomy, $label, $value, $input, $random_id) {
                    $search_input = ud_get_wp_property("searchable_attr_fields.{$taxonomy}");
                    $terms = get_terms($taxonomy, array('fields' => 'id=>name'));
                    ob_start();
                    switch ($search_input) {
                        case 'multi_checkbox':
                            ?>
                <ul class="wpp_multi_checkbox taxonomy <?php 
                            echo $taxonomy;
                            ?>
">
                  <?php 
                            foreach ($terms as $term_id => $label) {
                                ?>
                    <?php 
                                $unique_id = rand(10000, 99999);
                                ?>
                    <li>
                      <input name="wpp_search[<?php 
                                echo $taxonomy;
                                ?>
][]" <?php 
                                echo is_array($value) && in_array($term_id, $value) ? 'checked="true"' : '';
                                ?>
 id="wpp_attribute_checkbox_<?php 
                                echo $unique_id;
                                ?>
" type="checkbox" value="<?php 
                                echo $term_id;
                                ?>
"/>
                      <label for="wpp_attribute_checkbox_<?php 
                                echo $unique_id;
                                ?>
" class="wpp_search_label_second_level"><?php 
                                echo $label;
                                ?>
</label>
                    </li>
                  <?php 
                            }
                            ?>
                </ul>
                <?php 
                            break;
                        case 'dropdown':
                        default:
                            ?>
                <select id="<?php 
                            echo $random_id;
                            ?>
" class="wpp_search_select_field taxonomy <?php 
                            echo $taxonomy;
                            ?>
" name="wpp_search[<?php 
                            echo $taxonomy;
                            ?>
]">
                  <option value="-1"><?php 
                            _e('Any', ud_get_wpp_terms('domain'));
                            ?>
</option>
                  <?php 
                            foreach ($terms as $term_id => $label) {
                                ?>
                    <option value="<?php 
                                echo $term_id;
                                ?>
" <?php 
                                selected($value, $term_id);
                                ?>
><?php 
                                echo $label;
                                ?>
</option>
                  <?php 
                            }
                            ?>
                </select>
                <?php 
                            break;
                    }
                    return ob_get_clean();
                }, 10, 6);
            }
        }
コード例 #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
<?php

/**
 * Property Overview Pagination
 * Pagination Type: 'slider'
 *
 * To modify template, copy the file to root of your theme.
 */
?>
<div class="wpp_pagination_slider_wrapper pagination-slider">
  <div class="wpp_pagination_back wpp_pagination_button"><?php 
_e('Prev', ud_get_wp_property()->domain);
?>
</div>
  <div class="wpp_pagination_forward wpp_pagination_button"><?php 
_e('Next', ud_get_wp_property()->domain);
?>
</div>
  <div class="wpp_pagination_slider"></div>
</div>
コード例 #23
0
ファイル: l10n.php プロジェクト: Juni4567/mycashflow
<?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)));
コード例 #24
0
 /**
  * @param string $atts
  * @return string|void
  */
 public function call($atts = "")
 {
     global $post, $wp_query;
     $r = '';
     $atts = wp_parse_args($atts, array('type' => NULL, 'orderby' => NULL, 'groupby' => NULL, 'order' => NULL, 'post_id' => false, 'before_list' => '', 'after_list' => '', 'opening' => '<ul class="attachment-list wpp_attachment_list">', 'closing' => '</ul>', 'before_item' => '<li>', 'after_item' => '</li>', 'show_descriptions' => true, 'include_icon_classes' => true, 'showsize' => false));
     if (isset($atts['post_id']) && is_numeric($atts['post_id'])) {
         $post = get_post($atts['post_id']);
     }
     if (!$post) {
         return;
     }
     if (!empty($atts['type'])) {
         $types = explode(',', str_replace(' ', '', $atts['type']));
     } else {
         $types = array();
     }
     $showsize = $atts['showsize'] == true || $atts['showsize'] == 'true' || $atts['showsize'] == 1 ? true : false;
     $upload_dir = wp_upload_dir();
     $op = clone $post;
     $oq = clone $wp_query;
     foreach (array('before_list', 'after_list', 'opening', 'closing', 'before_item', 'after_item') as $htmlItem) {
         $atts[$htmlItem] = str_replace(array('&lt;', '&gt;', '&quot;'), array('<', '>', '"'), $atts[$htmlItem]);
     }
     $args = array('post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post->ID);
     if (!empty($atts['orderby'])) {
         $args['orderby'] = $atts['orderby'];
     }
     if (!empty($atts['order'])) {
         $atts['order'] = in_array($atts['order'], array('a', 'asc', 'ascending')) ? 'asc' : 'desc';
         $args['order'] = $atts['order'];
     }
     if (!empty($atts['groupby'])) {
         $args['orderby'] = $atts['groupby'];
     }
     $attachments = get_posts($args);
     if ($attachments) {
         $grouper = $atts['groupby'];
         $test = $attachments;
         $test = array_shift($test);
         if (!property_exists($test, $grouper)) {
             $grouper = 'post_' . $grouper;
         }
         $attlist = array();
         foreach ($attachments as $att) {
             $key = !empty($atts['groupby']) ? $att->{$grouper} : $att->ID;
             $key .= !empty($atts['orderby']) ? $att->{$atts}['orderby'] : '';
             $attlink = wp_get_attachment_url($att->ID);
             if (count($types)) {
                 foreach ($types as $t) {
                     if (substr($attlink, 0 - strlen('.' . $t)) == '.' . $t) {
                         $attlist[$key] = clone $att;
                         $attlist[$key]->attlink = $attlink;
                     }
                 }
             } else {
                 $attlist[$key] = clone $att;
                 $attlist[$key]->attlink = $attlink;
             }
         }
         if ($atts['groupby']) {
             if ($atts['order'] == 'asc') {
                 ksort($attlist);
             } else {
                 krsort($attlist);
             }
         }
     }
     if (count($attlist)) {
         $open = false;
         $r = $atts['before_list'] . $atts['opening'];
         foreach ($attlist as $att) {
             $container_classes = array('attachment_container');
             //** Determine class to display for this file type */
             if ($atts['include_icon_classes']) {
                 switch ($att->post_mime_type) {
                     case 'application/zip':
                         $class = 'zip';
                         break;
                     case 'vnd.ms-excel':
                         $class = 'excel';
                         break;
                     case 'image/jpeg':
                     case 'image/png':
                     case 'image/gif':
                     case 'image/bmp':
                         $class = 'image';
                         break;
                     default:
                         $class = 'default';
                         break;
                 }
             }
             $icon_class = $class ? 'wpp_attachment_icon file-' . $class : false;
             //** Determine if description shuold be displayed, and if it is not empty */
             $echo_description = $atts['show_descriptions'] && !empty($att->post_content) ? ' <span class="attachment_description"> ' . $att->post_content . ' </span> ' : false;
             $echo_title = $att->post_excerpt ? $att->post_excerpt : __('View ', ud_get_wp_property()->domain) . apply_filters('the_title_attribute', $att->post_title);
             if ($icon_class) {
                 $container_classes[] = 'has_icon';
             }
             if (!empty($echo_description)) {
                 $container_classes[] = 'has_description';
             }
             //** Add conditional classes if class is not already passed into container */
             if (!strpos($atts['before_item'], 'class')) {
                 $this_before_item = str_replace('>', ' class="' . implode(' ', $container_classes) . '">', $atts['before_item']);
             }
             $echo_size = $showsize ? ' <span class="attachment-size">' . WPP_F::get_filesize(str_replace($upload_dir['baseurl'], $upload_dir['basedir'], $attlink)) . '</span>' : '';
             if (!isset($current_group)) {
                 $current_group = false;
             }
             if (!empty($atts['groupby']) && $current_group != $att->{$grouper}) {
                 if ($open) {
                     $r .= $atts['closing'] . $atts['after_item'];
                     $open = false;
                 }
                 $r .= $atts['before_item'] . '<h3>' . $att->{$grouper} . '</h3>' . $atts['opening'];
                 $open = true;
                 $current_group = $att->{$grouper};
             }
             $attlink = $att->attlink;
             $r .= $this_before_item . '<a href="' . $attlink . '" title="' . $echo_title . '" class="wpp_attachment ' . $icon_class . '">' . apply_filters('the_title', $att->post_title) . '</a>' . $echo_size . $echo_description . $atts['after_item'];
         }
         if ($open) {
             $r .= $atts['closing'] . $atts['after_item'];
         }
         $r .= $atts['closing'] . $atts['after_list'];
     }
     $wp_query = clone $oq;
     $post = clone $op;
     return $r;
 }
コード例 #25
0
ファイル: property.php プロジェクト: ksan5835/rankproperties
" style="width:100%; height:450px"></div>
        <?php 
}
?>

        <?php 
if ($post->post_parent) {
    ?>
          <a href="<?php 
    echo $post->parent_link;
    ?>
" class="<?php 
    wpp_css('btn', "btn btn-return");
    ?>
"><?php 
    _e('Return to building page.', ud_get_wp_property()->domain);
    ?>
</a>
        <?php 
}
?>

      </div><!-- .entry-content -->
      
      <?php 
comments_template();
?>
      
    </div><!-- #post-## -->

    </div><!-- #content -->
コード例 #26
0
ファイル: wp-property.php プロジェクト: Juni4567/mycashflow
 function wpp($key = false, $default = null)
 {
     return ud_get_wp_property($key, $default);
 }
コード例 #27
0
        <?php 
        }
        ?>
      <?php 
    }
    ?>
    </ul>

    <?php 
    if (!empty($instance['enable_more']) && $instance['enable_more'] == 'on') {
        ?>
      <p class="more"><a href="<?php 
        echo $this_property->permalink;
        ?>
"
                         class="btn btn-info"><?php 
        _e('More', ud_get_wp_property()->domain);
        ?>
</a></p>
    <?php 
    }
    ?>
  </div>
  <?php 
    unset($this_property);
}
if (!empty($instance['enable_view_all']) && $instance['enable_view_all'] == 'on') {
    echo '<p class="view-all"><a href="' . site_url() . '/' . $wp_properties['configuration']['base_slug'] . '" class="btn btn-large">' . __('View All', ud_get_wp_property()->domain) . '</a></p>';
}
echo '<div class="clear"></div>';
echo '</div>';
コード例 #28
0
<?php

/**
 * Default template for [featured_properties] shortcode
 *
 */
$label_matches = array('post_title' => __('Title', ud_get_wp_property()->domain));
if (!empty($stats) && !is_array($stats)) {
    $stats = explode(',', $stats);
    foreach ($stats as $k => $s) {
        $stats[$k] = trim($s);
    }
}
?>

<?php 
if (have_properties()) {
    ?>

  <ul class="<?php 
    wpp_css('property_featured_shortcode::featured_properties', "wpp_featured_properties_shortcode clearfix");
    ?>
">
    <?php 
    foreach (returned_properties('load_gallery=false') as $property) {
        ?>
      <li class="<?php 
        wpp_css('property_featured_shortcode::property', "{$class} wpp_featured_property_container wp-caption clearfix");
        ?>
" >
コード例 #29
0
    function wpp_render_search_input($args = false)
    {
        global $wp_properties;
        extract($args = wp_parse_args($args, array('type' => 'input', 'input_type' => false, 'search_values' => false, 'attrib' => false, 'random_element_id' => 'wpp_search_element_' . rand(1000, 9999), 'value' => false, 'placeholder' => false)));
        $attribute_data = UsabilityDynamics\WPP\Attributes::get_attribute_data($args['attrib']);
        if (!empty($args['input_type'])) {
            $use_input_type = $args['input_type'];
        } else {
            $use_input_type = isset($wp_properties['searchable_attr_fields'][$attrib]) ? $wp_properties['searchable_attr_fields'][$attrib] : false;
        }
        ob_start();
        if (!empty($use_input_type)) {
            switch ($use_input_type) {
                case 'input':
                    ?>
          <input id="<?php 
                    echo $random_element_id;
                    ?>
" class="<?php 
                    echo $attribute_data['ui_class'];
                    ?>
" name="wpp_search[<?php 
                    echo $attrib;
                    ?>
]" value="<?php 
                    echo $value;
                    ?>
" placeholder="<?php 
                    echo $placeholder;
                    ?>
" type="text" />
          <?php 
                    break;
                case 'range_input':
                    /* Determine if $value has correct format, and if not - fix it. */
                    $value = !is_array($value) ? array('min' => '', 'max' => '') : $value;
                    $value['min'] = in_array('min', $value) ? $value['min'] : '';
                    $value['max'] = in_array('max', $value) ? $value['max'] : '';
                    ?>
          <input id="<?php 
                    echo $random_element_id;
                    ?>
" class="wpp_search_input_field wpp_search_input_field_min wpp_search_input_field_<?php 
                    echo $attrib;
                    ?>
 <?php 
                    echo $attribute_data['ui_class'];
                    ?>
" type="text" name="wpp_search[<?php 
                    echo $attrib;
                    ?>
][min]" value="<?php 
                    echo $value['min'];
                    ?>
" placeholder="<?php 
                    echo $placeholder['min'];
                    ?>
"/>
          <span class="wpp_dash">-</span>
          <input class="wpp_search_input_field wpp_search_input_field_max wpp_search_input_field_<?php 
                    echo $attrib;
                    ?>
 <?php 
                    echo $attribute_data['ui_class'];
                    ?>
" type="text" name="wpp_search[<?php 
                    echo $attrib;
                    ?>
][max]" value="<?php 
                    echo $value['max'];
                    ?>
" placeholder="<?php 
                    echo $placeholder['max'];
                    ?>
"/>
          <?php 
                    break;
                case 'range_dropdown':
                    ?>
          <?php 
                    $grouped_values = group_search_values($search_values[$attrib]);
                    ?>
          <select id="<?php 
                    echo $random_element_id;
                    ?>
" class="wpp_search_select_field wpp_search_select_field_<?php 
                    echo $attrib;
                    ?>
 <?php 
                    echo $attribute_data['ui_class'];
                    ?>
" name="wpp_search[<?php 
                    echo $attrib;
                    ?>
][min]">
              <option value="-1"><?php 
                    _e('Any', ud_get_wp_property()->domain);
                    ?>
</option>
              <?php 
                    foreach ($grouped_values as $v) {
                        ?>
                <option value='<?php 
                        echo (int) $v;
                        ?>
' <?php 
                        if (isset($value['min']) && $value['min'] == $v) {
                            echo " selected='true' ";
                        }
                        ?>
>
              <?php 
                        echo apply_filters("wpp_stat_filter_{$attrib}", $v);
                        ?>
 +
              </option>
            <?php 
                    }
                    ?>
          </select>
          <?php 
                    break;
                case 'advanced_range_dropdown':
                    ?>
          <?php 
                    $grouped_values = !empty($search_values[$attrib]) ? $search_values[$attrib] : group_search_values($search_values[$attrib]);
                    ?>
          <select id="<?php 
                    echo $random_element_id;
                    ?>
" class="wpp_search_select_field wpp_search_select_field_<?php 
                    echo $attrib;
                    ?>
 <?php 
                    echo $attribute_data['ui_class'];
                    ?>
" name="wpp_search[<?php 
                    echo $attrib;
                    ?>
][min]">
            <option value=""><?php 
                    _e('Min', ud_get_wp_property()->domain);
                    ?>
</option>
            <?php 
                    foreach ($grouped_values as $v) {
                        ?>
              <option value='<?php 
                        echo (int) $v;
                        ?>
' <?php 
                        if (isset($value['min']) && $value['min'] == (int) $v) {
                            echo " selected='selected' ";
                        }
                        ?>
>
                <?php 
                        echo apply_filters("wpp_stat_filter_{$attrib}", $v);
                        ?>
              </option>
            <?php 
                    }
                    ?>
          </select>
          <span class="delimiter">-</span>
          <select id="<?php 
                    echo $random_element_id;
                    ?>
" class="wpp_search_select_field wpp_search_select_field_<?php 
                    echo $attrib;
                    ?>
 <?php 
                    echo $attribute_data['ui_class'];
                    ?>
" name="wpp_search[<?php 
                    echo $attrib;
                    ?>
][max]">
            <option value=""><?php 
                    _e('Max', ud_get_wp_property()->domain);
                    ?>
</option>
            <?php 
                    foreach ($grouped_values as $v) {
                        ?>
              <option value='<?php 
                        echo (int) $v;
                        ?>
' <?php 
                        if (isset($value['max']) && $value['max'] == (int) $v) {
                            echo " selected='selected' ";
                        }
                        ?>
>
                <?php 
                        echo apply_filters("wpp_stat_filter_{$attrib}", $v);
                        ?>
              </option>
            <?php 
                    }
                    ?>
          </select>
          <?php 
                    break;
                case 'dropdown':
                    ?>
          <select id="<?php 
                    echo $random_element_id;
                    ?>
" class="wpp_search_select_field wpp_search_select_field_<?php 
                    echo $attrib;
                    ?>
 <?php 
                    echo $attribute_data['ui_class'];
                    ?>
" name="wpp_search[<?php 
                    echo $attrib;
                    ?>
]">
          <option value="-1"><?php 
                    _e('Any', ud_get_wp_property()->domain);
                    ?>
</option>
            <?php 
                    foreach ($search_values[$attrib] as $v) {
                        ?>
              <option value="<?php 
                        echo esc_attr($v);
                        ?>
" <?php 
                        selected($value, $v);
                        ?>
><?php 
                        echo esc_attr(apply_filters("wpp_stat_filter_{$attrib}", $v));
                        ?>
</option>
            <?php 
                    }
                    ?>
          </select>
          <?php 
                    break;
                case 'multi_checkbox':
                    ?>
          <ul class="wpp_multi_checkbox <?php 
                    echo $attribute_data['ui_class'];
                    ?>
">
        <?php 
                    foreach ($search_values[$attrib] as $value_label) {
                        ?>
          <?php 
                        $unique_id = rand(10000, 99999);
                        ?>
          <li>
            <input name="wpp_search[<?php 
                        echo $attrib;
                        ?>
][]" <?php 
                        echo is_array($value) && in_array($value_label, $value) ? 'checked="true"' : '';
                        ?>
 id="wpp_attribute_checkbox_<?php 
                        echo $unique_id;
                        ?>
" type="checkbox" value="<?php 
                        echo $value_label;
                        ?>
"/>
            <label for="wpp_attribute_checkbox_<?php 
                        echo $unique_id;
                        ?>
" class="wpp_search_label_second_level"><?php 
                        echo $value_label;
                        ?>
</label>
          </li>
        <?php 
                    }
                    ?>
        </ul>
          <?php 
                    break;
                case 'checkbox':
                    ?>
          <input id="<?php 
                    echo $random_element_id;
                    ?>
" type="checkbox" class="<?php 
                    echo $attribute_data['ui_class'];
                    ?>
" name="wpp_search[<?php 
                    echo $attrib;
                    ?>
]" <?php 
                    checked($value, 'true');
                    ?>
 value="true"/>
          <?php 
                    break;
                default:
                    echo apply_filters('wpp::render_search_input::custom', '', $args);
                    break;
            }
        } else {
            ?>
      <?php 
            if (empty($search_values[$attrib])) {
                ?>
        <input id="<?php 
                echo $random_element_id;
                ?>
" class="wpp_search_input_field wpp_search_input_field_<?php 
                echo $attrib;
                ?>
" name="wpp_search[<?php 
                echo $attrib;
                ?>
]" value="<?php 
                echo $value;
                ?>
" type="text"/>
        <?php 
                //* Determine if attribute is a numeric range */
                ?>
      <?php 
            } elseif (WPP_F::is_numeric_range($search_values[$attrib])) {
                ?>
        <input class="wpp_search_input_field wpp_search_input_field_min wpp_search_input_field_<?php 
                echo $attrib;
                ?>
 <?php 
                echo $attribute_data['ui_class'];
                ?>
" type="text" name="wpp_search[<?php 
                echo $attrib;
                ?>
][min]" value="<?php 
                echo isset($value['min']) ? $value['min'] : '';
                ?>
"/> -
        <input class="wpp_search_input_field wpp_search_input_field_max wpp_search_input_field_<?php 
                echo $attrib;
                ?>
 <?php 
                echo $attribute_data['ui_class'];
                ?>
" type="text" name="wpp_search[<?php 
                echo $attrib;
                ?>
][max]" value="<?php 
                echo isset($value['max']) ? $value['max'] : '';
                ?>
"/>
      <?php 
            } else {
                ?>
        <?php 
                /* Not a numeric range */
                ?>
        <select id="<?php 
                echo $random_element_id;
                ?>
" class="wpp_search_select_field wpp_search_select_field_<?php 
                echo $attrib;
                ?>
 <?php 
                echo $attribute_data['ui_class'];
                ?>
" name="wpp_search[<?php 
                echo $attrib;
                ?>
]">
        <option value="<?php 
                echo $attrib == 'property_type' && is_array($search_values[$attrib]) ? implode(',', array_flip($search_values[$attrib])) : '-1';
                ?>
"><?php 
                _e('Any', ud_get_wp_property()->domain);
                ?>
</option>
          <?php 
                foreach ($search_values[$attrib] as $key => $v) {
                    ?>
            <option value='<?php 
                    echo $attrib == 'property_type' ? $key : $v;
                    ?>
' <?php 
                    if ($value == ($attrib == 'property_type' ? $key : $v)) {
                        echo " selected='true' ";
                    }
                    ?>
>
          <?php 
                    echo apply_filters("wpp_stat_filter_{$attrib}", $v);
                    ?>
          </option>
          <?php 
                }
                ?>
        </select>
      <?php 
            }
            ?>
    <?php 
        }
        echo apply_filters('wpp_render_search_input', ob_get_clean(), $args);
    }
コード例 #30
0
?>
"/>
  <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>