• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_get_update_data函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: plugin_updates_available

 /**
  * any plugin updates available
  *
  * @return bool true if plugin updates are available
  */
 public static function plugin_updates_available()
 {
     $update_data = wp_get_update_data();
     $count = absint($update_data['counts']['plugins']);
     if ($count) {
         return true;
     }
     return false;
 }
开发者ID:bruno-barros,项目名称:w.eloquent.light,代码行数:14,代码来源:checks.php


示例2: result

 protected function result()
 {
     // pass an option to do it conditional;
     wp_update_themes();
     $update_data = wp_get_update_data();
     if (!isset($update_data['counts'])) {
         return new WP_Error('get_update_data_error', __('There was an error while getting the update data for this site.', 'jetpack'), 500);
     }
     $result = $update_data['counts'];
     include ABSPATH . WPINC . '/version.php';
     // $wp_version;
     $result['wp_version'] = isset($wp_version) ? $wp_version : null;
     $result['jp_version'] = JETPACK__VERSION;
     return $result;
 }
开发者ID:shazadmaved,项目名称:vizblog,代码行数:15,代码来源:class.jetpack-json-api-updates-status-endpoint.php


示例3: result

 protected function result()
 {
     wp_update_themes();
     wp_update_plugins();
     $update_data = wp_get_update_data();
     if (!isset($update_data['counts'])) {
         return new WP_Error('get_update_data_error', __('There was an error while getting the update data for this site.', 'jetpack'), 500);
     }
     $result = $update_data['counts'];
     include ABSPATH . WPINC . '/version.php';
     // $wp_version;
     $result['wp_version'] = isset($wp_version) ? $wp_version : null;
     if (!empty($result['wordpress'])) {
         $cur = get_preferred_from_update_core();
         if (isset($cur->response) && $cur->response === 'upgrade') {
             $result['wp_update_version'] = $cur->current;
         }
     }
     $result['jp_version'] = JETPACK__VERSION;
     return $result;
 }
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:21,代码来源:class.jetpack-json-api-updates-status-endpoint.php


示例4: get_plugin_update_count

 /**
  * Get number of plugin updates available.
  *
  * @since 4.3.0
  *
  * @return mixed|WP_Error Number of plugin updates available. Otherwise, a WP_Error instance with the corresponding error.
  */
 public static function get_plugin_update_count()
 {
     $updates = wp_get_update_data();
     if (isset($updates['counts']) && isset($updates['counts']['plugins'])) {
         $count = $updates['counts']['plugins'];
         if (0 == $count) {
             $response = array('code' => 'success', 'message' => esc_html__('All plugins are up-to-date. Keep up the good work!', 'jetpack'), 'count' => 0);
         } else {
             $response = array('code' => 'updates-available', 'message' => esc_html(sprintf(_n('%s plugin need updating.', '%s plugins need updating.', $count, 'jetpack'), $count)), 'count' => $count);
         }
         return rest_ensure_response($response);
     }
     return new WP_Error('not_found', esc_html__('Could not check updates for plugins on this site.', 'jetpack'), array('status' => 404));
 }
开发者ID:iamtakashi,项目名称:jetpack,代码行数:21,代码来源:class.core-rest-api-endpoints.php


示例5: admin_bar_menu

 function admin_bar_menu()
 {
     global $wp_admin_bar;
     $GetData = $this->get_flit_data('admin_bar_menu');
     if (!empty($GetData["UPFN"])) {
         unset($GetData["UPFN"]);
         if (is_array($GetData)) {
             // admin bar initialize nodes
             $All_Nodes = $wp_admin_bar->get_nodes();
             foreach ($All_Nodes as $node) {
                 if ($node->id != 'top-secondary') {
                     $wp_admin_bar->remove_node($node->id);
                 }
             }
             $SettingNodes = $GetData;
             $user_id = get_current_user_id();
             $current_user = wp_get_current_user();
             $profile_url = get_edit_profile_url($user_id);
             $update_data = wp_get_update_data();
             $activated_plugin = $this->ActivatedPlugin;
             $other_plugin = $this->OtherPluginMenu;
             // all nodes adjustment
             foreach ($SettingNodes as $Boxtype => $allnodes) {
                 foreach ($allnodes as $node_type => $nodes) {
                     foreach ($nodes as $key => $node) {
                         if (strstr($node["id"], 'custom_node')) {
                             if (!empty($node["group"])) {
                                 $node["meta"]["class"] = 'ab-sub-secondary';
                             } else {
                                 $node["href"] = $this->val_replace($node["href"]);
                             }
                         } elseif ($node["id"] == 'view-post_type') {
                             if (is_admin()) {
                                 if (!empty($All_Nodes['preview'])) {
                                     $node["href"] = $All_Nodes['preview']->href;
                                     $node["meta"] = $All_Nodes['preview']->meta;
                                 } elseif (!empty($All_Nodes['view'])) {
                                     $node["href"] = $All_Nodes['view']->href;
                                     $node["meta"] = $All_Nodes['view']->meta;
                                 } else {
                                     unset($SettingNodes[$Boxtype][$node_type][$key]);
                                     continue;
                                 }
                             } else {
                                 unset($SettingNodes[$Boxtype][$node_type][$key]);
                                 continue;
                             }
                         } elseif ($node["id"] == 'edit-post_type') {
                             if (!empty($All_Nodes["edit"])) {
                                 //$node["title"] = $All_Nodes["edit"]->title;
                                 $node["href"] = $All_Nodes["edit"]->href;
                                 $node["id"] = $All_Nodes["edit"]->id;
                             } else {
                                 unset($SettingNodes[$Boxtype][$node_type][$key]);
                                 continue;
                             }
                         } elseif ($node["id"] == 'search') {
                             if (!empty($All_Nodes["search"])) {
                                 $node["title"] = $All_Nodes["search"]->title;
                                 $node["id"] = $All_Nodes["search"]->id;
                                 $node["href"] = "";
                                 $node["meta"]["class"] = $All_Nodes["search"]->meta["class"];
                             } else {
                                 unset($SettingNodes[$Boxtype][$node_type][$key]);
                                 continue;
                             }
                         } elseif (!empty($All_Nodes[$node["id"]])) {
                             if ($node["id"] == 'search') {
                                 $node["href"] = $All_Nodes[$node["id"]]->href;
                                 $node["title"] = $All_Nodes[$node["id"]]->title;
                             } else {
                                 $node["href"] = $All_Nodes[$node["id"]]->href;
                             }
                         } else {
                             unset($SettingNodes[$Boxtype][$node_type][$key]);
                             continue;
                         }
                         if (!empty($All_Nodes[$node["id"]]->meta["title"])) {
                             $node["meta"]["title"] = $All_Nodes[$node["id"]]->meta["title"];
                         }
                         if ($Boxtype == 'right' && $node_type == 'main') {
                             $node["parent"] = "top-secondary";
                         }
                         if (strstr($node["title"], '[comment_count]')) {
                             if (!current_user_can('edit_posts')) {
                                 unset($SettingNodes[$Boxtype][$node_type][$key]);
                                 continue;
                             } else {
                                 $node["title"] = str_replace('[comment_count]', '<span class="ab-icon"></span><span id="ab-awaiting-mod" class="ab-label awaiting-mod pending-count count-[comment_count]">[comment_count_format]</span>', $node["title"]);
                             }
                         }
                         if (strstr($node["title"], '[update_total]')) {
                             if (!$update_data['counts']['total']) {
                                 unset($SettingNodes[$Boxtype][$node_type][$key]);
                                 continue;
                             } else {
                                 $node["title"] = str_replace('[update_total]', '<span class="ab-icon"></span><span class="ab-label">[update_total_format]</span>', $node["title"]);
                             }
                         }
                         if (strstr($node["title"], '[update_plugins]')) {
//.........这里部分代码省略.........
开发者ID:Optimize-Worldwide,项目名称:Admin-UI-Customization,代码行数:101,代码来源:wp-admin-ui-customize.php


示例6: save_update_data

 /**
  * Calculates available updates and saves them to a Jetpack Option
  * Update data is saved in the following schema:
  *
  * array (
  *      'plugins'                       => (int) number of plugin updates available
  *      'themes'                        => (int) number of theme updates available
  *      'wordpress'                     => (int) number of wordpress core updates available
  *      'translations'                  => (int) number of translation updates available
  *      'total'                         => (int) total of all available updates
  *      'wp_version'                    => (string) the current version of WordPress that is running
  *      'wp_update_version'             => (string) the latest available version of WordPress, only present if a WordPress update is needed
  *      'site_is_version_controlled'    => (bool) is the site under version control
  * )
  */
 function save_update_data()
 {
     global $wp_version;
     $update_data = wp_get_update_data();
     // Stores the individual update counts as well as the total count.
     if (isset($update_data['counts'])) {
         $updates = $update_data['counts'];
     }
     // Stores the current version of WordPress.
     $updates['wp_version'] = $wp_version;
     // If we need to update WordPress core, let's find the latest version number.
     if (!empty($updates['wordpress'])) {
         $cur = get_preferred_from_update_core();
         if (isset($cur->response) && 'upgrade' === $cur->response) {
             $updates['wp_update_version'] = $cur->current;
         }
     }
     $updates['site_is_version_controlled'] = (bool) $this->is_version_controlled();
     Jetpack_Options::update_option('updates', $updates);
 }
开发者ID:dtekcth,项目名称:datateknologer.se,代码行数:35,代码来源:class.jetpack-autoupdate.php


示例7: wp_admin_bar_updates_menu

 /**
  * Display admin bar updates for WordPress 3.3
  *
  * @param WP_Admin_Bar instance
  * @param integer $count
  * @param string $title
  * @return void
  */
 private function wp_admin_bar_updates_menu($wp_admin_bar, $count = 0, $title = '')
 {
     if (!$count or !$title) {
         return;
     }
     $update_data = wp_get_update_data();
     $update_data['counts']['total'] += $count;
     if (!$update_data['title']) {
         $update_data['title'] = $title;
     } else {
         $update_data['title'] .= ", {$title}";
     }
     $update_title = '<span class="ab-icon"></span><span class="ab-label">' . number_format_i18n($update_data['counts']['total']) . '</span>';
     $update_node = $wp_admin_bar->get_node('updates');
     // Does the update menu already exist?
     if (!$update_node) {
         $wp_admin_bar->add_menu(array('id' => 'updates', 'title' => $update_title, 'href' => network_admin_url('update-core.php'), 'meta' => array('title' => $update_data['title'])));
         return;
     }
     // Update existing menu
     $update_node->title = $update_title;
     $update_node->meta['title'] = $update_data['title'];
     $wp_admin_bar->add_menu($update_node);
 }
开发者ID:andrewkhunn,项目名称:lancero,代码行数:32,代码来源:mute-screamer.php


示例8: if

				<# if ( data.actions.activate ) { #>
					<a href="{{{ data.actions.activate }}}" class="button activate" aria-label="<?php 
echo $aria_label;
?>
"><?php 
_e('Activate');
?>
</a>
				<# } #>
				<a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php 
_e('Live Preview');
?>
</a>
			</div>

			<# if ( ! data.active && data.actions['delete'] ) { #>
				<a href="{{{ data.actions['delete'] }}}" class="button delete-theme"><?php 
_e('Delete');
?>
</a>
			<# } #>
		</div>
	</div>
</script>

<?php 
wp_print_request_filesystem_credentials_modal();
wp_print_admin_notice_templates();
wp_print_update_row_templates();
wp_localize_script('updates', '_wpUpdatesItemCounts', array('totals' => wp_get_update_data()));
require ABSPATH . 'wp-admin/admin-footer.php';
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:31,代码来源:themes.php


示例9: wp_admin_bar_updates_menu

/**
 * Provide an update link if theme/plugin/core updates are available.
 *
 * @since 3.1.0
 */
function wp_admin_bar_updates_menu($wp_admin_bar)
{
    $update_data = wp_get_update_data();
    if (!$update_data['counts']['total']) {
        return;
    }
    $update_title = "<span title='{$update_data['title']}'>";
    $update_title .= sprintf(__('Updates %s'), "<span id='ab-updates' class='update-count'>" . number_format_i18n($update_data['counts']['total']) . '</span>');
    $update_title .= '</span>';
    $wp_admin_bar->add_menu(array('id' => 'updates', 'title' => $update_title, 'href' => network_admin_url('update-core.php')));
}
开发者ID:redteam,项目名称:wordpress-,代码行数:16,代码来源:admin-bar.php


示例10: get_updates

 /**
  * jetpack_updates is saved in the following schema:
  *
  * array (
  *      'plugins'                       => (int) Number of plugin updates available.
  *      'themes'                        => (int) Number of theme updates available.
  *      'wordpress'                     => (int) Number of WordPress core updates available.
  *      'translations'                  => (int) Number of translation updates available.
  *      'total'                         => (int) Total of all available updates.
  *      'wp_update_version'             => (string) The latest available version of WordPress, only present if a WordPress update is needed.
  * )
  * @return array
  */
 public static function get_updates()
 {
     $update_data = wp_get_update_data();
     // Stores the individual update counts as well as the total count.
     if (isset($update_data['counts'])) {
         $updates = $update_data['counts'];
     }
     // If we need to update WordPress core, let's find the latest version number.
     if (!empty($updates['wordpress'])) {
         $cur = get_preferred_from_update_core();
         if (isset($cur->response) && 'upgrade' === $cur->response) {
             $updates['wp_update_version'] = $cur->current;
         }
     }
     return isset($updates) ? $updates : array();
 }
开发者ID:jordankoschei,项目名称:jordankoschei-dot-com,代码行数:29,代码来源:class.jetpack.php


示例11: prepare_items


//.........这里部分代码省略.........
         $show_network_active = apply_filters('show_network_active_plugins', $show);
     }
     set_transient('plugin_slugs', array_keys($plugins['all']), DAY_IN_SECONDS);
     if ($screen->in_admin('network')) {
         $recently_activated = get_site_option('recently_activated', array());
     } else {
         $recently_activated = get_option('recently_activated', array());
     }
     foreach ($recently_activated as $key => $time) {
         if ($time + WEEK_IN_SECONDS < time()) {
             unset($recently_activated[$key]);
         }
     }
     if ($screen->in_admin('network')) {
         update_site_option('recently_activated', $recently_activated);
     } else {
         update_option('recently_activated', $recently_activated);
     }
     $plugin_info = get_site_transient('update_plugins');
     foreach ((array) $plugins['all'] as $plugin_file => $plugin_data) {
         // Extra info if known. array_merge() ensures $plugin_data has precedence if keys collide.
         if (isset($plugin_info->response[$plugin_file])) {
             $plugins['all'][$plugin_file] = $plugin_data = array_merge((array) $plugin_info->response[$plugin_file], $plugin_data);
             // Make sure that $plugins['upgrade'] also receives the extra info since it is used on ?plugin_status=upgrade
             if (isset($plugins['upgrade'][$plugin_file])) {
                 $plugins['upgrade'][$plugin_file] = $plugin_data = array_merge((array) $plugin_info->response[$plugin_file], $plugin_data);
             }
         } elseif (isset($plugin_info->no_update[$plugin_file])) {
             $plugins['all'][$plugin_file] = $plugin_data = array_merge((array) $plugin_info->no_update[$plugin_file], $plugin_data);
             // Make sure that $plugins['upgrade'] also receives the extra info since it is used on ?plugin_status=upgrade
             if (isset($plugins['upgrade'][$plugin_file])) {
                 $plugins['upgrade'][$plugin_file] = $plugin_data = array_merge((array) $plugin_info->no_update[$plugin_file], $plugin_data);
             }
         }
         // Filter into individual sections
         if (is_multisite() && !$screen->in_admin('network') && is_network_only_plugin($plugin_file) && !is_plugin_active($plugin_file)) {
             if ($show_network_active) {
                 // On the non-network screen, show inactive network-only plugins if allowed
                 $plugins['inactive'][$plugin_file] = $plugin_data;
             } else {
                 // On the non-network screen, filter out network-only plugins as long as they're not individually active
                 unset($plugins['all'][$plugin_file]);
             }
         } elseif (!$screen->in_admin('network') && is_plugin_active_for_network($plugin_file)) {
             if ($show_network_active) {
                 // On the non-network screen, show network-active plugins if allowed
                 $plugins['active'][$plugin_file] = $plugin_data;
             } else {
                 // On the non-network screen, filter out network-active plugins
                 unset($plugins['all'][$plugin_file]);
             }
         } elseif (!$screen->in_admin('network') && is_plugin_active($plugin_file) || $screen->in_admin('network') && is_plugin_active_for_network($plugin_file)) {
             // On the non-network screen, populate the active list with plugins that are individually activated
             // On the network-admin screen, populate the active list with plugins that are network activated
             $plugins['active'][$plugin_file] = $plugin_data;
         } else {
             if (isset($recently_activated[$plugin_file])) {
                 // Populate the recently activated list with plugins that have been recently activated
                 $plugins['recently_activated'][$plugin_file] = $plugin_data;
             }
             // Populate the inactive list with plugins that aren't activated
             $plugins['inactive'][$plugin_file] = $plugin_data;
         }
     }
     if (strlen($s)) {
         $status = 'search';
         $plugins['search'] = array_filter($plugins['all'], array($this, '_search_callback'));
     }
     $totals = array();
     foreach ($plugins as $type => $list) {
         $totals[$type] = count($list);
     }
     if (empty($plugins[$status]) && !in_array($status, array('all', 'search'))) {
         $status = 'all';
     }
     $this->items = array();
     foreach ($plugins[$status] as $plugin_file => $plugin_data) {
         // Translate, Don't Apply Markup, Sanitize HTML
         $this->items[$plugin_file] = _get_plugin_data_markup_translate($plugin_file, $plugin_data, false, true);
     }
     $total_this_page = $totals[$status];
     $js_plugins = array();
     foreach ($plugins as $key => $list) {
         $js_plugins[$key] = array_keys((array) $list);
     }
     wp_localize_script('updates', '_wpUpdatesItemCounts', array('plugins' => $js_plugins, 'totals' => wp_get_update_data()));
     if (!$orderby) {
         $orderby = 'Name';
     } else {
         $orderby = ucfirst($orderby);
     }
     $order = strtoupper($order);
     uasort($this->items, array($this, '_order_callback'));
     $plugins_per_page = $this->get_items_per_page(str_replace('-', '_', $screen->id . '_per_page'), 999);
     $start = ($page - 1) * $plugins_per_page;
     if ($total_this_page > $plugins_per_page) {
         $this->items = array_slice($this->items, $start, $plugins_per_page);
     }
     $this->set_pagination_args(array('total_items' => $total_this_page, 'per_page' => $plugins_per_page));
 }
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:101,代码来源:class-wp-plugins-list-table.php


示例12: admin_menu

 /**
  * Move update core menu after options menu.
  */
 public function admin_menu()
 {
     global $menu;
     $update = wp_get_update_data();
     $name = __('Updates', 'admin-menu-tabs');
     $position = 81;
     if ($update['counts']['total']) {
         $name .= sprintf(' <span class="update-plugins count-%s"><span class="plugin-count">%s</span></span>', $update['counts']['total'], $update['counts']['total']);
     }
     while (isset($menu[$position])) {
         $position++;
     }
     add_menu_page($name, $name, 'update_core', 'update-core.php', '', '', $position);
 }
开发者ID:frozzare,项目名称:wp-admin-menu-tabs,代码行数:17,代码来源:class-admin-menu-tabs.php


示例13: save_update_data

 /**
  * Calculates available updates and saves them to a Jetpack Option
  *
  * jetpack_updates is saved in the following schema:
  *
  * array (
  *      'plugins'                       => (int) Number of plugin updates available.
  *      'themes'                        => (int) Number of theme updates available.
  *      'wordpress'                     => (int) Number of WordPress core updates available.
  *      'translations'                  => (int) Number of translation updates available.
  *      'total'                         => (int) Total of all available updates.
  *      'wp_update_version'             => (string) The latest available version of WordPress, only present if a WordPress update is needed.
  * )
  *
  * jetpack_update_details is saved in the following schema:
  *
  * array (
  *      'update_core'       => (array) The contents of the update_core transient.
  *      'update_themes'     => (array) The contents of the update_themes transient.
  *      'update_plugins'    => (array) The contents of the update_plugins transient.
  * )
  *
  */
 function save_update_data()
 {
     if (!current_user_can('update_plugins') || !current_user_can('update_core') || !current_user_can('update_themes')) {
         // `wp_get_updated_data` will not return useful information if a user does not have the capabilities.
         // We should should therefore bail to avoid saving incomplete data.
         return;
     }
     $update_data = wp_get_update_data();
     // Stores the individual update counts as well as the total count.
     if (isset($update_data['counts'])) {
         $updates = $update_data['counts'];
     }
     // If we need to update WordPress core, let's find the latest version number.
     if (!empty($updates['wordpress'])) {
         $cur = get_preferred_from_update_core();
         if (isset($cur->response) && 'upgrade' === $cur->response) {
             $updates['wp_update_version'] = $cur->current;
         }
     }
     Jetpack_Options::update_option('updates', $updates);
     // Let's also store and sync more details about what updates are needed.
     $update_details = array('update_core' => get_site_transient('update_core'), 'update_plugins' => get_site_transient('update_plugins'), 'update_themes' => get_site_transient('update_themes'));
     Jetpack_Options::update_option('update_details', $update_details);
 }
开发者ID:popthestack,项目名称:jetpack,代码行数:47,代码来源:class.jetpack-autoupdate.php


示例14: val_replace

 private function val_replace($str)
 {
     if (!empty($str)) {
         $update_data = wp_get_update_data();
         $awaiting_mod = wp_count_comments();
         $awaiting_mod = $awaiting_mod->moderated;
         $current_user = wp_get_current_user();
         if (is_multisite()) {
             $current_site = get_current_site();
         }
         if (strstr($str, '[comment_count]')) {
             if (current_user_can('edit_posts')) {
                 $str = str_replace('[comment_count]', '<span class="ab-icon"></span><span id="ab-awaiting-mod" class="ab-label awaiting-mod pending-count count-[comment_count]">[comment_count_format]</span>', $str);
             }
         }
         if (strstr($str, '[update_total]')) {
             if ($update_data['counts']['total']) {
                 $str = str_replace('[update_total]', '<span class="ab-icon"></span><span class="ab-label">[update_total_format]</span>', $str);
             }
         }
         if (strstr($str, '[update_plugins]')) {
             if ($update_data['counts']['plugins']) {
                 $str = str_replace('[update_plugins]', '[update_plugins_format]', $str);
             }
         }
         if (strstr($str, '[update_themes]')) {
             if ($update_data['counts']['themes']) {
                 $str = str_replace('[update_themes]', '[update_themes_format]', $str);
             }
         }
         if (strstr($str, '[blog_url]')) {
             $str = str_replace('[blog_url]', home_url(), $str);
         }
         if (strstr($str, '[template_directory_uri]')) {
             $str = str_replace('[template_directory_uri]', get_template_directory_uri(), $str);
         }
         if (strstr($str, '[stylesheet_directory_uri]')) {
             $str = str_replace('[stylesheet_directory_uri]', get_stylesheet_directory_uri(), $str);
         }
         if (strstr($str, '[blog_name]')) {
             $str = str_replace('[blog_name]', get_bloginfo('name'), $str);
         }
         if (strstr($str, '[update_total]')) {
             $str = str_replace('[update_total]', $update_data["counts"]["total"], $str);
         }
         if (strstr($str, '[update_total_format]')) {
             $str = str_replace('[update_total_format]', number_format_i18n($update_data["counts"]["total"]), $str);
         }
         if (strstr($str, '[update_plugins]')) {
             $str = str_replace('[update_plugins]', $update_data["counts"]["plugins"], $str);
         }
         if (strstr($str, '[update_plugins_format]')) {
             $str = str_replace('[update_plugins_format]', number_format_i18n($update_data["counts"]["plugins"]), $str);
         }
         if (strstr($str, '[update_themes]')) {
             $str = str_replace('[update_themes]', $update_data["counts"]["themes"], $str);
         }
         if (strstr($str, '[update_themes_format]')) {
             $str = str_replace('[update_themes_format]', number_format_i18n($update_data["counts"]["themes"]), $str);
         }
         if (strstr($str, '[comment_count]')) {
             $str = str_replace('[comment_count]', $awaiting_mod, $str);
         }
         if (strstr($str, '[comment_count_format]')) {
             $str = str_replace('[comment_count_format]', number_format_i18n($awaiting_mod), $str);
         }
         if (strstr($str, '[user_name]')) {
             $str = str_replace('[user_name]', '<span class="display-name">' . $current_user->display_name . '</span>', $str);
         }
         if (strstr($str, '[user_login]')) {
             $str = str_replace('[user_login]', '<span class=\'username\'>' . $current_user->user_login . '</span>', $str);
         }
         if (strstr($str, '[avatar16]')) {
             if (function_exists('bp_core_fetch_avatar')) {
                 $avatar16 = bp_core_fetch_avatar(array('item_id' => get_current_user_id(), 'type' => 'thumb', 'width' => 16, 'height' => 16, 'class' => 'friend-avatar', 'html' => true));
             } else {
                 $avatar16 = get_avatar(get_the_author_meta($current_user->user_login), 16);
             }
             $str = str_replace('[avatar16]', $avatar16, $str);
         }
         if (strstr($str, '[avatar64]')) {
             if (function_exists('bp_core_fetch_avatar')) {
                 $avatar64 = bp_core_fetch_avatar(array('item_id' => get_current_user_id(), 'type' => 'full', 'width' => 64, 'height' => 64, 'class' => 'friend-avatar', 'html' => true));
             } else {
                 $avatar64 = get_avatar(get_the_author_meta($current_user->user_login), 64);
             }
             $str = str_replace('[avatar64]', $avatar64, $str);
         }
         if (is_multisite()) {
             if (strstr($str, '[site_name]')) {
                 $str = str_replace('[site_name]', esc_attr($current_site->site_name), $str);
             }
             if (strstr($str, '[site_url]')) {
                 $protocol = is_ssl() ? 'https://' : 'http://';
                 $str = str_replace('[site_url]', $protocol . esc_attr($current_site->domain), $str);
             }
         }
     }
     return $str;
 }
开发者ID:bigkey,项目名称:php-getting-started,代码行数:100,代码来源:modern-admin.php


示例15: prepare_items

 /**
  *
  * @global string $status
  * @global array $totals
  * @global int $page
  * @global string $orderby
  * @global string $order
  * @global string $s
  */
 public function prepare_items()
 {
     global $status, $totals, $page, $orderby, $order, $s;
     wp_reset_vars(array('orderby', 'order', 's'));
     $themes = array('all' => apply_filters('all_themes', wp_get_themes()), 'search' => array(), 'enabled' => array(), 'disabled' => array(), 'upgrade' => array(), 'broken' => $this->is_site_themes ? array() : wp_get_themes(array('errors' => true)));
     if ($this->is_site_themes) {
         $themes_per_page = $this->get_items_per_page('site_themes_network_per_page');
         $allowed_where = 'site';
     } else {
         $themes_per_page = $this->get_items_per_page('themes_network_per_page');
         $allowed_where = 'network';
     }
     $maybe_update = current_user_can('update_themes') && !$this->is_site_themes && ($current = get_site_transient('update_themes'));
     foreach ((array) $themes['all'] as $key => $theme) {
         if ($this->is_site_themes && $theme->is_allowed('network')) {
             unset($themes['all'][$key]);
             continue;
         }
         if ($maybe_update && isset($current->response[$key])) {
             $themes['all'][$key]->update = true;
             $themes['upgrade'][$key] = $themes['all'][$key];
         }
         $filter = $theme->is_allowed($allowed_where, $this->site_id) ? 'enabled' : 'disabled';
         $themes[$filter][$key] = $themes['all'][$key];
     }
     if ($s) {
         $status = 'search';
         $themes['search'] = array_filter(array_merge($themes['all'], $themes['broken']), array($this, '_search_callback'));
     }
     $totals = array();
     foreach ($themes as $type => $list) {
         $totals[$type] = count($list);
     }
     if (empty($themes[$status]) && !in_array($status, array('all', 'search'))) {
         $status = 'all';
     }
     $this->items = $themes[$status];
     WP_Theme::sort_by_name($this->items);
     $this->has_items = !empty($themes['all']);
     $total_this_page = $totals[$status];
     wp_localize_script('updates', '_wpUpdatesItemCounts', array('themes' => $totals, 'totals' => wp_get_update_data()));
     if ($orderby) {
         $orderby = ucfirst($orderby);
         $order = strtoupper($order);
         if ($orderby === 'Name') {
             if ('ASC' === $order) {
                 $this->items = array_reverse($this->items);
             }
         } else {
             uasort($this->items, array($this, '_order_callback'));
         }
     }
     $start = ($page - 1) * $themes_per_page;
     if ($total_this_page > $themes_per_page) {
         $this->items = array_slice($this->items, $start, $themes_per_page, true);
     }
     $this->set_pagination_args(array('total_items' => $total_this_page, 'per_page' => $themes_per_page));
 }
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:67,代码来源:class-wp-ms-themes-list-table.php


示例16: wp_toolbar_experiments_ab_admin_menu

/**
 * Add admin submenu items to the "Site Name" menu.
 *
 * @since 4.4.0
 *
 * @param WP_Admin_Bar $wp_admin_bar
 */
function wp_toolbar_experiments_ab_admin_menu($wp_admin_bar)
{
    $wp_admin_bar->add_group(array('parent' => 'site-name', 'id' => 'admin'));
    // Post types.
    $cpts = (array) get_post_types(array('show_in_admin_bar' => true), 'objects');
    if (isset($cpts['post']) && current_user_can($cpts['post']->cap->edit_posts)) {
        $menu_icon = '<span class="ab-icon dashicons-admin-post"></span>';
        $actions['edit.php'] = array($cpts['post']->labels->name, 'edit-posts', $menu_icon);
    }
    if (isset($cpts['attachment']) && current_user_can('edit_posts')) {
        $menu_icon = '<span class="ab-icon dashicons-admin-media"></span>';
        $actions['upload.php'] = array($cpts['attachment']->labels->name, 'edit-media', $menu_icon);
    }
    if (isset($cpts['page']) && current_user_can($cpts['page']->cap->edit_posts)) {
        $menu_icon = '<span class="ab-icon dashicons-admin-page"></span>';
        $actions['edit.php?post_type=page'] = array($cpts['page']->labels->name, 'edit-pages', $menu_icon);
    }
    unset($cpts['post'], $cpts['page'], $cpts['attachment']);
    // Add any additional custom post types.
    foreach ($cpts as $cpt) {
        if (!current_user_can($cpt->cap->edit_posts)) {
            continue;
        }
        if (is_string($cpt->menu_icon)) {
            // Special handling for data:image/svg+xml and Dashicons.
            if (0 === strpos($cpt->menu_icon, 'dashicons-')) {
                $menu_icon = '<span class="ab-icon ' . $cpt->menu_icon . '"></span>';
            } elseif (0 === strpos($cpt->menu_icon, 'data:image/svg+xml;base64,')) {
                $menu_icon = '<span class="ab-icon"><img src="' . $cpt->menu_icon . '"></span>';
            } else {
                $menu_icon = '<span class="ab-icon"><img src="' . esc_url($cpt->menu_icon) . '"></span>';
            }
        } else {
            $menu_icon = '<span class="ab-icon dashicons-admin-post"></span>';
        }
        $key = 'edit.php?post_type=' . $cpt->name;
        $actions[$key] = array($cpt->labels->menu_name, 'edit-' . $cpt->name, $menu_icon);
    }
    if ($actions) {
        foreach ($actions as $link => $action) {
            list($title, $id, $menu_icon) = $action;
            $wp_admin_bar->add_menu(array('parent' => 'admin', 'id' => $id, 'title' => $menu_icon . '<span class="ab-label">' . $title . '</span>', 'href' => admin_url($link)));
        }
    }
    // Comments
    if (current_user_can('edit_posts')) {
        $awaiting_mod = wp_count_comments();
        $awaiting_mod = $awaiting_mod->moderated;
        $icon = '<span class="ab-icon dashicons-admin-comments"></span>';
        $wp_admin_bar->add_menu(array('parent' => 'admin', 'id' => 'comments', 'title' => $icon . '<span class="ab-label">' . sprintf(__('Comments %s'), "<span class='awaiting-mod count-{$awaiting_mod}'><span class='pending-count'>" . number_format_i18n($awaiting_mod) . "</span></span>") . '</span>', 'href' => admin_url('edit-comments.php')));
    }
    // Appearance.
    if (current_user_can('switch_themes') || current_user_can('edit_theme_options')) {
        $icon = '<span class="ab-icon dashicons-admin-appearance"></span>';
        $wp_admin_bar->add_menu(array('parent' => 'admin', 'id' => 'themes', 'title' => $icon . '<span class="ab-label">' . __('Appearance') . '</span>', 'href' => admin_url('themes.php')));
    }
    // Plugins.
    if (current_user_can('activate_plugins')) {
        if (!is_multisite() && current_user_can('update_plugins')) {
            $update_data = wp_get_update_data();
            $count = "<span class='update-plugins count-{$update_data['counts']['plugins']}'><span class='plugin-count'>" . number_format_i18n($update_data['counts']['plugins']) . "</span></span>";
        } else {
            $count = '';
        }
        $icon = '<span class="ab-icon dashicons-admin-plugins"></span>';
        $wp_admin_bar->add_menu(array('parent' => 'admin', 'id' => 'plugins', 'title' => $icon . '<span class="ab-label">' . sprintf(__('Plugins %s'), $count) . '</span>', 'href' => admin_url('plugins.php')));
    }
    // Users.
    if (current_user_can('list_users')) {
        $icon = '<span class="ab-icon dashicons-admin-users"></span>';
        $wp_admin_bar->add_menu(array('parent' => 'admin', 'id' => 'edit-users', 'title' => $icon . '<span class="ab-label">' . __('Users') . '</span>', 'href' => admin_url('users.php')));
    }
    // Tools.
    if (current_user_can('edit_posts')) {
        $icon = '<span class="ab-icon dashicons-admin-tools"></span>';
        $wp_admin_bar->add_menu(array('parent' => 'admin', 'id' => 'tools', 'title' => $icon . '<span class="ab-label">' . __('Tools') . '</span>', 'href' => admin_url('tools.php')));
    }
    // Settings.
    if (current_user_can('manage_options')) {
        $icon = '<span class="ab-icon dashicons-admin-settings"></span>';
        $wp_admin_bar->add_menu(array('parent' => 'admin', 'id' => 'settings', 'title' => $icon . '<span class="ab-label">' . __('Settings') . '</span>', 'href' => admin_url('options.php')));
    }
}
开发者ID:helen,项目名称:wp-toolbar-experiments,代码行数:90,代码来源:wp-toolbar-experiments.php


示例17: wp_admin_bar_updates_menu

/**
 * Provide an update link if theme/plugin/core updates are available.
 *
 * @since 3.1.0
 *
 * @param WP_Admin_Bar $wp_admin_bar
 */
function wp_admin_bar_updates_menu($wp_admin_bar)
{
    $update_data = wp_get_update_data();
    if (!$update_data['counts']['total']) {
        return;
    }
    $title = '<span class="ab-icon"></span><span class="ab-label">' . number_format_i18n($update_data['counts']['total']) . '</span>';
    $title .= '<span class="screen-reader-text">' . $update_data['title'] . '</span>';
    $wp_admin_bar->add_menu(array('id' => 'updates', 'title' => $title, 'href' => network_admin_url('update-core.php'), 'meta' => array('title' => $update_data['title'])));
}
开发者ID:ajspencer,项目名称:NCSSM-SG-WordPress,代码行数:17,代码来源:admin-bar.php


示例18: build_current_site_response


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_get_upload_dir函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_get_translation_updates函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap