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


PHP _get_plugin_data_markup_translate函数代码示例

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


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

示例1: get_plugin_data

/**
 * Parse the plugin contents to retrieve plugin's metadata.
 *
 * The metadata of the plugin's data searches for the following in the plugin's
 * header. All plugin data must be on its own line. For plugin description, it
 * must not have any newlines or only parts of the description will be displayed
 * and the same goes for the plugin data. The below is formatted for printing.
 *
 * <code>
 * /*
 * Plugin Name: Name of Plugin
 * Plugin URI: Link to plugin information
 * Description: Plugin Description
 * Author: Plugin author's name
 * Author URI: Link to the author's web site
 * Version: Must be set in the plugin for WordPress 2.3+
 * Text Domain: Optional. Unique identifier, should be same as the one used in
 *		plugin_text_domain()
 * Domain Path: Optional. Only useful if the translations are located in a
 *		folder above the plugin's base path. For example, if .mo files are
 *		located in the locale folder then Domain Path will be "/locale/" and
 *		must have the first slash. Defaults to the base folder the plugin is
 *		located in.
 *  * / # Remove the space to close comment
 * </code>
 *
 * Plugin data returned array contains the following:
 *		'Name' - Name of the plugin, must be unique.
 *		'Title' - Title of the plugin and the link to the plugin's web site.
 *		'Description' - Description of what the plugin does and/or notes
 *		from the author.
 *		'Author' - The author's name
 *		'AuthorURI' - The authors web site address.
 *		'Version' - The plugin version number.
 *		'PluginURI' - Plugin web site address.
 *		'TextDomain' - Plugin's text domain for localization.
 *		'DomainPath' - Plugin's relative directory path to .mo files.
 *
 * Some users have issues with opening large files and manipulating the contents
 * for want is usually the first 1kiB or 2kiB. This function stops pulling in
 * the plugin contents when it has all of the required plugin data.
 *
 * The first 8kiB of the file will be pulled in and if the plugin data is not
 * within that first 8kiB, then the plugin author should correct their plugin
 * and move the plugin data headers to the top.
 *
 * The plugin file is assumed to have permissions to allow for scripts to read
 * the file. This is not checked however and the file is only opened for
 * reading.
 *
 * @link http://trac.wordpress.org/ticket/5651 Previous Optimizations.
 * @link http://trac.wordpress.org/ticket/7372 Further and better Optimizations.
 * @since 1.5.0
 *
 * @param string $plugin_file Path to the plugin file
 * @param bool $markup If the returned data should have HTML markup applied
 * @param bool $translate If the returned data should be translated
 * @return array See above for description.
 */
function get_plugin_data($plugin_file, $markup = true, $translate = true)
{
    $default_headers = array('Name' => 'Plugin Name', 'PluginURI' => 'Plugin URI', 'Version' => 'Version', 'Description' => 'Description', 'Author' => 'Author', 'AuthorURI' => 'Author URI', 'TextDomain' => 'Text Domain', 'DomainPath' => 'Domain Path');
    $plugin_data = get_file_data($plugin_file, $default_headers, 'plugin');
    //For backward compatibility by default Title is the same as Name.
    $plugin_data['Title'] = $plugin_data['Name'];
    if ($markup || $translate) {
        $plugin_data = _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup, $translate);
    }
    return $plugin_data;
}
开发者ID:gigikiri,项目名称:bcnAutoWallpaperSite,代码行数:70,代码来源:plugin.php

示例2: get_plugin_data

/**
 * Parse the plugin contents to retrieve plugin's metadata.
 *
 * The metadata of the plugin's data searches for the following in the plugin's
 * header. All plugin data must be on its own line. For plugin description, it
 * must not have any newlines or only parts of the description will be displayed
 * and the same goes for the plugin data. The below is formatted for printing.
 *
 * <code>
 * /*
 * Plugin Name: Name of Plugin
 * Plugin URI: Link to plugin information
 * Description: Plugin Description
 * Author: Plugin author's name
 * Author URI: Link to the author's web site
 * Version: Must be set in the plugin for WordPress 2.3+
 * Text Domain: Optional. Unique identifier, should be same as the one used in
 *		plugin_text_domain()
 * Domain Path: Optional. Only useful if the translations are located in a
 *		folder above the plugin's base path. For example, if .mo files are
 *		located in the locale folder then Domain Path will be "/locale/" and
 *		must have the first slash. Defaults to the base folder the plugin is
 *		located in.
 * Network: Optional. Specify "Network: true" to require that a plugin is activated
 *		across all sites in an installation. This will prevent a plugin from being
 *		activated on a single site when Multisite is enabled.
 *  * / # Remove the space to close comment
 * </code>
 *
 * Plugin data returned array contains the following:
 *		'Name' - Name of the plugin, must be unique.
 *		'Title' - Title of the plugin and the link to the plugin's web site.
 *		'Description' - Description of what the plugin does and/or notes
 *		from the author.
 *		'Author' - The author's name
 *		'AuthorURI' - The authors web site address.
 *		'Version' - The plugin version number.
 *		'PluginURI' - Plugin web site address.
 *		'TextDomain' - Plugin's text domain for localization.
 *		'DomainPath' - Plugin's relative directory path to .mo files.
 *		'Network' - Boolean. Whether the plugin can only be activated network wide.
 *
 * Some users have issues with opening large files and manipulating the contents
 * for want is usually the first 1kiB or 2kiB. This function stops pulling in
 * the plugin contents when it has all of the required plugin data.
 *
 * The first 8kiB of the file will be pulled in and if the plugin data is not
 * within that first 8kiB, then the plugin author should correct their plugin
 * and move the plugin data headers to the top.
 *
 * The plugin file is assumed to have permissions to allow for scripts to read
 * the file. This is not checked however and the file is only opened for
 * reading.
 *
 * @link http://trac.wordpress.org/ticket/5651 Previous Optimizations.
 * @link http://trac.wordpress.org/ticket/7372 Further and better Optimizations.
 * @since 1.5.0
 *
 * @param string $plugin_file Path to the plugin file
 * @param bool $markup If the returned data should have HTML markup applied
 * @param bool $translate If the returned data should be translated
 * @return array See above for description.
 */
function get_plugin_data($plugin_file, $markup = true, $translate = true)
{
    $default_headers = array('Name' => 'Plugin Name', 'PluginURI' => 'Plugin URI', 'Version' => 'Version', 'Description' => 'Description', 'Author' => 'Author', 'AuthorURI' => 'Author URI', 'TextDomain' => 'Text Domain', 'DomainPath' => 'Domain Path', 'Network' => 'Network', '_sitewide' => 'Site Wide Only');
    $plugin_data = get_file_data($plugin_file, $default_headers, 'plugin');
    // Site Wide Only is the old header for Network
    if (empty($plugin_data['Network']) && !empty($plugin_data['_sitewide'])) {
        _deprecated_argument(__FUNCTION__, '3.0', sprintf(__('The <code>%1$s</code> plugin header is deprecated. Use <code>%2$s</code> instead.'), 'Site Wide Only: true', 'Network: true'));
        $plugin_data['Network'] = $plugin_data['_sitewide'];
    }
    $plugin_data['Network'] = 'true' == strtolower($plugin_data['Network']);
    unset($plugin_data['_sitewide']);
    //For backward compatibility by default Title is the same as Name.
    $plugin_data['Title'] = $plugin_data['Name'];
    if ($markup || $translate) {
        $plugin_data = _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup, $translate);
    }
    return $plugin_data;
}
开发者ID:google-code-backups,项目名称:pumpmyvote,代码行数:81,代码来源:plugin.php

示例3: plugins_nav

 function plugins_nav()
 {
     if (!current_user_can('manage_network_options')) {
         return;
     }
     global $totals, $status, $plugins;
     $visible_plugins_array = $this->get_plugin_array(is_network_admin() ? 'sitewide' : 'both');
     $totals['visible'] = count($visible_plugins_array);
     $totals['hidden'] = $totals['all'] - $totals['visible'];
     //echo "<pre>"; print_r($totals); echo "</pre>";
     if (isset($_REQUEST['plugin_status']) && $status != 'search' && ($_REQUEST['plugin_status'] == 'visible' || $_REQUEST['plugin_status'] == 'hidden')) {
         $status = $_REQUEST['plugin_status'];
         $screen = get_current_screen();
         if ($screen->is_network && $screen->base == 'plugins-network' && $status == 'hidden') {
             $options = $this->get_site_option();
             if (isset($_REQUEST['pvm-action']) && $_REQUEST['pvm-action'] == 'dismiss') {
                 $options['dismiss-netword-vis'] = 1;
                 update_site_option('pvm-options', $options);
             } else {
                 if (!isset($options['dismiss-netword-vis']) || $options['dismiss-netword-vis'] != 1) {
                     $url = $_SERVER['REQUEST_URI'] . '&pvm-action=dismiss';
                     printf('<div id="pvm-message" class="updated"><p><strong>Note:</strong> For an individual site, Super Admins can make plugins that are not visible to the network available on a site\'s plugin page.<span style="float:right"><a href="%s">Dismiss</a></span></p></div>', $url);
                 }
             }
         }
         $plugins['visible'] = array();
         $plugins['hidden'] = array();
         //echo "<pre>"; print_r($visible_network_plugins); echo "</pre>";
         foreach ($plugins['all'] as $plugin_file => $plugin_data) {
             if (in_array($plugin_file, $visible_plugins_array)) {
                 $plugins['visible'][$plugin_file] = $plugin_data;
             } else {
                 $plugins['hidden'][$plugin_file] = $plugin_data;
             }
         }
         global $wp_list_table;
         $wp_list_table->items = array();
         foreach ($plugins[$status] as $plugin_file => $plugin_data) {
             // Translate, Don't Apply Markup, Sanitize HTML
             $wp_list_table->items[$plugin_file] = _get_plugin_data_markup_translate($plugin_file, $plugin_data, false, true);
         }
     }
 }
开发者ID:segadora,项目名称:plugin-visibility-manager,代码行数:43,代码来源:plugin-visibility-manager.php

示例4: prepare_items

 /**
  * Fetch the list of VIP plugins to display in the list table.
  */
 public function prepare_items()
 {
     $active = $inactive = array();
     $vip_plugins = WPCOM_VIP_Plugins_UI::instance();
     $shared_plugins = $vip_plugins->get_shared_plugins();
     foreach ($shared_plugins as $plugin_file => $plugin_data) {
         $plugin_folder = basename(dirname($plugin_file));
         if (isset(WPCOM_VIP_Plugins_UI()->fpp_plugins[$plugin_folder])) {
             continue;
         }
         $plugin_file = WPCOM_VIP_Plugins_UI::SHARED_PLUGINS_RELATIVE_PATH . '/' . $plugin_file;
         $status = WPCOM_VIP_Plugins_UI()->is_plugin_active($plugin_folder) ? 'active' : 'inactive';
         if ('inactive' === $status && in_array($plugin_folder, WPCOM_VIP_Plugins_UI()->hidden_plugins, true)) {
             continue;
         }
         ${$status}[$plugin_file] = _get_plugin_data_markup_translate($plugin_file, $plugin_data, false, true);
     }
     $this->items = array_merge($active, $inactive);
 }
开发者ID:Automattic,项目名称:vip-mu-plugins-public,代码行数:22,代码来源:class.wpcom-vip-plugins-ui-list-table.php

示例5: get_plugin_data

/**
 * Parse the plugin contents to retrieve plugin's metadata.
 *
 * The metadata of the plugin's data searches for the following in the plugin's
 * header. All plugin data must be on its own line. For plugin description, it
 * must not have any newlines or only parts of the description will be displayed
 * and the same goes for the plugin data. The below is formatted for printing.
 *
 *     /*
 *     Plugin Name: Name of Plugin
 *     Plugin URI: Link to plugin information
 *     Description: Plugin Description
 *     Author: Plugin author's name
 *     Author URI: Link to the author's web site
 *     Version: Must be set in the plugin for WordPress 2.3+
 *     Text Domain: Optional. Unique identifier, should be same as the one used in
 *    		load_plugin_textdomain()
 *     Domain Path: Optional. Only useful if the translations are located in a
 *    		folder above the plugin's base path. For example, if .mo files are
 *    		located in the locale folder then Domain Path will be "/locale/" and
 *    		must have the first slash. Defaults to the base folder the plugin is
 *    		located in.
 *     Network: Optional. Specify "Network: true" to require that a plugin is activated
 *    		across all sites in an installation. This will prevent a plugin from being
 *    		activated on a single site when Multisite is enabled.
 *      * / # Remove the space to close comment
 *
 * Plugin data returned array contains the following:
 *
 * - 'Name' - Name of the plugin, must be unique.
 * - 'Title' - Title of the plugin and the link to the plugin's web site.
 * - 'Description' - Description of what the plugin does and/or notes
 * - from the author.
 * - 'Author' - The author's name
 * - 'AuthorURI' - The authors web site address.
 * - 'Version' - The plugin version number.
 * - 'PluginURI' - Plugin web site address.
 * - 'TextDomain' - Plugin's text domain for localization.
 * - 'DomainPath' - Plugin's relative directory path to .mo files.
 * - 'Network' - Boolean. Whether the plugin can only be activated network wide.
 *
 * Some users have issues with opening large files and manipulating the contents
 * for want is usually the first 1kiB or 2kiB. This function stops pulling in
 * the plugin contents when it has all of the required plugin data.
 *
 * The first 8kiB of the file will be pulled in and if the plugin data is not
 * within that first 8kiB, then the plugin author should correct their plugin
 * and move the plugin data headers to the top.
 *
 * The plugin file is assumed to have permissions to allow for scripts to read
 * the file. This is not checked however and the file is only opened for
 * reading.
 *
 * @link https://core.trac.wordpress.org/ticket/5651 Previous Optimizations.
 * @link https://core.trac.wordpress.org/ticket/7372 Further and better Optimizations.
 *
 * @since 1.5.0
 *
 * @param string $plugin_file Path to the plugin file
 * @param bool $markup Optional. If the returned data should have HTML markup applied. Defaults to true.
 * @param bool $translate Optional. If the returned data should be translated. Defaults to true.
 * @return array See above for description.
 */
function get_plugin_data($plugin_file, $markup = true, $translate = true)
{
    $default_headers = array('Name' => 'Plugin Name', 'PluginURI' => 'Plugin URI', 'Version' => 'Version', 'Description' => 'Description', 'Author' => 'Author', 'AuthorURI' => 'Author URI', 'TextDomain' => 'Text Domain', 'DomainPath' => 'Domain Path', 'Network' => 'Network', '_sitewide' => 'Site Wide Only');
    $plugin_data = get_file_data($plugin_file, $default_headers, 'plugin');
    // Site Wide Only is the old header for Network
    if (!$plugin_data['Network'] && $plugin_data['_sitewide']) {
        /* translators: 1: Site Wide Only: true, 2: Network: true */
        _deprecated_argument(__FUNCTION__, '3.0', sprintf(__('The %1$s plugin header is deprecated. Use %2$s instead.'), '<code>Site Wide Only: true</code>', '<code>Network: true</code>'));
        $plugin_data['Network'] = $plugin_data['_sitewide'];
    }
    $plugin_data['Network'] = 'true' == strtolower($plugin_data['Network']);
    unset($plugin_data['_sitewide']);
    if ($markup || $translate) {
        $plugin_data = _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup, $translate);
    } else {
        $plugin_data['Title'] = $plugin_data['Name'];
        $plugin_data['AuthorName'] = $plugin_data['Author'];
    }
    return $plugin_data;
}
开发者ID:gigikiri,项目名称:WordPress,代码行数:83,代码来源:plugin.php

示例6: prepare_items

 /**
  * Fetch the list of VIP plugins to display in the list table.
  */
 public function prepare_items()
 {
     $active = $inactive = array();
     // The path has to be
     foreach (get_plugins('/../themes/vip/plugins') as $plugin_file => $plugin_data) {
         $plugin_folder = basename(dirname($plugin_file));
         // FPP is listed separately
         if (isset(WPcom_VIP_Plugins_UI()->fpp_plugins[$plugin_folder])) {
             continue;
         }
         $plugin_file = 'plugins/' . $plugin_file;
         $status = WPcom_VIP_Plugins_UI()->is_plugin_active($plugin_folder) ? 'active' : 'inactive';
         // Don't want some plugins showing up in the list
         if ('inactive' == $status && in_array($plugin_folder, WPcom_VIP_Plugins_UI()->hidden_plugins)) {
             continue;
         }
         // Translate, Don't Apply Markup, Sanitize HTML
         ${$status}[$plugin_file] = _get_plugin_data_markup_translate($plugin_file, $plugin_data, false, true);
     }
     $this->items = array_merge($active, $inactive);
 }
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:24,代码来源:class-wpcom-vip-plugins-list-tables.php

示例7: biont_get_plugin_data

 /**
  * Pretty much the same as WP-core get_plugin_data(),
  * but with a few adaptions that sadly weren't possible with the original function
  *
  * @param      $prefix
  * @param      $plugin_file
  * @param bool $markup
  * @param bool $translate
  *
  * @return array|bool|mixed
  */
 function biont_get_plugin_data($prefix, $plugin_file, $markup = TRUE, $translate = TRUE)
 {
     if (!function_exists('_get_plugin_data_markup_translate')) {
         include ABSPATH . 'wp-admin/includes/plugin.php';
     }
     $plugin_data = wp_cache_get($prefix . $plugin_file, $prefix . '_subplugins');
     if ($plugin_data === FALSE) {
         $default_headers = array('Name' => strtoupper($prefix) . '-Plugin Name', 'PluginURI' => 'Plugin URI', 'Version' => 'Version', 'Description' => 'Description', 'Author' => 'Author', 'AuthorURI' => 'Author URI', 'TextDomain' => 'Text Domain', 'DomainPath' => 'Domain Path', 'Network' => 'Network', '_sitewide' => 'Site Wide Only');
         $default_headers = apply_filters($prefix . '_plugin_data_headers', $default_headers);
         $plugin_data = get_file_data($plugin_file, $default_headers, 'plugin');
         $plugin_data['Network'] = 'true' == strtolower($plugin_data['Network']);
         if ($markup || $translate) {
             $plugin_data = _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup, $translate);
         } else {
             $plugin_data['Title'] = $plugin_data['Name'];
             $plugin_data['AuthorName'] = $plugin_data['Author'];
         }
         wp_cache_set($prefix . $plugin_file, $plugin_data, $prefix . '_subplugins');
     }
     return $plugin_data;
 }
开发者ID:biont,项目名称:wordpress-subplugins,代码行数:32,代码来源:sub-plugins.php

示例8: prepare_items

 /**
  * Fetch the list of VIP plugins to display in the list table.
  */
 public function prepare_items()
 {
     $active = $inactive = array();
     $vip_plugins = WPCOM_VIP_Plugins_UI::instance();
     $shared_plugins = $vip_plugins->get_shared_plugins();
     // The path has to be
     foreach ($shared_plugins as $plugin_file => $plugin_data) {
         $plugin_folder = basename(dirname($plugin_file));
         // FPP is listed separately
         if (isset(WPCOM_VIP_Plugins_UI()->fpp_plugins[$plugin_folder])) {
             continue;
         }
         $plugin_file = WPCOM_VIP_Plugins_UI::SHARED_PLUGINS_RELATIVE_PATH . '/' . $plugin_file;
         $status = WPCOM_VIP_Plugins_UI()->is_plugin_active($plugin_folder) ? 'active' : 'inactive';
         // Don't want some plugins showing up in the list
         if ('inactive' == $status && in_array($plugin_folder, WPCOM_VIP_Plugins_UI()->hidden_plugins)) {
             continue;
         }
         // Translate, Don't Apply Markup, Sanitize HTML
         ${$status}[$plugin_file] = _get_plugin_data_markup_translate($plugin_file, $plugin_data, false, true);
     }
     $this->items = array_merge($active, $inactive);
 }
开发者ID:humanmade,项目名称:vip-mu-plugins-public,代码行数:26,代码来源:class.wpcom-vip-plugins-ui-list-table.php

示例9: prepare_items

 /**
  * Overrides {@link WP_Plugins_List_Table::prepare_items()}
  */
 function prepare_items()
 {
     global $status, $page, $orderby, $order, $s;
     wp_reset_vars(array('orderby', 'order'));
     $plugins = array('all' => ray_get_network_plugins_only(), 'search' => array(), 'active' => array(), 'inactive' => array(), 'recently_activated' => array(), 'upgrade' => array(), 'mustuse' => array(), 'dropins' => array());
     $screen = $this->screen;
     if (!is_multisite() || $screen->in_admin('network') && current_user_can('manage_network_plugins')) {
         if (current_user_can('update_plugins')) {
             $current = get_site_transient('update_plugins');
             foreach ((array) $plugins['all'] as $plugin_file => $plugin_data) {
                 if (isset($current->response[$plugin_file])) {
                     $plugins['all'][$plugin_file]['update'] = true;
                     $plugins['upgrade'][$plugin_file] = $plugins['all'][$plugin_file];
                 }
             }
         }
     }
     set_transient('plugin_slugs', array_keys($plugins['all']), DAY_IN_SECONDS);
     $recently_activated = get_site_option('recently_activated', array());
     foreach ($recently_activated as $key => $time) {
         if ($time + WEEK_IN_SECONDS < time()) {
             unset($recently_activated[$key]);
         }
     }
     update_site_option('recently_activated', $recently_activated);
     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];
     if (!$orderby) {
         $orderby = 'Name';
     } else {
         $orderby = ucfirst($orderby);
     }
     $order = strtoupper($order);
     uasort($this->items, array($this, '_order_callback'));
 }
开发者ID:r-a-y,项目名称:blue-network-plugins,代码行数:53,代码来源:blue-network-plugins.php

示例10: get_upgradable_plugins

 function get_upgradable_plugins()
 {
     $all_plugins = get_plugins();
     $upgrade_plugins = array();
     $this->refresh_transient();
     $current = $this->wpr_get_transient('update_plugins');
     foreach ((array) $all_plugins as $plugin_file => $plugin_data) {
         $plugin_data = _get_plugin_data_markup_translate($plugin_file, $plugin_data, false, true);
         if (isset($current->response[$plugin_file])) {
             $current->response[$plugin_file]->name = $plugin_data['Name'];
             $current->response[$plugin_file]->old_version = $plugin_data['Version'];
             $current->response[$plugin_file]->file = $plugin_file;
             $upgrade_plugins[] = $current->response[$plugin_file];
         }
     }
     return $upgrade_plugins;
 }
开发者ID:satishux,项目名称:fitnesshack,代码行数:17,代码来源:display-cl.php

示例11: prepare_items

 function prepare_items()
 {
     global $status, $plugins, $totals, $page, $orderby, $order, $s;
     wp_reset_vars(array('orderby', 'order', 's'));
     $plugins = array('all' => apply_filters('all_plugins', get_plugins()), 'search' => array(), 'active' => array(), 'inactive' => array(), 'recently_activated' => array(), 'upgrade' => array(), 'mustuse' => array(), 'dropins' => array());
     $screen = get_current_screen();
     if (!is_multisite() || $screen->is_network && current_user_can('manage_network_plugins')) {
         if (apply_filters('show_advanced_plugins', true, 'mustuse')) {
             $plugins['mustuse'] = get_mu_plugins();
         }
         if (apply_filters('show_advanced_plugins', true, 'dropins')) {
             $plugins['dropins'] = get_dropins();
         }
         $current = get_site_transient('update_plugins');
         foreach ((array) $plugins['all'] as $plugin_file => $plugin_data) {
             if (isset($current->response[$plugin_file])) {
                 $plugins['upgrade'][$plugin_file] = $plugin_data;
             }
         }
     }
     set_transient('plugin_slugs', array_keys($plugins['all']), 86400);
     $recently_activated = get_option('recently_activated', array());
     $one_week = 7 * 24 * 60 * 60;
     foreach ($recently_activated as $key => $time) {
         if ($time + $one_week < time()) {
             unset($recently_activated[$key]);
         }
     }
     update_option('recently_activated', $recently_activated);
     foreach ((array) $plugins['all'] as $plugin_file => $plugin_data) {
         // Filter into individual sections
         if (is_multisite() && is_network_only_plugin($plugin_file) && !$screen->is_network) {
             unset($plugins['all'][$plugin_file]);
         } elseif (is_plugin_active_for_network($plugin_file) && !$screen->is_network) {
             unset($plugins['all'][$plugin_file]);
         } elseif (is_multisite() && is_network_only_plugin($plugin_file) && !current_user_can('manage_network_plugins')) {
             $plugins['network'][$plugin_file] = $plugin_data;
         } elseif (!$screen->is_network && is_plugin_active($plugin_file) || $screen->is_network && is_plugin_active_for_network($plugin_file)) {
             $plugins['active'][$plugin_file] = $plugin_data;
         } else {
             if (!$screen->is_network && isset($recently_activated[$plugin_file])) {
                 // Was the plugin recently activated?
                 $plugins['recently_activated'][$plugin_file] = $plugin_data;
             }
             $plugins['inactive'][$plugin_file] = $plugin_data;
         }
     }
     if (!current_user_can('update_plugins')) {
         $plugins['upgrade'] = array();
     }
     if ($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];
     if ($orderby) {
         $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'));
     $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:Esleelkartea,项目名称:herramienta_para_autodiagnostico_ADEADA,代码行数:79,代码来源:class-wp-plugins-list-table.php

示例12: array

$recent_plugins = array();
$recently_activated = (array) get_option('recently_activated');
//Clean out any plugins which were deactivated over a week ago.
foreach ($recently_activated as $key => $time) {
    if ($time + 7 * 24 * 60 * 60 < time()) {
        //1 week
        unset($recently_activated[$key]);
    }
}
if ($recently_activated != get_option('recently_activated')) {
    //If array changed, update it.
    update_option('recently_activated', $recently_activated);
}
foreach ((array) $all_plugins as $plugin_file => $plugin_data) {
    //Translate, Apply Markup, Sanitize HTML
    $plugin_data = _get_plugin_data_markup_translate($plugin_data, true, true);
    //Filter into individual sections
    if (is_plugin_active($plugin_file)) {
        $active_plugins[$plugin_file] = $plugin_data;
    } else {
        if (isset($recently_activated[$plugin_file])) {
            //Was the plugin recently activated?
            $recent_plugins[$plugin_file] = $plugin_data;
        } else {
            $inactive_plugins[$plugin_file] = $plugin_data;
        }
    }
}
?>

<?php 
开发者ID:BGCX262,项目名称:zxhproject-svn-to-git,代码行数:31,代码来源:plugins.php

示例13: set_transient

set_transient('plugin_slugs', array_keys($all_plugins), 86400);
// Clean out any plugins which were deactivated over a week ago.
foreach ($recently_activated as $key => $time) {
    if ($time + 7 * 24 * 60 * 60 < time()) {
        //1 week
        unset($recently_activated[$key]);
    }
}
if ($recently_activated != get_option('recently_activated')) {
    //If array changed, update it.
    update_option('recently_activated', $recently_activated);
}
$current = get_transient('update_plugins');
foreach ((array) $all_plugins as $plugin_file => $plugin_data) {
    //Translate, Apply Markup, Sanitize HTML
    $plugin_data = _get_plugin_data_markup_translate($plugin_file, $plugin_data, false, true);
    $all_plugins[$plugin_file] = $plugin_data;
    //Filter into individual sections
    if (is_plugin_active($plugin_file)) {
        $active_plugins[$plugin_file] = $plugin_data;
    } else {
        if (isset($recently_activated[$plugin_file])) {
            // Was the plugin recently activated?
            $recent_plugins[$plugin_file] = $plugin_data;
        }
        $inactive_plugins[$plugin_file] = $plugin_data;
    }
    if (isset($current->response[$plugin_file])) {
        $upgrade_plugins[$plugin_file] = $plugin_data;
    }
}
开发者ID:klr2003,项目名称:sourceread,代码行数:31,代码来源:plugins.php

示例14: get_plugin_data

/**
 * Parse the plugin contents to retrieve plugin's metadata.
 *
 * The metadata of the plugin's data searches for the following in the plugin's
 * header. All plugin data must be on its own line. For plugin description, it
 * must not have any newlines or only parts of the description will be displayed
 * and the same goes for the plugin data. The below is formatted for printing.
 *
 * <code>
 * /*
 * Plugin Name: Name of Plugin
 * Plugin URI: Link to plugin information
 * Description: Plugin Description
 * Author: Plugin author's name
 * Author URI: Link to the author's web site
 * Version: Must be set in the plugin for WordPress 2.3+
 * Text Domain: Optional. Unique identifier, should be same as the one used in
 *		plugin_text_domain()
 * Domain Path: Optional. Only useful if the translations are located in a
 *		folder above the plugin's base path. For example, if .mo files are
 *		located in the locale folder then Domain Path will be "/locale/" and
 *		must have the first slash. Defaults to the base folder the plugin is
 *		located in.
 *  * / # Remove the space to close comment
 * </code>
 *
 * Plugin data returned array contains the following:
 *		'Name' - Name of the plugin, must be unique.
 *		'Title' - Title of the plugin and the link to the plugin's web site.
 *		'Description' - Description of what the plugin does and/or notes
 *		from the author.
 *		'Author' - The author's name
 *		'AuthorURI' - The authors web site address.
 *		'Version' - The plugin version number.
 *		'PluginURI' - Plugin web site address.
 *		'TextDomain' - Plugin's text domain for localization.
 *		'DomainPath' - Plugin's relative directory path to .mo files.
 *
 * Some users have issues with opening large files and manipulating the contents
 * for want is usually the first 1kiB or 2kiB. This function stops pulling in
 * the plugin contents when it has all of the required plugin data.
 *
 * The first 8kiB of the file will be pulled in and if the plugin data is not
 * within that first 8kiB, then the plugin author should correct their plugin
 * and move the plugin data headers to the top.
 *
 * The plugin file is assumed to have permissions to allow for scripts to read
 * the file. This is not checked however and the file is only opened for
 * reading.
 *
 * @link http://trac.wordpress.org/ticket/5651 Previous Optimizations.
 * @link http://trac.wordpress.org/ticket/7372 Further and better Optimizations.
 * @since 1.5.0
 *
 * @param string $plugin_file Path to the plugin file
 * @param bool $markup If the returned data should have HTML markup applied
 * @param bool $translate If the returned data should be translated
 * @return array See above for description.
 */
function get_plugin_data($plugin_file, $markup = true, $translate = true)
{
    // We don't need to write to the file, so just open for reading.
    $fp = fopen($plugin_file, 'r');
    // Pull only the first 8kiB of the file in.
    $plugin_data = fread($fp, 8192);
    // PHP will close file handle, but we are good citizens.
    fclose($fp);
    preg_match('|Plugin Name:(.*)$|mi', $plugin_data, $name);
    preg_match('|Plugin URI:(.*)$|mi', $plugin_data, $uri);
    preg_match('|Version:(.*)|i', $plugin_data, $version);
    preg_match('|Description:(.*)$|mi', $plugin_data, $description);
    preg_match('|Author:(.*)$|mi', $plugin_data, $author_name);
    preg_match('|Author URI:(.*)$|mi', $plugin_data, $author_uri);
    preg_match('|Text Domain:(.*)$|mi', $plugin_data, $text_domain);
    preg_match('|Domain Path:(.*)$|mi', $plugin_data, $domain_path);
    foreach (array('name', 'uri', 'version', 'description', 'author_name', 'author_uri', 'text_domain', 'domain_path') as $field) {
        if (!empty(${$field})) {
            ${$field} = _cleanup_header_comment(${$field}[1]);
        } else {
            ${$field} = '';
        }
    }
    $plugin_data = array('Name' => $name, 'Title' => $name, 'PluginURI' => $uri, 'Description' => $description, 'Author' => $author_name, 'AuthorURI' => $author_uri, 'Version' => $version, 'TextDomain' => $text_domain, 'DomainPath' => $domain_path);
    if ($markup || $translate) {
        $plugin_data = _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup, $translate);
    }
    return $plugin_data;
}
开发者ID:bluedanbob,项目名称:wordpress,代码行数:88,代码来源:plugin.php

示例15: count

        //Do not apply markup/translate as it'll be cached.
        if (empty($plugin_data['Name'])) {
            $plugin_data['Name'] = $plugin_file;
        }
        $plugins['mustuse'][$plugin_file] = $plugin_data;
    }
    // Recount totals
    $GLOBALS['totals']['mustuse'] = count($plugins['mustuse']);
    // Only apply the rest if we're actually looking at the page
    if ($GLOBALS['status'] !== 'mustuse') {
        return;
    }
    // Reset the list table's data
    $wp_list_table->items = $plugins['mustuse'];
    foreach ($wp_list_table->items as $plugin_file => $plugin_data) {
        $wp_list_table->items[$plugin_file] = _get_plugin_data_markup_translate($plugin_file, $plugin_data, false, true);
    }
    $total_this_page = $GLOBALS['totals']['mustuse'];
    if ($GLOBALS['orderby']) {
        uasort($wp_list_table->items, array($wp_list_table, '_order_callback'));
    }
    // Force showing all plugins
    // See https://core.trac.wordpress.org/ticket/27110
    $plugins_per_page = $total_this_page;
    $wp_list_table->set_pagination_args(array('total_items' => $total_this_page, 'per_page' => $plugins_per_page));
});
add_action('network_admin_plugin_action_links', function ($actions, $plugin_file, $plugin_data, $context) use($hm_mu_plugins) {
    if ($context !== 'mustuse' || !in_array($plugin_file, $hm_mu_plugins)) {
        return;
    }
    $actions[] = sprintf('<span style="color:#333">File: <code>%s</code></span>', $plugin_file);
开发者ID:joshuadavidnelson,项目名称:base,代码行数:31,代码来源:loader.php


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