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


PHP stats_array函数代码示例

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


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

示例1: https_stats_footer

function https_stats_footer()
{
    $protocol = !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ? "https://" : "http://";
    global $wp_the_query, $current_user;
    $options = stats_get_options();
    if (!empty($current_user->ID) || empty($options['blog_id'])) {
        return;
    }
    $a['blog'] = $options['blog_id'];
    $a['v'] = 'ext';
    if ($wp_the_query->is_single || $wp_the_query->is_page) {
        $a['post'] = $wp_the_query->get_queried_object_id();
    } else {
        $a['post'] = '0';
    }
    ?>
<script src="<?php 
    echo $protocol;
    ?>
stats.wordpress.com/e-<?php 
    echo gmdate('YW');
    ?>
.js" type="text/javascript"></script>
<script type="text/javascript">
st_go({<?php 
    echo stats_array($a);
    ?>
});
var load_cmc = function(){linktracker_init(<?php 
    echo "{$a['blog']},{$a['post']},2";
    ?>
);};
if ( typeof addLoadEvent != 'undefined' ) addLoadEvent(load_cmc);
else load_cmc();
</script>
<?php 
}
开发者ID:xentek,项目名称:https-stats-fix,代码行数:37,代码来源:https-stats-fix.php

示例2: stats_template_redirect

function stats_template_redirect()
{
    global $wp_the_query, $current_user, $stats_footer;
    if (is_feed() || is_robots() || is_trackback()) {
        return;
    }
    $options = stats_get_options();
    // Ensure this is always setup for the check below
    $options['reg_users'] = empty($options['reg_users']) ? false : true;
    if (!$options['reg_users'] && !empty($current_user->ID)) {
        return;
    }
    add_action('wp_footer', 'stats_footer', 101);
    add_action('wp_head', 'stats_add_shutdown_action');
    $blog = get_option('jetpack_id');
    $v = 'ext';
    $j = JETPACK__API_VERSION;
    if ($wp_the_query->is_single || $wp_the_query->is_page || $wp_the_query->is_posts_page) {
        $post = $wp_the_query->get_queried_object_id();
    } else {
        $post = '0';
    }
    $http = is_ssl() ? 'https' : 'http';
    $week = gmdate('YW');
    $data = stats_array(compact('v', 'j', 'blog', 'post'));
    $stats_footer = <<<END

\t<script src="{$http}://stats.wordpress.com/e-{$week}.js" type="text/javascript"></script>
\t<script type="text/javascript">
\tst_go({{$data}});
\tvar load_cmc = function(){linktracker_init({$blog},{$post},2);};
\tif ( typeof addLoadEvent != 'undefined' ) addLoadEvent(load_cmc);
\telse load_cmc();
\t</script>
END;
}
开发者ID:sajidsan,项目名称:sajidsan.github.io,代码行数:36,代码来源:stats.php

示例3: stats_template_redirect

function stats_template_redirect()
{
    global $current_user, $stats_footer;
    if (is_feed() || is_robots() || is_trackback() || is_preview()) {
        return;
    }
    // Should we be counting this user's views?
    if (!empty($current_user->ID)) {
        $count_roles = stats_get_option('count_roles');
        if (!array_intersect($current_user->roles, $count_roles)) {
            return;
        }
    }
    add_action('wp_footer', 'stats_footer', 101);
    add_action('wp_head', 'stats_add_shutdown_action');
    $script = set_url_scheme('//stats.wp.com/e-' . gmdate('YW') . '.js');
    $data = stats_build_view_data();
    $data_stats_array = stats_array($data);
    $stats_footer = <<<END
<script type='text/javascript' src='{$script}' async defer></script>
<script type='text/javascript'>
\t_stq = window._stq || [];
\t_stq.push([ 'view', {{$data_stats_array}} ]);
\t_stq.push([ 'clickTrackerInit', '{$data['blog']}', '{$data['post']}' ]);
</script>

END;
}
开发者ID:iamtakashi,项目名称:jetpack,代码行数:28,代码来源:stats.php

示例4: stats_template_redirect

function stats_template_redirect()
{
    global $wp_the_query, $current_user, $stats_footer;
    if (is_feed() || is_robots() || is_trackback()) {
        return;
    }
    $options = stats_get_options();
    // Should we be counting this user's views?
    if (!empty($current_user->ID)) {
        $count_roles = stats_get_option('count_roles');
        if (!array_intersect($current_user->roles, $count_roles)) {
            return;
        }
    }
    add_action('wp_footer', 'stats_footer', 101);
    add_action('wp_head', 'stats_add_shutdown_action');
    $blog = Jetpack_Options::get_option('id');
    $tz = get_option('gmt_offset');
    $v = 'ext';
    $j = sprintf('%s:%s', JETPACK__API_VERSION, JETPACK__VERSION);
    if ($wp_the_query->is_single || $wp_the_query->is_page || $wp_the_query->is_posts_page) {
        // Store and reset the queried_object and queried_object_id
        // Otherwise, redirect_canonical() will redirect to home_url( '/' ) for show_on_front = page sites where home_url() is not all lowercase.
        // Repro:
        // 1. Set home_url = http://ExamPle.com/
        // 2. Set show_on_front = page
        // 3. Set page_on_front = something
        // 4. Visit http://example.com/
        $queried_object = isset($wp_the_query->queried_object) ? $wp_the_query->queried_object : null;
        $queried_object_id = isset($wp_the_query->queried_object_id) ? $wp_the_query->queried_object_id : null;
        $post = $wp_the_query->get_queried_object_id();
        $wp_the_query->queried_object = $queried_object;
        $wp_the_query->queried_object_id = $queried_object_id;
    } else {
        $post = '0';
    }
    $http = is_ssl() ? 'https' : 'http';
    $week = gmdate('YW');
    $data = stats_array(compact('v', 'j', 'blog', 'post', 'tz'));
    $stats_footer = <<<END

\t<script src="{$http}://stats.wordpress.com/e-{$week}.js" type="text/javascript"></script>
\t<script type="text/javascript">
\tst_go({{$data}});
\tvar load_cmc = function(){linktracker_init({$blog},{$post},2);};
\tif ( typeof addLoadEvent != 'undefined' ) addLoadEvent(load_cmc);
\telse load_cmc();
\t</script>
END;
}
开发者ID:valiror,项目名称:sharingdais_demo1,代码行数:50,代码来源:stats.php

示例5: stats_footer

function stats_footer()
{
    global $wp_the_query, $current_user;
    $options = stats_get_options();
    echo "<!--stats_footer_test-->";
    if (!$options['footer']) {
        stats_set_option('footer', true);
    }
    if (empty($options['blog_id'])) {
        return;
    }
    if (!$options['reg_users'] && !empty($current_user->ID)) {
        return;
    }
    $a['blog'] = $options['blog_id'];
    $a['v'] = 'ext';
    if ($wp_the_query->is_single || $wp_the_query->is_page) {
        $a['post'] = $wp_the_query->get_queried_object_id();
    } else {
        $a['post'] = '0';
    }
    $http = is_ssl() ? 'https' : 'http';
    ?>
<script src="<?php 
    echo $http;
    ?>
://stats.wordpress.com/e-<?php 
    echo gmdate('YW');
    ?>
.js" type="text/javascript"></script>
<script type="text/javascript">
st_go({<?php 
    echo stats_array($a);
    ?>
});
var load_cmc = function(){linktracker_init(<?php 
    echo "{$a['blog']},{$a['post']},2";
    ?>
);};
if ( typeof addLoadEvent != 'undefined' ) addLoadEvent(load_cmc);
else load_cmc();
</script>
<?php 
}
开发者ID:hypenotic,项目名称:slowfood,代码行数:44,代码来源:stats.php

示例6: stats_template_redirect

function stats_template_redirect()
{
    global $wp_the_query, $current_user, $stats_footer;
    if (is_feed() || is_robots() || is_trackback() || is_preview()) {
        return;
    }
    $options = stats_get_options();
    // Should we be counting this user's views?
    if (!empty($current_user->ID)) {
        $count_roles = stats_get_option('count_roles');
        if (!array_intersect($current_user->roles, $count_roles)) {
            return;
        }
    }
    add_action('wp_footer', 'stats_footer', 101);
    add_action('wp_head', 'stats_add_shutdown_action');
    $blog = Jetpack_Options::get_option('id');
    $tz = get_option('gmt_offset');
    $v = 'ext';
    $blog_url = parse_url(site_url());
    $srv = $blog_url['host'];
    $j = sprintf('%s:%s', JETPACK__API_VERSION, JETPACK__VERSION);
    if ($wp_the_query->is_single || $wp_the_query->is_page || $wp_the_query->is_posts_page) {
        // Store and reset the queried_object and queried_object_id
        // Otherwise, redirect_canonical() will redirect to home_url( '/' ) for show_on_front = page sites where home_url() is not all lowercase.
        // Repro:
        // 1. Set home_url = http://ExamPle.com/
        // 2. Set show_on_front = page
        // 3. Set page_on_front = something
        // 4. Visit http://example.com/
        $queried_object = isset($wp_the_query->queried_object) ? $wp_the_query->queried_object : null;
        $queried_object_id = isset($wp_the_query->queried_object_id) ? $wp_the_query->queried_object_id : null;
        $post = $wp_the_query->get_queried_object_id();
        $wp_the_query->queried_object = $queried_object;
        $wp_the_query->queried_object_id = $queried_object_id;
    } else {
        $post = '0';
    }
    $script = set_url_scheme('//stats.wp.com/e-' . gmdate('YW') . '.js');
    $data = stats_array(compact('v', 'j', 'blog', 'post', 'tz', 'srv'));
    $stats_footer = <<<END
<script type='text/javascript' src='{$script}' async defer></script>
<script type='text/javascript'>
\t_stq = window._stq || [];
\t_stq.push([ 'view', {{$data}} ]);
\t_stq.push([ 'clickTrackerInit', '{$blog}', '{$post}' ]);
</script>

END;
}
开发者ID:annbransom,项目名称:techishowl_prod_backup,代码行数:50,代码来源:stats.php

示例7: stats_template_redirect

function stats_template_redirect()
{
    global $wp_the_query, $current_user, $stats_footer;
    if (is_feed() || is_robots() || is_trackback()) {
        return;
    }
    $options = stats_get_options();
    // Ensure this is always setup for the check below
    $options['reg_users'] = empty($options['reg_users']) ? false : true;
    if (!$options['reg_users'] && !empty($current_user->ID)) {
        return;
    }
    add_action('wp_footer', 'stats_footer', 101);
    add_action('wp_head', 'stats_add_shutdown_action');
    $blog = Jetpack::get_option('id');
    $v = 'ext';
    $j = sprintf('%s:%s', JETPACK__API_VERSION, JETPACK__VERSION);
    if ($wp_the_query->is_single || $wp_the_query->is_page || $wp_the_query->is_posts_page) {
        // Store and reset the queried_object and queried_object_id
        // Otherwise, redirect_canonical() will redirect to home_url( '/' ) for show_on_front = page sites where home_url() is not all lowercase.
        // Repro:
        // 1. Set home_url = http://ExamPle.com/
        // 2. Set show_on_front = page
        // 3. Set page_on_front = something
        // 4. Visit http://example.com/
        $queried_object = isset($wp_the_query->queried_object) ? $wp_the_query->queried_object : null;
        $queried_object_id = isset($wp_the_query->queried_object_id) ? $wp_the_query->queried_object_id : null;
        $post = $wp_the_query->get_queried_object_id();
        $wp_the_query->queried_object = $queried_object;
        $wp_the_query->queried_object_id = $queried_object_id;
    } else {
        $post = '0';
    }
    $http = is_ssl() ? 'https' : 'http';
    $week = gmdate('YW');
    $data = stats_array(compact('v', 'j', 'blog', 'post'));
    $stats_footer = <<<END

\t<script src="{$http}://stats.wordpress.com/e-{$week}.js" type="text/javascript"></script>
\t<script type="text/javascript">
\tst_go({{$data}});
\tvar load_cmc = function(){linktracker_init({$blog},{$post},2);};
\tif ( typeof addLoadEvent != 'undefined' ) addLoadEvent(load_cmc);
\telse load_cmc();
\t</script>
END;
    if (isset($options['hide_smile']) && $options['hide_smile']) {
        $stats_footer .= "\n<style type='text/css'>img#wpstats{display:none}</style>";
    }
}
开发者ID:burbridge,项目名称:thesis2013website,代码行数:50,代码来源:stats.php


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