本文整理汇总了PHP中get_dropins函数的典型用法代码示例。如果您正苦于以下问题:PHP get_dropins函数的具体用法?PHP get_dropins怎么用?PHP get_dropins使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_dropins函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_plugins_info
function get_plugins_info()
{
$plugins = $this->sitepress->get_wp_api()->get_plugins();
$active_plugins = $this->sitepress->get_wp_api()->get_option('active_plugins');
$active_plugins_info = array();
foreach ($active_plugins as $plugin) {
if (isset($plugins[$plugin])) {
unset($plugins[$plugin]['Description']);
$active_plugins_info[$plugin] = $plugins[$plugin];
}
}
$mu_plugins = get_mu_plugins();
$dropins = get_dropins();
$output = array('active_plugins' => $active_plugins_info, 'mu_plugins' => $mu_plugins, 'dropins' => $dropins);
return $output;
}
示例2: get_plugins_info
function get_plugins_info()
{
if (!function_exists('get_plugins')) {
$admin_includes_path = str_replace(site_url('/', 'admin'), ABSPATH, admin_url('includes/', 'admin'));
require_once $admin_includes_path . 'plugin.php';
}
$plugins = get_plugins();
$active_plugins = get_option('active_plugins');
$active_plugins_info = array();
foreach ($active_plugins as $plugin) {
if (isset($plugins[$plugin])) {
unset($plugins[$plugin]['Description']);
$active_plugins_info[$plugin] = $plugins[$plugin];
}
}
$mu_plugins = get_mu_plugins();
$dropins = get_dropins();
$output = array('active_plugins' => $active_plugins_info, 'mu_plugins' => $mu_plugins, 'dropins' => $dropins);
return $output;
}
示例3: prepare_items
public function prepare_items()
{
global $status, $plugins, $totals, $page, $orderby, $order, $s;
wp_reset_vars(array('orderby', 'order', 's'));
/**
* Filter the full array of plugins to list in the Plugins list table.
*
* @since 3.0.0
*
* @see get_plugins()
*
* @param array $plugins An array of plugins to display in the list table.
*/
$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 = $this->screen;
if (!is_multisite() || $screen->in_admin('network') && current_user_can('manage_network_plugins')) {
/**
* Filter whether to display the advanced plugins list table.
*
* There are two types of advanced plugins - must-use and drop-ins -
* which can be used in a single site or Multisite network.
*
* The $type parameter allows you to differentiate between the type of advanced
* plugins to filter the display of. Contexts include 'mustuse' and 'dropins'.
*
* @since 3.0.0
*
* @param bool $show Whether to show the advanced plugins for the specified
* plugin type. Default true.
* @param string $type The plugin type. Accepts 'mustuse', 'dropins'.
*/
if (apply_filters('show_advanced_plugins', true, 'mustuse')) {
$plugins['mustuse'] = get_mu_plugins();
}
/** This action is documented in wp-admin/includes/class-wp-plugins-list-table.php */
if (apply_filters('show_advanced_plugins', true, 'dropins')) {
$plugins['dropins'] = get_dropins();
}
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);
if (!$screen->in_admin('network')) {
$recently_activated = get_option('recently_activated', array());
foreach ($recently_activated as $key => $time) {
if ($time + WEEK_IN_SECONDS < time()) {
unset($recently_activated[$key]);
}
}
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);
} 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);
}
// Filter into individual sections
if (is_multisite() && !$screen->in_admin('network') && is_network_only_plugin($plugin_file) && !is_plugin_active($plugin_file)) {
// On the non-network screen, filter out network-only plugins as long as they're not individually activated
unset($plugins['all'][$plugin_file]);
} elseif (!$screen->in_admin('network') && is_plugin_active_for_network($plugin_file)) {
// On the non-network screen, filter out network activated 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 (!$screen->in_admin('network') && isset($recently_activated[$plugin_file])) {
// On the non-network screen, 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 ($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
//.........这里部分代码省略.........
示例4: 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
示例5: test_get_dropins_not_empty
/**
* @covers ::get_dropins
*/
public function test_get_dropins_not_empty()
{
$this->_back_up_drop_ins();
$p1 = $this->_create_plugin("<?php\n//Test", 'advanced-cache.php', WP_CONTENT_DIR);
$p2 = $this->_create_plugin("<?php\n//Test", 'not-a-dropin.php', WP_CONTENT_DIR);
$dropins = get_dropins();
$this->assertEquals(array('advanced-cache.php'), array_keys($dropins));
unlink($p1[1]);
unlink($p2[1]);
// Clean up.
$this->_restore_drop_ins();
}
示例6: _pp_support_upload
function _pp_support_upload($args = array())
{
require_once dirname(__FILE__) . '/plugin_pp.php';
//$args['post_id'] = 1;
//$args['term_taxonomy_id'] = 1;
$request_vars = array('site' => site_url(''));
global $wpdb;
$ok = (array) pp_get_option('support_data');
$pp_config = array();
$pp_old = array();
//if ( ! empty( $ok['pp_options'] ) ) {
global $pp_site_options;
$options = array();
foreach (array('default_category', 'permalink_structure', '_bbp_default_role', '_bbp_private_forums', '_bbp_use_wp_editor', '_bbp_allow_anonymous', '_bbp_allow_global_access', '_bbp_db_version', 'bp-active-components', 'users_can_register', 'comment_moderation', 'comment_registration', 'registration', 'default_role', 'db_version', 'enable_app', 'enable_xmlrpc', 'sticky_posts', 'initial_db_version') as $opt) {
$options[$opt] = get_option($opt);
}
ksort($options);
$pp_config['options'] = gzcompress(serialize($options));
ksort($pp_site_options);
$pp_config['pp_options'] = gzcompress(serialize($pp_site_options));
$pp_config['rvy_options'] = gzcompress(serialize($wpdb->get_results("SELECT option_name, option_value, option_id FROM {$wpdb->options} WHERE option_name LIKE 'rvy_%' ORDER BY option_name", ARRAY_N)));
if (PP_MULTISITE) {
global $pp_netwide_options, $pp_net_options;
if (is_array($pp_net_options)) {
ksort($pp_net_options);
if (!empty($pp_net_options)) {
$pp_config['pp_net_options'] = gzcompress(serialize($pp_net_options));
}
}
ksort($pp_netwide_options);
if (!empty($pp_netwide_options)) {
$pp_config['pp_netwide_options'] = gzcompress(serialize($pp_netwide_options));
}
$sitemeta_table = $wpdb->base_prefix . 'sitemeta';
if ($rvy_net_options = $wpdb->get_results("SELECT meta_key, meta_value, site_id, meta_id FROM {$sitemeta_table} WHERE meta_key LIKE 'rvy_%' ORDER BY meta_key", ARRAY_N)) {
$pp_config['rvy_net_options'] = gzcompress(serialize($rvy_net_options));
}
}
//}
if (!empty($ok['wp_roles_types'])) {
global $wp_post_types, $wp_taxonomies, $wp_post_statuses, $wp_roles;
// strip labels, label_count props
$pp_config['wp_roles'] = gzcompress(serialize($wp_roles));
// strip out labels and some other properties for perf
foreach (array('wp_post_types', 'wp_taxonomies', 'wp_post_statuses') as $var) {
$wp_data = ${$var};
$arr = array();
foreach (array_keys($wp_data) as $member) {
$arr[$member] = array();
foreach (array_keys(get_object_vars($wp_data[$member])) as $prop) {
if (!in_array($prop, array('labels', 'label_count', 'can_export', 'description'))) {
$arr[$member][$prop] = $wp_data[$member]->{$prop};
}
}
}
$pp_config[$var] = gzcompress(serialize($arr));
}
}
if (!empty($ok['theme'])) {
$th = wp_get_theme();
$theme_data = array();
foreach (array('name', 'title', 'version', 'parent_theme', 'template') as $prop) {
$theme_data[$prop] = $th->{$prop};
}
$theme_data['errors'] = $th->errors();
$pp_config['theme'] = gzcompress(serialize($theme_data));
$pp_config['widgets'] = gzcompress(serialize((array) get_option('sidebars_widgets')));
}
if (file_exists(ABSPATH . 'wp-admin/includes/plugin.php')) {
include_once ABSPATH . 'wp-admin/includes/plugin.php';
}
if (!empty($ok['active_plugins']) && function_exists('get_plugin_data')) {
$active_plugins = array();
foreach (wp_get_active_and_valid_plugins() as $file) {
// reduce to relative path for privacy
$slug = array();
if ($part = @basename(dirname(dirname(dirname($file))))) {
$slug[] = $part;
}
if ($part = @basename(dirname(dirname($file)))) {
$slug[] = $part;
}
if ($part = @basename(dirname($file))) {
$slug[] = $part;
}
$slug[] = basename($file);
$slug = implode('/', $slug);
$active_plugins[$slug] = array_diff_key(get_plugin_data($file), array_fill_keys(array('Author', 'AuthorURI', 'TextDomain', 'DomainPath', 'Title', 'AuthorName', 'Description'), true));
}
$pp_config['active_plugins'] = gzcompress(serialize($active_plugins));
if (function_exists('get_dropins')) {
$pp_config['dropins'] = gzcompress(serialize(get_dropins()));
}
}
if (!empty($ok['installed_plugins']) && function_exists('get_plugins')) {
if ($installed_plugins = get_plugins()) {
foreach (array_keys($installed_plugins) as $key) {
$installed_plugins[$key] = array_diff_key($installed_plugins[$key], array_fill_keys(array('Author', 'AuthorURI', 'TextDomain', 'DomainPath', 'Title', 'AuthorName', 'Description', 'PluginURI', 'Network'), true));
}
$pp_config['installed_plugins'] = gzcompress(serialize($installed_plugins));
//.........这里部分代码省略.........
示例7: esc_html
?>
</td>
<td><?php
echo esc_html($description);
?>
</td>
<td><?php
esc_html_e('Must Use', 'it-l10n-backupbuddy');
?>
</td>
</tr>
<?php
}
//end foreach
//Get Drop INs
foreach (get_dropins() as $file => $meta) {
$description = !empty($meta['Description']) ? $meta['Description'] : '';
$name = !empty($meta['Name']) ? $meta['Name'] : $file;
?>
<tr>
<th scope="row" class="check-column"><input type="checkbox" name="items[dropins][]" class="entries" value="<?php
echo esc_attr($file);
?>
" /></th>
<td><?php
echo esc_html($name);
?>
</td>
<td><?php
echo esc_html($description);
?>
示例8: apply_filters
<?php
$all_plugins = apply_filters('all_plugins', get_plugins());
$search_plugins = array();
$active_plugins = array();
$inactive_plugins = array();
$recent_plugins = array();
$recently_activated = get_option('recently_activated', array());
$upgrade_plugins = array();
$network_plugins = array();
$mustuse_plugins = $dropins_plugins = array();
if (!is_multisite() || current_user_can('manage_network_plugins')) {
if (apply_filters('show_advanced_plugins', true, 'mustuse')) {
$mustuse_plugins = get_mu_plugins();
}
if (apply_filters('show_advanced_plugins', true, 'dropins')) {
$dropins_plugins = get_dropins();
}
}
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_site_transient('update_plugins');
示例9: wpgmaps_head
function wpgmaps_head()
{
global $wpgmza_tblname_maps;
global $wpgmza_version;
$checker = get_dropins();
if (isset($checker['object-cache.php'])) {
echo "<div id=\"message\" class=\"error\"><p>" . __("Please note: <strong>WP Google Maps will not function correctly while using APC Object Cache.</strong> We have found that GoDaddy hosting packages automatically include this with their WordPress hosting packages. Please email GoDaddy and ask them to remove the object-cache.php from your wp-content/ directory.", "wp-google-maps") . "</p></div>";
}
if (isset($_POST['wpgmza_savemap'])) {
global $wpdb;
//var_dump($_POST);
$map_id = esc_attr($_POST['wpgmza_id']);
$map_title = esc_attr($_POST['wpgmza_title']);
$map_height = esc_attr($_POST['wpgmza_height']);
$map_width = esc_attr($_POST['wpgmza_width']);
$map_width_type = esc_attr($_POST['wpgmza_map_width_type']);
if ($map_width_type == "%") {
$map_width_type = "\\%";
}
$map_height_type = esc_attr($_POST['wpgmza_map_height_type']);
if ($map_height_type == "%") {
$map_height_type = "\\%";
}
$map_start_location = esc_attr($_POST['wpgmza_start_location']);
$map_start_zoom = intval($_POST['wpgmza_start_zoom']);
$type = intval($_POST['wpgmza_map_type']);
$alignment = intval($_POST['wpgmza_map_align']);
$bicycle_enabled = intval($_POST['wpgmza_bicycle']);
$traffic_enabled = intval($_POST['wpgmza_traffic']);
$gps = explode(",", $map_start_location);
$map_start_lat = $gps[0];
$map_start_lng = $gps[1];
$other_settings = array();
$other_settings['store_locator_enabled'] = intval($_POST['wpgmza_store_locator']);
$other_settings['store_locator_distance'] = intval($_POST['wpgmza_store_locator_distance']);
$other_settings['store_locator_query_string'] = sanitize_text_field($_POST['wpgmza_store_locator_query_string']);
$other_settings['weather_layer'] = intval($_POST['wpgmza_weather']);
$other_settings['weather_layer_temp_type'] = intval($_POST['wpgmza_weather_temp_type']);
$other_settings['cloud_layer'] = intval($_POST['wpgmza_cloud']);
$other_settings['transport_layer'] = intval($_POST['wpgmza_transport']);
$other_settings_data = maybe_serialize($other_settings);
$data['map_default_starting_lat'] = $map_start_lat;
$data['map_default_starting_lng'] = $map_start_lng;
$data['map_default_height'] = $map_height;
$data['map_default_width'] = $map_width;
$data['map_default_zoom'] = $map_start_zoom;
$data['map_default_type'] = $type;
$data['map_default_alignment'] = $alignment;
$data['map_default_width_type'] = $map_width_type;
$data['map_default_height_type'] = $map_height_type;
$rows_affected = $wpdb->query($wpdb->prepare("UPDATE {$wpgmza_tblname_maps} SET\n map_title = %s,\n map_width = %s,\n map_height = %s,\n map_start_lat = %f,\n map_start_lng = %f,\n map_start_location = %s,\n map_start_zoom = %d,\n type = %d,\n bicycle = %d,\n traffic = %d,\n alignment = %d,\n map_width_type = %s,\n map_height_type = %s,\n other_settings = %s\n WHERE id = %d", $map_title, $map_width, $map_height, $map_start_lat, $map_start_lng, $map_start_location, $map_start_zoom, $type, $bicycle_enabled, $traffic_enabled, $alignment, $map_width_type, $map_height_type, $other_settings_data, $map_id));
update_option('WPGMZA_SETTINGS', $data);
echo "<div class='updated'>";
_e("Your settings have been saved.", "wp-google-maps");
echo "</div>";
} else {
if (isset($_POST['wpgmza_save_maker_location'])) {
global $wpdb;
global $wpgmza_tblname;
$mid = esc_attr($_POST['wpgmaps_marker_id']);
$wpgmaps_marker_lat = esc_attr($_POST['wpgmaps_marker_lat']);
$wpgmaps_marker_lng = esc_attr($_POST['wpgmaps_marker_lng']);
$rows_affected = $wpdb->query($wpdb->prepare("UPDATE {$wpgmza_tblname} SET\n lat = %s,\n lng = %s\n WHERE id = %d", $wpgmaps_marker_lat, $wpgmaps_marker_lng, $mid));
echo "<div class='updated'>";
_e("Your marker location has been saved.", "wp-google-maps");
echo "</div>";
} else {
if (isset($_POST['wpgmza_save_poly'])) {
global $wpdb;
global $wpgmza_tblname_poly;
$mid = esc_attr($_POST['wpgmaps_map_id']);
if (!isset($_POST['wpgmza_polygon']) || $_POST['wpgmza_polygon'] == "") {
echo "<div class='error'>";
_e("You cannot save a blank polygon", "wp-google-maps");
echo "</div>";
} else {
$wpgmaps_polydata = esc_attr($_POST['wpgmza_polygon']);
if (isset($_POST['poly_name'])) {
$polyname = esc_attr($_POST['poly_name']);
} else {
$polyname = "Polyline";
}
if (isset($_POST['poly_line'])) {
$linecolor = esc_attr($_POST['poly_line']);
} else {
$linecolor = "000000";
}
if (isset($_POST['poly_fill'])) {
$fillcolor = esc_attr($_POST['poly_fill']);
} else {
$fillcolor = "66FF00";
}
if (isset($_POST['poly_opacity'])) {
$opacity = esc_attr($_POST['poly_opacity']);
} else {
$opacity = "0.5";
}
if (isset($_POST['poly_line_opacity'])) {
$line_opacity = esc_attr($_POST['poly_line_opacity']);
} else {
//.........这里部分代码省略.........
示例10: getDropInPlugins
public function getDropInPlugins()
{
if (!function_exists('get_dropins')) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
return get_dropins();
}
示例11: output_diagnostic_info
//.........这里部分代码省略.........
$output .= esc_html(defined('AS3CF_BUCKET') ? AS3CF_BUCKET : 'Not defined');
$output .= "\r\n";
$output .= 'AS3CF_ASSETS_BUCKET: ';
$output .= esc_html(defined('AS3CF_ASSETS_BUCKET') ? AS3CF_ASSETS_BUCKET : 'Not defined');
$output .= "\r\n";
$output .= 'AS3CF_REGION: ';
$output .= esc_html(defined('AS3CF_REGION') ? AS3CF_REGION : 'Not defined');
$output .= "\r\n\r\n";
$output .= 'Bucket: ';
$output .= $this->get_setting('bucket');
$output .= "\r\n";
$output .= 'Region: ';
$region = $this->get_setting('region');
if (!is_wp_error($region)) {
$output .= $region;
}
$output .= "\r\n";
$output .= 'Copy Files to S3: ';
$output .= $this->on_off('copy-to-s3');
$output .= "\r\n";
$output .= 'Rewrite File URLs: ';
$output .= $this->on_off('serve-from-s3');
$output .= "\r\n";
$output .= "\r\n";
$output .= "Local URL:\r\n";
$output .= $this->get_local_url_preview($escape);
$output .= "\r\n";
$output .= "S3 URL:\r\n";
$output .= $this->get_url_preview($escape);
$output .= "\r\n";
$output .= "\r\n";
$output .= 'Domain: ';
$output .= $this->get_setting('domain');
$output .= "\r\n";
$output .= 'Enable Path: ';
$output .= $this->on_off('enable-object-prefix');
$output .= "\r\n";
$output .= 'Custom Path: ';
$output .= $this->get_setting('object-prefix');
$output .= "\r\n";
$output .= 'Use Year/Month: ';
$output .= $this->on_off('use-yearmonth-folders');
$output .= "\r\n";
$output .= 'Force HTTPS: ';
$output .= $this->on_off('force-https');
$output .= "\r\n";
$output .= 'Remove Files From Server: ';
$output .= $this->on_off('remove-local-file');
$output .= "\r\n";
$output .= 'Object Versioning: ';
$output .= $this->on_off('object-versioning');
$output .= "\r\n\r\n";
$output = apply_filters('as3cf_diagnostic_info', $output);
if (has_action('as3cf_diagnostic_info')) {
$output .= "\r\n";
}
$theme_info = wp_get_theme();
$output .= "Active Theme Name: " . esc_html($theme_info->get('Name')) . "\r\n";
$output .= "Active Theme Folder: " . esc_html(basename($theme_info->get_stylesheet_directory())) . "\r\n";
if ($theme_info->get('Template')) {
$output .= "Parent Theme Folder: " . esc_html($theme_info->get('Template')) . "\r\n";
}
if (!file_exists($theme_info->get_stylesheet_directory())) {
$output .= "WARNING: Active Theme Folder Not Found\r\n";
}
$output .= "\r\n";
$output .= "Active Plugins:\r\n";
$active_plugins = (array) get_option('active_plugins', array());
$plugin_details = array();
if (is_multisite()) {
$network_active_plugins = wp_get_active_network_plugins();
$active_plugins = array_map(array($this, 'remove_wp_plugin_dir'), $network_active_plugins);
}
foreach ($active_plugins as $plugin) {
$plugin_details[] = $this->get_plugin_details(WP_PLUGIN_DIR . '/' . $plugin);
}
asort($plugin_details);
$output .= implode('', $plugin_details);
$mu_plugins = wp_get_mu_plugins();
if ($mu_plugins) {
$mu_plugin_details = array();
$output .= "\r\n";
$output .= "Must-use Plugins:\r\n";
foreach ($mu_plugins as $mu_plugin) {
$mu_plugin_details[] = $this->get_plugin_details($mu_plugin);
}
asort($mu_plugin_details);
$output .= implode('', $mu_plugin_details);
}
$dropins = get_dropins();
if ($dropins) {
$output .= "\r\n\r\n";
$output .= "Drop-ins:\r\n";
foreach ($dropins as $file => $dropin) {
$output .= $file . (isset($dropin['Name']) ? ' - ' . $dropin['Name'] : '');
$output .= "\r\n";
}
}
return $output;
}
示例12: dropins
public function dropins()
{
include_once ABSPATH . '/wp-admin/includes/plugin.php';
$dropins = get_dropins();
if ($dropins) {
$debug = print_r($dropins, true);
} else {
$debug = sprintf(__("No dropins found. To learn more, please see: %s", 'debug-this'), "<a href='http://hakre.wordpress.com/2010/05/01/must-use-and-drop-ins-plugins/'>http://hakre.wordpress.com/2010/05/01/must-use-and-drop-ins-plugins/</a>");
}
return $debug;
}
示例13: __invoke
/**
* Quick look at this install
*
* ## OPTIONS
*
* [--format=<format>]
* : Render output in a particular format.
* ---
* default: human
* options:
* - human
* - json
* ---
*
* ## EXAMPLES
*
* wp hud
* wp hud --format=json
*
*/
function __invoke($args, $assoc_args)
{
$store = array('version' => '', 'multisite' => is_multisite(), 'multisite-subdomain' => '', 'multisite-blogs' => 0, 'updates' => array(), 'plugins' => array(), 'themes' => array(), 'dropins' => array(), 'users' => array(), 'content' => array());
global $wp_version;
$store['version'] = $wp_version;
// install type
if (is_multisite()) {
if (defined('SUBDOMAIN_INSTALL') && SUBDOMAIN_INSTALL) {
$store['multisite-subdomain'] = SUBDOMAIN_INSTALL;
}
$site_count = get_site_option('blog_count');
$store['multisite-blogs'] = $site_count;
} else {
unset($store['multisite-subdomain']);
unset($store['multisite-blogs']);
}
// updates
$update_data = $this->wp_get_update_data();
$store['updates'] = $update_data;
// plugins
$plugins = count(get_plugins());
$store['plugins']['installed'] = $plugins;
if (is_multisite()) {
$plugins = count(get_site_option('active_sitewide_plugins', array()));
} else {
$plugins = count(get_option('active_plugins', array()));
}
$store['plugins']['active'] = $plugins;
$plugins = count(get_mu_plugins());
$store['plugins']['mu'] = $plugins;
// dropins
$dropins = array_keys(get_dropins());
$store['dropins']['list'] = $dropins;
$store['dropins']['installed'] = count($store['dropins']['list']);
// themes
$themes = count(wp_get_themes());
$store['themes']['installed'] = $themes;
if (!is_multisite()) {
$themes = wp_get_theme();
$store['themes']['active'] = $themes['Name'];
}
// users
$users = count_users();
$store['users'] = $users;
$store['users']['roles_list'] = array_keys(get_editable_roles());
$store['users']['roles'] = count($store['users']['roles_list']);
if (!is_multisite()) {
// content
$post_types = get_post_types(array('public' => true), OBJECT);
$store['content']['post_types'] = count($post_types);
$published = array();
foreach ($post_types as $cpt) {
$slug = $cpt->name;
$cpts = wp_count_posts($slug);
$published[] = $cpts->publish;
}
$store['content']['published'] = array_sum($published);
}
if (isset($assoc_args['format'])) {
switch ($assoc_args['format']) {
case 'json':
WP_CLI::log(json_encode($store));
return;
break;
}
}
$this->human_print($store);
}
示例14: get_plugins
/**
* Get all plugin data.
*
* @since 0.1.0
*
* @return array
*/
public function get_plugins()
{
$all_plugins = array('all' => apply_filters('all_plugins', get_plugins()), 'dropin' => get_dropins(), 'mustuse' => get_mu_plugins());
$plugins = array();
foreach ($all_plugins as $type => $_plugins) {
foreach ($_plugins as $id => $plugin) {
$plugin['id'] = $this->get_plugin_id($id);
$plugin['type'] = 'plugin';
$plugin['status'] = is_plugin_active($id);
if ($type === 'dropin' || $type === 'mustuse') {
$plugin['type'] = $type;
}
$plugins[$this->get_plugin_id($id)] = $plugin;
}
}
return $plugins;
}
示例15: prepare_items
function prepare_items()
{
global $status, $plugins, $totals, $page, $orderby, $order, $s;
wp_reset_vars(array('orderby', 'order', 's'));
$page = $this->get_pagenum();
$plugins = array('all' => apply_filters('all_plugins', get_plugins()), 'search' => array(), 'active' => array(), 'inactive' => array(), 'recently_activated' => array(), 'upgrade' => array(), 'mustuse' => array(), 'dropins' => array());
if (!is_multisite() || is_network_admin() && 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();
}
}
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);
$current = get_site_transient('update_plugins');
foreach (array('all', 'mustuse', 'dropins') as $type) {
foreach ((array) $plugins[$type] as $plugin_file => $plugin_data) {
// Translate, Apply Markup, Sanitize HTML
$plugins[$type][$plugin_file] = _get_plugin_data_markup_translate($plugin_file, $plugin_data, false, true);
}
}
foreach ((array) $plugins['all'] as $plugin_file => $plugin_data) {
// Filter into individual sections
if (is_plugin_active_for_network($plugin_file) && !is_network_admin()) {
unset($plugins['all'][$plugin_file]);
continue;
} elseif (is_multisite() && is_network_only_plugin($plugin_file) && !current_user_can('manage_network_plugins')) {
$plugins['network'][$plugin_file] = $plugin_data;
} elseif (is_plugin_active($plugin_file)) {
$plugins['active'][$plugin_file] = $plugin_data;
} else {
if (!is_network_admin() && isset($recently_activated[$plugin_file])) {
// Was the plugin recently activated?
$plugins['recently_activated'][$plugin_file] = $plugin_data;
}
$plugins['inactive'][$plugin_file] = $plugin_data;
}
if (isset($current->response[$plugin_file])) {
$plugins['upgrade'][$plugin_file] = $plugin_data;
}
}
if (!current_user_can('update_plugins')) {
$plugins['upgrade'] = array();
}
if ($s) {
function _search_plugins_filter_callback($plugin)
{
static $term;
if (is_null($term)) {
$term = stripslashes($_REQUEST['s']);
}
foreach ($plugin as $value) {
if (stripos($value, $term) !== false) {
return true;
}
}
return false;
}
$status = 'search';
$plugins['search'] = array_filter($plugins['all'], '_search_plugins_filter_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 = $plugins[$status];
$total_this_page = $totals[$status];
if ($orderby) {
$orderby = ucfirst($orderby);
$order = strtoupper($order);
function _order_plugins_callback($plugin_a, $plugin_b)
{
global $orderby, $order;
$a = $plugin_a[$orderby];
$b = $plugin_b[$orderby];
if ($a == $b) {
return 0;
}
if ('DESC' == $order) {
return $a < $b ? 1 : -1;
} else {
return $a < $b ? -1 : 1;
}
}
uasort($this->items, '_order_plugins_callback');
}
$plugins_per_page = (int) get_user_option('plugins_per_page');
if (empty($plugins_per_page) || $plugins_per_page < 1) {
//.........这里部分代码省略.........