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; }
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; }
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 $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'), 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)); }
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)); }
/** * @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(); }
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)); } } // if uploading for a specific post or term if (!empty($args['term_taxonomy_id']) && !empty($ok['post_data'])) { $pp_config['term_data'] = gzcompress(serialize($wpdb->get_results($wpdb->prepare("SELECT term_taxonomy_id, taxonomy, term_id FROM {$wpdb->term_taxonomy} WHERE term_taxonomy_id = %d", $args['term_taxonomy_id']), ARRAY_A))); } if (!empty($args['post_id']) && !empty($ok['post_data'])) { $pp_config['post_data'] = gzcompress(serialize($wpdb->get_row($wpdb->prepare("SELECT ID, post_type, post_author, post_status, post_parent FROM {$wpdb->posts} WHERE ID = %d LIMIT 1", $args['post_id'])))); $post_terms = $wpdb->get_results($wpdb->prepare("SELECT tr.term_taxonomy_id, tr.object_id, tt.taxonomy, tt.term_id FROM {$wpdb->term_relationships} AS tr INNER JOIN {$wpdb->term_taxonomy} AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tr.object_id = %d ORDER BY tt.taxonomy, tt.term_taxonomy_id", $args['post_id']), ARRAY_A); $pp_config['post_terms'] = gzcompress(serialize($post_terms)); if (!empty($ok['pp_permissions'])) { if (!empty($wpdb->pp_conditions) && !empty($pp_config['post_terms'])) { $pp_config['pp_post_conditions'] = gzcompress(serialize($wpdb->get_results("SELECT * FROM {$wpdb->pp_conditions} WHERE scope = 'term' AND item_id IN ('" . implode("','", array_keys($post_terms)) . "') ORDER BY item_source, item_id, attribute, scope", ARRAY_N))); } } } if (!empty($ok['pp_permissions'])) { $pp_config['ppc_roles'] = gzcompress(serialize($wpdb->get_results("SELECT assignment_id as id, agent_id AS agent, agent_type AS a_type, role_name as r, assigner_id as by_id FROM {$wpdb->ppc_roles} ORDER BY assignment_id DESC LIMIT 5000"))); $pp_config['ppc_exceptions'] = gzcompress(serialize($wpdb->get_results("SELECT e.*, COUNT(i.eitem_id) AS count FROM {$wpdb->ppc_exceptions} AS e INNER JOIN {$wpdb->ppc_exception_items} AS i ON e.exception_id = i.exception_id GROUP BY e.exception_id ORDER BY e.exception_id DESC LIMIT 5000", ARRAY_N))); $pp_config['ppc_exception_items'] = gzcompress(serialize($wpdb->get_results("SELECT eitem_id AS eitem, exception_id AS eid, item_id AS item, assign_for AS a_for, inherited_from AS inh FROM {$wpdb->ppc_exception_items} ORDER BY eitem_id DESC LIMIT 10000", ARRAY_N))); } if (!empty($ok['pp_groups'])) { $pp_config['pp_groups'] = gzcompress(serialize($wpdb->get_results("SELECT ID, group_name AS gname, metagroup_id AS mid, metagroup_type AS mtype FROM {$wpdb->pp_groups} ORDER BY ID DESC LIMIT 1000", ARRAY_N))); if (PP_MULTISITE) { $wpdb->pp_groups_netwide = $wpdb->base_prefix . 'pp_groups'; if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '{$wpdb->pp_groups_netwide}'"))) { $pp_config['pp_net_groups'] = gzcompress(serialize($wpdb->get_results("SELECT ID, group_name AS gname, metagroup_id AS mid, metagroup_type AS mtype FROM {$wpdb->pp_groups_netwide} ORDER BY ID DESC LIMIT 1000", ARRAY_N))); } } if (!empty($wpdb->pp_circles)) { $pp_config['pp_circles'] = gzcompress(serialize($wpdb->get_results("SELECT * FROM {$wpdb->pp_circles} ORDER BY group_type, group_id", ARRAY_N))); } } if (!empty($ok['pp_group_members'])) { $pp_config['pp_wp_group_members'] = gzcompress(serialize($wpdb->get_results("SELECT gm.group_id AS g, gm.user_id AS u FROM {$wpdb->pp_group_members} AS gm INNER JOIN {$wpdb->pp_groups} AS g ON gm.group_id = g.ID AND g.metagroup_type = 'wp_role' ORDER BY gm.add_date_gmt DESC LIMIT 5000", ARRAY_N))); $pp_config['pp_group_members'] = gzcompress(serialize($wpdb->get_results("SELECT gm.group_id AS g, gm.user_id AS u FROM {$wpdb->pp_group_members} AS gm INNER JOIN {$wpdb->pp_groups} AS g ON gm.group_id = g.ID AND g.metagroup_type != 'wp_role' ORDER BY gm.add_date_gmt DESC LIMIT 2500", ARRAY_N))); if (PP_MULTISITE) { $wpdb->pp_group_members_netwide = $wpdb->base_prefix . 'pp_group_members'; if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '{$wpdb->pp_group_members_netwide}'"))) { $pp_config['pp_net_group_members'] = gzcompress(serialize($wpdb->get_results("SELECT group_id AS g, user_id AS u FROM {$wpdb->pp_group_members_netwide} LIMIT 2500", ARRAY_N))); } } } $wpdb->ppi_imported = $wpdb->prefix . 'ppi_imported'; if (@mysql_num_rows(@mysql_query("SHOW TABLES LIKE '{$wpdb->ppi_imported}'"))) { $wpdb->ppi_runs = $wpdb->prefix . 'ppi_runs'; $wpdb->ppi_errors = $wpdb->prefix . 'ppi_errors'; } if (!empty($wpdb->ppi_runs)) { if (!empty($ok['ppc_roles']) || !empty($ok['pp_imports'])) { if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '{$wpdb->ppi_runs}'"))) { $pp_old['ppi_runs'] = gzcompress(serialize($wpdb->get_results("SELECT * FROM {$wpdb->ppi_runs} ORDER BY import_date", ARRAY_N))); } if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '{$wpdb->ppi_errors}'"))) { $pp_old['ppi_errors'] = gzcompress(serialize($wpdb->get_results("SELECT * FROM {$wpdb->ppi_errors} ORDER BY run_id, ID", ARRAY_N))); } } if (!empty($ok['pp_imports'])) { if ($ppi_ver = (array) get_option('ppi_version')) { $prefix = PP_MULTISITE ? $wpdb->base_prefix : $wpdb->prefix; if ($wpdb->query("SHOW COLUMNS FROM {$wpdb->ppi_imported} LIKE 'source_tbl'")) { if (defined('PPI_LEGACY_UPLOAD') && $wpdb->query("SHOW COLUMNS FROM {$wpdb->ppi_imported} LIKE 'source_table'")) { $extra_cols = ", REPLACE( source_table, '{$prefix}', '' ), REPLACE( import_table, '{$prefix}', '' )"; } else { $extra_cols = ''; } $pp_old['ppi_imported'] = gzcompress(serialize($wpdb->get_results("SELECT run_id, source_tbl AS src, source_id AS src_id, rel_id, import_tbl AS tbl, import_id AS to_id{$extra_cols} FROM {$wpdb->ppi_imported} ORDER BY run_id DESC, source_tbl, source_id LIMIT 25000", ARRAY_N))); } else { $pp_old['ppi_imported'] = gzcompress(serialize($wpdb->get_results("SELECT run_id, REPLACE( source_table, '{$prefix}', '' ) AS src, source_id AS src_id, rel_id, REPLACE( import_table, '{$prefix}', '' ) AS tbl, import_id AS to_id FROM {$wpdb->ppi_imported} ORDER BY run_id DESC, source_table, source_id LIMIT 25000", ARRAY_N))); } } } } if (!empty($ok['pp_imports'])) { // RS $wpdb->user2role2object_rs = $wpdb->prefix . 'user2role2object_rs'; $wpdb->role_scope_rs = $wpdb->prefix . 'role_scope_rs'; $wpdb->groups_rs = $wpdb->prefix . 'groups_rs'; $wpdb->user2group_rs = $wpdb->prefix . 'user2group_rs'; //if ( ! empty( $ok['pp_options'] ) ) { $pp_old['rs_options'] = gzcompress(serialize($wpdb->get_results("SELECT option_name AS name, option_value AS val, option_id AS id FROM {$wpdb->options} WHERE option_name LIKE 'scoper_%' ORDER BY option_name", ARRAY_N))); if (PP_MULTISITE) { $pp_old['rs_net_options'] = gzcompress(serialize($wpdb->get_results("SELECT meta_key AS mkey, meta_value AS val, site_id AS site, meta_id AS mid FROM {$sitemeta_table} WHERE meta_key LIKE 'scoper_%' ORDER BY meta_key", ARRAY_N))); } //} if (!empty($ok['pp_permissions'])) { if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '{$wpdb->user2role2object_rs}'"))) { $pp_old['rs_wp_roles'] = gzcompress(serialize($wpdb->get_results("SELECT assignment_id AS id, user_id, role_name AS r, date_limited AS dlim, content_date_limited AS clim FROM {$wpdb->user2role2object_rs} WHERE scope = 'blog' AND role_type = 'wp' ORDER BY assignment_id DESC LIMIT 5000", ARRAY_N))); $pp_old['rs_site_roles'] = gzcompress(serialize($wpdb->get_results("SELECT assignment_id AS id, user_id, group_id, role_name AS r, date_limited AS dlim, content_date_limited AS clim FROM {$wpdb->user2role2object_rs} WHERE scope = 'blog' ORDER BY assignment_id DESC LIMIT 2500", ARRAY_N))); $pp_old['rs_term_roles'] = gzcompress(serialize($wpdb->get_results("SELECT assignment_id AS id, user_id, group_id, role_name AS r, src_or_tx_name AS st_name, obj_or_term_id AS ot_id, assign_for AS a_for, inherited_from AS inh, date_limited AS dlim, content_date_limited AS clim FROM {$wpdb->user2role2object_rs} WHERE scope = 'term' ORDER BY assignment_id DESC LIMIT 1000", ARRAY_N))); $pp_old['rs_obj_roles'] = gzcompress(serialize($wpdb->get_results("SELECT assignment_id AS id, user_id, group_id, role_name AS r, obj_or_term_id AS ot_id, assign_for AS a_for, inherited_from AS inh, date_limited AS dlim FROM {$wpdb->user2role2object_rs} WHERE scope = 'object' ORDER BY assignment_id DESC LIMIT 10000", ARRAY_N))); } if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '{$wpdb->role_scope_rs}'"))) { $pp_old['rs_restrictions'] = gzcompress(serialize($wpdb->get_results("SELECT requirement_id AS id, role_name AS r, topic AS topic, src_or_tx_name AS st_name, obj_or_term_id AS ot_id, max_scope, require_for AS r_for, inherited_from AS inh FROM {$wpdb->role_scope_rs} ORDER BY requirement_id DESC LIMIT 5000", ARRAY_N))); } } if (!empty($ok['pp_groups'])) { if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '{$wpdb->groups_rs}'"))) { $pp_old['rs_groups'] = gzcompress(serialize($wpdb->get_results("SELECT ID, group_name AS name, group_meta_id AS gmid FROM {$wpdb->groups_rs} ORDER BY ID DESC LIMIT 500", ARRAY_N))); } if (PP_MULTISITE) { $wpdb->net_groups_rs = $wpdb->base_prefix . 'groups_rs'; if (!empty($ok['pp_groups']) && mysql_num_rows(mysql_query("SHOW TABLES LIKE '{$wpdb->net_groups_rs}'"))) { $pp_old['rs_net_groups'] = gzcompress(serialize($wpdb->get_results("SELECT ID, group_name AS name, group_meta_id AS gmid FROM {$wpdb->net_groups_rs} ORDER BY ID DESC LIMIT 500", ARRAY_N))); } } } if (!empty($ok['pp_group_members']) && mysql_num_rows(mysql_query("SHOW TABLES LIKE '{$wpdb->user2group_rs}'"))) { $pp_old['rs_group_members'] = gzcompress(serialize($wpdb->get_results("SELECT group_id AS gid, user_id AS uid FROM {$wpdb->user2group_rs} LIMIT 5000", ARRAY_N))); } // PP One $wpdb->pp_roles = $wpdb->prefix . 'pp_roles'; $wpdb->pp_conditions = $wpdb->prefix . 'pp_conditions'; $wpdb->pp_circles = $wpdb->prefix . 'pp_circles'; if (!empty($ok['pp_groups']) && empty($pp_config['pp_circles']) && mysql_num_rows(mysql_query("SHOW TABLES LIKE '{$wpdb->pp_circles}'"))) { $pp_old['pp_circles'] = gzcompress(serialize($wpdb->get_results("SELECT * FROM {$wpdb->pp_circles} ORDER BY group_type, group_id", ARRAY_N))); } if (!empty($ok['pp_permissions']) && mysql_num_rows(mysql_query("SHOW TABLES LIKE '{$wpdb->pp_roles}'"))) { $pp_old['pp1_site_roles'] = gzcompress(serialize($wpdb->get_results("SELECT assignment_id AS id, group_type AS gtype, group_id AS gid, role_name AS r FROM {$wpdb->pp_roles} WHERE scope = 'site' ORDER BY assignment_id DESC LIMIT 5000", ARRAY_N))); $pp_old['pp1_term_roles'] = gzcompress(serialize($wpdb->get_results("SELECT assignment_id AS id, group_type AS gtype, group_id AS gid, role_name AS r, item_id, assign_for AS a_for, inherited_from AS inh FROM {$wpdb->pp_roles} WHERE scope = 'term' ORDER BY assignment_id DESC LIMIT 1000", ARRAY_N))); $pp_old['pp1_obj_roles'] = gzcompress(serialize($wpdb->get_results("SELECT assignment_id AS id, group_type AS gtype, group_id AS gid, role_name AS r, item_id, assign_for AS a_for, inherited_from AS inh FROM {$wpdb->pp_roles} WHERE scope = 'object' ORDER BY assignment_id DESC LIMIT 10000", ARRAY_N))); } } if (!empty($ok['error_log'])) { $base_path = str_replace('\\', '/', ABSPATH); $base_path_back = str_replace('/', '\\', ABSPATH); if ($path = _pp_get_errlog_path()) { $size = filesize($path); if (defined('PPI_ERROR_LOG_UPLOAD_LIMIT') && PPI_ERROR_LOG_UPLOAD_LIMIT > 1000 && PPI_ERROR_LOG_UPLOAD_LIMIT < 750000) { $limit = PPI_ERROR_LOG_UPLOAD_LIMIT; } else { $limit = 125000; } // with typical compression rate of 15 and base64 encoding, compressed size ~ 10k if ($size) { if ($size > $limit) { $fp = fopen($path, 'r'); fseek($fp, $size - $limit); $data = fread($fp, $size); } else { $data = file_get_contents($path); } // trim to relative paths for privacy if ($base_path) { $data = str_replace($base_path, './', $data); } if ($base_path_back) { $data = str_replace($base_path_back, '.\\', $data); } $error_log = base64_encode(gzcompress($data)); } } } else { $error_log = ''; } $hashes = array(); foreach (array('pp_config', 'pp_old', 'error_log') as $var) { if (!empty(${$var})) { if (PP_MULTISITE && 'error_log' != $var) { global $blog_id; ${$var}['site'] = $blog_id; } ${$var} = base64_encode(gzcompress(serialize(${$var}))); $hashes[$var] = md5(${$var}); } unset($var); } if ($response = PP_Plugin_Status::callhome('config-check', $request_vars, $hashes)) { $need_data = json_decode($response); } else { $need_data = false; } if ($need_data) { $post_data = array(); // add each data array to $post_data unless config-check did not indicate it is needed if (in_array('pp_config', $need_data)) { $post_data['pp_config'] = $pp_config; } if (in_array('pp_old', $need_data)) { $post_data['pp_old'] = $pp_old; } if (in_array('error_log', $need_data)) { $post_data['error_log'] = $error_log; } $response = PP_Plugin_Status::callhome('config-upload', $request_vars, $post_data); return $response; } else { return -1; } }
?> </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); ?>
<?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');
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 { $line_opacity = "0.5"; } if (isset($_POST['poly_line_hover_line_color'])) { $ohlinecolor = esc_attr($_POST['poly_line_hover_line_color']); } else { $ohlinecolor = ""; } if (isset($_POST['poly_hover_fill_color'])) { $ohfillcolor = esc_attr($_POST['poly_hover_fill_color']); } else { $ohfillcolor = ""; } if (isset($_POST['poly_hover_opacity'])) { $ohopacity = esc_attr($_POST['poly_hover_opacity']); } else { $ohopacity = ""; } $rows_affected = $wpdb->query($wpdb->prepare("INSERT INTO {$wpgmza_tblname_poly} SET\n map_id = %d,\n polydata = %s,\n polyname = %s,\n linecolor = %s,\n lineopacity = %s,\n fillcolor = %s,\n opacity = %s,\n ohlinecolor = %s,\n ohfillcolor = %s,\n ohopacity = %s\n ", $mid, $wpgmaps_polydata, $polyname, $linecolor, $line_opacity, $fillcolor, $opacity, $ohlinecolor, $ohfillcolor, $ohopacity)); echo "<div class='updated'>"; _e("Your polygon has been created.", "wp-google-maps"); echo "</div>"; } } else { if (isset($_POST['wpgmza_edit_poly'])) { global $wpdb; global $wpgmza_tblname_poly; $mid = esc_attr($_POST['wpgmaps_map_id']); $pid = esc_attr($_POST['wpgmaps_poly_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 { $line_opacity = "0.5"; } if (isset($_POST['poly_line_hover_line_color'])) { $ohlinecolor = esc_attr($_POST['poly_line_hover_line_color']); } else { $ohlinecolor = ""; } if (isset($_POST['poly_hover_fill_color'])) { $ohfillcolor = esc_attr($_POST['poly_hover_fill_color']); } else { $ohfillcolor = ""; } if (isset($_POST['poly_hover_opacity'])) { $ohopacity = esc_attr($_POST['poly_hover_opacity']); } else { $ohopacity = ""; } $rows_affected = $wpdb->query($wpdb->prepare("UPDATE {$wpgmza_tblname_poly} SET\n polydata = %s,\n polyname = %s,\n linecolor = %s,\n lineopacity = %s,\n fillcolor = %s,\n opacity = %s,\n ohlinecolor = %s,\n ohfillcolor = %s,\n ohopacity = %s\n WHERE `id` = %d", $wpgmaps_polydata, $polyname, $linecolor, $line_opacity, $fillcolor, $opacity, $ohlinecolor, $ohfillcolor, $ohopacity, $pid)); echo "<div class='updated'>"; _e("Your polygon has been saved.", "wp-google-maps"); echo "</div>"; } } else { if (isset($_POST['wpgmza_save_polyline'])) { global $wpdb; global $wpgmza_tblname_polylines; $mid = esc_attr($_POST['wpgmaps_map_id']); if (!isset($_POST['wpgmza_polyline']) || $_POST['wpgmza_polyline'] == "") { echo "<div class='error'>"; _e("You cannot save a blank polyline", "wp-google-maps"); echo "</div>"; } else { $wpgmaps_polydata = esc_attr($_POST['wpgmza_polyline']); if (isset($_POST['poly_name'])) { $polyname = esc_attr($_POST['poly_name']); } else { $polyname = ""; } if (isset($_POST['poly_line'])) { $linecolor = esc_attr($_POST['poly_line']); } else { $linecolor = "000000"; } if (isset($_POST['poly_thickness'])) { $linethickness = esc_attr($_POST['poly_thickness']); } else { $linethickness = "0"; } if (isset($_POST['poly_opacity'])) { $opacity = esc_attr($_POST['poly_opacity']); } else { $opacity = "1"; } $rows_affected = $wpdb->query($wpdb->prepare("INSERT INTO {$wpgmza_tblname_polylines} SET\n map_id = %d,\n polydata = %s,\n polyname = %s,\n linecolor = %s,\n linethickness = %s,\n opacity = %s\n ", $mid, $wpgmaps_polydata, $polyname, $linecolor, $linethickness, $opacity)); echo "<div class='updated'>"; _e("Your polyline has been created.", "wp-google-maps"); echo "</div>"; } } else { if (isset($_POST['wpgmza_edit_polyline'])) { global $wpdb; global $wpgmza_tblname_polylines; $mid = esc_attr($_POST['wpgmaps_map_id']); $pid = esc_attr($_POST['wpgmaps_poly_id']); if (!isset($_POST['wpgmza_polyline']) || $_POST['wpgmza_polyline'] == "") { echo "<div class='error'>"; _e("You cannot save a blank polyline", "wp-google-maps"); echo "</div>"; } else { $wpgmaps_polydata = esc_attr($_POST['wpgmza_polyline']); if (isset($_POST['poly_name'])) { $polyname = esc_attr($_POST['poly_name']); } else { $polyname = ""; } if (isset($_POST['poly_line'])) { $linecolor = esc_attr($_POST['poly_line']); } else { $linecolor = "000000"; } if (isset($_POST['poly_thickness'])) { $linethickness = esc_attr($_POST['poly_thickness']); } else { $linethickness = "0"; } if (isset($_POST['poly_opacity'])) { $opacity = esc_attr($_POST['poly_opacity']); } else { $opacity = "1"; } $rows_affected = $wpdb->query($wpdb->prepare("UPDATE {$wpgmza_tblname_polylines} SET\n polydata = %s,\n polyname = %s,\n linecolor = %s,\n linethickness = %s,\n opacity = %s\n WHERE `id` = %d", $wpgmaps_polydata, $polyname, $linecolor, $linethickness, $opacity, $pid)); echo "<div class='updated'>"; _e("Your polyline has been saved.", "wp-google-maps"); echo "</div>"; } } else { if (isset($_POST['wpgmza_save_settings'])) { global $wpdb; $wpgmza_data = array(); if (isset($_POST['wpgmza_settings_map_streetview'])) { $wpgmza_data['wpgmza_settings_map_streetview'] = esc_attr($_POST['wpgmza_settings_map_streetview']); } if (isset($_POST['wpgmza_settings_map_zoom'])) { $wpgmza_data['wpgmza_settings_map_zoom'] = esc_attr($_POST['wpgmza_settings_map_zoom']); } if (isset($_POST['wpgmza_settings_map_pan'])) { $wpgmza_data['wpgmza_settings_map_pan'] = esc_attr($_POST['wpgmza_settings_map_pan']); } if (isset($_POST['wpgmza_settings_map_type'])) { $wpgmza_data['wpgmza_settings_map_type'] = esc_attr($_POST['wpgmza_settings_map_type']); } if (isset($_POST['wpgmza_settings_force_jquery'])) { $wpgmza_data['wpgmza_settings_force_jquery'] = esc_attr($_POST['wpgmza_settings_force_jquery']); } if (isset($_POST['wpgmza_settings_map_scroll'])) { $wpgmza_data['wpgmza_settings_map_scroll'] = esc_attr($_POST['wpgmza_settings_map_scroll']); } if (isset($_POST['wpgmza_settings_map_draggable'])) { $wpgmza_data['wpgmza_settings_map_draggable'] = esc_attr($_POST['wpgmza_settings_map_draggable']); } if (isset($_POST['wpgmza_settings_map_clickzoom'])) { $wpgmza_data['wpgmza_settings_map_clickzoom'] = esc_attr($_POST['wpgmza_settings_map_clickzoom']); } if (isset($_POST['wpgmza_settings_map_open_marker_by'])) { $wpgmza_data['wpgmza_settings_map_open_marker_by'] = esc_attr($_POST['wpgmza_settings_map_open_marker_by']); } if (isset($_POST['wpgmza_api_version'])) { $wpgmza_data['wpgmza_api_version'] = esc_attr($_POST['wpgmza_api_version']); } if (isset($_POST['wpgmza_marker_xml_location'])) { update_option("wpgmza_xml_location", $_POST['wpgmza_marker_xml_location']); } if (isset($_POST['wpgmza_marker_xml_url'])) { update_option("wpgmza_xml_url", $_POST['wpgmza_marker_xml_url']); } if (isset($_POST['wpgmza_access_level'])) { $wpgmza_data['wpgmza_settings_access_level'] = esc_attr($_POST['wpgmza_access_level']); } update_option('WPGMZA_OTHER_SETTINGS', $wpgmza_data); echo "<div class='updated'>"; _e("Your settings have been saved.", "wp-google-maps"); echo "</div>"; } } } } } } } wpgmaps_folder_check(); }
public function getDropInPlugins() { if (!function_exists('get_dropins')) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } return get_dropins(); }
/** * Diagnostic information for the support tab * * @param bool $escape * * @return string */ function output_diagnostic_info($escape = true) { global $table_prefix; global $wpdb; $output = 'site_url(): '; $output .= esc_html(site_url()); $output .= "\r\n"; $output .= 'home_url(): '; $output .= esc_html(home_url()); $output .= "\r\n"; $output .= 'Database Name: '; $output .= esc_html($wpdb->dbname); $output .= "\r\n"; $output .= 'Table Prefix: '; $output .= esc_html($table_prefix); $output .= "\r\n"; $output .= 'WordPress: '; $output .= get_bloginfo('version', 'display'); if (is_multisite()) { $output .= ' Multisite '; $output .= '(' . (is_subdomain_install() ? 'subdomain' : 'subdirectory') . ')'; $output .= "\r\n"; $output .= 'Multisite Site Count: '; $output .= esc_html(get_blog_count()); $output .= "\r\n"; $output .= 'Domain Mapping: ' . (defined('SUNRISE') && SUNRISE ? 'Enabled' : 'Disabled'); } $output .= "\r\n"; $output .= 'Web Server: '; $output .= esc_html(!empty($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : ''); $output .= "\r\n"; $output .= 'PHP: '; if (function_exists('phpversion')) { $output .= esc_html(phpversion()); } $output .= "\r\n"; $output .= 'MySQL: '; $output .= esc_html($wpdb->db_version()); $output .= "\r\n"; $output .= 'ext/mysqli: '; $output .= empty($wpdb->use_mysqli) ? 'no' : 'yes'; $output .= "\r\n"; $output .= 'PHP Memory Limit: '; if (function_exists('ini_get')) { $output .= esc_html(ini_get('memory_limit')); } $output .= "\r\n"; $output .= 'WP Memory Limit: '; $output .= esc_html(WP_MEMORY_LIMIT); $output .= "\r\n"; $output .= 'Memory Usage: '; $output .= size_format(memory_get_usage(true)); $output .= "\r\n"; $output .= 'Blocked External HTTP Requests: '; if (!defined('WP_HTTP_BLOCK_EXTERNAL') || !WP_HTTP_BLOCK_EXTERNAL) { $output .= 'None'; } else { $accessible_hosts = defined('WP_ACCESSIBLE_HOSTS') ? WP_ACCESSIBLE_HOSTS : ''; if (empty($accessible_hosts)) { $output .= 'ALL'; } else { $output .= 'Partially (Accessible Hosts: ' . esc_html($accessible_hosts) . ')'; } } $output .= "\r\n"; $output .= 'WP Locale: '; $output .= esc_html(get_locale()); $output .= "\r\n"; $output .= 'Organize uploads by month/year: '; $output .= esc_html(get_option('uploads_use_yearmonth_folders') ? 'Enabled' : 'Disabled'); $output .= "\r\n"; $output .= 'WP_DEBUG: '; $output .= esc_html(defined('WP_DEBUG') && WP_DEBUG ? 'Yes' : 'No'); $output .= "\r\n"; $output .= 'WP_DEBUG_LOG: '; $output .= esc_html(defined('WP_DEBUG_LOG') && WP_DEBUG_LOG ? 'Yes' : 'No'); $output .= "\r\n"; $output .= 'WP_DEBUG_DISPLAY: '; $output .= esc_html(defined('WP_DEBUG_DISPLAY') && WP_DEBUG_DISPLAY ? 'Yes' : 'No'); $output .= "\r\n"; $output .= 'SCRIPT_DEBUG: '; $output .= esc_html(defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? 'Yes' : 'No'); $output .= "\r\n"; $output .= 'WP Max Upload Size: '; $output .= esc_html(size_format(wp_max_upload_size())); $output .= "\r\n"; $output .= 'PHP Time Limit: '; if (function_exists('ini_get')) { $output .= esc_html(ini_get('max_execution_time')); } $output .= "\r\n"; $output .= 'PHP Error Log: '; if (function_exists('ini_get')) { $output .= esc_html(ini_get('error_log')); } $output .= "\r\n"; $output .= 'WP Cron: '; $output .= esc_html(defined('DISABLE_WP_CRON') && DISABLE_WP_CRON ? 'Disabled' : 'Enabled'); $output .= "\r\n"; $output .= 'fsockopen: '; if (function_exists('fsockopen')) { $output .= 'Enabled'; } else { $output .= 'Disabled'; } $output .= "\r\n"; $output .= 'allow_url_fopen: '; $allow_url_fopen = ini_get('allow_url_fopen'); if (empty($allow_url_fopen)) { $output .= 'Disabled'; } else { $output .= 'Enabled'; } $output .= "\r\n"; $output .= 'OpenSSL: '; if ($this->open_ssl_enabled()) { $output .= esc_html(OPENSSL_VERSION_TEXT); } else { $output .= 'Disabled'; } $output .= "\r\n"; $output .= 'cURL: '; if (function_exists('curl_init')) { $output .= 'Enabled'; } else { $output .= 'Disabled'; } $output .= "\r\n"; $output .= 'Zlib Compression: '; if (function_exists('gzcompress')) { $output .= 'Enabled'; } else { $output .= 'Disabled'; } $output .= "\r\n"; $output .= 'PHP GD: '; if ($this->gd_enabled()) { $gd_info = gd_info(); $output .= isset($gd_info['GD Version']) ? esc_html($gd_info['GD Version']) : 'Enabled'; } else { $output .= 'Disabled'; } $output .= "\r\n"; $output .= 'Imagick: '; if ($this->imagick_enabled()) { $output .= 'Enabled'; } else { $output .= 'Disabled'; } $output .= "\r\n"; $output .= 'Basic Auth: '; if (isset($_SERVER['REMOTE_USER']) || isset($_SERVER['PHP_AUTH_USER']) || isset($_SERVER['REDIRECT_REMOTE_USER'])) { $output .= 'Enabled'; } else { $output .= 'Disabled'; } $output .= "\r\n"; $output .= 'Proxy: '; if (defined('WP_PROXY_HOST') || defined('WP_PROXY_PORT')) { $output .= 'Enabled'; } else { $output .= 'Disabled'; } $output .= "\r\n\r\n"; $media_counts = $this->diagnostic_media_counts(); $output .= 'Media Files: '; $output .= number_format_i18n($media_counts['all']); $output .= "\r\n"; $output .= 'Media Files on S3: '; $output .= number_format_i18n($media_counts['s3']); $output .= "\r\n"; $output .= 'Number of Image Sizes: '; $sizes = count(get_intermediate_image_sizes()); $output .= number_format_i18n($sizes); $output .= "\r\n\r\n"; $output .= 'Names and Dimensions of Image Sizes: '; $output .= "\r\n"; $size_details = $this->get_image_sizes_details(); $output .= $size_details; $output .= "\r\n"; $output .= 'WP_CONTENT_DIR: '; $output .= esc_html(defined('WP_CONTENT_DIR') ? WP_CONTENT_DIR : 'Not defined'); $output .= "\r\n"; $output .= 'WP_CONTENT_URL: '; $output .= esc_html(defined('WP_CONTENT_URL') ? WP_CONTENT_URL : 'Not defined'); $output .= "\r\n"; $output .= 'UPLOADS: '; $output .= esc_html(defined('UPLOADS') ? UPLOADS : 'Not defined'); $output .= "\r\n"; $output .= 'WP_PLUGIN_DIR: '; $output .= esc_html(defined('WP_PLUGIN_DIR') ? WP_PLUGIN_DIR : 'Not defined'); $output .= "\r\n"; $output .= 'WP_PLUGIN_URL: '; $output .= esc_html(defined('WP_PLUGIN_URL') ? WP_PLUGIN_URL : 'Not defined'); $output .= "\r\n\r\n"; $output .= 'AWS_USE_EC2_IAM_ROLE: '; $output .= esc_html(defined('AWS_USE_EC2_IAM_ROLE') ? AWS_USE_EC2_IAM_ROLE : 'Not defined'); $output .= "\r\n"; $output .= 'AS3CF_BUCKET: '; $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; }
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; }
/** * 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); }
/** * 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; }
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) { $plugins_per_page = 999; } $plugins_per_page = apply_filters('plugins_per_page', $plugins_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)); }