function degg_remove_notifications()
{
    if (!current_user_can('edit_dashboard')) {
        delete_site_transient('update_core');
        remove_action('admin_init', '_maybe_update_core');
        remove_action('wp_version_check', 'wp_version_check');
        wp_clear_scheduled_hook('wp_version_check');
        remove_action('init', 'wp_schedule_update_checks');
        delete_site_transient('update_plugins');
        remove_action('admin_init', '_maybe_update_plugins');
        remove_action('load-plugins.php', 'wp_update_plugins');
        remove_action('load-update-core.php', 'wp_update_plugins');
        remove_action('load-update.php', 'wp_update_plugins');
        remove_action('wp_update_plugins', 'wp_update_plugins');
        wp_clear_scheduled_hook('wp_update_plugins');
        delete_site_transient('update_themes');
        remove_action('admin_init', '_maybe_update_themes');
        remove_action('load-themes.php', 'wp_update_themes');
        remove_action('load-update-core.php', 'wp_update_themes');
        remove_action('load-update.php', 'wp_update_themes');
        remove_action('wp_update_themes', 'wp_update_themes');
        wp_clear_scheduled_hook('wp_update_themes');
        add_action('admin_print_styles', 'degg_admin_editor_styles');
    }
}
Example #2
0
 function delete_transients()
 {
     delete_site_transient('update_plugins');
     delete_site_transient($this->config['slug'] . '_new_version');
     delete_site_transient($this->config['slug'] . '_github_data');
     delete_site_transient($this->config['slug'] . '_changelog');
 }
 /**
  * {@inheritdoc}
  * @internal
  */
 public function _get_framework_latest_version($force_check)
 {
     $user_slash_repo = fw()->manifest->get($this->manifest_key);
     if (empty($user_slash_repo)) {
         return false;
     }
     if (!preg_match($this->manifest_key_regex, $user_slash_repo)) {
         return new WP_Error('fw_ext_update_github_framework_manifest_invalid', __('Framework manifest has invalid "github_update" parameter. Please use "user/repo" format.', 'fw'));
     }
     $theme_id = preg_replace('[^a-z0-9_]', '_', fw()->theme->manifest->get_id());
     $transient_id = 'fw_ext_update_gh_' . $theme_id . '_fw';
     // this should be 45 characters or less
     if ($force_check) {
         delete_site_transient($transient_id);
     } else {
         $cache = get_site_transient($transient_id);
         if ($cache !== false && isset($cache[$user_slash_repo])) {
             return $cache[$user_slash_repo];
         }
     }
     $latest_version = $this->fetch_latest_version($user_slash_repo);
     if (empty($latest_version)) {
         return new WP_Error(sprintf(__('Failed to fetch framework latest version from github "%s".', 'fw'), $user_slash_repo));
     }
     if (is_wp_error($latest_version)) {
         return $latest_version;
     }
     set_site_transient($transient_id, array($user_slash_repo => $latest_version), $this->transient_expiration);
     return $latest_version;
 }
 static function uninstall()
 {
     global $wpdb;
     if (is_multisite()) {
         // Cleanup Network install
         foreach (wp_get_sites(array('limit' => apply_filters('gadwp_sites_limit', 100))) as $blog) {
             switch_to_blog($blog['blog_id']);
             $sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_gadash%%'");
             $sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_timeout_gadash%%'");
             $sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_ga_dash%%'");
             $sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_timeout_ga_dash%%'");
             delete_option('gadash_options');
             delete_transient('ga_dash_lasterror');
             delete_transient('ga_dash_refresh_token');
             delete_transient('ga_dash_gapi_errors');
             restore_current_blog();
         }
         delete_site_option('gadash_network_options');
         delete_site_transient('ga_dash_refresh_token');
     } else {
         // Cleanup Single install
         $sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_gadash%%'");
         $sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_timeout_gadash%%'");
         $sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_ga_dash%%'");
         $sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_timeout_ga_dash%%'");
         delete_option('gadash_options');
         delete_transient('ga_dash_lasterror');
         delete_transient('ga_dash_refresh_token');
         delete_transient('ga_dash_gapi_errors');
     }
 }
 public function after_switch_theme()
 {
     // clean theme updates cache
     delete_site_transient('update_themes');
     // ping to api server
     self::api_request('ping');
 }
Example #6
0
/**
 * AJAX Helper to delete our transient when a widget is saved
 */
function wds_ajax_wds_reset_transient()
{
    // Delete our footer transient.  This runs when a widget is saved or updated.  Only do this if our nonce is passed.
    if (!empty($_REQUEST['wds-widget-nonce'])) {
        delete_site_transient('wds_footer_widgets');
    }
}
Example #7
0
 /**
  * Register plugin/theme update.
  *
  * @param string $name
  * @param string $type
  * @param string $remote
  * @param array  $options
  */
 public function register($name, $type, $remote, array $options = array())
 {
     $options = array_merge(compact('name', 'type', 'remote'), $options);
     if (!isset($options['id'])) {
         $options['id'] = $type == 'plugin' ? "{$name}/{$name}.php" : $name;
     }
     if ($type == 'plugin') {
         $this->plugins[$name] = $options;
     } else {
         $this->themes[$name] = $options;
     }
     // check expiration
     if (isset($options['expiration'])) {
         $timeout = $options['expiration'];
         if ($type == 'plugin' and $transient = get_site_transient('update_plugins') and isset($transient->response[$options['id']], $transient->last_checked)) {
             if (time() - $transient->last_checked > $timeout) {
                 delete_site_transient('update_plugins');
             }
         }
         if ($type == 'theme' and $transient = get_site_transient('update_themes') and isset($transient->response[$options['id']], $transient->last_checked)) {
             if (time() - $transient->last_checked > $timeout) {
                 delete_site_transient('update_themes');
             }
         }
     }
 }
Example #8
0
 /**
  * Execute module upgrade
  *
  * @return void
  */
 public function execute_upgrade()
 {
     global $itsec_old_version;
     if ($itsec_old_version < 4036) {
         delete_site_transient('itsec_online_files_remote_checksums');
     }
 }
 protected function update($version, $locale)
 {
     $args = $this->input();
     $version = isset($args['version']) ? $args['version'] : false;
     $locale = isset($args['locale']) ? $args['locale'] : get_locale();
     include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
     delete_site_transient('update_core');
     wp_version_check(array(), true);
     if ($version) {
         $update = find_core_update($version, $locale);
     } else {
         $update = $this->find_latest_update_offer();
     }
     /**
      * Pre-upgrade action
      * 
      * @since 3.9.3
      * 
      * @param object|array $update as returned by find_core_update() or find_core_auto_update()
      */
     do_action('jetpack_pre_core_upgrade', $update);
     $skin = new Automatic_Upgrader_Skin();
     $upgrader = new Core_Upgrader($skin);
     $this->new_version = $upgrader->upgrade($update);
     $this->log = $upgrader->skin->get_upgrade_messages();
     if (is_wp_error($this->new_version)) {
         return $this->new_version;
     }
     return $this->new_version;
 }
 /**
  * Retrieve the appropriate EP_HOST
  *
  * Looks at the defined EP_HOST or a backup global should the defined host failed.
  * Priority is given to the EP_HOST constand with the backups only used when needed.
  *
  * @since 1.6
  *
  * @global array $ep_backup_host   array of backup hosts
  *
  * @param bool   $force            Whether to force a new lookup or not
  * @param bool   $use_only_backups Forces the use of only the backup array, no others
  *
  * @return string|WP_Error the host to use or an error
  */
 public function get_ep_host($force = false, $use_only_backups = false)
 {
     global $ep_backup_host;
     // Delete the transient if we want to force a new good host lookup
     if (true === $force) {
         delete_site_transient('ep_last_good_host');
     }
     $last_good_host = get_site_transient('ep_last_good_host');
     if ($last_good_host) {
         return $last_good_host;
     }
     // If nothing is defined just return an error
     if (!defined('EP_HOST') && !$ep_backup_host) {
         return new WP_Error('elasticpress', __('No running host available.', 'elasticpress'));
     }
     $hosts = array();
     if (defined('EP_HOST') && false === $use_only_backups) {
         $hosts[] = EP_HOST;
     }
     // If no backups are defined just return the host
     if ($ep_backup_host && is_array($ep_backup_host)) {
         $hosts = array_merge($hosts, $ep_backup_host);
     }
     foreach ($hosts as $host) {
         if (true === ep_elasticsearch_alive($host)) {
             set_site_transient('ep_last_good_host', $host, apply_filters('ep_last_good_host_timeout', 3600));
             return $host;
         }
     }
     return new WP_Error('elasticpress', __('No running host available.', 'elasticpress'));
 }
Example #11
0
 public static function delete($backwpup_jobid)
 {
     if (empty($backwpup_jobid)) {
         $id = get_site_option('backwpup_cfg_easycronjobid');
     } else {
         $id = BackWPup_Option::get($backwpup_jobid, 'easycronjobid');
     }
     if (empty($id)) {
         return TRUE;
     }
     $message = self::query_api('delete', array('id' => $id));
     delete_site_transient('backwpup_easycron_' . $id);
     if ($message['status'] == 'success' && !empty($message['cron_job_id'])) {
         if (empty($backwpup_jobid)) {
             delete_site_option('backwpup_cfg_easycronjobid');
         } else {
             BackWPup_Option::delete($backwpup_jobid, 'easycronjobid');
         }
         return TRUE;
     } else {
         if ($message['error']['code'] == 25) {
             if (empty($backwpup_jobid)) {
                 delete_site_option('backwpup_cfg_easycronjobid');
             } else {
                 BackWPup_Option::delete($backwpup_jobid, 'easycronjobid');
             }
         }
     }
     return FALSE;
 }
/**
 * Unlink user callback in the database (ajax)
 */
function plugpress_unlink_callback()
{
    $option_name = 'plugpress_account_user';
    $transient_name = $option_name . '_check';
    $user = delete_site_option($option_name);
    $user_check = delete_site_transient($transient_name);
    die;
}
 protected function clear_ticketing_settings()
 {
     delete_option(self::WP_OPTION_KEY);
     // Clear transient API data
     delete_site_transient('ai1ec_api_feeds_subscriptions');
     delete_site_transient('ai1ec_api_subscriptions');
     delete_site_transient('ai1ec_api_features');
 }
 /**
  * We need to force WP to do an update check because WP won't recheck for updates unless the _site_transient_update_plugins transient has expired
  * i.e. if WP checked for updates within the past 12 hrs, it (probably!) won't recheck and therefore may not have the very latest data for our own plugin
  * Deleting the update_plugins transient will force WP to re-check for updates (so the transient can be re-inserted).
  * The re-insert is done in wp_update_plugins() which is called via the "load-update" (load-$page) action in admin.php
  * wp_update_plugins() is badly named - it really should be "wp_update_plugin_versions()" - it (possibly) updates the versions in the transient - it doesn't "update plugins"
  * What a horribly convoluted way of doing a simple task!
  *
  * TODO - will force a recheck of ALL plugins. We should try to force the re-check of only the plugin that instantiates this class
  */
 public function forceUpdate()
 {
     delete_site_transient('update_plugins');
     $nonce = wp_create_nonce("upgrade-plugin_{$this->slug}/{$this->slug}.php");
     $url = get_bloginfo('wpurl') . "/wp-admin/update.php?action=upgrade-plugin&plugin={$this->slug}/{$this->slug}.php&_wpnonce={$nonce}";
     header("Location: {$url}");
     exit;
 }
Example #15
0
 /**
  * Execute module deactivation
  *
  * @return void
  */
 public function execute_deactivate()
 {
     global $itsec_files;
     delete_site_transient('itsec_random_version');
     //Reset recommended file permissions
     @chmod(ITSEC_Lib::get_htaccess(), 0644);
     @chmod(ITSEC_Lib::get_config(), 0644);
 }
Example #16
0
/**
 * Remove a theme
 *
 * @since 2.8.0
 *
 * @param string $stylesheet Stylesheet of the theme to delete
 * @param string $redirect Redirect to page when complete.
 * @return mixed
 */
function delete_theme($stylesheet, $redirect = '') {
	global $wp_filesystem;

	if ( empty($stylesheet) )
		return false;

	ob_start();
	if ( empty( $redirect ) )
		$redirect = wp_nonce_url('themes.php?action=delete&stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet);
	if ( false === ($credentials = request_filesystem_credentials($redirect)) ) {
		$data = ob_get_contents();
		ob_end_clean();
		if ( ! empty($data) ){
			include_once( ABSPATH . 'wp-admin/admin-header.php');
			echo $data;
			include( ABSPATH . 'wp-admin/admin-footer.php');
			exit;
		}
		return;
	}

	if ( ! WP_Filesystem($credentials) ) {
		request_filesystem_credentials($url, '', true); // Failed to connect, Error and request again
		$data = ob_get_contents();
		ob_end_clean();
		if ( ! empty($data) ) {
			include_once( ABSPATH . 'wp-admin/admin-header.php');
			echo $data;
			include( ABSPATH . 'wp-admin/admin-footer.php');
			exit;
		}
		return;
	}

	if ( ! is_object($wp_filesystem) )
		return new WP_Error('fs_unavailable', __('Could not access filesystem.'));

	if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() )
		return new WP_Error('fs_error', __('Filesystem error.'), $wp_filesystem->errors);

	//Get the base plugin folder
	$themes_dir = $wp_filesystem->wp_themes_dir();
	if ( empty($themes_dir) )
		return new WP_Error('fs_no_themes_dir', __('Unable to locate WordPress theme directory.'));

	$themes_dir = trailingslashit( $themes_dir );
	$theme_dir = trailingslashit($themes_dir . $stylesheet);
	$deleted = $wp_filesystem->delete($theme_dir, true);

	if ( ! $deleted )
		return new WP_Error('could_not_remove_theme', sprintf(__('Could not fully remove the theme %s.'), $stylesheet) );

	// Force refresh of theme update information
	delete_site_transient('update_themes');

	return true;
}
function wptouch_pro_handle_activation()
{
    delete_site_transient('_wptouch_bncid_latest_version');
    global $wptouch_pro;
    if (!$wptouch_pro) {
        wptouch_pro_create_four_object();
    }
    $wptouch_pro->handle_activation();
}
 /**
  * Execute module deactivation
  *
  * @return void
  */
 public function execute_deactivate()
 {
     global $itsec_files;
     delete_site_transient('itsec_random_version');
     $config_rules[] = itsec_tweaks_Admin::build_wpconfig_rules(null, true);
     $itsec_files->set_wpconfig($config_rules);
     //Reset recommended file permissions
     @chmod(ITSEC_Lib::get_htaccess(), 0644);
     @chmod(ITSEC_Lib::get_config(), 0644);
 }
 public static function deleteTransient($sTransientKey)
 {
     global $_wp_using_ext_object_cache;
     $_bWpUsingExtObjectCacheTemp = $_wp_using_ext_object_cache;
     $_wp_using_ext_object_cache = false;
     self::$_bIsNetworkAdmin = isset(self::$_bIsNetworkAdmin) ? self::$_bIsNetworkAdmin : is_network_admin();
     $_vTransient = self::$_bIsNetworkAdmin ? delete_site_transient($sTransientKey) : delete_transient($sTransientKey);
     $_wp_using_ext_object_cache = $_bWpUsingExtObjectCacheTemp;
     return $_vTransient;
 }
Example #20
0
 /**
  * Delete a transient by name
  *
  * @return  bool
  */
 private function delete_transient($transient = '', $site_wide = false)
 {
     if (empty($transient)) {
         return false;
     }
     if (false !== $site_wide) {
         return delete_site_transient($transient);
     } else {
         return delete_transient($transient);
     }
 }
Example #21
0
/**
 * Save comment notification user meta data
 */
function cbent_macn_save_user_meta_data($user_id)
{
    if (!current_user_can('edit_user', $user_id)) {
        return false;
    }
    // Update user meta
    update_user_meta($user_id, 'cbnet_macn_comment_notify', isset($_POST['cbnet_macn_comment_notify']) ? true : false);
    // Delete transients
    delete_site_transient('cbnet_macn_moderation_email_addresses');
    delete_site_transient('cbnet_macn_notification_email_addresses');
}
Example #22
0
 /**
  * Validate data from HTML form
  */
 public function validate_options($input)
 {
     $input = wp_parse_args($input, $this->data->get_settings_page_data());
     delete_site_transient('update_plugins');
     // Force check. Regenerate package url for updater
     if (isset($_POST['reset'])) {
         $input = $this->data->get_default_settings_page_data();
         add_settings_error($this->settings_page_properties['menu_slug'], 'restore_defaults', __('Default options restored.', $this->textdomain), 'updated fade');
     }
     return $input;
 }
 function test_serialized_data()
 {
     $key = __FUNCTION__;
     $value = array('foo' => true, 'bar' => true);
     $this->assertTrue(set_site_transient($key, $value));
     $this->assertEquals($value, get_site_transient($key));
     $value = (object) $value;
     $this->assertTrue(set_site_transient($key, $value));
     $this->assertEquals($value, get_site_transient($key));
     $this->assertTrue(delete_site_transient($key));
 }
Example #24
0
 /**
  * Check updates
  */
 public function check_updates($force_check = false)
 {
     if ($force_check) {
         delete_site_transient('update_plugins');
         // Force check
     }
     // Insert custom plugins info to 'update_plugins" site transient
     add_filter('pre_set_site_transient_update_plugins', array($this, 'check_plugin'));
     // Define the alternative response for information checking
     add_filter('plugins_api', array($this, 'check_info'), 10, 3);
 }
 function version_requirement_actions()
 {
     $addon_requirement_check = get_option('wpsdb_addon_requirement_check', array());
     // we only want to delete the transients once, here we keep track of which versions we've checked
     if (!isset($addon_requirement_check[$this->plugin_slug]) || $addon_requirement_check[$this->plugin_slug] != $GLOBALS['wpsdb_meta'][$this->plugin_slug]['version']) {
         delete_site_transient('wpsdb_upgrade_data');
         delete_site_transient('update_plugins');
         $addon_requirement_check[$this->plugin_slug] = $GLOBALS['wpsdb_meta'][$this->plugin_slug]['version'];
         update_option('wpsdb_addon_requirement_check', $addon_requirement_check);
     }
     $this->version_requirement_warning();
 }
Example #26
0
 public function init()
 {
     require_once dirname(__FILE__) . '/settings.php';
     $show_sync = $GLOBALS['ithemes-sync-settings']->get_option('show_sync');
     if (is_array($show_sync)) {
         $show_sync = in_array(get_current_user_id(), $show_sync);
     }
     if (!$show_sync && current_user_can('manage_options')) {
         $user_id = get_current_user_id();
         if (isset($_GET['ithemes-sync-force-display'])) {
             if (!empty($_GET['ithemes-sync-force-display'])) {
                 $show_sync = true;
                 set_site_transient("ithemes-sync-force-display-{$user_id}", true, 600);
                 add_action('all_admin_notices', array($this, 'show_force_display_notice'), 0);
             } else {
                 delete_site_transient("ithemes-sync-force-display-{$user_id}");
                 add_action('all_admin_notices', array($this, 'show_force_display_disable_notice'), 0);
             }
         } else {
             if (false !== get_site_transient("ithemes-sync-force-display-{$user_id}")) {
                 $show_sync = true;
                 add_action('all_admin_notices', array($this, 'show_force_display_notice'), 0);
             }
         }
     }
     if ($show_sync) {
         if (!is_multisite() || is_super_admin()) {
             add_action('admin_menu', array($this, 'add_admin_pages'));
         }
         add_action('network_admin_menu', array($this, 'add_network_admin_pages'));
         if (current_user_can('manage_options')) {
             if (!get_site_option('ithemes-sync-authenticated') && (empty($_GET['page']) || $this->page_name != $_GET['page']) && !get_site_option('ithemes_sync_hide_authenticate_notice')) {
                 require_once dirname(__FILE__) . '/functions.php';
                 $path_url = Ithemes_Sync_Functions::get_url(dirname(__FILE__));
                 wp_enqueue_style('ithemes-updater-admin-notice-style', "{$path_url}/css/admin-notice.css");
                 wp_enqueue_script('ithemes-updater-admin-notice-script', "{$path_url}/js/admin-notice.js", array('jquery'));
                 add_action('all_admin_notices', array($this, 'show_authenticate_notice'), 0);
                 delete_site_transient('ithemes-sync-activated');
             } else {
                 if (!empty($_GET['activate']) && get_site_transient('ithemes-sync-activated')) {
                     require_once dirname(__FILE__) . '/functions.php';
                     $path_url = Ithemes_Sync_Functions::get_url(dirname(__FILE__));
                     wp_enqueue_style('ithemes-updater-admin-notice-style', "{$path_url}/css/admin-notice.css");
                     wp_enqueue_script('ithemes-updater-admin-notice-script', "{$path_url}/js/admin-notice.js", array('jquery'));
                     add_action('all_admin_notices', array($this, 'show_activate_notice'), 0);
                     delete_site_transient('ithemes-sync-activated');
                 }
             }
         }
     } else {
         add_action('load-plugins.php', array($this, 'modify_plugins_page'));
     }
 }
 /**
  * Processes and sends daily digest message
  *
  * @since 4.5
  *
  * @return void
  */
 public function init()
 {
     if (is_404() || (!defined('ITSEC_NOTIFY_USE_CRON') || false === ITSEC_NOTIFY_USE_CRON) && get_site_transient('itsec_notification_running') !== false) {
         return;
     }
     if (!defined('ITSEC_NOTIFY_USE_CRON') || false === ITSEC_NOTIFY_USE_CRON) {
         set_site_transient('itsec_notification_running', true, 3600);
     }
     $result = $this->send_daily_digest();
     delete_site_transient('itsec_notification_running');
     return $result;
 }
Example #28
0
/**
 * Return an array of installed plugins
 *
 * @return array
 */
function _wprp_get_plugins()
{
    require_once ABSPATH . '/wp-admin/includes/plugin.php';
    // Get all plugins
    $plugins = get_plugins();
    // Get the list of active plugins
    $active = get_option('active_plugins', array());
    // Delete the transient so wp_update_plugins can get fresh data
    if (function_exists('get_site_transient')) {
        delete_site_transient('update_plugins');
    } else {
        delete_transient('update_plugins');
    }
    // Force a plugin update check
    wp_update_plugins();
    // Different versions of wp store the updates in different places
    // TODO can we depreciate
    if (function_exists('get_site_transient') && ($transient = get_site_transient('update_plugins'))) {
        $current = $transient;
    } elseif ($transient = get_transient('update_plugins')) {
        $current = $transient;
    } else {
        $current = get_option('update_plugins');
    }
    // Premium plugins that have adopted the ManageWP API report new plugins by this filter
    $manage_wp_updates = apply_filters('mwp_premium_update_notification', array());
    foreach ((array) $plugins as $plugin_file => $plugin) {
        if (is_plugin_active($plugin_file)) {
            $plugins[$plugin_file]['active'] = true;
        } else {
            $plugins[$plugin_file]['active'] = false;
        }
        $manage_wp_plugin_update = false;
        foreach ($manage_wp_updates as $manage_wp_update) {
            if (!empty($manage_wp_update['Name']) && $plugin['Name'] == $manage_wp_update['Name']) {
                $manage_wp_plugin_update = $manage_wp_update;
            }
        }
        if ($manage_wp_plugin_update) {
            $plugins[$plugin_file]['latest_version'] = $manage_wp_plugin_update['new_version'];
        } else {
            if (isset($current->response[$plugin_file])) {
                $plugins[$plugin_file]['latest_version'] = $current->response[$plugin_file]->new_version;
                $plugins[$plugin_file]['latest_package'] = $current->response[$plugin_file]->package;
                $plugins[$plugin_file]['slug'] = $current->response[$plugin_file]->slug;
            } else {
                $plugins[$plugin_file]['latest_version'] = $plugin['Version'];
            }
        }
    }
    return $plugins;
}
Example #29
0
function bp_loader_activate() {
	/* Force refresh theme roots. */
	delete_site_transient( 'theme_roots' );

	/* Switch the user to the new bp-default if they are using the old bp-default on activation. */
	if ( 'bp-sn-parent' == get_blog_option( BP_ROOT_BLOG, 'template' ) && 'bp-default' == get_blog_option( BP_ROOT_BLOG, 'stylesheet' ) )
		switch_theme( 'bp-default', 'bp-default' );

	/* Install site options on activation */
	bp_core_activate_site_options( array( 'bp-disable-account-deletion' => 0, 'bp-disable-avatar-uploads' => 0, 'bp-disable-blogforum-comments' => 0,  'bp-disable-forum-directory' => 0,  'bp-disable-profile-sync' => 0 ) );

	do_action( 'bp_loader_activate' );
}
 public function upgrade($plugin, $url)
 {
     $this->init();
     $this->upgrade_strings();
     add_filter('upgrader_pre_install', array(&$this, 'deactivate_plugin_before_upgrade'), 10, 2);
     add_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'), 10, 4);
     // inject our certificate, in case we are on machine w/o CA
     add_action('http_api_curl', array(Ai1ec_Http_Utility::instance(), 'curl_inject_certificate'));
     $this->run(array('package' => $url, 'destination' => WP_PLUGIN_DIR, 'clear_destination' => true, 'clear_working' => true, 'hook_extra' => array('plugin' => $plugin)));
     // Cleanup our hooks, in case something else does an upgrade on
     // this connection.
     remove_filter('upgrader_pre_install', array(&$this, 'deactivate_plugin_before_upgrade'));
     remove_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'));
     if (!$this->result || is_wp_error($this->result)) {
         return $this->result;
     }
     // Force refresh of plugin update information
     delete_site_transient('update_plugins');
     wp_cache_delete('plugins', 'plugins');
     // activate the plugin
     activate_plugin($plugin);
     echo '<p>Plugin activated.</p>';
     echo '<a href="' . admin_url('index.php') . '">Continue Here</a>';
     return true;
 }