Exemple #1
1
 function run()
 {
     add_action('w3tc_dashboard_setup', array(&$this, 'wp_dashboard_setup'));
     add_action('w3tc_network_dashboard_setup', array(&$this, 'wp_dashboard_setup'));
     // Configure authorize and have_zone
     $this->_setup($this->_config);
     /**
      * Retry setup with main blog
      */
     if (w3_is_network() && is_network_admin() && !$this->authorized) {
         $this->_config = new W3_Config(false, 1);
         $this->_setup($this->_config);
     }
     if (w3_is_network()) {
         $conig_admin = w3_instance('W3_ConfigAdmin');
         $this->_sealed = $conig_admin->get_boolean('cdn.configuration_sealed');
     }
     if ($this->have_zone && $this->authorized && isset($_GET['page']) && strpos($_GET['page'], 'w3tc_dashboard') !== false) {
         w3_require_once(W3TC_LIB_NETDNA_DIR . '/NetDNA.php');
         w3_require_once(W3TC_LIB_NETDNA_DIR . '/NetDNAPresentation.php');
         $authorization_key = $this->_config->get_string('cdn.maxcdn.authorization_key');
         $alias = $consumerkey = $consumersecret = '';
         $keys = explode('+', $authorization_key);
         if (sizeof($keys) == 3) {
             list($alias, $consumerkey, $consumersecret) = $keys;
         }
         $this->api = new NetDNA($alias, $consumerkey, $consumersecret);
         add_action('admin_head', array(&$this, 'admin_head'));
     }
 }
 /**
  * Flush varnish cache
  */
 function flush()
 {
     if (!is_network_admin()) {
         $this->_purge(w3_get_home_url() . '/.*');
     } else {
         global $wpdb;
         $protocall = w3_is_https() ? 'https://' : 'http://';
         // If WPMU Domain Mapping plugin is installed and active
         if (defined('SUNRISE_LOADED') && SUNRISE_LOADED && isset($wpdb->dmtable) && !empty($wpdb->dmtable)) {
             $blogs = $wpdb->get_results("SELECT {$wpdb->blogs}.domain, {$wpdb->blogs}.path, {$wpdb->dmtable}.domain AS mapped_domain\n                                    FROM {$wpdb->dmtable}\n                                    RIGHT JOIN {$wpdb->blogs} ON {$wpdb->dmtable}.blog_id = {$wpdb->blogs}.blog_id\n                                    WHERE site_id = {$wpdb->siteid}\n                                    AND spam = 0\n                                    AND deleted = 0\n                                    AND archived = '0'\n                                   ");
             foreach ($blogs as $blog) {
                 if (!isset($blog->mapped_domain)) {
                     $url = $protocall . $blog->domain . (strlen($blog->path) > 1 ? '/' . trim($blog->path, '/') : '') . '/.*';
                 } else {
                     $url = $protocall . $blog->mapped_domain . '/.*';
                 }
                 $this->_purge($url);
             }
         } else {
             if (!w3_is_subdomain_install()) {
                 $this->_purge(w3_get_home_url() . '/.*');
             } else {
                 $blogs = $wpdb->get_results("\n                                        SELECT domain, path\n                                        FROM {$wpdb->blogs}\n                                        WHERE site_id = '{$wpdb->siteid}'\n                                        AND spam = 0\n                                        AND deleted = 0\n                                        AND archived = '0'\n                                    ");
                 foreach ($blogs as $blog) {
                     $url = $protocall . $blog->domain . (strlen($blog->path) > 1 ? '/' . trim($blog->path, '/') : '') . '/.*';
                     $this->_purge($url);
                 }
             }
         }
     }
 }
 function after()
 {
     if (empty($this->upgrader->result['destination_name'])) {
         return;
     }
     $theme_info = $this->upgrader->theme_info();
     if (empty($theme_info)) {
         return;
     }
     $name = $theme_info['Name'];
     $stylesheet = $this->upgrader->result['destination_name'];
     $template = !empty($theme_info['Template']) ? $theme_info['Template'] : $stylesheet;
     $preview_link = htmlspecialchars(add_query_arg(array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'preview_iframe' => 1, 'TB_iframe' => 'true'), trailingslashit(esc_url(get_option('home')))));
     $activate_link = wp_nonce_url("themes.php?action=activate&template=" . urlencode($template) . "&stylesheet=" . urlencode($stylesheet), 'switch-theme_' . $template);
     $install_actions = array('preview' => '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $name)) . '">' . __('Preview') . '</a>', 'activate' => '<a href="' . $activate_link . '" class="activatelink" title="' . esc_attr(sprintf(__('Activate &#8220;%s&#8221;'), $name)) . '">' . __('Activate') . '</a>');
     if (is_network_admin() && current_user_can('manage_network_themes')) {
         $install_actions['network_enable'] = '<a href="' . esc_url(wp_nonce_url('themes.php?action=enable&amp;theme=' . $template, 'enable-theme_' . $template)) . '" title="' . esc_attr__('Enable this theme for all sites in this network') . '" target="_parent">' . __('Network Enable') . '</a>';
     }
     $install_actions['themes_page'] = '<a href="' . self_admin_url('themes.php') . '" title="' . esc_attr__('Themes page') . '" target="_parent">' . __('View Installed Themes', 'wp-app-store') . '</a>';
     if (!$this->result || is_wp_error($this->result) || is_network_admin()) {
         unset($install_actions['activate'], $install_actions['preview']);
     }
     $install_actions = apply_filters('install_theme_complete_actions', $install_actions, $this->api, $stylesheet, $theme_info);
     if (!empty($install_actions)) {
         $this->feedback(implode(' | ', (array) $install_actions));
     }
 }
 public function log($connector, $message, $args, $object_id, $contexts, $user_id = null)
 {
     global $wpdb;
     if (is_null($user_id)) {
         $user_id = get_current_user_id();
     }
     require_once MAINWP_WP_STREAM_INC_DIR . 'class-wp-stream-author.php';
     $user = new WP_User($user_id);
     $roles = get_option($wpdb->get_blog_prefix() . 'user_roles');
     if (!isset($args['author_meta'])) {
         $args['author_meta'] = array('user_email' => $user->user_email, 'display_name' => defined('WP_CLI') && empty($user->display_name) ? 'WP-CLI' : $user->display_name, 'user_login' => $user->user_login, 'user_role_label' => !empty($user->roles) ? $roles[$user->roles[0]]['name'] : null, 'agent' => MainWP_WP_Stream_Author::get_current_agent());
         if (defined('WP_CLI') && function_exists('posix_getuid')) {
             $uid = posix_getuid();
             $user_info = posix_getpwuid($uid);
             $args['author_meta']['system_user_id'] = $uid;
             $args['author_meta']['system_user_name'] = $user_info['name'];
         }
     }
     // Remove meta with null values from being logged
     $meta = array_filter($args, function ($var) {
         return !is_null($var);
     });
     $recordarr = array('object_id' => $object_id, 'site_id' => is_multisite() ? get_current_site()->id : 1, 'blog_id' => apply_filters('blog_id_logged', is_network_admin() ? 0 : get_current_blog_id()), 'author' => $user_id, 'author_role' => !empty($user->roles) ? $user->roles[0] : null, 'created' => current_time('mysql', 1), 'summary' => vsprintf($message, $args), 'parent' => self::$instance->prev_record, 'connector' => $connector, 'contexts' => $contexts, 'meta' => $meta, 'ip' => mainwp_wp_stream_filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP));
     $record_id = MainWP_WP_Stream_DB::get_instance()->insert($recordarr);
     return $record_id;
 }
/**
 * Adds an admin page to the plugins admin menu dropdown.
 * The page displays instructions to admins to fully activate
 * the Media Vault plugin
 *
 * @since 0.8.5
 */
function mgjp_mv_extra_activation_steps_page()
{
    if (is_multisite() && !is_network_admin()) {
        return;
    }
    add_submenu_page('plugins.php', __('Media Vault Activation Helper', 'media-vault'), __('Media Vault Activation', 'media-vault'), 'install_plugins', 'mgjp-mv-eas', 'mgjp_mv_render_extra_activation_steps_page');
}
 public function __construct()
 {
     /**
      * Check current WooCommerce version to ensure compatibility.
      */
     $woo_version = $this->wpbo_get_woo_version_number();
     if (version_compare($woo_version, '2.1', '<')) {
         exit(__('PayPal for WooCommerce requires WooCommerce version 2.1 or higher.  Please backup your site files and database, update WooCommerce, and try again.', 'paypal-for-woocommerce'));
     }
     add_filter('woocommerce_paypal_args', array($this, 'ae_paypal_standard_additional_parameters'));
     add_action('plugins_loaded', array($this, 'init'));
     register_activation_hook(__FILE__, array($this, 'activate_paypal_for_woocommerce'));
     register_deactivation_hook(__FILE__, array($this, 'deactivate_paypal_for_woocommerce'));
     add_action('wp_enqueue_scripts', array($this, 'woocommerce_paypal_express_init_styles'), 12);
     add_action('admin_notices', array($this, 'admin_notices'));
     add_action('admin_init', array($this, 'set_ignore_tag'));
     add_filter('woocommerce_product_title', array($this, 'woocommerce_product_title'));
     add_action('woocommerce_sections_checkout', array($this, 'donate_message'), 11);
     add_action('parse_request', array($this, 'woocommerce_paypal_express_review_order_page_angelleye'), 11);
     // http://stackoverflow.com/questions/22577727/problems-adding-action-links-to-wordpress-plugin
     $basename = plugin_basename(__FILE__);
     $prefix = is_network_admin() ? 'network_admin_' : '';
     add_filter("{$prefix}plugin_action_links_{$basename}", array($this, 'plugin_action_links'), 10, 4);
     add_action('woocommerce_after_add_to_cart_button', array($this, 'buy_now_button'));
     add_action('woocommerce_after_mini_cart', array($this, 'mini_cart_button'));
     add_action('woocommerce_add_to_cart_redirect', array($this, 'add_to_cart_redirect'));
     add_action('woocommerce_after_single_variation', array($this, 'buy_now_button_js'));
     add_action('admin_enqueue_scripts', array($this, 'onetarek_wpmut_admin_scripts'));
     add_action('admin_print_styles', array($this, 'onetarek_wpmut_admin_styles'));
     add_action('woocommerce_cart_calculate_fees', array($this, 'woocommerce_custom_surcharge'));
     add_action('woocommerce_before_add_to_cart_button', array($this, 'add_div_before_add_to_cart_button'), 25);
     add_action('woocommerce_after_add_to_cart_button', array($this, 'add_div_after_add_to_cart_button'), 35);
     add_action('admin_init', array($this, 'angelleye_check_version'), 5);
 }
Exemple #7
0
 public function admin_init()
 {
     if (!empty($_GET['developer_plugin_reset']) && current_user_can('manage_options')) {
         delete_option(self::OPTION);
     }
     $this->recommended_plugins = array('debug-bar' => array('project_type' => 'all', 'name' => esc_html__('Debug Bar', 'a8c-developer'), 'active' => class_exists('Debug_Bar')), 'debug-bar-console' => array('project_type' => 'all', 'name' => esc_html__('Debug Bar Console', 'a8c-developer'), 'active' => function_exists('debug_bar_console_panel')), 'debug-bar-cron' => array('project_type' => 'all', 'name' => esc_html__('Debug Bar Cron', 'a8c-developer'), 'active' => function_exists('zt_add_debug_bar_cron_panel')), 'debug-bar-extender' => array('project_type' => 'all', 'name' => esc_html__('Debug Bar Extender', 'a8c-developer'), 'active' => class_exists('Debug_Bar_Extender')), 'rewrite-rules-inspector' => array('project_type' => 'all', 'name' => esc_html__('Rewrite Rules Inspector', 'a8c-developer'), 'active' => class_exists('Rewrite_Rules_Inspector')), 'log-deprecated-notices' => array('project_type' => 'all', 'name' => esc_html__('Log Deprecated Notices', 'a8c-developer'), 'active' => class_exists('Deprecated_Log')), 'log-viewer' => array('project_type' => 'all', 'name' => esc_html__('Log Viewer', 'a8c-developer'), 'active' => class_exists('ciLogViewer')), 'vip-scanner' => array('project_type' => 'wpcom-vip', 'name' => esc_html__('VIP Scanner', 'a8c-developer'), 'active' => class_exists('VIP_Scanner')), 'jetpack' => array('project_type' => 'wpcom-vip', 'name' => esc_html__('Jetpack', 'a8c-developer'), 'active' => class_exists('Jetpack')), 'polldaddy' => array('project_type' => 'wpcom-vip', 'name' => esc_html__('Polldaddy Polls & Ratings', 'a8c-developer'), 'active' => class_exists('WP_Polldaddy')), 'monster-widget' => array('project_type' => 'all', 'name' => esc_html__('Monster Widget', 'a8c-developer'), 'active' => class_exists('Monster_Widget')), 'user-switching' => array('project_type' => 'all', 'name' => esc_html__('User Switching', 'a8c-developer'), 'active' => class_exists('user_switching')), 'piglatin' => array('project_type' => array('wporg-theme', 'wporg'), 'name' => esc_html__('Pig Latin', 'a8c-developer'), 'active' => class_exists('PigLatin')), 'rtl-tester' => array('project_type' => 'wporg-theme', 'name' => esc_html__('RTL Tester', 'a8c-developer'), 'active' => class_exists('RTLTester')), 'regenerate-thumbnails' => array('project_type' => 'wporg-theme', 'name' => esc_html__('Regenerate Thumbnails', 'a8c-developer'), 'active' => class_exists('RegenerateThumbnails')), 'simply-show-ids' => array('project_type' => 'wporg-theme', 'name' => esc_html__('Simply Show IDs', 'a8c-developer'), 'active' => function_exists('ssid_add')), 'theme-test-drive' => array('project_type' => 'wporg-theme', 'name' => esc_html__('Theme Test Drive', 'a8c-developer'), 'active' => function_exists('TTD_filters'), 'filename' => 'themedrive.php'), 'theme-check' => array('project_type' => 'wporg-theme', 'name' => esc_html__('Theme Check', 'a8c-developer'), 'active' => function_exists('tc_add_headers')));
     if (!self::is_dev_version()) {
         $this->recommended_plugins['wordpress-beta-tester'] = array('project_type' => 'all', 'name' => esc_html__('Beta Tester', 'a8c-developer'), 'active' => class_exists('wp_beta_tester'), 'filename' => 'wp-beta-tester.php');
     }
     $this->recommended_constants = array('WP_DEBUG' => array('project_type' => 'all', 'description' => __('Enables <a href="http://codex.wordpress.org/Debugging_in_WordPress" target="_blank">debug mode</a> which helps identify and resolve issues', 'a8c-developer')), 'SAVEQUERIES' => array('project_type' => 'all', 'description' => esc_html__('Logs database queries to an array so you can review them. The Debug Bar plugin will list out database queries if you set this constant.', 'a8c-developer')), 'JETPACK_DEV_DEBUG' => array('project_type' => 'wpcom-vip', 'description' => __('Enables <a href="http://jetpack.me/2013/03/28/jetpack-dev-mode-release/">Development Mode</a> in Jetpack for testing features without a connection to WordPress.com.', 'a8c-developer')));
     register_setting(self::OPTION, self::OPTION, array($this, 'settings_validate'));
     wp_register_script('a8c-developer', plugins_url('developer.js', __FILE__), array('jquery'), self::VERSION);
     $strings = array('settings_slug' => self::PAGE_SLUG, 'go_to_step_2' => current_user_can('install_plugins') && current_user_can('activate_plugins') && 'direct' == get_filesystem_method() ? 'yes' : 'no', 'lightbox_title' => __('Developer: Plugin Setup', 'a8c-developer'), 'saving' => __('Saving...', 'a8c-developer'), 'installing' => '<img src="images/loading.gif" alt="" /> ' . esc_html__('Installing...', 'a8c-developer'), 'installed' => __('Installed', 'a8c-developer'), 'activating' => '<img src="images/loading.gif" alt="" /> ' . esc_html__('Activating...', 'a8c-developer'), 'activated' => __('Activated', 'a8c-developer'), 'error' => __('Error!', 'a8c-developer'), 'ACTIVE' => __('ACTIVE', 'a8c-developer'), 'INSTALLED' => __('INSTALLED', 'a8c-developer'), 'ERROR' => __('ERROR!', 'a8c-developer'));
     wp_localize_script('a8c-developer', 'a8c_developer_i18n', $strings);
     wp_register_style('a8c-developer', plugins_url('developer.css', __FILE__), array(), self::VERSION);
     // Handle the submission of the lightbox form if step 2 won't be shown
     if (!empty($_POST['action']) && 'a8c_developer_lightbox_step_1' == $_POST['action'] && !empty($_POST['a8c_developer_project_type']) && check_admin_referer('a8c_developer_lightbox_step_1')) {
         $this->save_project_type($_POST['a8c_developer_project_type']);
         add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated');
     }
     if (!get_option(self::OPTION)) {
         if (!empty($_GET['a8cdev_errorsaving'])) {
             add_settings_error(self::PAGE_SLUG, self::PAGE_SLUG . '_error_saving', __('Error saving settings. Please try again.', 'a8c-developer'));
         } elseif (!is_network_admin() && current_user_can('manage_options')) {
             add_action('admin_enqueue_scripts', array($this, 'load_lightbox_scripts_and_styles'));
             add_action('admin_footer', array($this, 'output_setup_box_html'));
         }
     }
 }
 /**
  * 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'));
 }
 /**
  * Register the top-level 'Snippets' menu and associated 'Manage' subpage
  *
  * @uses add_menu_page() to register a top-level menu
  * @uses add_submenu_page() to register a sub-menu
  */
 function register()
 {
     /* Register the top-level menu */
     add_menu_page(__('Snippets', 'code-snippets'), __('Snippets', 'code-snippets'), code_snippets()->get_cap(), code_snippets()->get_menu_slug(), array($this, 'render'), 'div', is_network_admin() ? 21 : 67);
     /* Register the sub-menu */
     parent::register();
 }
 protected function _isInstantiatable()
 {
     if (isset($GLOBALS['pagenow']) && 'admin-ajax.php' === $GLOBALS['pagenow']) {
         return false;
     }
     return !is_network_admin();
 }
 /**
  * Install WPCM
  */
 public static function install()
 {
     if (!defined('WPCM_INSTALLING')) {
         define('WPCM_INSTALLING', true);
     }
     // Ensure needed classes are loaded
     include_once 'admin/class-wpcm-admin-notices.php';
     self::create_options();
     self::create_roles();
     // Register post types
     WPCM_Post_Types::register_post_types();
     WPCM_Post_Types::register_taxonomies();
     // Queue upgrades
     $current_version = get_option('wpclubmanager_version', null);
     if ($current_version) {
         update_option('wpcm_version_upgraded_from', $current_version);
     }
     // Update version
     delete_option('wpclubmanager_version');
     add_option('wpclubmanager_version', WPCM()->version);
     // Flush rules after install
     flush_rewrite_rules();
     // Redirect to welcome screen
     if (!is_network_admin() && !isset($_GET['activate-multi'])) {
         set_transient('_wpcm_activation_redirect', 1, 30);
     }
     // Trigger action
     do_action('wpclubmanager_installed');
 }
        /**
         * Display "Install demo data" or "Uninstal demo data" buttons
         * @return void
         */
        function bws_show_demo_button($form_title)
        {
            if (!(is_multisite() && is_network_admin())) {
                if (empty($this->bws_demo_options)) {
                    $value = 'install';
                    $button_title = __('Install Demo Data', $this->bws_plugin_text_domain);
                } else {
                    $value = 'remove';
                    $button_title = __('Remove Demo Data', $this->bws_plugin_text_domain);
                    $form_title = __('Delete demo-data and restore old plugin settings.', $this->bws_plugin_text_domain);
                }
                ?>
				<form method="post" action="" id="bws_handle_demo_data">
					<p><?php 
                echo $form_title;
                ?>
</p>
					<p>
						<button class="button" name="bws_handle_demo" value="<?php 
                echo $value;
                ?>
"><?php 
                echo $button_title;
                ?>
</button>
						<?php 
                wp_nonce_field($this->bws_plugin_basename, 'bws_settings_nonce_name');
                ?>
					</p>
				</form>
			<?php 
            }
        }
Exemple #13
0
 public function onDisplaySettingsPage()
 {
     $this->check_wplister_setup('settings');
     $default_tab = is_network_admin() ? 'license' : 'settings';
     $active_tab = isset($_GET['tab']) ? $_GET['tab'] : $default_tab;
     if ('categories' == $active_tab) {
         return $this->displayCategoriesPage();
     }
     if ('developer' == $active_tab) {
         return $this->displayDeveloperPage();
     }
     if ('advanced' == $active_tab) {
         return $this->displayAdvancedSettingsPage();
     }
     if ('accounts' == $active_tab) {
         return $this->displayAccountsPage();
     }
     // // action FetchToken
     // if ( $this->requestAction() == 'FetchToken' ) {
     // 	// FetchToken
     // 	$this->initEC();
     // 	$ebay_token = $this->EC->doFetchToken();
     // 	$this->EC->closeEbay();
     // 	// check if we have a token
     // 	if ( self::getOption('ebay_token') == '' ) {
     // 		$this->showMessage( "There was a problem fetching your token. Make sure you follow the instructions.", 1 );
     // 	}
     // 	$this->check_wplister_setup('settings');
     // }
     $aData = array('plugin_url' => self::$PLUGIN_URL, 'message' => $this->message, 'ebay_sites' => EbayController::getEbaySites(), 'ebay_token_userid' => self::getOption('ebay_token_userid'), 'ebay_user' => self::getOption('ebay_user'), 'option_cron_auctions' => self::getOption('cron_auctions'), 'local_auction_display' => self::getOption('local_auction_display', 'off'), 'send_weight_and_size' => self::getOption('send_weight_and_size', 'default'), 'is_staging_site' => $this->isStagingSite(), 'settings_url' => 'admin.php?page=' . self::ParentMenuId . '-settings', 'auth_url' => 'admin.php?page=' . self::ParentMenuId . '-settings' . '&tab=' . $active_tab . '&action=wplRedirectToAuthURL', 'form_action' => 'admin.php?page=' . self::ParentMenuId . '-settings' . '&tab=' . $active_tab);
     $this->display('settings_page', $aData);
 }
 /**
  * Sets up properties.
  */
 public function __construct($sOptionKey)
 {
     $this->bIsNetworkAdmin = is_network_admin();
     // must be done first
     $this->sOptionKey = $sOptionKey;
     $this->aOptions = $this->_getFormattedOptions($sOptionKey);
 }
/**
 * Install
 *
 * Runs on plugin install.
 *
 * @access      private
 * @since       1.0
 * @return      void
*/
function edd_install()
{
    global $wpdb, $edd_options;
    // Setup the Downloads Custom Post Type
    edd_setup_edd_post_types();
    // Setup the Download Taxonomies
    edd_setup_download_taxonomies();
    // Clear the permalinks
    flush_rewrite_rules();
    // Checks if the purchase page option exists
    if (!isset($edd_options['purchase_page'])) {
        // Checkout Page
        $checkout = wp_insert_post(array('post_title' => __('Checkout', 'edd'), 'post_content' => '[download_checkout]', 'post_status' => 'publish', 'post_author' => 1, 'post_type' => 'page', 'comment_status' => 'closed'));
        // Purchase Confirmation (Success) Page
        $success = wp_insert_post(array('post_title' => __('Purchase Confirmation', 'edd'), 'post_content' => __('Thank you for your purchase!', 'edd'), 'post_status' => 'publish', 'post_author' => 1, 'post_type' => 'page', 'comment_status' => 'closed'));
        // Failed Purchase Page
        $failed = wp_insert_post(array('post_title' => __('Transaction Failed', 'edd'), 'post_content' => __('Your transaction failed, please try again or contact site support.', 'edd'), 'post_status' => 'publish', 'post_author' => 1, 'post_type' => 'page', 'post_parent' => $checkout, 'comment_status' => 'closed'));
        // Purchase History (History) Page
        $history = wp_insert_post(array('post_title' => __('Purchase History', 'edd'), 'post_content' => '[download_history]', 'post_status' => 'publish', 'post_author' => 1, 'post_type' => 'page', 'post_parent' => $checkout, 'comment_status' => 'closed'));
    }
    // Bail if activating from network, or bulk
    if (is_network_admin() || isset($_GET['activate-multi'])) {
        return;
    }
    // Add the transient to redirect
    set_transient('_edd_activation_redirect', true, 30);
}
Exemple #16
0
/**
 * Install
 *
 * Runs on plugin install to populates the settings fields for those plugin
 * pages. After successful install, the user is redirected to the WPSTG Welcome
 * screen.
 *
 * @since 0.9.0
 * @global $wpdb
 * @global $wpstg_options
 * @global $wp_version
 * @return void
 */
function wpstg_install()
{
    global $wpdb, $wpstg_options, $wp_version;
    // Add Upgraded from Option
    $current_version = get_option('wpstg_version');
    if ($current_version) {
        update_option('wpstg_version_upgraded_from', $current_version);
    }
    // Update the current version
    update_option('wpstg_version', WPSTG_VERSION);
    // Add plugin installation date and variable for rating div
    add_option('wpstg_installDate', date('Y-m-d h:i:s'));
    add_option('wpstg_RatingDiv', 'no');
    // Add First-time variables
    add_option('wpstg_firsttime', 'true');
    add_option('wpstg_is_staging_site', 'false');
    // Show beta notice
    add_option('wpstg_hide_beta', 'no');
    // Create empty config files in /wp-content/uploads/wp-staging
    wpstg_create_remaining_files();
    wpstg_create_clonedetails_files();
    /* Setup some default options
     * Store our initial social networks in separate option row.
     * For easier modification and to prevent some trouble
     */
    // Bail if activating from network, or bulk
    if (is_network_admin() || isset($_GET['activate-multi'])) {
        return;
    }
    // Add the transient to redirect / not for multisites
    set_transient('_wpstg_activation_redirect', true, 30);
}
Exemple #17
0
 /**
  * Maybe initialize the upgrade
  */
 function maybe_init_upgrade()
 {
     if (!is_admin() || defined('DOING_AJAX') && DOING_AJAX) {
         return;
     }
     // make sure this only fires inside the network admin for multisites
     if (is_multisite() && !is_network_admin()) {
         return;
     }
     // Have we completed the upgrade yet?
     if ($this->as3cf->get_setting('post_meta_version', 0) > 0) {
         return;
     }
     // If the upgrade status is already set, then we've already initialized the upgrade
     if ($this->get_upgrade_status()) {
         return;
     }
     // Do we actually have S3 meta data without regions to update?
     // No need to bother for fresh sites, or media not uploaded to S3
     if (0 == $this->count_all_attachments_without_region()) {
         $this->as3cf->set_setting('post_meta_version', 1);
         $this->as3cf->save_settings();
         return;
     }
     // Initialize the upgrade
     $this->save_session(array('status' => self::STATUS_RUNNING));
     $this->as3cf->schedule_event(self::CRON_HOOK, self::CRON_SCHEDULE_KEY);
 }
 /**
  * Remove the WordPress comments menu bar item, replacing with a Facebook comments link
  * Check if Facebook comments enabled and if the current user might be able to view a comments edit screen on Facebook
  *
  * @since 1.1
  * @see WP_Admin_Bar->add_menus()
  */
 public static function admin_bar_menu()
 {
     global $facebook_loader;
     if (is_network_admin() && is_user_admin()) {
         return;
     }
     // use moderate_comments capability as a local proxy for accounts that might be granted moderate comments permissions for the Facebook application if the application administrator fully setup the app
     // technically the WordPress menu item is added for users with 'edit_posts' due to the permissions of the destination page but we'll check for the specific comments permission instead
     // TODO: check if Facebook data stored for current user, check if Facebook user is moderator
     if (!current_user_can('moderate_comments')) {
         return;
     }
     if (!class_exists('Facebook_User')) {
         require_once dirname(dirname(__FILE__)) . '/facebook-user.php';
     }
     $current_user = wp_get_current_user();
     $facebook_user_data = Facebook_User::get_user_meta($current_user->ID, 'fb_data', true);
     if (!(is_array($facebook_user_data) && isset($facebook_user_data['fb_uid']))) {
         return;
     }
     // swap only. don't add a menu item if none existed
     if (remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60)) {
         add_action('admin_bar_menu', array('Facebook_Comments', 'admin_bar_add_comments_menu'), 60);
     }
 }
 function site_option_allowedthemes($themes)
 {
     global $psts;
     if (is_network_admin()) {
         return $themes;
     }
     $blog_id = get_current_blog_id();
     // If the blog is not a Pro Site, just return standard themes
     $visible_pro_only = apply_filters('prosites_show_themes_prosites_only', false, is_pro_site(get_current_blog_id()));
     if ($visible_pro_only || defined('PSTS_THEMES_PRO_ONLY') && PSTS_THEMES_PRO_ONLY === true) {
         update_blog_option($blog_id, 'psts_blog_allowed_themes', $themes);
         return $themes;
     }
     $allowed_themes = $psts->get_setting('pt_allowed_themes');
     if ($allowed_themes == false) {
         $allowed_themes = array();
     }
     if (count($allowed_themes) > 0) {
         if (!is_array($themes)) {
             $themes = array();
         }
         foreach ($allowed_themes as $key => $allowed_theme) {
             $themes[$key] = $allowed_theme;
         }
     }
     update_blog_option($blog_id, 'psts_blog_allowed_themes', $themes);
     return $themes;
 }
Exemple #20
0
 /**
  * Public constructor
  */
 public function __construct()
 {
     // Get all sections from the database
     self::$sections = WP_Stream_Reports_Settings::get_user_options('sections');
     // Load records
     add_filter('wp_stream_reports_load_records', array($this, 'sort_coordinates_by_count'), 10, 2);
     add_filter('wp_stream_reports_load_records', array($this, 'limit_coordinates'), 10, 2);
     // Make charts
     add_filter('wp_stream_reports_make_chart', array($this, 'pie_chart_coordinates'), 10, 2);
     add_filter('wp_stream_reports_make_chart', array($this, 'bar_chart_coordinates'), 10, 2);
     add_filter('wp_stream_reports_make_chart', array($this, 'line_chart_coordinates'), 10, 2);
     // Finalize charts
     add_filter('wp_stream_reports_finalize_chart', array($this, 'translate_labels'), 10, 2);
     add_filter('wp_stream_reports_finalize_chart', array($this, 'apply_chart_settings'), 10, 2);
     // Get chart labels
     add_filter('wp_stream_reports_get_label', array($this, 'translate_data_type_labels'), 10, 2);
     // Specific data for multisite
     if (is_multisite() && is_network_admin()) {
         add_filter('wp_stream_reports_data_types', array($this, 'mutlisite_data_types'), 10);
         add_filter('wp_stream_reports_selector_types', array($this, 'mutlisite_selector_types'), 10);
         add_filter('wp_stream_reports_get_label', array($this, 'multisite_labels'), 10, 2);
         add_filter('wp_stream_reports_query_args', array($this, 'multisite_query_args'), 10, 2);
     }
     $ajax_hooks = array('wp_stream_reports_add_metabox' => 'add_metabox', 'wp_stream_reports_delete_metabox' => 'delete_metabox', 'wp_stream_reports_default_reports' => 'setup_user', 'wp_stream_reports_save_metabox_config' => 'save_metabox_config', 'wp_stream_reports_save_chart_height' => 'save_chart_height', 'wp_stream_reports_save_chart_options' => 'save_chart_options', 'wp_stream_reports_update_metabox_display' => 'update_metabox_display');
     // Register all ajax action and check referer for this class
     WP_Stream_Reports::handle_ajax_request($ajax_hooks, $this);
 }
Exemple #21
0
function affiliate_wp_install()
{
    // Create affiliate caps
    $roles = new Affiliate_WP_Capabilities();
    $roles->add_caps();
    $affiliate_wp_install = new stdClass();
    $affiliate_wp_install->affiliates = new Affiliate_WP_DB_Affiliates();
    $affiliate_wp_install->affiliate_meta = new Affiliate_WP_Affiliate_Meta_DB();
    $affiliate_wp_install->referrals = new Affiliate_WP_Referrals_DB();
    $affiliate_wp_install->visits = new Affiliate_WP_Visits_DB();
    $affiliate_wp_install->creatives = new Affiliate_WP_Creatives_DB();
    $affiliate_wp_install->settings = new Affiliate_WP_Settings();
    $affiliate_wp_install->affiliates->create_table();
    $affiliate_wp_install->affiliate_meta->create_table();
    $affiliate_wp_install->referrals->create_table();
    $affiliate_wp_install->visits->create_table();
    $affiliate_wp_install->creatives->create_table();
    if (!get_option('affwp_is_installed')) {
        $affiliate_area = wp_insert_post(array('post_title' => __('Affiliate Area', 'affiliate-wp'), 'post_content' => '[affiliate_area]', 'post_status' => 'publish', 'post_author' => 1, 'post_type' => 'page', 'comment_status' => 'closed'));
        $options = $affiliate_wp_install->settings->get_all();
        $options['affiliates_page'] = $affiliate_area;
        update_option('affwp_settings', $options);
    }
    update_option('affwp_is_installed', '1');
    update_option('affwp_version', AFFILIATEWP_VERSION);
    // Clear rewrite rules
    flush_rewrite_rules();
    // Bail if activating from network, or bulk
    if (is_network_admin() || isset($_GET['activate-multi'])) {
        return;
    }
    // Add the transient to redirect
    set_transient('_affwp_activation_redirect', true, 30);
}
 /**
  * Construct function
  * Protected to make sure it isn't declared elsewhere
  *
  * @since   1.4
  * @access  protected
  */
 protected function __construct()
 {
     self::$_instance = $this;
     parent::__construct();
     // Load data
     $this->set_optionData(get_option($this->get_optionKey()));
     /**
      * Checks if the management part of module should be enabled
      *
      * @since  1.4    Validate option data
      * @since  1.6    Also calls init()
      */
     if (true == $this->get_optionData('enable')) {
         $this->enable = true;
         $this->init();
     }
     /**
      * Only allow settings for admin users or users with the correct apabilities
      *
      * @since  1.5.2    Validate custom capability view_admin_as_role_defaults
      * @since  1.5.2.1  Validate is_super_admin (bug in 1.5.2)
      * @since  1.5.3    Disable for network pages
      */
     if ($this->is_vaa_enabled() && !is_network_admin() && (is_super_admin($this->get_curUser()->ID) || current_user_can('view_admin_as_role_defaults'))) {
         add_action('vaa_view_admin_as_init', array($this, 'vaa_init'));
     }
 }
Exemple #23
0
/**
 * Install
 *
 * Runs on plugin install to populates the settings fields for those plugin
 * pages. After successful install, the user is redirected to the MASHSB Welcome
 * screen.
 *
 * @since 2.0
 * @global $wpdb
 * @global $mashsb_options
 * @global $wp_version
 * @return void
 */
function mashsb_install()
{
    global $wpdb, $mashsb_options, $wp_version;
    // Add Upgraded From Option
    $current_version = get_option('mashsb_version');
    if ($current_version) {
        update_option('mashsb_version_upgraded_from', $current_version);
    }
    // Update the current version
    update_option('mashsb_version', MASHSB_VERSION);
    // Add plugin installation date and variable for rating div
    add_option('mashsb_installDate', date('Y-m-d h:i:s'));
    add_option('mashsb_RatingDiv', 'no');
    if (!get_option('mashsb_update_notice')) {
        add_option('mashsb_update_notice', 'no');
    }
    /* Setup some default options
     * Store our initial social networks in separate option row.
     * For easier modification and to prevent some trouble
     */
    $networks = array('Facebook', 'Twitter', 'Subscribe');
    if (is_plugin_inactive('mashshare-networks/mashshare-networks.php')) {
        update_option('mashsb_networks', $networks);
    }
    // Bail if activating from network, or bulk
    if (is_network_admin() || isset($_GET['activate-multi'])) {
        return;
    }
    // Add the transient to redirect / not for multisites
    set_transient('_mashsb_activation_redirect', true, 30);
}
 /**
  * Adds the filters and actions only for users who have the right
  * Groups permissions.
  */
 public static function setup()
 {
     if (current_user_can(GROUPS_ACCESS_GROUPS)) {
         // filters to display the user's groups
         add_filter('manage_users_columns', array(__CLASS__, 'manage_users_columns'));
         // args: unknown, string $column_name, int $user_id
         add_filter('manage_users_custom_column', array(__CLASS__, 'manage_users_custom_column'), 10, 3);
     }
     if (current_user_can(GROUPS_ADMINISTER_GROUPS)) {
         if (!is_network_admin()) {
             // scripts
             add_action('admin_enqueue_scripts', array(__CLASS__, 'admin_enqueue_scripts'));
             // styles
             add_action('admin_head', array(__CLASS__, 'admin_head'));
             // allow to add or remove selected users to groups
             add_action('load-users.php', array(__CLASS__, 'load_users'));
             // add links to filter users by group
             add_filter('views_users', array(__CLASS__, 'views_users'));
             // modify query to filter users by group
             add_filter('pre_user_query', array(__CLASS__, 'pre_user_query'));
             // WP_Users_List_Table implements extra_tablenav() where the restrict_manage_users action is invoked.
             // As the extra_tablenav() method does not define a generic extension point, this is
             // the best shot we get at inserting our group actions block (currently we're at WordPress 3.6.1).
             // We choose to use our own group-actions block instead of re-using the existing bulk-actions,
             // to have a more explicit user interface which makes it clear that these actions
             // are directed at relating users and groups.
             add_action('restrict_manage_users', array(__CLASS__, 'restrict_manage_users'), 0);
         }
     }
 }
Exemple #25
0
 /**
  * Delete meta keys
  *
  * @global type $wpdb
  * @param type $keys
  * @param type $post_id
  * @return type
  */
 static function delete_meta_key($keys, $post_id = null)
 {
     if (empty($keys) || !count($keys)) {
         return false;
     }
     global $wpdb;
     $extra = !empty($post_id) ? 'post_id = ' . esc_sql($post_id) . ' AND' : '';
     $sql = "DELETE FROM {$wpdb->postmeta} WHERE {$extra} meta_key IN (" . implode(', ', array_fill(0, count($keys), '%s')) . ")";
     // Call $wpdb->prepare passing the values of the array as separate arguments
     $query = call_user_func_array(array($wpdb, 'prepare'), array_merge(array($sql), $keys));
     $wpdb->query($query);
     // del all blog
     if (is_network_admin()) {
         // get list id blog all
         $list_prefix_musite = $wpdb->get_results("SELECT blog_id FROM {$wpdb->blogs}", ARRAY_A);
         if ($list_prefix_musite && count($list_prefix_musite) > 1) {
             foreach ($list_prefix_musite as $key => $value) {
                 if ($value['blog_id'] == 1) {
                     continue;
                 }
                 $prefix = $wpdb->prefix . $value['blog_id'] . '_';
                 $sql = "DELETE FROM {$prefix}postmeta WHERE {$extra} meta_key IN (" . implode(', ', array_fill(0, count($keys), '%s')) . ")";
                 // Call $wpdb->prepare passing the values of the array as separate arguments
                 $query = call_user_func_array(array($wpdb, 'prepare'), array_merge(array($sql), $keys));
                 $wpdb->query($query);
             }
         }
     }
 }
 /**
 		@brief		The uninstall form.
 		@since		2015-10-28 18:45:14
 	**/
 public function admin_uninstall()
 {
     $r = '';
     $form = $this->form2();
     $form->prefix(get_class($this));
     $form->markup('uninstall_info_1')->p_('This button will remove the database settings for the plugin packs themselves: list of activated plugins, license keys.');
     $form->markup('uninstall_info_2')->p_('To uninstall the settings for each pack plugin, use the plugin list bulk action.');
     $uninstall = $form->primary_button('uninstall')->value_('Uninstall the pack settings');
     if ($form->is_posting()) {
         $form->post();
         if ($uninstall->pressed()) {
             $this->uninstall_internal();
             $this->deactivate_me();
             if (is_network_admin()) {
                 $url = 'ms-admin.php';
             } else {
                 $url = 'index.php';
             }
             $this->message_('The plugin and all associated settings and database tables have been removed. Please %sfollow this link to complete the uninstallation procedure%s.', sprintf('<a href="%s" title="%s">', $url, $this->_('This link will take you to the index page')), '</a>');
             return;
         }
     }
     $r .= $form->open_tag();
     $r .= $form->display_form_table();
     $r .= $form->close_tag();
     echo $r;
 }
/**
 * Database changes required for Smart Coupons
 *
 * Add option 'smart_coupon_email_subject' if not exists
 * Enable 'Auto Generation' for Store Credit (discount_type: 'smart_coupon') not having any customer_email
 * Disable 'apply_before_tax' for all Store Credit (discount_type: 'smart_coupon')
 */
function smart_coupon_activate()
{
    global $wpdb, $blog_id;
    if (is_multisite()) {
        $blog_ids = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs}", 0);
    } else {
        $blog_ids = array($blog_id);
    }
    if (!get_option('smart_coupon_email_subject')) {
        add_option('smart_coupon_email_subject');
    }
    foreach ($blog_ids as $blog_id) {
        if (file_exists(WP_PLUGIN_DIR . '/woocommerce/woocommerce.php') && is_plugin_active('woocommerce/woocommerce.php')) {
            $wpdb_obj = clone $wpdb;
            $wpdb->blogid = $blog_id;
            $wpdb->set_prefix($wpdb->base_prefix);
            $query = "SELECT postmeta.post_id FROM {$wpdb->prefix}postmeta as postmeta WHERE postmeta.meta_key = 'discount_type' AND postmeta.meta_value = 'smart_coupon' AND postmeta.post_id IN\n\t\t\t\t\t(SELECT p.post_id FROM {$wpdb->prefix}postmeta AS p WHERE p.meta_key = 'customer_email' AND p.meta_value = 'a:0:{}') ";
            $results = $wpdb->get_col($query);
            foreach ($results as $result) {
                update_post_meta($result, 'auto_generate_coupon', 'yes');
            }
            // To disable apply_before_tax option for Gift Certificates / Store Credit.
            $post_id_tax_query = "SELECT post_id FROM {$wpdb->prefix}postmeta WHERE meta_key = 'discount_type' AND meta_value = 'smart_coupon'";
            $tax_post_ids = $wpdb->get_col($post_id_tax_query);
            foreach ($tax_post_ids as $tax_post_id) {
                update_post_meta($tax_post_id, 'apply_before_tax', 'no');
            }
            $wpdb = clone $wpdb_obj;
        }
    }
    if (!is_network_admin() && !isset($_GET['activate-multi'])) {
        set_transient('_smart_coupons_activation_redirect', 1, 30);
    }
}
/**
 * Query for XProfile groups and fields.
 *
 * @since 1.0.0
 *
 * @global object $profile_template
 * @see BP_XProfile_Group::get() for full description of `$args` array.
 *
 * @param array|string $args {
 *     Array of arguments. See BP_XProfile_Group::get() for full description. Those arguments whose defaults differ
 *     from that method are described here:
 *     @type string|array $member_type            Default: 'any'.
 *     @type bool         $hide_empty_groups      Default: true.
 *     @type bool         $hide_empty_fields      Defaults to true on the Dashboard, on a user's Edit Profile page,
 *                                                or during registration. Otherwise false.
 *     @type bool         $fetch_visibility_level Defaults to true when an admin is viewing a profile, or when a user is
 *                                                viewing her own profile, or during registration. Otherwise false.
 *     @type bool         $fetch_fields           Default: true.
 *     @type bool         $fetch_field_data       Default: true.
 * }
 *
 * @return bool
 */
function bp_has_profile($args = '')
{
    global $profile_template;
    // Only show empty fields if we're on the Dashboard, or we're on a user's
    // profile edit page, or this is a registration page.
    $hide_empty_fields_default = !is_network_admin() && !is_admin() && !bp_is_user_profile_edit() && !bp_is_register_page();
    // We only need to fetch visibility levels when viewing your own profile.
    if (bp_is_my_profile() || bp_current_user_can('bp_moderate') || bp_is_register_page()) {
        $fetch_visibility_level_default = true;
    } else {
        $fetch_visibility_level_default = false;
    }
    // Parse arguments.
    $r = bp_parse_args($args, array('user_id' => bp_displayed_user_id(), 'member_type' => 'any', 'profile_group_id' => false, 'hide_empty_groups' => true, 'hide_empty_fields' => $hide_empty_fields_default, 'fetch_fields' => true, 'fetch_field_data' => true, 'fetch_visibility_level' => $fetch_visibility_level_default, 'exclude_groups' => false, 'exclude_fields' => false, 'update_meta_cache' => true), 'has_profile');
    // Populate the template loop global.
    $profile_template = new BP_XProfile_Data_Template($r);
    /**
     * Filters whether or not a group has a profile to display.
     *
     * @since 1.1.0
     * @since 2.6.0 Added the `$r` parameter.
     *
     * @param bool   $has_groups       Whether or not there are group profiles to display.
     * @param string $profile_template Current profile template being used.
     * @param array  $r                Array of arguments passed into the BP_XProfile_Data_Template class.
     */
    return apply_filters('bp_has_profile', $profile_template->has_groups(), $profile_template, $r);
}
 /**
  * Show a form where users can enter their license key
  * Takes Multisites into account
  *
  * @param bool $embedded
  * @return null
  */
 public function show_license_form($embedded = true)
 {
     // For non-multisites, always show the license form
     if (!is_multisite()) {
         parent::show_license_form($embedded);
         return;
     }
     // Plugin is network activated
     if ($this->is_network_activated) {
         // We're on the network admin
         if (is_network_admin()) {
             parent::show_license_form($embedded);
         } else {
             // We're not in the network admin area, show a notice
             parent::show_license_form_heading();
             if (is_super_admin()) {
                 echo "<p>" . sprintf(__('%s is network activated, you can manage your license in the <a href="%s">network admin license page</a>.', $this->product->get_text_domain()), $this->product->get_item_name(), $this->product->get_license_page_url()) . "</p>";
             } else {
                 echo "<p>" . sprintf(__('%s is network activated, please contact your site administrator to manage the license.', $this->product->get_text_domain()), $this->product->get_item_name()) . "</p>";
             }
         }
     } else {
         if (false == is_network_admin()) {
             parent::show_license_form($embedded);
         }
     }
 }
 function save()
 {
     global $wpdb;
     $defaults = array('ID' => null, 'blog_id' => is_network_admin() ? 0 : get_current_blog_id(), 'author' => wp_get_current_user()->ID, 'summary' => null, 'visibility' => 'inactive', 'type' => 'notfication_rule', 'created' => current_time('mysql', 1));
     $data = $this->to_array();
     $record = array_intersect_key($data, $defaults);
     if ($this->exists()) {
         $before = new WP_Stream_Notification_Rule($this->ID);
         // update `created` to current date if needed
         if ($before->visibility === 'inactive' || $this->visibility === 'inactive') {
             $record['created'] = $defaults['created'];
         }
         $result = $wpdb->update($wpdb->stream, $record, array('ID' => $this->ID));
         // cache ok, db call ok
         $success = false !== $result;
     } else {
         if (!$record['created']) {
             unset($record['created']);
         }
         $record = wp_parse_args($record, $defaults);
         $result = $wpdb->insert($wpdb->stream, $record);
         // cache ok, db call ok
         $success = is_int($result);
         if ($success) {
             $this->ID = $wpdb->insert_id;
             // cache ok, db call ok
         }
     }
     if ($this->ID) {
         $meta_keys = array('triggers', 'groups', 'alerts');
         $meta = array_intersect_key($data, array_flip($meta_keys));
         update_site_option('stream_notifications_' . $this->ID, $meta);
     }
     return $success;
 }