本文整理汇总了PHP中wp_clean_themes_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_clean_themes_cache函数的具体用法?PHP wp_clean_themes_cache怎么用?PHP wp_clean_themes_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_clean_themes_cache函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: tearDown
function tearDown()
{
remove_filter('extra_theme_headers', array($this, '_theme_data_extra_headers'));
wp_clean_themes_cache();
unset($GLOBALS['wp_themes']);
parent::tearDown();
}
开发者ID:Benrajalu,项目名称:philRaj,代码行数:7,代码来源:theme.php
示例2: hooks_theme_install_or_update
/**
* @param Theme_Upgrader $upgrader
* @param array $extra
*/
public function hooks_theme_install_or_update($upgrader, $extra)
{
if (!isset($extra['type']) || 'theme' !== $extra['type']) {
return;
}
if ('install' === $extra['action']) {
$slug = $upgrader->theme_info();
if (!$slug) {
return;
}
wp_clean_themes_cache();
$theme = wp_get_theme($slug);
$name = $theme->name;
$version = $theme->version;
aal_insert_log(array('action' => 'installed', 'object_type' => 'Theme', 'object_name' => $name, 'object_subtype' => $version));
}
if ('update' === $extra['action']) {
if (isset($extra['bulk']) && true == $extra['bulk']) {
$slugs = $extra['themes'];
} else {
$slugs = array($upgrader->skin->theme);
}
foreach ($slugs as $slug) {
$theme = wp_get_theme($slug);
$stylesheet = $theme['Stylesheet Dir'] . '/style.css';
$theme_data = get_file_data($stylesheet, array('Version' => 'Version'));
$name = $theme['Name'];
$version = $theme_data['Version'];
aal_insert_log(array('action' => 'updated', 'object_type' => 'Theme', 'object_name' => $name, 'object_subtype' => $version));
}
}
}
开发者ID:leogopal,项目名称:wordpress-aryo-activity-log,代码行数:36,代码来源:class-aal-hook-theme.php
示例3: rollback
public function rollback($theme, $args = array())
{
$defaults = array('clear_update_cache' => true);
$parsed_args = wp_parse_args($args, $defaults);
$this->init();
$this->upgrade_strings();
if (0) {
$this->skin->before();
$this->skin->set_result(false);
$this->skin->error('up_to_date');
$this->skin->after();
return false;
}
$theme_slug = $this->skin->theme;
$theme_version = $this->skin->options['version'];
$download_endpoint = 'https://downloads.wordpress.org/theme/';
$url = $download_endpoint . $theme_slug . '.' . $theme_version . '.zip';
add_filter('upgrader_pre_install', array($this, 'current_before'), 10, 2);
add_filter('upgrader_post_install', array($this, 'current_after'), 10, 2);
add_filter('upgrader_clear_destination', array($this, 'delete_old_theme'), 10, 4);
//'source_selection' => array($this, 'source_selection'), //there's a trac ticket to move up the directory for zip's which are made a bit differently, useful for non-.org plugins.
$this->run(array('package' => $url, 'destination' => get_theme_root(), 'clear_destination' => true, 'clear_working' => true, 'hook_extra' => array('theme' => $theme, 'type' => 'theme', 'action' => 'update')));
remove_filter('upgrader_pre_install', array($this, 'current_before'));
remove_filter('upgrader_post_install', array($this, 'current_after'));
remove_filter('upgrader_clear_destination', array($this, 'delete_old_theme'));
if (!$this->result || is_wp_error($this->result)) {
return $this->result;
}
// Force refresh of theme update information
wp_clean_themes_cache($parsed_args['clear_update_cache']);
return true;
}
开发者ID:CoachBirgit,项目名称:WP-Rollback,代码行数:32,代码来源:class-rollback-theme-upgrader.php
示例4: tearDown
function tearDown()
{
$GLOBALS['wp_theme_directories'] = $this->orig_theme_dir;
remove_filter('theme_root', array(&$this, '_theme_root'));
wp_clean_themes_cache();
unset($GLOBALS['wp_themes']);
parent::tearDown();
}
开发者ID:rmccue,项目名称:wordpress-unit-tests,代码行数:8,代码来源:themeDirLarge.php
示例5: tearDown
function tearDown()
{
global $wp_theme_directories;
$wp_theme_directories = $this->wp_theme_directories;
remove_filter('extra_theme_headers', array($this, '_theme_data_extra_headers'));
wp_clean_themes_cache();
unset($GLOBALS['wp_themes']);
parent::tearDown();
}
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:9,代码来源:theme.php
示例6: tearDown
public function tearDown()
{
$GLOBALS['wp_theme_directories'] = $this->orig_theme_dir;
remove_filter('theme_root', array($this, 'filter_theme_root'));
remove_filter('stylesheet_root', array($this, 'filter_theme_root'));
remove_filter('template_root', array($this, 'filter_theme_root'));
wp_clean_themes_cache();
unset($GLOBALS['wp_themes']);
unset($GLOBALS['l10n']);
unset($GLOBALS['l10n_unloaded']);
parent::tearDown();
}
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:12,代码来源:loadTextdomainJustInTime.php
示例7: callback_upgrader_process_complete
/**
* Log plugin installations
*
* @action transition_post_status
*/
public static function callback_upgrader_process_complete($upgrader, $extra)
{
$logs = array();
$success = !is_wp_error($upgrader->skin->result);
$error = null;
if (!$success) {
$errors = $upgrader->skin->result->errors;
list($error) = reset($errors);
}
// This would have failed down the road anyway
if (!isset($extra['type'])) {
return false;
}
$type = $extra['type'];
$action = $extra['action'];
if (!in_array($type, array('plugin', 'theme'))) {
return;
}
if ('install' === $action) {
if ('plugin' === $type) {
$path = $upgrader->plugin_info();
if (!$path) {
return;
}
$data = get_plugin_data($upgrader->skin->result['local_destination'] . '/' . $path);
$slug = $upgrader->result['destination_name'];
$name = $data['Name'];
$version = $data['Version'];
} else {
// theme
$slug = $upgrader->theme_info();
if (!$slug) {
return;
}
wp_clean_themes_cache();
$theme = wp_get_theme($slug);
$name = $theme->name;
$version = $theme->version;
}
$action = 'installed';
$message = _x('Installed %1$s: %2$s %3$s', 'Plugin/theme installation. 1: Type (plugin/theme), 2: Plugin/theme name, 3: Plugin/theme version', 'stream');
$logs[] = compact('slug', 'name', 'version', 'message', 'action');
} elseif ('update' === $action) {
$action = 'updated';
$message = _x('Updated %1$s: %2$s %3$s', 'Plugin/theme update. 1: Type (plugin/theme), 2: Plugin/theme name, 3: Plugin/theme version', 'stream');
if ('plugin' === $type) {
if (isset($extra['bulk']) && true == $extra['bulk']) {
$slugs = $extra['plugins'];
} else {
$slugs = array($upgrader->skin->plugin);
}
$_plugins = self::get_plugins();
foreach ($slugs as $slug) {
$plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/' . $slug);
$name = $plugin_data['Name'];
$version = $plugin_data['Version'];
$old_version = $_plugins[$slug]['Version'];
$logs[] = compact('slug', 'name', 'old_version', 'version', 'message', 'action');
}
} else {
// theme
if (isset($extra['bulk']) && true == $extra['bulk']) {
$slugs = $extra['themes'];
} else {
$slugs = array($upgrader->skin->theme);
}
foreach ($slugs as $slug) {
$theme = wp_get_theme($slug);
$stylesheet = $theme['Stylesheet Dir'] . '/style.css';
$theme_data = get_file_data($stylesheet, array('Version' => 'Version'));
$name = $theme['Name'];
$old_version = $theme['Version'];
$version = $theme_data['Version'];
$logs[] = compact('slug', 'name', 'old_version', 'version', 'message', 'action');
}
}
} else {
return false;
}
$context = $type . 's';
foreach ($logs as $log) {
$name = isset($log['name']) ? $log['name'] : null;
$version = isset($log['version']) ? $log['version'] : null;
$slug = isset($log['slug']) ? $log['slug'] : null;
$old_version = isset($log['old_version']) ? $log['old_version'] : null;
$message = isset($log['message']) ? $log['message'] : null;
$action = isset($log['action']) ? $log['action'] : null;
self::log($message, compact('type', 'name', 'version', 'slug', 'success', 'error', 'old_version'), null, $context, $action);
}
}
开发者ID:johnleesw,项目名称:mustardseedwp,代码行数:95,代码来源:class-wp-stream-connector-installer.php
示例8: perform_auto_updates
/**
* Kicks off a upgrade request for each item in the upgrade "queue"
*/
static function perform_auto_updates()
{
$lock_name = 'auto_upgrader.lock';
if (get_site_option($lock_name)) {
// Test to see if it was set more than an hour ago, if so, cleanup.
if (get_site_option($lock_name) < time() - HOUR_IN_SECONDS) {
delete_site_option($lock_name);
} else {
// The process is already locked
return;
}
}
// Lock upgrades for us for half an hour
if (!add_site_option($lock_name, microtime(true), HOUR_IN_SECONDS / 2)) {
return;
}
// Don't automatically run these thins, as we'll handle it ourselves
remove_action('upgrader_process_complete', array('Language_Pack_Upgrader', 'async_upgrade'), 20, 3);
remove_action('upgrader_process_complete', 'wp_version_check');
remove_action('upgrader_process_complete', 'wp_update_plugins');
remove_action('upgrader_process_complete', 'wp_update_themes');
// Next, Plugins
wp_update_plugins();
// Check for Plugin updates
$plugin_updates = get_site_transient('update_plugins');
if ($plugin_updates && !empty($plugin_updates->response)) {
foreach (array_keys($plugin_updates->response) as $plugin) {
self::upgrade('plugin', $plugin);
}
// Force refresh of plugin update information
wp_clean_plugins_cache();
}
// Next, those themes we all love
wp_update_themes();
// Check for Theme updates
$theme_updates = get_site_transient('update_themes');
if ($theme_updates && !empty($theme_updates->response)) {
foreach (array_keys($theme_updates->response) as $theme) {
self::upgrade('theme', $theme);
}
// Force refresh of theme update information
wp_clean_themes_cache();
}
// Next, Process any core upgrade
wp_version_check();
// Check for Core updates
$core_update = find_core_auto_update();
if ($core_update) {
self::upgrade('core', $core_update);
delete_site_transient('update_core');
}
// Cleanup, and check for any pending translations
wp_version_check();
// check for Core updates
wp_update_themes();
// Check for Theme updates
wp_update_plugins();
// Check for Plugin updates
// Finally, Process any new translations
$language_updates = wp_get_translation_updates();
if ($language_updates) {
foreach ($language_updates as $update) {
self::upgrade('language', $update);
}
// Clear existing caches
wp_clean_plugins_cache();
wp_clean_themes_cache();
delete_site_transient('update_core');
wp_version_check();
// check for Core updates
wp_update_themes();
// Check for Theme updates
wp_update_plugins();
// Check for Plugin updates
}
/**
* Filter whether to email an update summary to the site administrator.
*
* @since 3.7.0
*
* @param bool Whether or not email should be sent to administrator. Default true.
* @param bool|array $core_update An array of core update data, false otherwise.
* @param object $theme_updates Object containing theme update properties.
* @param object $plugin_updates Object containing plugin update properties.
* @param array $language_updates Array containing the Language updates available.
* @param array $upgrade_results Array of the upgrade results keyed by upgrade type, and plugin/theme slug.
*/
if (apply_filters('enable_auto_upgrade_email', true, $core_update, $theme_updates, $plugin_updates, $language_updates, self::$upgrade_results)) {
self::send_email();
}
// Clear the lock
delete_site_option($lock_name);
}
开发者ID:openify,项目名称:wordpress-composer,代码行数:96,代码来源:class-wp-upgrader.php
示例9: languages_page
public function languages_page()
{
// prepare the list of tabs
$tabs = array('lang' => __('Languages', 'polylang'));
// only if at least one language has been created
if ($listlanguages = $this->model->get_languages_list()) {
$tabs['strings'] = __('Strings translation', 'polylang');
$tabs['settings'] = __('Settings', 'polylang');
}
// allows plugins to add tabs
$tabs = apply_filters('pll_settings_tabs', $tabs);
switch ($this->active_tab) {
case 'lang':
// prepare the list table of languages
$list_table = new PLL_Table_Languages();
$list_table->prepare_items($listlanguages);
break;
case 'strings':
// get the strings to translate
$data = PLL_Admin_Strings::get_strings();
// get the groups
foreach ($data as $key => $row) {
$groups[] = $row['context'];
}
$groups = array_unique($groups);
$selected = empty($_GET['group']) || !in_array($_GET['group'], $groups) ? -1 : $_GET['group'];
$s = empty($_GET['s']) ? '' : wp_unslash($_GET['s']);
// filter for search string
foreach ($data as $key => $row) {
if (-1 != $selected && $row['context'] != $selected || !empty($s) && stripos($row['name'], $s) === false && stripos($row['string'], $s) === false) {
unset($data[$key]);
}
}
// load translations
foreach ($listlanguages as $language) {
// filters by language if requested
if (($lg = get_user_meta(get_current_user_id(), 'pll_filter_content', true)) && $language->slug != $lg) {
continue;
}
$mo = new PLL_MO();
$mo->import_from_db($language);
foreach ($data as $key => $row) {
$data[$key]['translations'][$language->slug] = $mo->translate($row['string']);
$data[$key]['row'] = $key;
// store the row number for convenience
}
}
// get an array with language slugs as keys, names as values
$languages = array_combine(wp_list_pluck($listlanguages, 'slug'), wp_list_pluck($listlanguages, 'name'));
$string_table = new PLL_Table_String(compact('languages', 'groups', 'selected'));
$string_table->prepare_items($data);
break;
case 'settings':
$post_types = get_post_types(array('public' => true, '_builtin' => false));
$post_types = array_diff($post_types, get_post_types(array('_pll' => true)));
$post_types = array_unique(apply_filters('pll_get_post_types', $post_types, true));
$taxonomies = get_taxonomies(array('public' => true, '_builtin' => false));
$taxonomies = array_diff($taxonomies, get_taxonomies(array('_pll' => true)));
$taxonomies = array_unique(apply_filters('pll_get_taxonomies', $taxonomies, true));
break;
}
$action = isset($_REQUEST['pll_action']) ? $_REQUEST['pll_action'] : '';
switch ($action) {
case 'add':
check_admin_referer('add-lang', '_wpnonce_add-lang');
if ($this->model->add_language($_POST) && 'en_US' != $_POST['locale']) {
// attempts to install the language pack
require_once ABSPATH . 'wp-admin/includes/translation-install.php';
if (!wp_download_language_pack($_POST['locale'])) {
add_settings_error('general', 'pll_download_mo', __('The language was created, but the WordPress language file was not downloaded. Please install it manually.', 'polylang'));
}
// force checking for themes and plugins translations updates
wp_clean_themes_cache();
wp_clean_plugins_cache();
}
self::redirect();
// to refresh the page ( possible thanks to the $_GET['noheader']=true )
break;
case 'delete':
check_admin_referer('delete-lang');
if (!empty($_GET['lang'])) {
$this->model->delete_language((int) $_GET['lang']);
}
self::redirect();
// to refresh the page ( possible thanks to the $_GET['noheader']=true )
break;
case 'edit':
if (!empty($_GET['lang'])) {
$edit_lang = $this->model->get_language((int) $_GET['lang']);
}
break;
case 'update':
check_admin_referer('add-lang', '_wpnonce_add-lang');
$error = $this->model->update_language($_POST);
self::redirect();
// to refresh the page ( possible thanks to the $_GET['noheader']=true )
break;
case 'default-lang':
check_admin_referer('default-lang');
if ($lang = $this->model->get_language((int) $_GET['lang'])) {
//.........这里部分代码省略.........
开发者ID:britwayresources,项目名称:website,代码行数:101,代码来源:settings.php
示例10: wp_install_themes
function wp_install_themes($array)
{
require_once $this->data['dir'] . '/wp-admin/includes/class-wp-upgrader.php';
global $WPQI_Installer_Skin;
$WPQI_Installer_Skin();
$first = true;
foreach ($array as $name) {
if (!$name) {
continue;
}
$is_url = preg_match("/^(http|https):\\/\\//i", $name);
$url = $is_url ? $name : "https://downloads.wordpress.org/theme/{$name}.zip";
$upgrader = new Theme_Upgrader(new WPQI_Installer_Skin());
$upgrader->install($url);
if ($first) {
switch_theme($name);
$first = false;
}
}
wp_clean_themes_cache();
}
开发者ID:pravdomil,项目名称:WP-Quick-Install,代码行数:21,代码来源:wp-quick-install.php
示例11: get_selected_theme
/**
* Get theme details
**/
function get_selected_theme($theme_name, $newsletter_id = false)
{
global $wp_theme_directories;
$added = 0;
if (!in_array($this->template_custom_directory, $wp_theme_directories)) {
$added = 1;
register_theme_directory($this->template_custom_directory);
}
if (!in_array($this->template_directory, $wp_theme_directories)) {
$added = 1;
register_theme_directory($this->template_directory);
}
//cheating message fix
if ($added) {
wp_clean_themes_cache();
}
$theme = wp_get_theme($theme_name);
if ($theme->exists()) {
$template = $this->get_theme_dir_url($theme, $theme_name);
//load theme options
if ($this->loaded_theme_options != $template['dir']) {
$this->loaded_theme_options = $template['dir'];
if (file_exists($template['dir'] . 'functions.php')) {
include $template['dir'] . 'functions.php';
} elseif (file_exists($template['dir'] . 'index.php')) {
include $template['dir'] . 'index.php';
}
}
$styles = $this->get_contents_elements($template['dir'], 0);
$return = array('url' => $template['url'], 'dir' => $template['dir'], 'Stylesheet' => $theme['Stylesheet'], 'Template' => $theme['Template'], 'Status' => $theme['Status'], 'Style' => $styles['default_style'] . $styles['style']);
return $return;
} else {
if ($theme_name != 'iletter') {
if ($newsletter_id) {
global $wpdb;
$query = $wpdb->prepare("UPDATE {$this->tb_prefix}enewsletter_newsletters\r\r\n SET template = %s\r\r\n WHERE newsletter_id = %d", 'iletter', $newsletter_id);
$wpdb->query($query);
}
return $this->get_selected_theme('iletter');
}
}
return false;
}
开发者ID:VLabsInc,项目名称:WordPressPlatforms,代码行数:46,代码来源:class.functions.php
示例12: upgrade_bsf_product
function upgrade_bsf_product($request_product_id, $bundled_id)
{
global $bsf_product_validate_url, $bsf_support_url;
if (!current_user_can('update_plugins')) {
wp_die(__('You do not have sufficient permissions to update plugins for this site.', 'bsf'));
}
$brainstrom_users = get_option('brainstrom_users') ? get_option('brainstrom_users') : array();
$brainstrom_products = get_option('brainstrom_products') ? get_option('brainstrom_products') : array();
$brainstrom_bundled_products = get_option('brainstrom_bundled_products') ? get_option('brainstrom_bundled_products') : array();
$plugins = $themes = $mix = array();
if (!empty($brainstrom_products)) {
$plugins = isset($brainstrom_products['plugins']) ? $brainstrom_products['plugins'] : array();
$themes = isset($brainstrom_products['themes']) ? $brainstrom_products['themes'] : array();
}
$mix = array_merge($plugins, $themes);
$bsf_username = $purchase_key = $type = $template = $name = '';
if (!empty($brainstrom_users)) {
foreach ($brainstrom_users as $bsf_user) {
$bsf_username = $bsf_user['email'];
}
}
$found_in_bsf_products = false;
if ($bundled_id !== false) {
$product_details_id = $bundled_id;
} else {
$product_details_id = $request_product_id;
}
foreach ($mix as $key => $product) {
$pid = $product['id'];
if ($pid === $product_details_id) {
$purchase_key = $product['purchase_key'];
$type = $product['type'];
$template = $product['template'];
$name = $product['product_name'];
$found_in_bsf_products = true;
break;
}
}
if ($bundled_id !== false) {
if (!empty($brainstrom_bundled_products)) {
foreach ($brainstrom_bundled_products as $bp) {
if ($bp->id === $request_product_id) {
$type = $bp->type;
$template = $bp->init;
$name = $bp->name;
}
}
}
}
if ($bsf_username === '' || $purchase_key === '' || $request_product_id === '') {
wp_die('Not valid to update product');
}
$path = base64_decode($bsf_product_validate_url);
$data = array('action' => 'bsf_product_update_request', 'id' => $request_product_id, 'username' => $bsf_username, 'purchase_key' => $purchase_key, 'site_url' => get_site_url(), 'bundled' => $bundled_id);
$request = @wp_remote_post($path, array('body' => $data, 'timeout' => '60', 'sslverify' => false));
if (!is_wp_error($request) || wp_remote_retrieve_response_code($request) === 200) {
$result = json_decode($request['body']);
if (isset($result->error) && !$result->error) {
$download_path = $result->update_data->download_url;
$timezone = date_default_timezone_get();
$call = 'file=' . $download_path . '&hashtime=' . strtotime(date('d-m-Y h:i:s a')) . '&timezone=' . $timezone;
$hash = base64_encode($call);
$parse = parse_url($path);
$download = $parse['scheme'] . '://' . $parse['host'];
$get_path = 'http://downloads.brainstormforce.com/';
$download_path = rtrim($get_path, '/') . '/download.php?hash=' . $hash;
//echo $download_path;
//die();
require_once ABSPATH . '/wp-admin/includes/file.php';
WP_Filesystem();
global $wp_filesystem;
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
$WP_Upgrader = new WP_Upgrader();
$res = $WP_Upgrader->fs_connect(array(WP_CONTENT_DIR));
if (!$res) {
wp_die(new WP_Error('Server error', __("Error! Can't connect to filesystem", 'bsf')));
} else {
$upgrade_folder = $wp_filesystem->wp_content_dir() . 'upgrade_tmp/bsf_package';
$package_filename = basename($download_path);
$plugin_folder = dirname($template);
if ($type === 'theme' && $bundled_id === false) {
$defaults = array('clear_update_cache' => true);
$args = array();
$parsed_args = wp_parse_args($args, $defaults);
$Theme_Upgrader = new Theme_Upgrader();
$Theme_Upgrader->init();
$Theme_Upgrader->upgrade_strings();
$Theme_Upgrader->strings['downloading_package'] = __('Downloading package from Server', 'bsf');
add_filter('upgrader_pre_install', array(&$Theme_Upgrader, 'current_before'), 10, 2);
add_filter('upgrader_post_install', array(&$Theme_Upgrader, 'current_after'), 10, 2);
add_filter('upgrader_clear_destination', array(&$Theme_Upgrader, 'delete_old_theme'), 10, 4);
$Theme_Upgrader->run(array('package' => $download_path, 'destination' => get_theme_root($template), 'clear_destination' => false, 'abort_if_destination_exists' => false, 'clear_working' => true, 'hook_extra' => array('theme' => $template, 'type' => 'theme', 'action' => 'update')));
remove_filter('upgrader_pre_install', array(&$Theme_Upgrader, 'current_before'));
remove_filter('upgrader_post_install', array(&$Theme_Upgrader, 'current_after'));
remove_filter('upgrader_clear_destination', array(&$Theme_Upgrader, 'delete_old_theme'));
if (!$Theme_Upgrader->result || is_wp_error($Theme_Upgrader->result)) {
return $Theme_Upgrader->result;
}
wp_clean_themes_cache($parsed_args['clear_update_cache']);
$response = array('status' => true, 'type' => 'theme', 'name' => $name);
//.........这里部分代码省略.........
开发者ID:jfitzsimmons,项目名称:soundtrackforspace,代码行数:101,代码来源:admin-functions.php
示例13: handle_actions
/**
* Manages the user input for the languages pages
*
* @since 1.9
*
* @param string $action
*/
public function handle_actions($action)
{
switch ($action) {
case 'add':
check_admin_referer('add-lang', '_wpnonce_add-lang');
if ($this->model->add_language($_POST) && 'en_US' !== $_POST['locale']) {
// attempts to install the language pack
require_once ABSPATH . 'wp-admin/includes/translation-install.php';
if (!wp_download_language_pack($_POST['locale'])) {
add_settings_error('general', 'pll_download_mo', __('The language was created, but the WordPress language file was not downloaded. Please install it manually.', 'polylang'));
}
// force checking for themes and plugins translations updates
wp_clean_themes_cache();
wp_clean_plugins_cache();
}
self::redirect();
// to refresh the page ( possible thanks to the $_GET['noheader']=true )
break;
case 'delete':
check_admin_referer('delete-lang');
if (!empty($_GET['lang'])) {
$this->model->delete_language((int) $_GET['lang']);
}
self::redirect();
// to refresh the page ( possible thanks to the $_GET['noheader']=true )
break;
case 'update':
check_admin_referer('add-lang', '_wpnonce_add-lang');
$error = $this->model->update_language($_POST);
self::redirect();
// to refresh the page ( possible thanks to the $_GET['noheader']=true )
break;
case 'default-lang':
check_admin_referer('default-lang');
if ($lang = $this->model->get_language((int) $_GET['lang'])) {
$this->model->update_default_lang($lang->slug);
}
self::redirect();
// to refresh the page ( possible thanks to the $_GET['noheader']=true )
break;
case 'content-default-lang':
check_admin_referer('content-default-lang');
if ($nolang = $this->model->get_objects_with_no_lang()) {
if (!empty($nolang['posts'])) {
$this->model->set_language_in_mass('post', $nolang['posts'], $this->options['default_lang']);
}
if (!empty($nolang['terms'])) {
$this->model->set_language_in_mass('term', $nolang['terms'], $this->options['default_lang']);
}
}
self::redirect();
// to refresh the page ( possible thanks to the $_GET['noheader']=true )
break;
case 'activate':
check_admin_referer('pll_activate');
$this->modules[$_GET['module']]->activate();
self::redirect();
break;
case 'deactivate':
check_admin_referer('pll_deactivate');
$this->modules[$_GET['module']]->deactivate();
self::redirect();
break;
default:
/**
* Fires when a non default action has been sent to Polylang settings
*
* @since 1.8
*/
do_action("mlang_action_{$action}");
break;
}
}
开发者ID:JSreactor,项目名称:MarketCrater.com,代码行数:80,代码来源:settings.php
示例14: current_after
function current_after($return, $theme)
{
if (is_wp_error($return)) {
return $return;
}
$theme = isset($theme['theme']) ? $theme['theme'] : '';
if ($theme != get_stylesheet()) {
// If not current
return $return;
}
// Ensure stylesheet name hasn't changed after the upgrade:
if ($theme == get_stylesheet() && $theme != $this->result['destination_name']) {
wp_clean_themes_cache();
$stylesheet = $this->result['destination_name'];
switch_theme($stylesheet);
}
//Time to remove maintenance mode
if (!$this->bulk) {
$this->maintenance_mode(false);
}
return $return;
}
开发者ID:pauEscarcia,项目名称:AIMM,代码行数:22,代码来源:class-wp-upgrader.php
示例15: bulk_upgrade
function bulk_upgrade($themes)
{
$this->init();
$this->bulk = true;
$this->upgrade_strings();
$current = get_site_transient('update_themes');
add_filter('upgrader_pre_install', array(&$this, 'current_before'), 10, 2);
add_filter('upgrader_post_install', array(&$this, 'current_after'), 10, 2);
add_filter('upgrader_clear_destination', array(&$this, 'delete_old_theme'), 10, 4);
$this->skin->header();
// Connect to the Filesystem first.
$res = $this->fs_connect(array(WP_CONTENT_DIR));
if (!$res) {
$this->skin->footer();
return false;
}
$this->skin->bulk_header();
// Only start maintenance mode if running in Multisite OR the theme is in use
$maintenance = is_multisite();
// @TODO: This should only kick in for individual sites if at all possible.
foreach ($themes as $theme) {
$maintenance = $maintenance || $theme == get_stylesheet() || $theme == get_template();
}
if ($maintenance) {
$this->maintenance_mode(true);
}
$results = array();
$this->update_count = count($themes);
$this->update_current = 0;
foreach ($themes as $theme) {
$this->update_current++;
if (!isset($current->response[$theme])) {
$this->skin->set_result(false);
$this->skin->before();
$this->skin->error('up_to_date');
$this->skin->after();
$results[$theme] = false;
continue;
}
$this->skin->theme_info = $this->theme_info($theme);
// Get the URL to the zip file
$r = $current->response[$theme];
$options = array('package' => $r['package'], 'destination' => WP_CONTENT_DIR . '/themes', 'clear_destination' => true, 'clear_working' => true, 'hook_extra' => array('theme' => $theme));
$result = $this->run($options);
$results[$theme] = $this->result;
// Prevent credentials auth screen from displaying multiple times
if (false === $result) {
break;
}
}
//end foreach $plugins
$this->maintenance_mode(false);
$this->skin->bulk_footer();
$this->skin->footer();
// Cleanup our hooks, in case something else does a upgrade on this connection.
remove_filter('upgrader_pre_install', array(&$this, 'current_before'), 10, 2);
remove_filter('upgrader_post_install', array(&$this, 'current_after'), 10, 2);
remove_filter('upgrader_clear_destination', array(&$this, 'delete_old_theme'), 10, 4);
// Force refresh of theme update information
wp_clean_themes_cache();
return $results;
}
开发者ID:newington,项目名称:wordpress,代码行数:62,代码来源:class-wp-upgrader.php
示例16: bulk_upgrade
function bulk_upgrade($extensions, $args = array())
{
$defaults = array('clear_update_cache' => true);
$parsed_args = wp_parse_args($args, $defaults);
$this->init();
$this->bulk = true;
$this->upgrade_strings();
$current = get_site_transient('update_themes');
add_filter('upgrader_pre_install', array($this, 'current_before'), 10, 2);
add_filter('upgrader_post_install', array($this, 'current_after'), 10, 2);
add_filter('upgrader_clear_destination', array($this, 'delete_old_theme'), 10, 4);
$this->skin->header();
// Connect to the Filesystem first.
$res = $this->fs_connect(array(WP_CONTENT_DIR));
if (!$res) {
$this->skin->footer();
return false;
}
$this->skin->bulk_header();
// Only start maintenance mode if:
// - running Multisite and there are one or more themes specified, OR
// - a theme with an update available is currently in use.
// @TODO: For multisite, maintenance mode should only kick in for individual sites if at all possible.
$maintenance = is_multisite() && !empty($extensions);
foreach ($extensions as $extension) {
$maintenance = $maintenance || $extension == get_stylesheet() || $extension == get_template();
}
if ($maintenance) {
$this->maintenance_mode(true);
}
$results = array();
$this->update_count = count($extensions);
$this->update_current = 0;
foreach ($extensions as $extension) {
$this->update_current++;
$this->skin->theme_info = $this->theme_info($extension);
if (!isset($current->extensions[$extension])) {
$this->skin->set_result(true);
$this->skin->before();
$this->skin->feedback('up_to_date');
$this->skin->after();
$results[$extension] = true;
continue;
}
// Get the URL to the zip file
$r = $current->extensions[$extension];
$result = $this->run(array('package' => $r['package'], 'destination' => get_theme_root($extension), 'clear_destination' => true, 'clear_working' => true, 'hook_extra' => array('theme' => $extension)));
$results[$extension] = $this->result;
// Prevent credentials auth screen from displaying multiple times
if (false === $result) {
break;
}
}
//end foreach $plugins
$this->maintenance_mode(false);
do_action('upgrader_process_complete', $this, array('action' => 'update', 'type' => 'theme', 'bulk' => true, 'themes' => $extensions));
$this->skin->bulk_footer();
$this->skin->footer();
// Cleanup our hooks, in case something else does a upgrade on this connection.
remove_filter('upgrader_pre_install', array($this, 'current_before'));
remove_filter('upgrader_post_install', array($this, 'current_after'));
remove_filter('upgrader_clear_destination', array($this, 'delete_old_theme'));
// Refresh the Theme Update information
wp_clean_themes_cache($parsed_args['clear_update_cache']);
return $results;
}
开发者ID:bangtienmanh,项目名称:Runway-Framework,代码行数:66,代码来源:extension_upgrader.php
示例17: mp_core_install_plugin
//.........这里部分代码省略.........
return true;
// stop the normal page form from displaying
}
//Now we have some credentials, try to get the wp_filesystem running
if (!WP_Filesystem($creds)) {
// our credentials were no good, ask the user for them again
request_filesystem_credentials($url, $method, true, false);
return true;
}
//By this point, the $wp_filesystem global should be working, so let's use it get our plugin
global $wp_filesystem;
//If we are installing a theme
if ($this->_args['plugin_is_theme']) {
//Get the plugins directory and name the temp plugin file
$upload_dir = $wp_filesystem->wp_themes_dir();
} else {
//Get the plugins directory and name the temp plugin file
$upload_dir = $wp_filesystem->wp_plugins_dir();
}
$filename = trailingslashit($upload_dir) . 'temp.zip';
//if 'allow_url_fopen' is available, do it the right way using the WP Filesystem api
if (ini_get('allow_url_fopen')) {
//Download the plugin file defined in the passed in array
$saved_file = $wp_filesystem->get_contents(esc_url_raw(add_query_arg(array('site_activating' => get_bloginfo('wpurl')), $this->_args['plugin_download_link'])));
//Save the contents into a temp.zip file (string stored in $filename)
$wp_filesystem->put_contents($filename, $saved_file, FS_CHMOD_FILE);
} else {
echo __('Oops! Your Web Host is badly configured! Let your web host know they need to have "allow_url_fopen" turned on.', 'mp_core');
// Initializing curl
$ch = curl_init();
//Return Transfer
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//File to fetch
curl_setopt($ch, CURLOPT_URL, $this->_args['plugin_download_link']);
//Open/Create new file
$file = fopen($upload_dir . "temp.zip", 'w');
//Put contents of plugin_download_link in this new file
curl_setopt($ch, CURLOPT_FILE, $file);
#output
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
// allow redirects
//Set User Agent
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
//set user agent
// Getting results
$result = curl_exec($ch);
// Getting jSON result string
curl_close($ch);
fclose($file);
//If we are unable to find the file, let the user know. This will also fail if a license is incorrect - but it should be caught further up the page
if (!$result) {
die;
}
}
//Unzip the temp zip file
unzip_file($filename, trailingslashit($upload_dir) . '/');
//Delete the temp zipped file
$wp_filesystem->rmdir($filename);
//If we are installing a theme
if ($this->_args['plugin_is_theme']) {
//Set themes cache to NULL so wp_get_themes will get the new theme we just installed
wp_clean_themes_cache(true);
$installed_themes = wp_get_themes();
//Loop through each installed theme
foreach ($installed_themes as $theme_slug => $theme) {
echo $theme['headers:WP_Theme:private']['Name'];
echo $theme['plugin_name'];
//If this theme is the theme we're hoping to in
|
请发表评论