Пример #1
0
 static function desc()
 {
     if ('1' == wpsf_get_setting(wpsf_get_option_group('../settings/settings-general.php'), 'advanced', 'memtest')) {
         return sprintf('Use this link to test your actual server ram. <a href="%s">CLICK HERE TO TEST NOW</a><br /><kbd>DO NOT LEAVE THIS ENABLED!!!</kbd>', add_query_arg(array('pl_memcheck' => 1), admin_url()));
     } else {
         return '<p>Most cheap hosts although they say 256M of RAM is allocated to your account in reality it is limited in other ways.<br />This simple test will reveal your true account limitations.</p>';
     }
 }
Пример #2
0
 function advanced_search_query($where)
 {
     if (is_search() && '1' === wpsf_get_setting(wpsf_get_option_group('../settings/settings-general.php'), 'search', 'enabled')) {
         global $wpdb;
         $query = get_search_query();
         $query = like_escape($query);
         // include postmeta in search
         $where .= " OR {$wpdb->posts}.ID IN (SELECT {$wpdb->postmeta}.post_id FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->postmeta}.meta_key = 'pl-settings' AND {$wpdb->postmeta}.meta_value LIKE '%{$query}%' AND {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id)";
         // include taxonomy in search
         $where .= " OR {$wpdb->posts}.ID IN (SELECT {$wpdb->posts}.ID FROM {$wpdb->posts},{$wpdb->term_relationships},{$wpdb->terms} WHERE {$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id AND {$wpdb->term_relationships}.term_taxonomy_id = {$wpdb->terms}.term_id AND {$wpdb->terms}.name LIKE '%{$query}%')";
     }
     return $where;
 }
Пример #3
0
 public function init()
 {
     $this->uploads_only = apply_filters('wp_stack_cdn_uploads_only', defined('WP_STACK_CDN_UPLOADS_ONLY') ? WP_STACK_CDN_UPLOADS_ONLY : false);
     $this->extensions = apply_filters('wp_stack_cdn_extensions', array('jpe?g', 'gif', 'png', 'css', 'bmp', 'js', 'ico'));
     if (!is_admin()) {
         $this->hook('template_redirect');
         if ($this->uploads_only) {
             $this->hook('wp_stack_cdn_content', 'filter_uploads_only');
         } else {
             $this->hook('wp_stack_cdn_content', 'filter');
         }
         $this->site_domain = parse_url(get_bloginfo('url'), PHP_URL_HOST);
         $this->cdn_domain = defined('WP_STACK_CDN_DOMAIN') ? WP_STACK_CDN_DOMAIN : wpsf_get_setting(wpsf_get_option_group('../settings/settings-general.php'), 'cdn', 'cdn-enabled');
     }
 }
Пример #4
0
 static function cache_stats()
 {
     if (!is_admin()) {
         return;
     }
     if ('1' == wpsf_get_setting(wpsf_get_option_group('../settings/settings-general.php'), 'section_cache', 'cache-enabled')) {
         global $wpdb;
         $threshold = time() - 60;
         // count transient expiration records, total and expired
         $sql = "select count(*) as `total`, count(case when option_value < '{$threshold}' then 1 end) as `expired`\n\t\t\t\t\tfrom {$wpdb->options}\n\t\t\t\t\twhere (option_name like '\\_transient\\_timeout\\_section\\_cache\\_%')";
         $counts = $wpdb->get_row($sql);
         $query = $wpdb->get_row($sql);
         $expired = $query->expired;
         $count = $query->total;
         // delete expired transients, using the paired timeout record to find them
         $sql = "\n\t\t\t\t\t\tdelete from t1, t2\n\t\t\t\t\t\tusing {$wpdb->options} t1\n\t\t\t\t\t\tjoin {$wpdb->options} t2 on t2.option_name = replace(t1.option_name, '_timeout', '')\n\t\t\t\t\t\twhere (t1.option_name like '\\_transient\\_timeout\\_section\\_cache%')\n\t\t\t\t\t\tand t1.option_value < '{$threshold}';\n\t\t\t\t\t";
         $wpdb->query($sql);
         $out = sprintf('<br /><strong>%s</strong> total cached sections found.<br /><strong>%s</strong> stale sections were detected and deleted from the db.', $count, $expired);
         return $out;
     }
 }
 static function cache_stats()
 {
     if ('1' == wpsf_get_setting(wpsf_get_option_group('../settings/settings-general.php'), 'section_cache', 'cache-enabled')) {
         global $wpdb;
         $stale = 0;
         $where = "option_name LIKE '\\_transient_section_cache%'";
         $transients = $wpdb->get_col("SELECT option_name FROM {$wpdb->options} WHERE {$where}");
         $count = count($transients);
         $cache_key = self::pl_get_cache_key();
         foreach ($transients as $k => $name) {
             $key = str_replace('_transient_section_cache_', '', $name);
             $key = explode('_', $key);
             if ($key[0] != $cache_key) {
                 $stale++;
                 delete_transient(str_replace('_transient_', '', $name));
             }
         }
         $out = sprintf('<br /><strong>%s</strong> total cache sections found.<br /><strong>%s</strong> stale sections were detected and deleted from the db.', $count, $stale);
         return $out;
     }
 }
Пример #6
0
 function add_js()
 {
     if (!wp_script_is('cookiejs', 'queue')) {
         wp_enqueue_script('cookiejs', plugins_url(basename(__DIR__) . '/js/cookie.min.js'), array('jquery'));
     }
     wp_enqueue_script('check', plugins_url(basename(__DIR__) . '/js/check.js'), array('jquery'));
     wp_localize_script('check', 'check', array('ajaxurl' => admin_url('admin-ajax.php')));
     $param = wpsf_get_setting(wpsf_get_option_group(plugin_dir_path(__FILE__) . 'php/settings.php'), 'ppc', 'param');
     wp_localize_script('check', 'get', $param);
 }
Пример #7
0
 function bulk()
 {
     if ('1' === wpsf_get_setting(wpsf_get_option_group('../settings/settings-general.php'), 'bulk_edit', 'enabled')) {
         new PL_Bulk_edit();
     }
 }
Пример #8
0
 function lazyload()
 {
     if ('1' === wpsf_get_setting(wpsf_get_option_group('../settings/settings-general.php'), 'lazyload', 'enabled')) {
         new LazyLoad_Images_Pro();
     }
 }
Пример #9
0
 function advanced_search_query($where)
 {
     if (!defined('CORE_VERSION') || version_compare(CORE_VERSION, '2.1', '<')) {
         return $where;
     }
     if (is_search() && '1' === wpsf_get_setting(wpsf_get_option_group('../settings/settings-general.php'), 'search', 'enabled')) {
         global $wpdb;
         $query = get_search_query();
         $query = like_escape($query);
         $result = $this->search_sections($query);
         $where .= " OR {$wpdb->posts}.ID IN ( '{$result}' )";
     }
     return $where;
 }