Example #1
0
        /**
         * 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 
        }
 /**
  * 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' ) );
 }
Example #3
0
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');
}
/**
 * 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);
        }
    }
}
 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');
         }
     }
 }
Example #6
0
 /**
  * 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();
 }
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;
}
Example #8
0
 /**
  * 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']);
 }
Example #9
0
 /**
  * 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;
 }
Example #10
0
 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'));
 }
 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'));
         }
     }
 }
 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";
 }
Example #13
0
 /**
  * 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();
         }
     }
 }
 /**
  * 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'));
 }
 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) . '&amp;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;
 }
Example #16
0
 public function prepare_items()
 {
     $current_page = $this->get_pagenum();
     $per_page = 10;
     global $blog_id;
     global $wpdb;
     global $pagenow;
     if (is_plugin_active_for_network('wp-piwik/wp-piwik.php')) {
         $total_items = $wpdb->get_var('SELECT COUNT(*) FROM ' . $wpdb->blogs);
         $blogs = \WP_Piwik\Settings::getBlogList($per_page, $current_page);
         foreach ($blogs as $blog) {
             $blogDetails = get_blog_details($blog['blog_id'], true);
             $this->data[] = array('name' => $blogDetails->blogname, 'id' => $blogDetails->blog_id, 'siteurl' => $blogDetails->siteurl, 'piwikid' => $this->wpPiwik->getPiwikSiteId($blogDetails->blog_id));
         }
     } else {
         $blogDetails = get_bloginfo();
         $this->data[] = array('name' => get_bloginfo('name'), 'id' => '-', 'siteurl' => get_bloginfo('url'), 'piwikid' => $this->wpPiwik->getPiwikSiteId());
         $total_items = 1;
     }
     $columns = $this->get_columns();
     $hidden = array();
     $sortable = array();
     $this->_column_headers = array($columns, $hidden, $sortable);
     $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page));
     foreach ($this->data as $key => $dataset) {
         if (empty($dataset['piwikid']) || $dataset['piwikid'] == 'n/a') {
             $this->data[$key]['piwikid'] = __('Site not created yet.', 'wp-piwik');
         }
         if ($this->wpPiwik->isNetworkMode()) {
             $this->data[$key]['name'] = '<a href="index.php?page=wp-piwik_stats&wpmu_show_stats=' . $dataset['id'] . '">' . $dataset['name'] . '</a>';
         }
     }
     $this->items = $this->data;
     return count($this->items);
 }
function rcp_get_payments_db_name() {
	global $wpdb;

	$prefix = is_plugin_active_for_network( 'restrict-content-pro/restrict-content-pro.php' ) ? '' : $wpdb->prefix;

	return apply_filters( 'rcp_payments_db_name', $prefix . 'rcp_payments' );
}
/**
 * Get all admin bar items and write in a options of Adminimize settings array
 * 
 * @since   1.8.1  01/10/2013
 * @return  void
 */
function _mw_adminimize_get_admin_bar_nodes()
{
    // Update only on Adminimize Settings page
    if (!isset($GLOBALS['current_screen']->base) || 'settings_page_adminimize/adminimize' !== $GLOBALS['current_screen']->base) {
        return NULL;
    }
    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_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);
        }
    }
}
 /**
  * Constructor.
  * @param string $file The base file of the plugin.
  * @since  1.0.0
  * @return  void
  */
 public function __construct($file, $version)
 {
     // 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->version = $version;
     $this->plugin_url = trailingslashit(plugins_url('', $plugin = $file));
     $this->plugin_path = trailingslashit(dirname($file));
     $this->products = array();
     $this->load_plugin_textdomain();
     // Run this on activation.
     register_activation_hook($this->file, array($this, 'activation'));
     if (is_admin()) {
         // Load the admin.
         require_once 'class-woothemes-updater-admin.php';
         $this->admin = new WooThemes_Updater_Admin($file);
         // Look for enabled updates across all themes (active or otherwise). If they are available, queue them.
         add_action('init', array($this, 'maybe_queue_theme_updates'), 1);
         // Get queued plugin updates - Run on init so themes are loaded as well as plugins.
         add_action('init', array($this, 'load_queued_updates'), 2);
     }
     $this->add_notice_unlicensed_product();
     add_filter('site_transient_' . 'update_plugins', array($this, 'change_update_information'));
 }
 /**
  * Short Description. (use period)
  *
  * Long Description.
  *
  * @since    1.0.0
  */
 public static function activate()
 {
     global $wpdb;
     if (!in_array('mailchimp-for-wp/mailchimp-for-wp.php', apply_filters('active_plugins', get_option('active_plugins'))) && !is_plugin_active_for_network('mailchimp-for-wp/mailchimp-for-wp.php')) {
         wp_die("<strong>MailChimp for BuddyPress</strong> requires <strong>MailChimp for WordPress</strong> plugin activate to work normally.<br /><br />Back to the WordPress <a href='" . get_admin_url(null, 'plugins.php') . "'>Plugins page</a>.");
     }
 }
Example #21
0
 function get_autoblogentries($timestamp)
 {
     if (defined('AUTOBLOG_LAZY_ID') && AUTOBLOG_LAZY_ID == true) {
         $sites = array($this->siteid, 0);
         $blogs = array($this->blogid, 0);
     } else {
         $sites = array($this->siteid);
         $blogs = array($this->blogid);
     }
     if (function_exists('is_multisite') && is_multisite()) {
         if (function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('autoblog/autoblogpremium.php')) {
             $sql = $this->db->prepare("SELECT * FROM {$this->autoblog} WHERE site_id IN (" . implode(',', $sites) . ") AND nextcheck < %d AND nextcheck > 0 ORDER BY nextcheck ASC", $timestamp);
         } else {
             $sql = $this->db->prepare("SELECT * FROM {$this->autoblog} WHERE site_id IN (" . implode(',', $sites) . ") AND blog_id IN (" . implode(',', $blogs) . ") AND nextcheck < %d AND nextcheck > 0 ORDER BY nextcheck ASC", $timestamp);
         }
     } else {
         $sql = $this->db->prepare("SELECT * FROM {$this->autoblog} WHERE site_id IN (" . implode(',', $sites) . ") AND blog_id IN (" . implode(',', $blogs) . ") AND nextcheck < %d AND nextcheck > 0 ORDER BY nextcheck ASC", $timestamp);
     }
     if (defined('AUTOBLOG_FORCE_PROCESS_ALL') && AUTOBLOG_FORCE_PROCESS_ALL === true) {
         // Override and force to grab all feeds from the site
         $sql = $this->db->prepare("SELECT * FROM {$this->autoblog} WHERE site_id IN (" . implode(',', $sites) . ") AND nextcheck < %d AND nextcheck > 0 ORDER BY nextcheck ASC", $timestamp);
     }
     $results = $this->db->get_results($sql);
     return $results;
 }
 public static 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(MAINWP_WP_STREAM_PLUGIN);
 }
 public function network_active()
 {
     if (!function_exists('is_plugin_active_for_network')) {
         require_once ABSPATH . '/wp-admin/includes/plugin.php';
     }
     return is_plugin_active_for_network('wpclef/wpclef.php');
 }
Example #24
0
 function __construct()
 {
     if (!defined('PL_UPDATER_SHOW_ALL')) {
         define('PL_UPDATER_SHOW_ALL', true);
     }
     if (is_admin()) {
         $this->extra_notices();
     }
     $path = trailingslashit(basename(dirname(__FILE__))) . basename(__FILE__);
     // fix for symlinked folders :/
     register_activation_hook($path, array($this, 'activate_redirect'));
     add_action('admin_init', array($this, 'activate_redirect_do'));
     $menu_hook = is_multisite() ? 'network_admin_menu' : 'admin_menu';
     add_action($menu_hook, array($this, 'add_menu'));
     add_action('admin_init', array($this, 'license_functions'));
     add_action('admin_enqueue_scripts', array($this, 'register_style'));
     add_action('admin_init', array($this, 'product_updates'));
     add_action('admin_init', array($this, 'register_core'), 11);
     if (is_multisite() && !is_network_admin()) {
         remove_action('admin_notices', 'pagelines_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;
     }
     add_action('after_setup_theme', array($this, 'bootstrap_dms'));
     add_filter('gettext', array($this, 'update_strings'), 20, 3);
 }
Example #25
0
 /**
  * Whether the plugin is active.
  *
  * @since 1.0.0
  *
  * @return boolean
  */
 public function is_active()
 {
     if (is_multisite()) {
         return $this->is_installed() && is_plugin_active_for_network($this->get_file());
     }
     return $this->is_installed() && is_plugin_active($this->get_file());
 }
 private function __construct()
 {
     $plugin = WP_Maintenance_Mode::get_instance();
     $this->plugin_slug = $plugin->get_plugin_slug();
     $this->plugin_settings = $plugin->get_plugin_settings();
     $this->plugin_default_settings = $plugin->default_settings();
     // Load admin style sheet and JavaScript.
     add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles'));
     add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
     // Add the options page and menu item.
     add_action('admin_menu', array($this, 'add_plugin_menu'));
     // Add an action link pointing to the options page
     $plugin_basename = plugin_basename(WPMM_PATH . $this->plugin_slug . '.php');
     if (is_multisite() && is_plugin_active_for_network($plugin_basename)) {
         // settings link will point to admin_url of the main blog, not to network_admin_url
         add_filter('network_admin_plugin_action_links_' . $plugin_basename, array($this, 'add_settings_link'));
     } else {
         add_filter('plugin_action_links_' . $plugin_basename, array($this, 'add_settings_link'));
     }
     // Add admin notices
     add_action('admin_notices', array($this, 'add_notices'));
     // Add ajax methods
     add_action('wp_ajax_wpmm_subscribers_export', array($this, 'subscribers_export'));
     add_action('wp_ajax_wpmm_reset_settings', array($this, 'reset_settings'));
 }
 /**
  * Constructor.
  *
  * @since 1.0.0
  */
 public function __construct()
 {
     if (!function_exists('is_plugin_active_for_network')) {
         require_once ABSPATH . '/wp-admin/includes/plugin.php';
     }
     // Check if WooCommerce is active
     if (!in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) {
         if (!is_plugin_active_for_network('woocommerce/woocommerce.php')) {
             return;
         }
     }
     // Check if WooCommerce Advanced Shipping is active
     if (!in_array('woocommerce-advanced-shipping/woocommerce-advanced-shipping.php', apply_filters('active_plugins', get_option('active_plugins')))) {
         if (!is_plugin_active_for_network('woocommerce-advanced-shipping/woocommerce-advanced-shipping.php')) {
             return;
         }
     }
     // Add zone to conditions list
     add_filter('was_conditions', array($this, 'was_conditions_add_zones'), 10, 1);
     // Add zone to values list
     add_filter('was_values', array($this, 'was_values_add_zones'), 10, 2);
     // Add description to zone condition
     add_filter('was_descriptions', array($this, 'was_descriptions_zones'));
     // Match zones
     add_filter('was_match_condition_zones', array($this, 'was_match_condition_zones'), 10, 3);
     // Enqueue scripts
     add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
     // Settings page
     require_once 'includes/class-wasz-settings.php';
     $this->settings = new WASZ_Settings();
     // Post type
     require_once plugin_dir_path(__FILE__) . 'includes/class-wasz-post-type.php';
     $this->post_type = new WASZ_Post_Type();
 }
 public static function check($this_plugin)
 {
     global $pagenow;
     if ($pagenow == 'update.php' || $pagenow == 'update-core.php') {
         return true;
     }
     require_once ABSPATH . '/wp-admin/includes/plugin.php';
     if (is_multisite()) {
         if (is_plugin_active_for_network(plugin_basename($this_plugin))) {
             if (is_plugin_active_for_network('piklist/piklist.php')) {
                 return true;
             } else {
                 self::deactivate_plugins($this_plugin, 'network');
             }
         } else {
             if (is_plugin_active('piklist/piklist.php')) {
                 return true;
             } else {
                 self::deactivate_plugins($this_plugin, 'single-network');
             }
         }
     } else {
         if (is_plugin_active('piklist/piklist.php')) {
             return true;
         } else {
             self::deactivate_plugins($this_plugin, 'single');
         }
     }
 }
 function run()
 {
     $this->settings = get_site_option('itsec_hide_backend');
     //Execute module functions on frontend init
     if ($this->settings['enabled'] === true) {
         $jetpack_active_modules = get_option('jetpack_active_modules');
         if (is_multisite() && function_exists('is_plugin_active_for_network')) {
             //see if Jetpack is active
             $is_jetpack_active = in_array('jetpack/jetpack.php', (array) get_option('active_plugins', array())) || is_plugin_active_for_network('jetpack/jetpack.php');
         } else {
             $is_jetpack_active = in_array('jetpack/jetpack.php', (array) get_option('active_plugins', array()));
         }
         if (!($is_jetpack_active === true && is_array($jetpack_active_modules) && in_array('json-api', $jetpack_active_modules) && isset($_GET['action']) && $_GET['action'] == 'jetpack_json_api_authorization')) {
             $this->auth_cookie_expired = false;
             add_action('auth_cookie_expired', array($this, 'auth_cookie_expired'));
             add_action('init', array($this, 'execute_hide_backend'), 1000);
             add_action('login_init', array($this, 'execute_hide_backend_login'));
             add_action('plugins_loaded', array($this, 'plugins_loaded'), 11);
             add_filter('body_class', array($this, 'remove_admin_bar'));
             add_filter('loginout', array($this, 'filter_loginout'));
             add_filter('wp_redirect', array($this, 'filter_login_url'), 10, 2);
             add_filter('lostpassword_url', array($this, 'filter_login_url'), 10, 2);
             add_filter('site_url', array($this, 'filter_login_url'), 10, 2);
             add_filter('retrieve_password_message', array($this, 'retrieve_password_message'));
             add_filter('comment_moderation_text', array($this, 'comment_moderation_text'));
             remove_action('template_redirect', 'wp_redirect_admin_locations', 1000);
         }
     }
 }
 /**
  *
  * Actually build the option pages
  *
  */
 function build_options_page()
 {
     // this is only necessary if the plugin is activated for network
     if (@$_GET['action'] == 'update') {
         $input = $_POST['rss_options'];
         self::$options = $this->validate_options($input);
         update_site_option('rss_options', self::$options);
         $this->initialize_settings();
     }
     // the main options page begins here
     $eol = "\n";
     parent::open_page('Feed Images', __('http://wasistlos.waldemarstoffel.com/plugins-fur-wordpress/rss-image-feed', 'rss-image-feed'), 'rss-image-feed', __('Plugin Support', 'rss-image-feed'));
     _e('Define the size of the images and summary in your feed.', 'rss-image-feed');
     if (is_plugin_active_for_network(RIF_BASE)) {
         settings_errors();
     }
     $action = is_plugin_active_for_network(RIF_BASE) ? '?page=rss-image-feed&action=update' : 'options.php';
     parent::open_form($action);
     settings_fields('rss_options');
     do_settings_sections('new_image_settings');
     submit_button();
     if (WP_DEBUG === true) {
         self::open_tab();
         self::sortable('deep-down', self::debug_info(self::$options, __('Debug Info', 'rss-image-feed')));
         self::close_tab();
     }
     parent::close_page();
 }