本文整理汇总了PHP中get_user_count函数的典型用法代码示例。如果您正苦于以下问题:PHP get_user_count函数的具体用法?PHP get_user_count怎么用?PHP get_user_count使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_user_count函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_sitestats
/**
* Gets the network's site and user counts.
*
* @since MU 1.0
* @uses get_blog_count()
* @uses get_user_count()
*
* @return array Site and user count for the network.
*/
function get_sitestats()
{
global $wpdb;
$stats['blogs'] = get_blog_count();
$stats['users'] = get_user_count();
return $stats;
}
示例2: wp_version_check
/**
* Check WordPress version against the newest version.
*
* The WordPress version, PHP version, and Locale is sent. Checks against the
* WordPress server at api.wordpress.org server. Will only check if WordPress
* isn't installing.
*
* @package WordPress
* @since 2.3.0
* @uses $wp_version Used to check against the newest WordPress version.
*
* @return mixed Returns null if update is unsupported. Returns false if check is too soon.
*/
function wp_version_check()
{
if (defined('WP_INSTALLING')) {
return;
}
global $wp_version, $wpdb, $wp_local_package, $wpmu_version, $current_site;
$php_version = phpversion();
$current = get_transient('update_core');
if (!is_object($current)) {
$current = new stdClass();
$current->updates = array();
$current->version_checked = $wp_version;
}
$locale = apply_filters('core_version_check_locale', get_locale());
// Update last_checked for current to prevent multiple blocking requests if request hangs
$current->last_checked = time();
set_transient('update_core', $current);
if (method_exists($wpdb, 'db_version')) {
$mysql_version = preg_replace('/[^0-9.].*/', '', $wpdb->db_version());
} else {
$mysql_version = 'N/A';
}
$local_package = isset($wp_local_package) ? $wp_local_package : '';
$url = "http://api.wordpress.org/core/version-check/1.3-mu/?version={$wp_version}&wpmu_version={$wpmu_version}&php={$php_version}&locale={$locale}&mysql={$mysql_version}&local_package={$local_package}&blogs=" . get_blog_count() . "&users=" . get_user_count();
$options = array('timeout' => defined('DOING_CRON') && DOING_CRON ? 30 : 3, 'user-agent' => 'WordPress MU/' . $wpmu_version . '; ' . apply_filters('currentsite_on_version_check', 'http://' . $current_site->domain . $current_site->path));
$response = wp_remote_get($url, $options);
if (is_wp_error($response)) {
return false;
}
if (200 != $response['response']['code']) {
return false;
}
$body = trim($response['body']);
$body = str_replace(array("\r\n", "\r"), "\n", $body);
$new_options = array();
foreach (explode("\n\n", $body) as $entry) {
$returns = explode("\n", $entry);
$new_option = new stdClass();
$new_option->response = esc_attr($returns[0]);
if (isset($returns[1])) {
$new_option->url = esc_url($returns[1]);
}
if (isset($returns[2])) {
$new_option->package = esc_url($returns[2]);
}
if (isset($returns[3])) {
$new_option->current = esc_attr($returns[3]);
}
if (isset($returns[4])) {
$new_option->locale = esc_attr($returns[4]);
}
$new_options[] = $new_option;
}
$updates = new stdClass();
$updates->updates = $new_options;
$updates->last_checked = time();
$updates->version_checked = $wp_version;
set_transient('update_core', $updates);
}
示例3: get_sitestats
/**
* Gets the network's site and user counts.
*
* @since MU 1.0
* @uses get_blog_count()
* @uses get_user_count()
*
* @return array Site and user count for the network.
*/
function get_sitestats() {
global $wpdb;
$stats = array(
'blogs' => get_blog_count(),
'users' => get_user_count(),
);
return $stats;
}
示例4: get_views
protected function get_views()
{
global $role;
$total_users = get_user_count();
$super_admins = get_super_admins();
$total_admins = count($super_admins);
$class = $role != 'super' ? ' class="current"' : '';
$role_links = array();
$role_links['all'] = "<a href='" . network_admin_url('users.php') . "'{$class}>" . sprintf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users'), number_format_i18n($total_users)) . '</a>';
$class = $role == 'super' ? ' class="current"' : '';
$role_links['super'] = "<a href='" . network_admin_url('users.php?role=super') . "'{$class}>" . sprintf(_n('Super Admin <span class="count">(%s)</span>', 'Super Admins <span class="count">(%s)</span>', $total_admins), number_format_i18n($total_admins)) . '</a>';
return $role_links;
}
示例5: index
function index()
{
if (c("wxValid")) {
$signature = $_GET["signature"];
$timestamp = $_GET["timestamp"];
$nonce = $_GET["nonce"];
$echoStr = $_GET["echostr"];
$postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
die($this->valid($echoStr, $signature, $timestamp, $nonce));
}
$postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
$postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
$GLOBALS['fromUsername'] = $postObj->FromUserName;
$GLOBALS['toUsername'] = $postObj->ToUserName;
$event = $postObj->Event;
$eventKey = $postObj->EventKey;
$keyword = z(t($postObj->Content));
//订阅事件,发送欢迎词
if ($event == "subscribe") {
$text = c("subscribe");
die($this->creat_xml_response($text));
}
//自定义菜单的点击事件
if ($event == "CLICK") {
switch ($eventKey) {
case 'V1001_RANK_LUCKY':
$votecount = 10 - get_user_count(g("fromUsername"));
$msg = "您还剩余{$votecount}票";
die($this->creat_xml_response($msg));
break;
case 'V1001_INREODUCE':
$title = "";
$description = "";
$picUrl = "";
$url = "";
die($this->creat_pic_response($title, $description, $picUrl, $url));
break;
default:
break;
}
}
//进行投票操作
$openId = g("fromUsername");
if ($keyword != "") {
$workId = strtoupper($keyword);
$text = send_vote($openId, $workId);
}
}
示例6: dashboard_signups
public function dashboard_signups()
{
global $gMemberNetwork;
$query = new \WP_User_Query(array('blog_id' => 0, 'orderby' => 'registered', 'order' => 'DESC', 'number' => 12, 'fields' => array('ID', 'display_name', 'user_email', 'user_registered', 'user_login')));
if (empty($query->results)) {
_ex('No User?!', 'Signup Admin Widget', GMEMBER_TEXTDOMAIN);
} else {
echo '<table class="widefat gmember-dashboard -table-signup"><thead><tr>';
echo '<th>' . _x('On', 'Signup Admin Widget', GMEMBER_TEXTDOMAIN) . '</th>';
echo '<th>' . _x('Name', 'Signup Admin Widget', GMEMBER_TEXTDOMAIN) . '</th>';
echo '<th>' . _x('E-mail', 'Signup Admin Widget', GMEMBER_TEXTDOMAIN) . '</th>';
echo '</tr></thead>';
$last = FALSE;
$alt = TRUE;
$template = '<tr%1$s>' . '<td class="-month-day" title="%5$s">%4$s</td>' . '<td class="-edit-link"><a title="%8$s" href="%6$s" target="_blank">%2$s</a></td>' . '<td class="-mail-link"><a title="%7$s" href="%7$s" target="_blank">%3$s</a></td>' . '</tr>';
foreach ($query->results as $user) {
$registered = strtotime(get_date_from_gmt($user->user_registered));
vprintf($template, array($alt ? ' class="alternate"' : '', esc_html($user->display_name), esc_html(gPluginTextHelper::truncateString($user->user_email, 32)), esc_html($gMemberNetwork->getDate($registered, 'monthday')), esc_attr(human_time_diff($registered) . ' — ' . $gMemberNetwork->getDate($registered)), get_edit_user_link($user->ID), 'mailto:' . esc_attr($user->user_email), $user->user_login));
$alt = !$alt;
if (!$last) {
$last = $registered;
}
}
echo '</table>';
echo '<table class="gmember-dashboard -table-summary"></tbody>';
echo '<tr><td>';
printf(_x('Last User Registered %s ago', 'Signup Admin Widget', GMEMBER_TEXTDOMAIN), human_time_diff($last));
echo '</td><td>';
if ($spam_users = $gMemberNetwork->get_spam_count()) {
printf(_nx('With %s Spam User', 'With %s Spam Users', $spam_users, 'Signup Admin Widget', GMEMBER_TEXTDOMAIN), number_format_i18n($spam_users));
} else {
_ex('With No Spam User', 'Signup Admin Widget', GMEMBER_TEXTDOMAIN);
}
echo '</td></tr><tr><td>';
$super_admins = count(get_super_admins());
printf(_nx('And %s Super Admin', 'And %s Super Admins', $super_admins, 'Signup Admin Widget', GMEMBER_TEXTDOMAIN), number_format_i18n($super_admins));
echo '</td><td>';
$user_count = get_user_count();
printf(_nx('Total of One User', 'Total of %s Users', $user_count, 'Signup Admin Widget', GMEMBER_TEXTDOMAIN), number_format_i18n($user_count));
echo '</td></tr>';
echo '</tbody></table>';
}
}
示例7: user_list
/**
* 返回用户列表数据
*
* @access public
* @param
*
* @return void
*/
function user_list()
{
$result = get_filter();
if ($result === false) {
/* 过滤条件 */
$filter['keywords'] = empty($_REQUEST['keywords']) ? '' : trim($_REQUEST['keywords']);
if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
$filter['keywords'] = json_str_iconv($filter['keywords']);
}
$filter['rank'] = empty($_REQUEST['rank']) ? 0 : intval($_REQUEST['rank']);
$filter['pay_points_gt'] = empty($_REQUEST['pay_points_gt']) ? 0 : intval($_REQUEST['pay_points_gt']);
$filter['pay_points_lt'] = empty($_REQUEST['pay_points_lt']) ? 0 : intval($_REQUEST['pay_points_lt']);
$filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'user_id' : trim($_REQUEST['sort_by']);
$filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
$ex_where = ' WHERE 1 ';
if (isset($_REQUEST['sign'])) {
if ($_REQUEST['sign'] == 1) {
$ex_where .= " AND parent_id = 0 AND is_fenxiao <> 0 AND is_fenxiao = 1";
}
if ($_REQUEST['sign'] == 2) {
$ex_where .= " AND parent_id > 0 AND is_fenxiao <> 0 AND is_fenxiao = 1";
}
if ($_REQUEST['sign'] == 3) {
$ex_where .= " AND is_fenxiao <> 1 ";
}
}
if ($filter['keywords']) {
$ex_where .= " AND user_name LIKE '%" . mysql_like_quote($filter['keywords']) . "%'";
}
if ($filter['rank']) {
$sql = "SELECT min_points, max_points, special_rank FROM " . $GLOBALS['ecs']->table('user_rank') . " WHERE rank_id = '{$filter['rank']}'";
$row = $GLOBALS['db']->getRow($sql);
if ($row['special_rank'] > 0) {
/* 特殊等级 */
$ex_where .= " AND user_rank = '{$filter['rank']}' ";
} else {
$ex_where .= " AND rank_points >= " . intval($row['min_points']) . " AND rank_points < " . intval($row['max_points']);
}
}
if ($filter['pay_points_gt']) {
$ex_where .= " AND pay_points >= '{$filter['pay_points_gt']}' ";
}
if ($filter['pay_points_lt']) {
$ex_where .= " AND pay_points < '{$filter['pay_points_lt']}' ";
}
$filter['record_count'] = $GLOBALS['db']->getOne("SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('users') . $ex_where);
/* 分页大小 */
$filter = page_and_size($filter);
$sql = "SELECT user_id, user_name, email, is_validated, validated,status,user_money, frozen_money, rank_points, pay_points, reg_time,is_fenxiao,parent_id " . " FROM " . $GLOBALS['ecs']->table('users') . $ex_where . " ORDER by " . $filter['sort_by'] . ' ' . $filter['sort_order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
$filter['keywords'] = stripslashes($filter['keywords']);
set_filter($filter, $sql);
} else {
$sql = $result['sql'];
$filter = $result['filter'];
}
$user_list = $GLOBALS['db']->getAll($sql);
$count = count($user_list);
for ($i = 0; $i < $count; $i++) {
$user_list[$i]['reg_time'] = local_date($GLOBALS['_CFG']['date_format'], $user_list[$i]['reg_time']);
$user_list[$i]['upper_user_name'] = get_upper_level($user_list[$i]['parent_id']);
$one_level_user_count = get_user_count($user_list[$i]['user_id'], 1);
$two_level_user_count = get_user_count($user_list[$i]['user_id'], 2);
$three_level_user_count = get_user_count($user_list[$i]['user_id'], 3);
$user_list[$i]['one_level_user_count'] = $one_level_user_count;
$user_list[$i]['two_level_user_count'] = $two_level_user_count;
$user_list[$i]['three_level_user_count'] = $three_level_user_count;
$user_list[$i]['total_user'] = $one_level_user_count + $two_level_user_count + $three_level_user_count;
}
$arr = array('user_list' => $user_list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
return $arr;
}
示例8: wp_version_check
/**
* Check WordPress version against the newest version.
*
* The WordPress version, PHP version, and Locale is sent. Checks against the
* WordPress server at api.wordpress.org server. Will only check if WordPress
* isn't installing.
*
* @since 2.3.0
* @global string $wp_version Used to check against the newest WordPress version.
* @global wpdb $wpdb
* @global string $wp_local_package
*
* @param array $extra_stats Extra statistics to report to the WordPress.org API.
* @param bool $force_check Whether to bypass the transient cache and force a fresh update check. Defaults to false, true if $extra_stats is set.
*/
function wp_version_check($extra_stats = array(), $force_check = false)
{
if (wp_installing()) {
return;
}
global $wp_version, $wpdb, $wp_local_package;
// include an unmodified $wp_version
include ABSPATH . WPINC . '/version.php';
$php_version = phpversion();
$current = get_site_transient('update_core');
$translations = wp_get_installed_translations('core');
// Invalidate the transient when $wp_version changes
if (is_object($current) && $wp_version != $current->version_checked) {
$current = false;
}
if (!is_object($current)) {
$current = new stdClass();
$current->updates = array();
$current->version_checked = $wp_version;
}
if (!empty($extra_stats)) {
$force_check = true;
}
// Wait 60 seconds between multiple version check requests
$timeout = 60;
$time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
if (!$force_check && $time_not_changed) {
return;
}
/**
* Filter the locale requested for WordPress core translations.
*
* @since 2.8.0
*
* @param string $locale Current locale.
*/
$locale = apply_filters('core_version_check_locale', get_locale());
// Update last_checked for current to prevent multiple blocking requests if request hangs
$current->last_checked = time();
set_site_transient('update_core', $current);
if (method_exists($wpdb, 'db_version')) {
$mysql_version = preg_replace('/[^0-9.].*/', '', $wpdb->db_version());
} else {
$mysql_version = 'N/A';
}
if (is_multisite()) {
$user_count = get_user_count();
$num_blogs = get_blog_count();
$wp_install = network_site_url();
$multisite_enabled = 1;
} else {
$user_count = count_users();
$user_count = $user_count['total_users'];
$multisite_enabled = 0;
$num_blogs = 1;
$wp_install = home_url('/');
}
$query = array('version' => $wp_version, 'php' => $php_version, 'locale' => $locale, 'mysql' => $mysql_version, 'local_package' => isset($wp_local_package) ? $wp_local_package : '', 'blogs' => $num_blogs, 'users' => $user_count, 'multisite_enabled' => $multisite_enabled, 'initial_db_version' => get_site_option('initial_db_version'));
$post_body = array('translations' => wp_json_encode($translations));
if (is_array($extra_stats)) {
$post_body = array_merge($post_body, $extra_stats);
}
$url = $http_url = 'http://api.wordpress.org/core/version-check/1.7/?' . http_build_query($query, null, '&');
if ($ssl = wp_http_supports(array('ssl'))) {
$url = set_url_scheme($url, 'https');
}
$options = array('timeout' => defined('DOING_CRON') && DOING_CRON ? 30 : 3, 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url('/'), 'headers' => array('wp_install' => $wp_install, 'wp_blog' => home_url('/')), 'body' => $post_body);
$response = wp_remote_post($url, $options);
if ($ssl && is_wp_error($response)) {
trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.') . ' ' . __('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE);
$response = wp_remote_post($http_url, $options);
}
if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
return;
}
$body = trim(wp_remote_retrieve_body($response));
$body = json_decode($body, true);
if (!is_array($body) || !isset($body['offers'])) {
return;
}
$offers = $body['offers'];
foreach ($offers as &$offer) {
foreach ($offer as $offer_key => $value) {
if ('packages' == $offer_key) {
$offer['packages'] = (object) array_intersect_key(array_map('esc_url', $offer['packages']), array_fill_keys(array('full', 'no_content', 'new_bundled', 'partial', 'rollback'), ''));
//.........这里部分代码省略.........
示例9: test_get_user_count
function test_get_user_count() {
// Refresh the cache
wp_update_network_counts();
$start_count = get_user_count();
// Only false for large networks as of 3.7
add_filter( 'enable_live_network_counts', '__return_false' );
$this->factory->user->create( array( 'role' => 'administrator' ) );
$count = get_user_count(); // No change, cache not refreshed
$this->assertEquals( $start_count, $count );
wp_update_network_counts(); // Magic happens here
$count = get_user_count();
$this->assertEquals( $start_count + 1, $count );
remove_filter( 'enable_live_network_counts', '__return_false' );
}
示例10: wp_network_dashboard_right_now
/**
* @since 3.1.0
*/
function wp_network_dashboard_right_now()
{
$actions = array();
if (current_user_can('create_sites')) {
$actions['create-site'] = '<a href="' . network_admin_url('site-new.php') . '">' . __('Create a New Site') . '</a>';
}
if (current_user_can('create_users')) {
$actions['create-user'] = '<a href="' . network_admin_url('user-new.php') . '">' . __('Create a New User') . '</a>';
}
$c_users = get_user_count();
$c_blogs = get_blog_count();
$user_text = sprintf(_n('%s user', '%s users', $c_users), number_format_i18n($c_users));
$blog_text = sprintf(_n('%s site', '%s sites', $c_blogs), number_format_i18n($c_blogs));
$sentence = sprintf(__('You have %1$s and %2$s.'), $blog_text, $user_text);
if ($actions) {
echo '<ul class="subsubsub">';
foreach ($actions as $class => $action) {
$actions[$class] = "\t<li class='{$class}'>{$action}";
}
echo implode(" |</li>\n", $actions) . "</li>\n";
echo '</ul>';
}
?>
<br class="clear" />
<p class="youhave"><?php
echo $sentence;
?>
</p>
<?php
/**
* Fires in the Network Admin 'Right Now' dashboard widget
* just before the user and site search form fields.
*
* @since MU
*
* @param null $unused
*/
do_action('wpmuadminresult', '');
?>
<form action="<?php
echo network_admin_url('users.php');
?>
" method="get">
<p>
<label class="screen-reader-text" for="search-users"><?php
_e('Search Users');
?>
</label>
<input type="search" name="s" value="" size="30" autocomplete="off" id="search-users"/>
<?php
submit_button(__('Search Users'), 'button', false, false, array('id' => 'submit_users'));
?>
</p>
</form>
<form action="<?php
echo network_admin_url('sites.php');
?>
" method="get">
<p>
<label class="screen-reader-text" for="search-sites"><?php
_e('Search Sites');
?>
</label>
<input type="search" name="s" value="" size="30" autocomplete="off" id="search-sites"/>
<?php
submit_button(__('Search Sites'), 'button', false, false, array('id' => 'submit_sites'));
?>
</p>
</form>
<?php
/**
* Fires at the end of the 'Right Now' widget in the Network Admin dashboard.
*
* @since MU
*/
do_action('mu_rightnow_end');
/**
* Fires at the end of the 'Right Now' widget in the Network Admin dashboard.
*
* @since MU
*/
do_action('mu_activity_box_end');
}
示例11: user_list
/**
* 返回分销等级会员列表数据
*
* @access public
* @param
*
* @return void
*/
function user_list($user_id, $level)
{
$filter = array();
$filter['record_count'] = get_user_count($user_id, $level);
/* 分页大小 */
$filter = page_and_size($filter);
$up_uid = "'{$user_id}'";
for ($i = 1; $i <= $level; $i++) {
$count = 0;
if ($up_uid) {
$sql = "SELECT user_id FROM " . $GLOBALS['ecs']->table('users') . " WHERE parent_id IN({$up_uid})";
$query = $GLOBALS['db']->query($sql);
$up_uid = '';
while ($rt = $GLOBALS['db']->fetch_array($query)) {
$up_uid .= $up_uid ? ",'{$rt['user_id']}'" : "'{$rt['user_id']}'";
$count++;
}
}
}
if ($count) {
$sql = "SELECT user_id, user_name, email, is_validated, user_money, frozen_money, rank_points, pay_points, reg_time " . " FROM " . $GLOBALS['ecs']->table('users') . " WHERE user_id IN({$up_uid})";
$res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']);
while ($rows = $GLOBALS['db']->fetchRow($res)) {
$arr[] = $rows;
}
}
if (!empty($arr)) {
return array('arr' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
}
示例12: wp_version_check
/**
* Check WordPress version against the newest version.
*
* The WordPress version, PHP version, and Locale is sent. Checks against the
* WordPress server at api.wordpress.org server. Will only check if WordPress
* isn't installing.
*
* @package WordPress
* @since 2.3.0
* @uses $wp_version Used to check against the newest WordPress version.
*
* @return mixed Returns null if update is unsupported. Returns false if check is too soon.
*/
function wp_version_check()
{
if (defined('WP_INSTALLING')) {
return;
}
global $wpdb, $wp_local_package;
include ABSPATH . WPINC . '/version.php';
// include an unmodified $wp_version
$php_version = phpversion();
$current = get_site_transient('update_core');
if (!is_object($current)) {
$current = new stdClass();
$current->updates = array();
$current->version_checked = $wp_version;
}
$locale = apply_filters('core_version_check_locale', get_locale());
// Update last_checked for current to prevent multiple blocking requests if request hangs
$current->last_checked = time();
set_site_transient('update_core', $current);
if (method_exists($wpdb, 'db_version')) {
$mysql_version = preg_replace('/[^0-9.].*/', '', $wpdb->db_version());
} else {
$mysql_version = 'N/A';
}
if (is_multisite()) {
$user_count = get_user_count();
$num_blogs = get_blog_count();
$wp_install = network_site_url();
$multisite_enabled = 1;
} else {
$user_count = count_users();
$multisite_enabled = 0;
$num_blogs = 1;
$wp_install = home_url('/');
}
$local_package = isset($wp_local_package) ? $wp_local_package : '';
$url = "http://api.wordpress.org/core/version-check/1.6/?version={$wp_version}&php={$php_version}&locale={$locale}&mysql={$mysql_version}&local_package={$local_package}&blogs={$num_blogs}&users={$user_count['total_users']}&multisite_enabled={$multisite_enabled}";
$options = array('timeout' => defined('DOING_CRON') && DOING_CRON ? 30 : 3, 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url('/'), 'headers' => array('wp_install' => $wp_install, 'wp_blog' => home_url('/')));
$response = wp_remote_get($url, $options);
if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
return false;
}
$body = trim(wp_remote_retrieve_body($response));
if (!($body = maybe_unserialize($body))) {
return false;
}
if (!isset($body['offers'])) {
return false;
}
$offers = $body['offers'];
foreach ($offers as &$offer) {
foreach ($offer as $offer_key => $value) {
if ('packages' == $offer_key) {
$offer['packages'] = (object) array_intersect_key(array_map('esc_url', $offer['packages']), array_fill_keys(array('full', 'no_content', 'new_bundled', 'partial'), ''));
} elseif ('download' == $offer_key) {
$offer['download'] = esc_url($value);
} else {
$offer[$offer_key] = esc_html($value);
}
}
$offer = (object) array_intersect_key($offer, array_fill_keys(array('response', 'download', 'locale', 'packages', 'current', 'php_version', 'mysql_version', 'new_bundled', 'partial_version'), ''));
}
$updates = new stdClass();
$updates->updates = $offers;
$updates->last_checked = time();
$updates->version_checked = $wp_version;
set_site_transient('update_core', $updates);
}
示例13: totalUsers
static function totalUsers($params = null)
{
if (!empty($params[0])) {
return get_user_count() + (int) $params[0];
} else {
return get_user_count();
}
}
示例14: optin_data
public function optin_data()
{
global $wpdb;
$comments = wp_count_comments();
$users = count_users();
$settings = get_option('yarpp');
$collect = array_flip(array('threshold', 'limit', 'excerpt_length', 'recent', 'rss_limit', 'rss_excerpt_length', 'past_only', 'show_excerpt', 'rss_show_excerpt', 'template', 'rss_template', 'show_pass_post', 'cross_relate', 'rss_display', 'rss_excerpt_display', 'promote_yarpp', 'rss_promote_yarpp', 'myisam_override', 'weight', 'require_tax', 'auto_display_archive'));
$check_changed = array('before_title', 'after_title', 'before_post', 'after_post', 'after_related', 'no_results', 'order', 'rss_before_title', 'rss_after_title', 'rss_before_post', 'rss_after_post', 'rss_after_related', 'rss_no_results', 'rss_order', 'exclude', 'thumbnails_heading', 'thumbnails_default', 'rss_thumbnails_heading', 'rss_thumbnails_default', 'display_code');
$data = array('versions' => array('yarpp' => YARPP_VERSION, 'wp' => get_bloginfo('version'), 'php' => phpversion()), 'yarpp' => array('settings' => array_intersect_key($settings, $collect), 'cache_engine' => YARPP_CACHE_TYPE), 'diagnostics' => array('myisam_posts' => $this->diagnostic_myisam_posts(), 'fulltext_disabled' => $this->diagnostic_fulltext_disabled(), 'fulltext_indices' => $this->diagnostic_fulltext_indices(), 'hidden_metaboxes' => $this->diagnostic_hidden_metaboxes(), 'post_thumbnails' => $this->diagnostic_post_thumbnails(), 'happy' => $this->diagnostic_happy(), 'using_thumbnails' => $this->diagnostic_using_thumbnails(), 'generate_thumbnails' => $this->diagnostic_generate_thumbnails()), 'stats' => array('counts' => array(), 'terms' => array(), 'comments' => array('moderated' => $comments->moderated, 'approved' => $comments->approved, 'total' => $comments->total_comments, 'posts' => $wpdb->get_var("select count(ID) from {$wpdb->posts} where post_type = 'post' and comment_count > 0")), 'users' => $wpdb->get_var("select count(ID) from {$wpdb->users}")), 'locale' => get_bloginfo('language'), 'url' => get_bloginfo('url'), 'plugins' => array('active' => implode('|', get_option('active_plugins', array())), 'sitewide' => implode('|', array_keys(get_site_option('active_sitewide_plugins', array())))), 'pools' => $settings['pools']);
$data['yarpp']['settings']['auto_display_post_types'] = implode('|', $settings['auto_display_post_types']);
$changed = array();
foreach ($check_changed as $key) {
if ($this->default_options[$key] != $settings[$key]) {
$changed[] = $key;
}
}
foreach (array('before_related', 'rss_before_related') as $key) {
if ($settings[$key] != '<p>' . __('Related posts:', 'yarpp') . '</p><ol>' && $settings[$key] != $this->default_options[$key]) {
$changed[] = $key;
}
}
$data['yarpp']['changed_settings'] = implode('|', $changed);
if (method_exists($this->cache, 'cache_status')) {
$data['yarpp']['cache_status'] = $this->cache->cache_status();
}
if (method_exists($this->cache, 'stats')) {
$stats = $this->cache->stats();
$flattened = array();
foreach ($stats as $key => $value) {
$flattened[] = "{$key}:{$value}";
}
$data['yarpp']['stats'] = implode('|', $flattened);
}
if (method_exists($wpdb, 'db_version')) {
$data['versions']['mysql'] = preg_replace('/[^0-9.].*/', '', $wpdb->db_version());
}
$counts = array();
foreach (get_post_types(array('public' => true)) as $post_type) {
$counts[$post_type] = wp_count_posts($post_type);
}
$data['stats']['counts'] = wp_list_pluck($counts, 'publish');
foreach (get_taxonomies(array('public' => true)) as $taxonomy) {
$data['stats']['terms'][$taxonomy] = wp_count_terms($taxonomy);
}
if (is_multisite()) {
$data['multisite'] = array('url' => network_site_url(), 'users' => get_user_count(), 'sites' => get_blog_count());
}
return $data;
}
示例15: show_message
show_message('您还不是分销商!', '去首页', 'index.php');
exit;
}
if (!$smarty->is_cached('v_user_huiyuan.dwt', $cache_id)) {
assign_template();
$position = assign_ur_here();
$smarty->assign('page_title', $position['title']);
// 页面标题
$smarty->assign('ur_here', $position['ur_here']);
// 当前位置
/* meta information */
$smarty->assign('keywords', htmlspecialchars($_CFG['shop_keywords']));
$smarty->assign('description', htmlspecialchars($_CFG['shop_desc']));
$smarty->assign('user_info', get_user_info_by_user_id($_SESSION['user_id']));
$smarty->assign('one_level_user_count', get_user_count($_SESSION['user_id'], 1));
//一级会员数量
$smarty->assign('two_level_user_count', get_user_count($_SESSION['user_id'], 2));
//一级会员数量
$smarty->assign('three_level_user_count', get_user_count($_SESSION['user_id'], 3));
//一级会员数量
$smarty->assign('one_user_list', get_distrib_user_info($_SESSION['user_id'], 1));
//一级会员信息
$smarty->assign('two_user_list', get_distrib_user_info($_SESSION['user_id'], 2));
//二级会员信息
$smarty->assign('three_user_list', get_distrib_user_info($_SESSION['user_id'], 3));
//三级会员信息
$smarty->assign('user_id', $_SESSION['user_id']);
/* 页面中的动态内容 */
assign_dynamic('v_user_huiyuan');
}
$smarty->display('v_user_huiyuan.dwt', $cache_id);