Пример #1
0
 /**
  * Secondary WPP Initialization ran towards the end of init()
  *
  * Loads things that we want make accessible for modification via other plugins.
  *
  * @since 1.31.0
  * @uses $wp_properties WP-Property configuration array
  * @access public
  *
  */
 function init_lower()
 {
     global $wp_properties;
     /** Ajax functions */
     add_action('wp_ajax_wpp_ajax_max_set_property_type', create_function("", ' die(WPP_F::mass_set_property_type($_REQUEST["property_type"]));'));
     add_action('wp_ajax_wpp_ajax_property_query', create_function("", ' $class = WPP_F::get_property(trim($_REQUEST["property_id"])); if($class) { echo "WPP_F::get_property() output: \\n\\n"; print_r($class); echo "\\nAfter prepare_property_for_display() filter:\\n\\n"; print_r(prepare_property_for_display($class));  } else { echo __("No property found.","wpp"); } die();'));
     add_action('wp_ajax_wpp_ajax_image_query', create_function("", ' $class = WPP_F::get_property_image_data($_REQUEST["image_id"]); if($class)  print_r($class); else echo __("No image found.","wpp"); die();'));
     add_action('wp_ajax_wpp_ajax_clear_cache', create_function("", '  echo WPP_F::clear_cache(); die();'));
     add_action('wp_ajax_wpp_ajax_revalidate_all_addresses', create_function("", '  echo WPP_F::revalidate_all_addresses(); die();'));
     add_action('wp_ajax_wpp_save_settings', create_function("", ' die(WPP_F::save_settings());'));
     /** Called in setup_postdata().  We add property values here to make available in global $post variable on frontend */
     add_action('the_post', array('WPP_F', 'the_post'));
     add_action("the_content", array(&$this, "the_content"));
     add_action("post_submitbox_misc_actions", array(&$this, "post_submitbox_misc_actions"));
     add_action('save_post', array($this, 'save_property'), 11);
     //** Address revalidation @since 1.37.2 @author odokienko@UD */
     add_action('save_property', create_function('$post_id', 'WPP_F::revalidate_address($post_id);'));
     add_action('before_delete_post', array('WPP_F', 'before_delete_post'));
     add_filter('post_updated_messages', array($this, 'property_updated_messages'), 5);
     /** Fix toggale row actions -> get rid of "Quick Edit" on property rows */
     add_filter('page_row_actions', array(&$this, 'property_row_actions'), 0, 2);
     /** Disables meta cache for property obejcts if enabled */
     add_action('pre_get_posts', array('WPP_F', 'pre_get_posts'));
     /** Fix 404 errors */
     add_filter("parse_request", array($this, "parse_request"));
     //** Determines if current request is for a child property */
     add_filter("posts_results", array('WPP_F', "posts_results"));
     //** Hack. Used to avoid issues of some WPP capabilities */
     add_filter('current_screen', array($this, 'current_screen'));
     //** Contextual Help */
     add_action('wpp_contextual_help', array($this, 'wpp_contextual_help'));
     //** Page loading handlers */
     add_action('load-property_page_property_settings', array('WPP_F', 'property_page_property_settings_load'));
     //** Add custom image sizes */
     foreach ($wp_properties['image_sizes'] as $image_name => $image_sizes) {
         add_image_size($image_name, $image_sizes['width'], $image_sizes['height'], true);
     }
     //** Determine if we are secure */
     $scheme = is_ssl() && !is_admin() ? 'https' : 'http';
     //** Load Localization early so plugins can use them as well */
     //** Try to generate static localization script. It can be flushed on Clear Cache! */
     if ($l10n_url = $this->maybe_generate_l10n_script()) {
         wp_register_script('wpp-localization', $l10n_url, array(), WPP_Version);
     } else {
         wp_register_script('wpp-localization', ud_get_wp_property()->path('static/scripts/l10n.js', 'url'), array(), WPP_Version);
         wp_localize_script('wpp-localization', 'wpp_l10n', $this->get_l10n_data());
     }
     wp_register_script('wpp-jquery-fancybox', WPP_URL . 'scripts/fancybox/jquery.fancybox-1.3.4.pack.js', array('jquery', 'wpp-localization'), '1.7.3');
     wp_register_script('wpp-jquery-colorpicker', WPP_URL . 'scripts/colorpicker/colorpicker.js', array('jquery', 'wpp-localization'));
     wp_register_script('wpp-jquery-easing', WPP_URL . 'scripts/fancybox/jquery.easing-1.3.pack.js', array('jquery', 'wpp-localization'), '1.7.3');
     wp_register_script('wpp-jquery-ajaxupload', WPP_URL . 'scripts/fileuploader.js', array('jquery', 'wpp-localization'));
     wp_register_script('wp-property-admin-overview', WPP_URL . 'scripts/wpp.admin.overview.js', array('jquery', 'wpp-localization'), WPP_Version);
     wp_register_script('wp-property-admin-widgets', WPP_URL . 'scripts/wpp.admin.widgets.js', array('jquery', 'wpp-localization'), WPP_Version);
     wp_register_script('wp-property-admin-settings', WPP_URL . 'scripts/wpp.admin.settings.js', array('jquery', 'wpp-localization'), WPP_Version);
     wp_register_script('wp-property-backend-global', WPP_URL . 'scripts/wpp.admin.global.js', array('jquery', 'wp-property-global', 'wpp-localization'), WPP_Version);
     wp_register_script('wp-property-backend-editor', WPP_URL . 'scripts/wpp.admin.editor.js', array('jquery', 'wp-property-global', 'wpp-localization'), WPP_Version);
     wp_register_script('wp-property-global', WPP_URL . 'scripts/wpp.global.js', array('jquery', 'wpp-localization', 'jquery-ui-tabs', 'jquery-ui-sortable'), WPP_Version);
     wp_register_script('jquery-cookie', WPP_URL . 'scripts/jquery.smookie.js', array('jquery', 'wpp-localization'), '1.7.3');
     wp_register_script('google-maps', 'https://maps.google.com/maps/api/js?sensor=true');
     wp_register_script('wpp-md5', WPP_URL . 'scripts/md5.js', array('wpp-localization'), WPP_Version);
     wp_register_script('wpp-jquery-gmaps', WPP_URL . 'scripts/jquery.ui.map.min.js', array('google-maps', 'jquery-ui-core', 'jquery-ui-widget', 'wpp-localization'));
     wp_register_script('wpp-jquery-nivo-slider', WPP_URL . 'scripts/jquery.nivo.slider.pack.js', array('jquery', 'wpp-localization'));
     wp_register_script('wpp-jquery-address', WPP_URL . 'scripts/jquery.address-1.5.js', array('jquery', 'wpp-localization'));
     wp_register_script('wpp-jquery-scrollTo', WPP_URL . 'scripts/jquery.scrollTo-min.js', array('jquery', 'wpp-localization'));
     wp_register_script('wpp-jquery-validate', WPP_URL . 'scripts/jquery.validate.js', array('jquery', 'wpp-localization'));
     wp_register_script('wpp-jquery-number-format', WPP_URL . 'scripts/jquery.number.format.js', array('jquery', 'wpp-localization'));
     wp_register_script('wp-property-galleria', WPP_URL . 'scripts/galleria/galleria-1.2.5.js', array('jquery', 'wpp-localization'));
     wp_register_style('wpp-jquery-fancybox-css', WPP_URL . 'scripts/fancybox/jquery.fancybox-1.3.4.css');
     wp_register_style('wpp-jquery-colorpicker-css', WPP_URL . 'scripts/colorpicker/colorpicker.css');
     wp_register_style('jquery-ui', WPP_URL . 'styles/wpp.admin.jquery.ui.css');
     /** Find and register stylesheet  */
     if (file_exists(STYLESHEETPATH . '/wp-properties.css')) {
         wp_register_style('wp-property-frontend', get_bloginfo('stylesheet_directory') . '/wp-properties.css', array(), WPP_Version);
     } elseif (file_exists(STYLESHEETPATH . '/wp_properties.css')) {
         wp_register_style('wp-property-frontend', get_bloginfo('stylesheet_directory') . '/wp_properties.css', array(), WPP_Version);
     } elseif (file_exists(TEMPLATEPATH . '/wp-properties.css')) {
         wp_register_style('wp-property-frontend', get_bloginfo('template_url') . '/wp-properties.css', array(), WPP_Version);
     } elseif (file_exists(TEMPLATEPATH . '/wp_properties.css')) {
         wp_register_style('wp-property-frontend', get_bloginfo('template_url') . '/wp_properties.css', array(), WPP_Version);
     } elseif ($wp_properties['configuration']['autoload_css'] == 'true') {
         wp_register_style('wp-property-frontend', WPP_URL . 'styles/wp_properties.css', array(), WPP_Version);
         //** Find and register theme-specific style if a custom wp_properties.css does not exist in theme */
         if (isset($wp_properties['configuration']['do_not_load_theme_specific_css']) && $wp_properties['configuration']['do_not_load_theme_specific_css'] != 'true' && WPP_F::has_theme_specific_stylesheet()) {
             wp_register_style('wp-property-theme-specific', WPP_URL . "styles/theme-specific/" . get_option('template') . ".css", array('wp-property-frontend'), WPP_Version);
         }
     }
     //** Find front-end JavaScript and register the script */
     if (file_exists(STYLESHEETPATH . '/wp_properties.js')) {
         wp_register_script('wp-property-frontend', get_bloginfo('stylesheet_directory') . '/wp_properties.js', array('jquery-ui-core', 'wpp-localization'), WPP_Version, true);
     } elseif (file_exists(TEMPLATEPATH . '/wp_properties.js')) {
         wp_register_script('wp-property-frontend', get_bloginfo('template_url') . '/wp_properties.js', array('jquery-ui-core', 'wpp-localization'), WPP_Version, true);
     } else {
         wp_register_script('wp-property-frontend', WPP_URL . 'scripts/wp_properties.js', array('jquery-ui-core', 'wpp-localization'), WPP_Version, true);
     }
     //** Add troubleshoot log page */
     //** Modify admin body class */
     add_filter('admin_body_class', array($this, 'admin_body_class'), 5);
     //** Modify Front-end property body class */
     add_filter('body_class', array($this, 'properties_body_class'));
     add_filter('wp_get_attachment_link', array('WPP_F', 'wp_get_attachment_link'), 10, 6);
     //** Make Property Featured Via AJAX */
     if (isset($_REQUEST['post_id']) && isset($_REQUEST['_wpnonce']) && wp_verify_nonce($_REQUEST['_wpnonce'], "wpp_make_featured_" . $_REQUEST['post_id'])) {
         add_action('wp_ajax_wpp_make_featured', create_function("", '  $post_id = $_REQUEST[\'post_id\']; echo WPP_F::toggle_featured( $post_id ); die();'));
     }
     add_filter('wpp::draw_stats::attributes', array(__CLASS__, 'make_attributes_hidden'), 10, 2);
     //** Post-init action hook */
     do_action('wpp_post_init');
 }
Пример #2
0
        <div class="wpp_settings_block"><br/>
          <ul>
            <?php 
if (apply_filters('wpp::custom_styles', false) === false) {
    ?>
              <li>
                <?php 
    echo $using_custom_css ? WPP_F::checkbox("name=wpp_settings[configuration][autoload_css]&label=" . __('Load default CSS.', ud_get_wp_property()->domain), $wp_properties['configuration']['autoload_css']) : WPP_F::checkbox("name=wpp_settings[configuration][autoload_css]&label=" . __('Load default CSS.', ud_get_wp_property()->domain), $wp_properties['configuration']['autoload_css']);
    ?>
                <span class="description"><?php 
    printf(__('If unchecked, the %s in your theme folder will not be loaded.', ud_get_wp_property()->domain), 'wp-properties.css');
    ?>
</span>
              </li>
              <?php 
    if (WPP_F::has_theme_specific_stylesheet()) {
        ?>
                <li>
                  <?php 
        echo WPP_F::checkbox("name=wpp_settings[configuration][do_not_load_theme_specific_css]&label=" . __('Do not load theme-specific stylesheet.', ud_get_wp_property()->domain), isset($wp_properties['configuration']['do_not_load_theme_specific_css']) ? $wp_properties['configuration']['do_not_load_theme_specific_css'] : false);
        ?>
                  <span class="description"><?php 
        _e('This version of WP-Property has a stylesheet made specifically for the theme you are using.', ud_get_wp_property()->domain);
        ?>
</span>
                </li>
              <?php 
    }
    /* WPP_F::has_theme_specific_stylesheet() */
    ?>
            <?php