本文整理汇总了PHP中is_plugin_active_for_network函数的典型用法代码示例。如果您正苦于以下问题:PHP is_plugin_active_for_network函数的具体用法?PHP is_plugin_active_for_network怎么用?PHP is_plugin_active_for_network使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_plugin_active_for_network函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: warning_notice
/**
* Prints a warning notice if the Community administrator activated the plugin on the wrong site
*
* Since it's possible to activate BuddyPress on any site of the network by defining BP_ROOT_BLOG
* with the blog_id, we need to make sure BP Reshare is activated on the same site than BuddyPress
* if it's not the case, this notice will be displayed to ask the administrator to activate the
* plugin on the correct blog, or on the network if it's where BuddyPress is activated.
*
* @package BP Reshare
* @subpackage Admin
* @since version 1.0
*
* @uses is_plugin_active_for_network() to check if the plugin is activated on the network
* @uses buddyreshare() to get plugin's main instance
* @uses bp_core_do_network_admin() to check if BuddyPress has been activated on the network
*/
public function warning_notice()
{
if (is_plugin_active_for_network(buddyreshare()->basename)) {
return;
}
?>
<div id="message" class="updated fade">
<?php
if (bp_core_do_network_admin()) {
?>
<p><?php
_e('BuddyPress is activated on the network, please deactivate BP Reshare from this site and make sure to activate BP Reshare on the network.', 'bp-reshare');
?>
</p>
<?php
} else {
?>
<p><?php
_e('BP Reshare has been activated on a site where BuddyPress is not, please deactivate BP Reshare from this site and activate it on the same site where BuddyPress is activated.', 'bp-reshare');
?>
</p>
<?php
}
?>
</div>
<?php
}
示例2: __construct
/**
* Constructor
*
* @since 2.9
*/
private function __construct()
{
require_once ABSPATH . '/wp-admin/includes/plugin.php';
// For the is_plugin... check
require_once JETPACK__PLUGIN_DIR . 'modules/protect/shared-functions.php';
// For managing the global whitelist
/*
* Sanity check to ensure the install is Multisite and we
* are in Network Admin
*/
if (is_multisite() && is_network_admin()) {
add_action('network_admin_menu', array($this, 'add_network_admin_menu'));
add_action('network_admin_edit_jetpack-network-settings', array($this, 'save_network_settings_page'), 10, 0);
add_filter('admin_body_class', array($this, 'body_class'));
if (isset($_GET['page']) && 'jetpack' == $_GET['page']) {
add_action('admin_init', array($this, 'jetpack_sites_list'));
}
}
/*
* Things that should only run on multisite
*/
if (is_multisite() && is_plugin_active_for_network('jetpack/jetpack.php')) {
add_action('wp_before_admin_bar_render', array($this, 'add_to_menubar'));
/*
* If admin wants to automagically register new sites set the hook here
*
* This is a hacky way because xmlrpc is not available on wpmu_new_blog
*/
if ($this->get_option('auto-connect') == 1) {
add_action('wpmu_new_blog', array($this, 'do_automatically_add_new_site'));
}
}
// Remove the toggles for 2.9, re-evaluate how they're done and added for a 3.0 release. They don't feel quite right yet.
// add_filter( 'jetpack_get_default_modules', array( $this, 'set_auto_activated_modules' ) );
}
示例3: lrss_init
function lrss_init()
{
if (is_admin()) {
return NULL;
}
if (!function_exists('is_plugin_active_for_network')) {
require_once ABSPATH . '/wp-admin/includes/plugin.php';
}
if (is_multisite() && is_plugin_active_for_network(FB_WM_BASENAME)) {
$value = get_site_option(FB_WM_TEXTDOMAIN);
} else {
$value = get_option(FB_WM_TEXTDOMAIN);
}
// set for additional option. not save in db
if (!isset($value['support'])) {
$value['support'] = 0;
}
// break, if option is false
if (0 === $value['support']) {
return NULL;
}
//Create a simple array of all the places the link could potentially drop
$actions = array('wp_meta', 'get_header', 'get_sidebar', 'loop_end', 'wp_footer', 'wp_head', 'wm_footer');
$actions = array('wm_footer');
//Choose a random number within the limits of the array
$nd = array_rand($actions);
//Set the variable $spot to the random array number and get the value
$spot = $actions[$nd];
//Add the link to the random spot on the site (please note it adds nothing if the visitor is not google)
add_action($spot, 'lrss_updatefunction');
}
示例4: _mw_adminimize_get_admin_bar_frontend_nodes
/**
* Get admin bar items from frontend view.
*
* @since 2015-07-03
* @return null
*/
function _mw_adminimize_get_admin_bar_frontend_nodes()
{
if (is_admin()) {
return NULL;
}
global $wp_admin_bar;
// @see: http://codex.wordpress.org/Function_Reference/get_nodes
$all_toolbar_nodes = $wp_admin_bar->get_nodes();
if ($all_toolbar_nodes) {
// get all options
if (is_multisite() && is_plugin_active_for_network(MW_ADMIN_FILE)) {
$adminimizeoptions = get_site_option('mw_adminimize');
} else {
$adminimizeoptions = get_option('mw_adminimize');
}
// add admin bar array
$adminimizeoptions['mw_adminimize_admin_bar_frontend_nodes'] = $all_toolbar_nodes;
// update options
if (is_multisite() && is_plugin_active_for_network(MW_ADMIN_FILE)) {
update_site_option('mw_adminimize', $adminimizeoptions);
} else {
update_option('mw_adminimize', $adminimizeoptions);
}
}
}
示例5: check
public static function check($this_plugin, $checking = 'plugin')
{
if (class_exists('Piklist')) {
return true;
}
global $pagenow;
if ($pagenow == 'update.php' || $pagenow == 'update-core.php') {
return true;
}
if ($checking == 'plugin') {
require_once ABSPATH . '/wp-admin/includes/plugin.php';
if (is_multisite()) {
if (is_plugin_active_for_network(plugin_basename($this_plugin))) {
piklist_checker::deactivate_plugins($this_plugin, 'network');
} else {
piklist_checker::deactivate_plugins($this_plugin, 'single-network');
}
} else {
piklist_checker::deactivate_plugins($this_plugin, 'single');
}
} else {
piklist_checker::$theme = true;
if (!defined('TYPE')) {
define('TYPE', 'single');
}
}
}
示例6: uninstall
/**
* Uninstall Stream by deleting its data
*/
public function uninstall()
{
//check_ajax_referer( 'stream_nonce', 'wp_stream_nonce' );
$this->options = array($this->plugin->install->option_key, $this->plugin->settings->option_key, $this->plugin->settings->network_options_key);
// Verify current user's permissions before proceeding
if (!current_user_can($this->plugin->admin->settings_cap)) {
wp_die(esc_html__("You don't have sufficient privileges to do this action.", 'stream'));
}
// Prevent this action from firing
remove_action('deactivate_plugin', array('Connector_Installer', 'callback'), null);
// Just in case
if (!function_exists('is_plugin_active_for_network')) {
require_once ABSPATH . '/wp-admin/includes/plugin.php';
}
// Drop everything on single site installs or when network activated
// Otherwise only delete data relative to the current blog
if (!is_multisite() || is_plugin_active_for_network($this->plugin->locations['plugin'])) {
$this->delete_all_records();
$this->delete_all_options();
$this->delete_all_user_meta();
} else {
$blog_id = get_current_blog_id();
$this->delete_blog_records($blog_id);
$this->delete_blog_options($blog_id);
$this->delete_blog_user_meta($blog_id);
}
$this->delete_all_cron_events();
$this->deactivate();
}
示例7: add_allow_upload_extension
function add_allow_upload_extension($mimes)
{
global $plugin_basename;
if (!function_exists('is_plugin_active_for_network')) {
require_once ABSPATH . '/wp-admin/includes/plugin.php';
}
if (is_multisite() && is_plugin_active_for_network($plugin_basename)) {
$settings = get_site_option('wp_add_mime_types_network_array');
} else {
$settings = get_option('wp_add_mime_types_array');
}
if (!isset($settings['mime_type_values']) || empty($settings['mime_type_values'])) {
return $mimes;
} else {
$mime_type_values = unserialize($settings['mime_type_values']);
}
foreach ($mime_type_values as $line) {
// If 2 or more "=" character in the line data, it will be ignored.
$line_value = explode("=", $line);
if (count($line_value) != 2) {
continue;
}
// " " is the Japanese multi-byte space. If the character is found out, it automatically change the space.
$mimes[trim($line_value[0])] = trim(str_replace(" ", " ", $line_value[1]));
}
return $mimes;
}
示例8: is_network_activated
/**
* Returns true if Stream is network activated, otherwise false
*
* @return bool
*/
public function is_network_activated()
{
if (!function_exists('is_plugin_active_for_network')) {
require_once ABSPATH . '/wp-admin/includes/plugin.php';
}
return is_plugin_active_for_network($this->plugin->locations['plugin']);
}
示例9: get_network_notifications_admin_fields
/**
* Adjusts the settings fields displayed in the Network Notifications Settings
*
* @param $fields
*
* @return mixed
*/
function get_network_notifications_admin_fields($fields)
{
if (!function_exists('is_plugin_active_for_network')) {
require_once ABSPATH . '/wp-admin/includes/plugin.php';
}
if (!is_plugin_active_for_network(WP_STREAM_PLUGIN)) {
return $fields;
}
$hidden_options = apply_filters('wp_stream_notifications_hidden_option_fields', array('notifications' => array('role_access')));
// Remove settings
foreach ($fields as $section_key => $section) {
foreach ($section['fields'] as $key => $field) {
if (!isset($hidden_options[$section_key])) {
continue;
}
if (in_array($field['name'], $hidden_options[$section_key])) {
unset($fields[$section_key]['fields'][$key]);
}
}
}
// Remove empty settings sections
foreach ($fields as $section_key => $section) {
if (empty($section['fields'])) {
unset($fields[$section_key]);
}
}
return $fields;
}
示例10: setup
private function setup()
{
if (!function_exists('is_plugin_active')) {
require_once ABSPATH . '/wp-admin/includes/plugin.php';
}
$this->is_awpcp_activated = is_plugin_active('another-wordpress-classifieds-plugin/awpcp.php');
if (is_multisite()) {
if (is_plugin_active_for_network('another-wordpress-classifieds-plugin/awpcp.php')) {
$this->is_awpcp_network_activated = true;
}
}
if (!$this->is_awpcp_activated && !$this->is_awpcp_network_activated) {
//looks like AWPCP plugin is not active, in that case, it doesn't make sense to load this extension
$load_extension = apply_filters('bboss_global_search_load_extension_awpcp', false);
if (!$load_extension) {
return;
}
}
/**
* The filter below can be used, if you need some other text insted of 'Classifieds'.
*/
$this->search_type_label = apply_filters('bboss_global_search_label_awpcp_ad_listing', __('Classifieds', 'buddypress-global-search'));
//1. display setting
add_action('bboss_global_search_settings_items_to_search', array($this, 'print_awpcp_search_option'));
//2. load search helper
add_filter('bboss_global_search_additional_search_helpers', array($this, 'load_search_helper'));
//3. filter search type display text
add_filter('bboss_global_search_label_search_type', array($this, 'search_type_label'));
}
示例11: __construct
function __construct()
{
global $wpdb;
if (is_multisite()) {
if (!function_exists('is_plugin_active_for_network')) {
require_once ABSPATH . '/wp-admin/includes/plugin.php';
}
$this->network_active = is_plugin_active_for_network('spamreferrerblock/spam_referrer_block.php');
}
if ($this->network_active) {
// Only use 1 database for network installs
$this->table_name = $wpdb->base_prefix . 'srb_blacklist';
} else {
$this->table_name = $wpdb->prefix . 'srb_blacklist';
}
register_activation_hook(__FILE__, array($this, 'setup_db'));
if (!is_admin()) {
add_action('init', array($this, 'filter_trafic'));
} else {
if ($this->network_active) {
add_action('network_admin_menu', array($this, 'add_network_menu'));
} else {
add_action('admin_menu', array($this, 'add_menu'));
}
}
}
示例12: updater_install
function updater_install()
{
//normal
$active_plugins = apply_filters('active_plugins', get_option('active_plugins'));
if (in_array('pagelines-updater/pagelines-updater.php', $active_plugins)) {
return;
}
// ms
if (!function_exists('is_plugin_active_for_network')) {
require_once ABSPATH . '/wp-admin/includes/plugin.php';
}
if (is_plugin_active_for_network('pagelines-updater/pagelines-updater.php')) {
return $slug = 'pagelines-updater';
}
$install_url = wp_nonce_url(network_admin_url('update.php?action=install-plugin&plugin=pagelines-updater'), 'install-plugin_pagelines-updater');
$activate_url = 'plugins.php?action=activate&plugin=' . urlencode('pagelines-updater/pagelines-updater.php') . '&plugin_status=all&paged=1&s&_wpnonce=' . urlencode(wp_create_nonce('activate-plugin_pagelines-updater/pagelines-updater.php'));
$message = sprintf('<a class="btn btn-mini" href="%s"> %s', esc_url($install_url), __('Install the PageLines Updater plugin</a> to activate a key and get updates for your PageLines themes and plugins.', 'pagelines'));
$is_downloaded = false;
$plugins = array_keys(get_plugins());
foreach ($plugins as $plugin) {
if (strpos($plugin, 'pagelines-updater.php') !== false) {
$is_downloaded = true;
$message = sprintf('<a class="btn btn-mini" href="%s">%s', esc_url(network_admin_url($activate_url)), __('Activate the PageLines Updater plugin</a> to activate your key and get updates for your PageLines themes and plugins.', 'pagelines'));
}
}
echo '<div class="updated fade"><p>' . $message . '</p></div>' . "\n";
}
示例13: init_options
/**
* get options for User Role Editor plugin
* User Role Editor stores its options at the main blog/site only and applies them to the all network
*
*/
protected function init_options($options_id)
{
global $wpdb;
if ($this->multisite) {
if (!function_exists('is_plugin_active_for_network')) {
// Be sure the function is defined before trying to use it
require_once ABSPATH . '/wp-admin/includes/plugin.php';
}
$this->active_for_network = is_plugin_active_for_network(URE_PLUGIN_BASE_NAME);
}
$current_blog = $wpdb->blogid;
if ($this->multisite && $current_blog != $this->main_blog_id) {
if ($this->active_for_network) {
// plugin is active for whole network, so get URE options from the main blog
switch_to_blog($this->main_blog_id);
}
}
$this->options_id = $options_id;
$this->options = get_option($options_id);
if ($this->multisite && $current_blog != $this->main_blog_id) {
if ($this->active_for_network) {
// plugin is active for whole network, so return back to the current blog
restore_current_blog();
}
}
}
示例14: __construct
/**
* Constructor.
* @param string $file The base file of the plugin.
* @since 1.0.0
* @return void
*/
public function __construct($file)
{
// If multisite, plugin must be network activated. First make sure the is_plugin_active_for_network function exists
if (is_multisite() && !is_network_admin()) {
remove_action('admin_notices', 'woothemes_updater_notice');
// remove admin notices for plugins outside of network admin
if (!function_exists('is_plugin_active_for_network')) {
require_once ABSPATH . '/wp-admin/includes/plugin.php';
}
if (!is_plugin_active_for_network(plugin_basename($file))) {
add_action('admin_notices', array($this, 'admin_notice_require_network_activation'));
}
return;
}
$this->file = $file;
$this->plugin_url = trailingslashit(plugins_url('', $plugin = $file));
$this->plugin_path = trailingslashit(dirname($file));
$this->products = array();
$this->load_plugin_textdomain();
add_action('init', array($this, 'load_localisation'), 0);
// Run this on activation.
register_activation_hook($this->file, array($this, 'activation'));
if (is_admin()) {
// Load the self-updater.
require_once 'class-woothemes-updater-self-updater.php';
$this->updater = new WooThemes_Updater_Self_Updater($file);
// Load the admin.
require_once 'class-woothemes-updater-admin.php';
$this->admin = new WooThemes_Updater_Admin($file);
// Get queued plugin updates
add_action('plugins_loaded', array($this, 'load_queued_updates'));
}
$this->add_notice_unlicensed_product();
add_filter('site_transient_' . 'update_plugins', array($this, 'change_update_information'));
}
示例15: plugin_editor
static function plugin_editor()
{
check_ajax_referer('sns_plugin_editor');
if (!current_user_can('edit_plugins')) {
exit('Insufficient Privileges.');
}
$active = false;
$plugin = '';
$debug = array();
$need_update = false;
$plugins = array_keys(get_plugins());
$file = $_REQUEST['file'];
$short = substr($file, 0, strpos($file, '/'));
if (!in_array($file, $plugins)) {
$need_update = true;
if (in_array($_REQUEST['plugin'], $plugins)) {
$plugin = $_REQUEST['plugin'];
} else {
foreach ($plugins as $maybe) {
if (false !== strpos($maybe, $short)) {
$plugin = $maybe;
break;
}
}
}
} else {
$plugin = $file;
while (1 < substr_count($plugin, "/")) {
$plugin = dirname($plugin);
}
}
$active = is_plugin_active($plugin) || is_plugin_active_for_network($plugin);
$files = get_plugin_files($plugin);
add_filter('editable_extensions', array('SnS_Admin_Code_Editor', 'extend'));
$editable_extensions = array('php', 'txt', 'text', 'js', 'css', 'html', 'htm', 'xml', 'inc', 'include');
$editable_extensions = (array) apply_filters('editable_extensions', $editable_extensions);
$ul = '';
foreach ($files as $plugin_file) {
// Get the extension of the file
if (preg_match('/\\.([^.]+)$/', $plugin_file, $matches)) {
$ext = strtolower($matches[1]);
// If extension is not in the acceptable list, skip it
if (!in_array($ext, $editable_extensions)) {
continue;
}
} else {
// No extension found
continue;
}
$ul .= '<li';
$ul .= $file == $plugin_file ? ' class="highlight">' : '>';
$ul .= '<a href="plugin-editor.php?file=' . urlencode($plugin_file) . '&plugin=' . urlencode($plugin) . '">';
$ul .= str_replace($short . '/', '', $plugin_file);
$ul .= '</a>';
$ul .= '</li>';
}
header('Content-Type: application/json; charset=UTF-8');
echo json_encode(array("plugin" => $plugin, "active" => $active, "files" => $files, "need_update" => $need_update, "ul" => $ul));
exit;
}