当前位置: 首页>>代码示例>>PHP>>正文


PHP wp_statistics_searchengine_list函数代码示例

本文整理汇总了PHP中wp_statistics_searchengine_list函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_statistics_searchengine_list函数的具体用法?PHP wp_statistics_searchengine_list怎么用?PHP wp_statistics_searchengine_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wp_statistics_searchengine_list函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wp_statistics_shortcake

function wp_statistics_shortcake()
{
    // ShortCake support if loaded.
    if (function_exists('shortcode_ui_register_for_shortcode')) {
        $se_list = wp_statistics_searchengine_list();
        $se_options = array('' => 'None');
        foreach ($se_list as $se) {
            $se_options[$se['tag']] = $se['translated'];
        }
        shortcode_ui_register_for_shortcode('wpstatistics', array('label' => 'WP Statistics', 'listItemImage' => '<img src="' . plugin_dir_url(__FILE__) . 'assets/images/logo-250.png" width="128" height="128">', 'attrs' => array(array('label' => __('Statistic', 'wp_statistics'), 'attr' => 'stat', 'type' => 'select', 'description' => __('Select the statistic you wish to display.', 'wp_statistics'), 'value' => 'usersonline', 'options' => array('usersonline' => __('Users Online', 'wp_statistiscs'), 'visits' => __('Visits', 'wp_statistiscs'), 'visitors' => __('Visitors', 'wp_statistiscs'), 'pagevisits' => __('Page Visits', 'wp_statistiscs'), 'searches' => __('Searches', 'wp_statistiscs'), 'postcount' => __('Post Count', 'wp_statistiscs'), 'pagecount' => __('Page Count', 'wp_statistiscs'), 'commentcount' => __('Comment Count', 'wp_statistiscs'), 'spamcount' => __('Spam Count', 'wp_statistiscs'), 'usercount' => __('User Count', 'wp_statistiscs'), 'postaverage' => __('Post Average', 'wp_statistiscs'), 'commentaverage' => __('Comment Average', 'wp_statistiscs'), 'useraverage' => __('User Average', 'wp_statistiscs'), 'lpd' => __('Last Post Date', 'wp_statistiscs'))), array('label' => __('Time Frame', 'wp_statistics'), 'attr' => 'time', 'type' => 'url', 'description' => __('The time frame to get the statistic for, strtotime() (http://php.net/manual/en/datetime.formats.php) will be used to calculate it.', 'wp_statistics'), 'meta' => array('size' => '10')), array('label' => __('Search Provider', 'wp_statistics'), 'attr' => 'provider', 'type' => 'select', 'description' => __('The search provider to get statistics on.', 'wp_statistics'), 'options' => $se_options), array('label' => __('Number Format', 'wp_statistics'), 'attr' => 'format', 'type' => 'select', 'description' => __('The format to display numbers in: i18n, english, none.', 'wp_statistics'), 'value' => 'none', 'options' => array('none' => __('None', 'wp_statistics'), 'english' => __('English', 'wp_statistics'), 'i18n' => __('International', 'wp_statistics'))))));
    }
}
开发者ID:proj-2014,项目名称:vlan247-test-wp,代码行数:12,代码来源:shortcode.php

示例2: wp_statistics_searchengine_list

<script type="text/javascript">
	jQuery(document).ready(function(){
		postboxes.add_postbox_toggles(pagenow);
	});
</script>
<?php 
$search_engines = wp_statistics_searchengine_list();
$search_result['All'] = wp_statistics_searchword('all', 'total');
foreach ($search_engines as $key => $se) {
    $search_result[$key] = wp_statistics_searchword($key, 'total');
}
if (array_key_exists('referred', $_GET)) {
    if ($_GET['referred'] != '') {
        $referred = $_GET['referred'];
    } else {
        $referred = 'All';
    }
} else {
    $referred = 'All';
}
$total = $search_result[$referred];
?>
<div class="wrap">
	<?php 
screen_icon('options-general');
?>
	<h2><?php 
_e('Latest Search Words', 'wp_statistics');
?>
</h2>
	<ul class="subsubsub">
开发者ID:dtekcth,项目名称:datateknologer.se,代码行数:31,代码来源:last-search.php

示例3: wp_statistics_searchengine_regex

function wp_statistics_searchengine_regex($search_engine = 'all')
{
    // Get a complete list of search engines
    $searchengine_list = wp_statistics_searchengine_list();
    $search_query = '';
    // Are we getting results for all search engines or a specific one?
    if (strtolower($search_engine) == 'all') {
        foreach ($searchengine_list as $se) {
            // The SQL pattern for a search engine may be an array if it has to handle multiple domains (like google.com and google.ca) or other factors.
            if (is_array($se['regexpattern'])) {
                foreach ($se['regexpattern'] as $subse) {
                    $search_query .= "{$subse}|";
                }
            } else {
                $search_query .= "{$se['regexpattern']}|";
            }
        }
        // Trim off the last '|' for the loop above.
        $search_query = substr($search_query, 0, strlen($search_query) - 1);
    } else {
        // For just one?  Ok, the SQL pattern for a search engine may be an array if it has to handle multiple domains (like google.com and google.ca) or other factors.
        if (is_array($searchengine_list[$search_engine]['regexpattern'])) {
            foreach ($searchengine_list[$search_engine]['regexpattern'] as $se) {
                $search_query .= "{$se}|";
            }
            // Trim off the last '|' for the loop above.
            $search_query = substr($search_query, 0, strlen($search_query) - 1);
        } else {
            $search_query .= $searchengine_list[$search_engine]['regexpattern'];
        }
    }
    // Add the brackets and return
    return "({$search_query})";
}
开发者ID:proj-2014,项目名称:vlan247-test-wp,代码行数:34,代码来源:functions.php

示例4: Visitors

 public function Visitors()
 {
     global $wp_query, $WP_Statistics;
     // Get the pages or posts ID if it exists.
     if (is_object($wp_query)) {
         $this->current_page_id = $wp_query->get_queried_object_id();
     }
     if ($this->get_option('use_honeypot') && $this->get_option('honeypot_postid') > 0 && $this->get_option('honeypot_postid') == $this->current_page_id && $this->current_page_id > 0) {
         $this->exclusion_match = TRUE;
         $this->exclusion_reason = "honeypot";
     }
     // If we're a webcrawler or referral from ourselves or an excluded address don't record the visit.
     // The exception here is if we've matched a honey page, we want to lookup the user and flag them
     // as having been trapped in the honey pot for later exclusions.
     if ($this->exclusion_reason == 'honeypot' || !$this->exclusion_match) {
         // Check to see if we already have an entry in the database.
         if ($this->ip_hash != false) {
             $this->result = $this->db->get_row("SELECT * FROM {$this->tb_prefix}statistics_visitor WHERE `last_counter` = '{$this->Current_Date('Y-m-d')}' AND `ip` = '{$this->ip_hash}'");
         } else {
             $this->result = $this->db->get_row("SELECT * FROM {$this->tb_prefix}statistics_visitor WHERE `last_counter` = '{$this->Current_Date('Y-m-d')}' AND `ip` = '{$this->ip}' AND `agent` = '{$this->agent['browser']}' AND `platform` = '{$this->agent['platform']}' AND `version` = '{$this->agent['version']}'");
         }
         // Check to see if this is a visit to the honey pot page, flag it when we create the new entry.
         $honeypot = 0;
         if ($this->exclusion_reason == 'honeypot') {
             $honeypot = 1;
         }
         // If we don't create a new one, otherwise update the old one.
         if (!$this->result) {
             // If we've been told to store the entire user agent, do so.
             if ($this->get_option('store_ua') == true) {
                 $ua = $_SERVER['HTTP_USER_AGENT'];
             } else {
                 $ua = '';
             }
             // Store the result.
             // We'd normally use the WordPress insert function, but since we may run in to a race condition where another hit to the site has already created a new entry in the database
             // for this IP address we want to do an "INSERT IGNORE" which WordPress doesn't support.
             $sqlstring = $this->db->prepare('INSERT IGNORE INTO ' . $this->tb_prefix . 'statistics_visitor (last_counter, referred, agent, platform, version, ip, location, UAString, hits, honeypot) VALUES ( %s, %s, %s, %s, %s, %s, %s, %s, 1, %s )', $this->Current_date('Y-m-d'), $this->get_Referred(), $this->agent['browser'], $this->agent['platform'], $this->agent['version'], $this->ip_hash ? $this->ip_hash : $this->ip, $this->location, $ua, $honeypot);
             $this->db->query($sqlstring);
             // Now parse the referrer and store the results in the search table if the database has been converted.
             // Also make sure we actually inserted a row on the INSERT IGNORE above or we'll create duplicate entries.
             if ($this->get_option('search_converted') && $this->db->insert_id) {
                 $search_engines = wp_statistics_searchengine_list();
                 $referred = $this->get_Referred();
                 // Parse the URL in to it's component parts.
                 $parts = parse_url($referred);
                 // Loop through the SE list until we find which search engine matches.
                 foreach ($search_engines as $key => $value) {
                     $search_regex = wp_statistics_searchengine_regex($key);
                     preg_match('/' . $search_regex . '/', $parts['host'], $matches);
                     if (isset($matches[1])) {
                         $data['last_counter'] = $this->Current_date('Y-m-d');
                         $data['engine'] = $key;
                         $data['words'] = $WP_Statistics->Search_Engine_QueryString($referred);
                         $data['host'] = $parts['host'];
                         $data['visitor'] = $this->db->insert_id;
                         if ($data['words'] == 'No search query found!') {
                             $data['words'] = '';
                         }
                         $this->db->insert($this->db->prefix . 'statistics_search', $data);
                     }
                 }
             }
         } else {
             // Normally we've done all of our exclusion matching during the class creation, however for the robot threshold is calculated here to avoid another call the database.
             if ($this->get_option('robot_threshold') > 0 && $this->result->hits + 1 > $this->get_option('robot_threshold')) {
                 $this->exclusion_match = TRUE;
                 $this->exclusion_reason = "robot_threshold";
             } else {
                 if ($this->result->honeypot) {
                     $this->exclusion_match = TRUE;
                     $this->exclusion_reason = "honeypot";
                 } else {
                     $sqlstring = $this->db->prepare('UPDATE ' . $this->tb_prefix . 'statistics_visitor SET `hits` = `hits` + %d, `honeypot` = %d WHERE `ID` = %d', 1 - $honeypot, $honeypot, $this->result->ID);
                     $this->db->query($sqlstring);
                 }
             }
         }
     }
     if ($this->exclusion_match) {
         $this->RecordExclusion();
     }
 }
开发者ID:vanlong200880,项目名称:uni,代码行数:83,代码来源:hits.class.php

示例5: wp_statistics_summary_widget

function wp_statistics_summary_widget()
{
    global $WP_Statistics;
    // If the widget isn't visible, don't output the stats as they take too much memory and CPU to compute for no reason.
    if (($is_visible = wp_statistics_is_wp_widget_visible('wp-statistics-summary-widget', 'dashboard')) !== true) {
        echo $is_visible;
        return;
    }
    // Load the css we use for the statistics pages.
    wp_statistics_load_widget_css_and_scripts();
    // Include the hits chart widget, we're going to display the last 10 days only as the WordPress columns are kind of small to do much else.
    include_once dirname(__FILE__) . "/includes/log/widgets/summary.php";
    wp_statistics_generate_summary_postbox_content(wp_statistics_searchengine_list());
}
开发者ID:vanlong200880,项目名称:uni,代码行数:14,代码来源:dashboard.php

示例6: wp_statistics_searchengine_list

<?php

$selist = wp_statistics_searchengine_list(true);
if ($wps_nonce_valid) {
    // We need to handle a change in the report schedule manually, so check to see it has been set.
    if (array_key_exists('wps_time_report', $_POST)) {
        // If the report has been changed, we need to update the schedule.
        if ($WP_Statistics->get_option('time_report') != $_POST['wps_time_report']) {
            // Remove the old schedule if it exists.
            if (wp_next_scheduled('report_hook')) {
                wp_unschedule_event(wp_next_scheduled('report_hook'), 'report_hook');
            }
            // Setup the new schedule, we could just let this fall through and let the code in schedule.php deal with it
            // but that would require an extra page load to start the schedule so do it here instead.
            wp_schedule_event(time(), $_POST['wps_time_report'], 'report_hook');
        }
    }
    $wps_option_list = array("wps_stats_report", "wps_time_report", "wps_send_report", "wps_content_report", "wps_email_list", "wps_browscap_report", "wps_geoip_report", "wps_prune_report", "wps_upgrade_report");
    foreach ($wps_option_list as $option) {
        if (array_key_exists($option, $_POST)) {
            $value = $_POST[$option];
        } else {
            $value = '';
        }
        // WordPress escapes form data no matter what the setting of magic quotes is in PHP (http://www.theblog.ca/wordpress-addslashes-magic-quotes).
        $value = stripslashes($value);
        $new_option = str_replace("wps_", "", $option);
        $WP_Statistics->store_option($new_option, $value);
    }
}
?>
开发者ID:dtekcth,项目名称:datateknologer.se,代码行数:31,代码来源:wps-notifications.php

示例7: form


//.........这里部分代码省略.........
        _e('Total Visitor', 'wp_statistics');
        ?>
</label></li>

	<li><input type="checkbox" id="tpviews_widget" name="tpviews_widget" <?php 
        checked('on', $widget_options['tpviews_widget']);
        ?>
/>
	<label for="tpviews_widget"><?php 
        _e('Total Page Views', 'wp_statistics');
        ?>
</label></li>

	<li><input type="checkbox" id="ser_widget" class="ser_widget" name="ser_widget" <?php 
        checked('on', $widget_options['ser_widget']);
        ?>
/>
	<label for="ser_widget"><?php 
        _e('Search Engine Referred', 'wp_statistics');
        ?>
</label></li>

	<p id="ser_option" style="<?php 
        if (!$widget_options['ser_widget']) {
            echo "display: none;";
        }
        ?>
">
		<?php 
        _e('Select type of search engine', 'wp_statistics');
        ?>
:<br />
<?php 
        $search_engines = wp_statistics_searchengine_list();
        foreach ($search_engines as $se) {
            echo '		<input type="radio" id="select_' . $se['tag'] . '" name="select_se" value="' . $se['tag'] . '" ';
            checked($se['tag'], $widget_options['select_se']);
            echo "/>\n";
            echo '		<label for="' . $se['name'] . '">' . $se['translated'] . "</label>\n";
            echo "\n";
        }
        ?>
		<input type="radio" id="select_all" name="select_se" value="all" <?php 
        checked('all', $widget_options['select_se']);
        ?>
/>
		<label for="select_all"><?php 
        _e('All', 'wp_statistics');
        ?>
</label>
	</p>

	<li><input type="checkbox" id="tp_widget" name="tp_widget" <?php 
        checked('on', $widget_options['tp_widget']);
        ?>
/>
	<label for="tp_widget"><?php 
        _e('Total Posts', 'wp_statistics');
        ?>
</label></li>

	<li><input type="checkbox" id="tpg_widget" name="tpg_widget" <?php 
        checked('on', $widget_options['tpg_widget']);
        ?>
/>
	<label for="tpg_widget"><?php 
开发者ID:Ezyva2015,项目名称:money101.com.au,代码行数:67,代码来源:widget.php

示例8: Search_Engine_QueryString

 public function Search_Engine_QueryString($url = false)
 {
     // If no URL was passed in, get the current referrer for the session.
     if (!$url) {
         $url = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : false;
     }
     // If there is no URL and no referrer, always return false.
     if ($url == false) {
         return false;
     }
     // Parse the URL in to it's component parts.
     $parts = parse_url($url);
     // Check to see if there is a query component in the URL (everything after the ?).  If there isn't one
     // set an empty array so we don't get errors later.
     if (array_key_exists('query', $parts)) {
         parse_str($parts['query'], $query);
     } else {
         $query = array();
     }
     // Get the list of search engines we currently support.
     $search_engines = wp_statistics_searchengine_list();
     // Loop through the SE list until we find which search engine matches.
     foreach ($search_engines as $key => $value) {
         $search_regex = wp_statistics_searchengine_regex($key);
         preg_match('/' . $search_regex . '/', $parts['host'], $matches);
         if (isset($matches[1])) {
             // Check to see if the query key the SE uses exists in the query part of the URL.
             if (array_key_exists($search_engines[$key]['querykey'], $query)) {
                 $words = strip_tags($query[$search_engines[$key]['querykey']]);
             } else {
                 $words = '';
             }
             // If no words were found, return a pleasant default.
             if ($words == '') {
                 $words = 'No search query found!';
             }
             return $words;
         }
     }
     // We should never actually get to this point, but let's make sure we return something
     // just in case something goes terribly wrong.
     return 'No search query found!';
 }
开发者ID:bqevin,项目名称:wp-shopeasy,代码行数:43,代码来源:statistics.class.php

示例9: array

    if (array_key_exists('wps_historical_visitors', $_POST)) {
        $result = $wpdb->update($wp_prefix . "statistics_historical", array('value' => $_POST['wps_historical_visitors']), array('category' => 'visitors'));
        if ($result == 0) {
            $result = $wpdb->insert($wp_prefix . "statistics_historical", array('value' => $_POST['wps_historical_visitors'], 'category' => 'visitors', 'page_id' => -1, 'uri' => '-1'));
        }
    }
    if (array_key_exists('wps_historical_visits', $_POST)) {
        $result = $wpdb->update($wp_prefix . "statistics_historical", array('value' => $_POST['wps_historical_visits']), array('category' => 'visits'));
        if ($result == 0) {
            $result = $wpdb->insert($wp_prefix . "statistics_historical", array('value' => $_POST['wps_historical_visits'], 'category' => 'visits', 'page_id' => -2, 'uri' => '-2'));
        }
    }
}
if (array_key_exists('search', $_GET)) {
    // Make sure we get all the search engines, even the ones the disabled ones.
    $se_list = wp_statistics_searchengine_list();
    $total = 0;
    $limitsize = 10000;
    foreach ($se_list as $key => $se) {
        $sql = wp_statistics_searchengine_query($key);
        $rowcount = $wpdb->get_var("SELECT count(*) FROM `{$wpdb->prefix}statistics_visitor` WHERE {$sql}");
        $offset = 0;
        while ($rowcount > 0) {
            $result = $wpdb->get_results("SELECT * FROM `{$wpdb->prefix}statistics_visitor` WHERE {$sql} LIMIT {$offset}, {$limitsize}");
            foreach ($result as $row) {
                $parts = parse_url($row->referred);
                $data['last_counter'] = $row->last_counter;
                $data['engine'] = $key;
                $data['host'] = $parts['host'];
                $data['words'] = $WP_Statistics->Search_Engine_QueryString($row->referred);
                $data['visitor'] = $row->ID;
开发者ID:vanlong200880,项目名称:uni,代码行数:31,代码来源:wps-optimization.php

示例10: wp_statistics_get_widget_contents_callback

function wp_statistics_get_widget_contents_callback()
{
    global $WP_Statistics, $wpdb;
    // this is how you get access to the database
    $widgets = array('about', 'browsers', 'map', 'countries', 'hits', 'hitsmap', 'page', 'pages', 'quickstats', 'recent', 'referring', 'search', 'summary', 'top.visitors', 'words');
    $view_cap = wp_statistics_validate_capability($WP_Statistics->get_option('read_capability', 'manage_options'));
    if (current_user_can($view_cap)) {
        $widget = '';
        if (array_key_exists('widget', $_POST)) {
            // Get the widget we're going to display.
            if (in_array($_POST['widget'], $widgets)) {
                $widget = $_POST['widget'];
            }
        }
        if ('map' == $widget || 'hitsmap' == $widget) {
            if ($WP_Statistics->get_option('map_type') == 'jqvmap') {
                $widget = 'jqv.map';
            } else {
                $widget = 'google.map';
            }
        }
        if ('' == $widget) {
            _e('No matching widget found!', 'wp_statistics');
            wp_die();
        }
        $ISOCountryCode = $WP_Statistics->get_country_codes();
        $search_engines = wp_statistics_searchengine_list();
        require $WP_Statistics->plugin_dir . '/includes/log/widgets/' . $widget . '.php';
        switch ($widget) {
            case 'summary':
                wp_statistics_generate_summary_postbox_content($search_engines);
                break;
            case 'quickstats':
                wp_statistics_generate_quickstats_postbox_content($search_engines);
                break;
            case 'browsers':
                wp_statistics_generate_browsers_postbox_content();
                break;
            case 'referring':
                wp_statistics_generate_referring_postbox_content();
                break;
            case 'countries':
                wp_statistics_generate_countries_postbox_content($ISOCountryCode);
                break;
            case 'jqv.map':
            case 'google.map':
                wp_statistics_generate_map_postbox_content($ISOCountryCode);
                break;
            case 'hits':
                wp_statistics_generate_hits_postbox_content();
                break;
            case 'search':
                wp_statistics_generate_search_postbox_content($search_engines);
                break;
            case 'words':
                wp_statistics_generate_words_postbox_content($ISOCountryCode);
                break;
            case 'page':
                $pageid = (int) $_POST['page-id'];
                wp_statistics_generate_page_postbox_content(null, $pageid);
                break;
            case 'pages':
                list($total, $uris) = wp_statistics_get_top_pages();
                wp_statistics_generate_pages_postbox_content($total, $uris);
                break;
            case 'recent':
                wp_statistics_generate_recent_postbox_content($ISOCountryCode);
                break;
            case 'top.visitors':
                wp_statistics_generate_top_visitors_postbox_content($ISOCountryCode);
                break;
            case 'about':
                wp_statistics_generate_about_postbox_content($ISOCountryCode);
                break;
            default:
                _e('ERROR: Widget not found!', 'wp_statistics');
        }
    } else {
        _e('Access denied!', 'wp_statistics');
    }
    wp_die();
    // this is required to terminate immediately and return a proper response
}
开发者ID:ltdat287,项目名称:id.nhomdichvu,代码行数:83,代码来源:ajax.php


注:本文中的wp_statistics_searchengine_list函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。