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


PHP stats_get_option函数代码示例

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


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

示例1: make

 public static function make()
 {
     if (!self::is_usable()) {
         return null;
     }
     return new Prompt_Admin_Jetpack_Import(stats_get_option('blog_id'), 'http://' . STATS_DASHBOARD_SERVER . '/wp-admin/index.php', array('Jetpack_Client', 'remote_request'), JETPACK__API_VERSION, JETPACK__VERSION, JETPACK_MASTER_USER);
 }
开发者ID:postmatic,项目名称:beta-dist,代码行数:7,代码来源:jetpack-import.php

示例2: jetpack_stats_api_path

/**
 * Abstract out building the rest api stats path.
 *
 * @param  string $resource
 * @return string
 */
function jetpack_stats_api_path($resource = '')
{
    $resource = ltrim($resource, '/');
    return sprintf('/sites/%d/stats/%s', stats_get_option('blog_id'), $resource);
}
开发者ID:iamtakashi,项目名称:jetpack,代码行数:11,代码来源:stats.php

示例3: page_admin_scripts

 function page_admin_scripts()
 {
     if ($this->is_redirecting) {
         return;
         // No need for scripts on a fallback page
     }
     $is_dev_mode = Jetpack::is_development_mode();
     // Enqueue jp.js and localize it
     wp_enqueue_script('react-plugin', plugins_url('_inc/build/admin.js', JETPACK__PLUGIN_FILE), array(), JETPACK__VERSION, true);
     if (!$is_dev_mode) {
         // Required for Analytics
         wp_enqueue_script('jp-tracks', '//stats.wp.com/w.js', array(), gmdate('YW'), true);
     }
     $localeSlug = explode('_', get_locale());
     $localeSlug = $localeSlug[0];
     // Collecting roles that can view site stats
     $stats_roles = array();
     $enabled_roles = function_exists('stats_get_option') ? stats_get_option('roles') : array('administrator');
     foreach (get_editable_roles() as $slug => $role) {
         $stats_roles[$slug] = array('name' => translate_user_role($role['name']), 'canView' => is_array($enabled_roles) ? in_array($slug, $enabled_roles, true) : false);
     }
     $response = rest_do_request(new WP_REST_Request('GET', '/jetpack/v4/module/all'));
     $modules = $response->get_data();
     // Preparing translated fields for JSON encoding by transforming all HTML entities to
     // respective characters.
     foreach ($modules as $slug => $data) {
         $modules[$slug]['name'] = html_entity_decode($data['name']);
         $modules[$slug]['description'] = html_entity_decode($data['description']);
         $modules[$slug]['short_description'] = html_entity_decode($data['short_description']);
         $modules[$slug]['long_description'] = html_entity_decode($data['long_description']);
     }
     // Add objects to be passed to the initial state of the app
     wp_localize_script('react-plugin', 'Initial_State', array('WP_API_root' => esc_url_raw(rest_url()), 'WP_API_nonce' => wp_create_nonce('wp_rest'), 'pluginBaseUrl' => plugins_url('', JETPACK__PLUGIN_FILE), 'connectionStatus' => array('isActive' => Jetpack::is_active(), 'isStaging' => Jetpack::is_staging_site(), 'devMode' => array('isActive' => $is_dev_mode, 'constant' => defined('JETPACK_DEV_DEBUG') && JETPACK_DEV_DEBUG, 'url' => site_url() && false === strpos(site_url(), '.'), 'filter' => apply_filters('jetpack_development_mode', false)), 'isPublic' => '1' == get_option('blog_public'), 'isInIdentityCrisis' => Jetpack::validate_sync_error_idc_option()), 'dismissedNotices' => $this->get_dismissed_jetpack_notices(), 'isDevVersion' => Jetpack::is_development_version(), 'currentVersion' => JETPACK__VERSION, 'happinessGravIds' => jetpack_get_happiness_gravatar_ids(), 'getModules' => $modules, 'showJumpstart' => jetpack_show_jumpstart(), 'rawUrl' => Jetpack::build_raw_urls(get_home_url()), 'adminUrl' => esc_url(admin_url()), 'stats' => array('data' => array('general' => false, 'day' => false, 'week' => false, 'month' => false), 'roles' => $stats_roles), 'settingNames' => array('jetpack_holiday_snow_enabled' => function_exists('jetpack_holiday_snow_option_name') ? jetpack_holiday_snow_option_name() : false), 'userData' => array('currentUser' => jetpack_current_user_data()), 'locale' => $this->get_i18n_data(), 'localeSlug' => $localeSlug, 'jetpackStateNotices' => array('messageCode' => Jetpack::state('message'), 'errorCode' => Jetpack::state('error'), 'errorDescription' => Jetpack::state('error_description')), 'tracksUserData' => Jetpack_Tracks_Client::get_connected_user_tracks_identity(), 'currentIp' => function_exists('jetpack_protect_get_ip') ? jetpack_protect_get_ip() : false));
 }
开发者ID:netmagik,项目名称:netmagik,代码行数:34,代码来源:class.jetpack-react-page.php

示例4: stats_admin_bar_menu

function stats_admin_bar_menu(&$wp_admin_bar)
{
    $blog_id = stats_get_option('blog_id');
    $url = add_query_arg('page', 'stats', admin_url('admin.php'));
    // no menu_page_url() blog-side.
    $img_src = esc_attr(add_query_arg(array('noheader' => '', 'proxy' => '', 'chart' => 'admin-bar-hours-scale'), $url));
    $img_src_2x = esc_attr(add_query_arg(array('noheader' => '', 'proxy' => '', 'chart' => 'admin-bar-hours-scale-2x'), $url));
    $alt = esc_attr(__('Stats', 'jetpack'));
    $title = esc_attr(__('Views over 48 hours. Click for more Site Stats.', 'jetpack'));
    $menu = array('id' => 'stats', 'title' => "<div><script type='text/javascript'>var src;if(typeof(window.devicePixelRatio)=='undefined'||window.devicePixelRatio<2){src='{$img_src}';}else{src='{$img_src_2x}';}document.write('<img src=\\''+src+'\\' alt=\\'{$alt}\\' title=\\'{$title}\\' />');</script></div>", 'href' => $url);
    $wp_admin_bar->add_menu($menu);
}
开发者ID:valiror,项目名称:sharingdais_demo1,代码行数:12,代码来源:stats.php

示例5: stats_admin_bar_menu

function stats_admin_bar_menu(&$wp_admin_bar)
{
    $blog_id = stats_get_option('blog_id');
    $url = add_query_arg('page', 'stats', admin_url());
    $img_src = add_query_arg(array('noheader' => '', 'proxy' => '', 'chart' => 'admin-bar-hours', 'height' => 20, 'hours' => 48), $url);
    $title = __('Views over 48 hours. Click for more Site Stats.', 'stats');
    $menu = array('id' => 'stats', 'title' => "<img style='width:95px;height:20px' src='{$img_src}' alt='{$title}' title='{$title}' />", 'href' => $url);
    $wp_admin_bar->add_menu($menu);
}
开发者ID:hypenotic,项目名称:slowfood,代码行数:9,代码来源:stats.php

示例6: stats_dashboard_widget_content

function stats_dashboard_widget_content()
{
    $blog_id = stats_get_option('blog_id');
    if (!($width = (int) ($_GET['width'] / 2)) || $width < 250) {
        $width = 370;
    }
    if (!($height = (int) $_GET['height'] - 36) || $height < 230) {
        $height = 230;
    }
    $_width = $width - 5;
    $_height = $height - ($GLOBALS['is_winIE'] ? 16 : 5);
    // hack!
    $options = stats_dashboard_widget_options();
    $http = !empty($_SERVER['HTTPS']) ? 'https' : 'http';
    $src = clean_url("{$http}://dashboard.wordpress.com/wp-admin/index.php?page=estats&blog={$blog_id}&noheader=true&chart&unit={$options['chart']}&width={$_width}&height={$_height}");
    echo "<iframe id='stats-graph' class='stats-section' frameborder='0' style='width: {$width}px; height: {$height}px; overflow: hidden' src='{$src}'></iframe>";
    $post_ids = array();
    if (version_compare('2.7-z', $GLOBALS['wp_version'], '<=')) {
        $csv_args = array('top' => '&limit=8', 'active' => '&limit=5', 'search' => '&limit=5');
        $printf = __('%s %s Views');
    } else {
        $csv_args = array('top' => '', 'active' => '', 'search' => '');
        $printf = __('%s, %s views');
    }
    foreach ($top_posts = stats_get_csv('postviews', "days={$options['top']}{$csv_args['top']}") as $post) {
        $post_ids[] = $post['post_id'];
    }
    foreach ($active_posts = stats_get_csv('postviews', "days={$options['active']}{$csv_args['active']}") as $post) {
        $post_ids[] = $post['post_id'];
    }
    // cache
    get_posts(array('include' => join(',', array_unique($post_ids))));
    $searches = array();
    foreach ($search_terms = stats_get_csv('searchterms', "days={$options['search']}{$csv_args['search']}") as $search_term) {
        $searches[] = $search_term['searchterm'];
    }
    ?>
<div id="stats-info">
	<div id="top-posts" class='stats-section'>
		<div class="stats-section-inner">
		<h4 class="heading"><?php 
    _e('Top Posts');
    ?>
</h4>
		<?php 
    foreach ($top_posts as $post) {
        if (!get_post($post['post_id'])) {
            continue;
        }
        ?>
		<p><?php 
        printf($printf, '<a href="' . get_permalink($post['post_id']) . '">' . get_the_title($post['post_id']) . '</a>', number_format_i18n($post['views']));
        ?>
</p>
		<?php 
    }
    ?>
		</div>
	</div>
	<div id="top-search" class='stats-section'>
		<div class="stats-section-inner">
		<h4 class="heading"><?php 
    _e('Top Searches');
    ?>
</h4>
		<p><?php 
    echo join(',&nbsp; ', $searches);
    ?>
</p>
		</div>
	</div>
	<div id="active" class='stats-section'>
		<div class="stats-section-inner">
		<h4 class="heading"><?php 
    _e('Most Active');
    ?>
</h4>
		<?php 
    foreach ($active_posts as $post) {
        if (!get_post($post['post_id'])) {
            continue;
        }
        ?>
		<p><?php 
        printf($printf, '<a href="' . get_permalink($post['post_id']) . '">' . get_the_title($post['post_id']) . '</a>', number_format_i18n($post['views']));
        ?>
</p>
		<?php 
    }
    ?>
		</div>
	</div>
</div>
<br class="clear" />
<p class="textright">
	<a class="button" href="index.php?page=stats"><?php 
    _e('View All');
    ?>
</a>
</p>
//.........这里部分代码省略.........
开发者ID:SymbiSoft,项目名称:litprojects,代码行数:101,代码来源:stats.php

示例7: wpme_get_shortlink

 function wpme_get_shortlink($id = 0, $context = 'post', $allow_slugs = true)
 {
     global $wp_query;
     $blog_id = stats_get_option('blog_id');
     if ('query' == $context) {
         if (is_singular()) {
             $id = $wp_query->get_queried_object_id();
             $context = 'post';
         } elseif (is_front_page()) {
             $context = 'blog';
         } else {
             return '';
         }
     }
     if ('blog' == $context) {
         if (empty($id)) {
             $id = $blog_id;
         }
         return 'http://wp.me/' . wpme_dec2sixtwo($id);
     }
     $post = get_post($id);
     if (empty($post)) {
         return '';
     }
     $post_id = $post->ID;
     $type = '';
     if ($allow_slugs && 'publish' == $post->post_status && 'post' == $post->post_type && strlen($post->post_name) <= 8 && false === strpos($post->post_name, '%') && false === strpos($post->post_name, '-')) {
         $id = $post->post_name;
         $type = 's';
     } else {
         $id = wpme_dec2sixtwo($post_id);
         if ('page' == $post->post_type) {
             $type = 'P';
         } elseif ('post' == $post->post_type) {
             $type = 'p';
         } elseif ('attachment' == $post->post_type) {
             $type = 'a';
         }
     }
     if (empty($type)) {
         return '';
     }
     return 'http://wp.me/' . $type . wpme_dec2sixtwo($blog_id) . '-' . $id;
 }
开发者ID:sjcockell,项目名称:fuzzierlogic.blog,代码行数:44,代码来源:stats.php


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