本文整理汇总了PHP中Theme_Upgrader::upgrade_strings方法的典型用法代码示例。如果您正苦于以下问题:PHP Theme_Upgrader::upgrade_strings方法的具体用法?PHP Theme_Upgrader::upgrade_strings怎么用?PHP Theme_Upgrader::upgrade_strings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Theme_Upgrader
的用法示例。
在下文中一共展示了Theme_Upgrader::upgrade_strings方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function install_package($args = array())
{
parent::upgrade_strings();
// needed for the 'remove_old' string
$args['clear_destination'] = true;
$args['abort_if_destination_exists'] = false;
return parent::install_package($args);
}
示例2:
function upgrade_strings()
{
parent::upgrade_strings();
$this->strings['downloading_package'] = __('Downloading upgrade package from the Envato API…', 'envato');
$options = get_option(EWPT_PLUGIN_SLUG);
if (!isset($options['skip_theme_backup'])) {
$this->strings['remove_old'] = __('Backing up & removing the old version of the theme…', 'envato');
}
}
示例3:
function upgrade_strings()
{
parent::upgrade_strings();
$this->strings['skin_before_update_header'] = __('Updating %1$s (%2$d/%3$d)', 'tfuse');
$this->strings['up_to_date'] = __('The package is at the latest version.', 'tfuse');
$this->strings['remove_old'] = __('Removing the old version of the %s…', 'tfuse');
$this->strings['remove_old_failed'] = __('Could not remove the old version of the ', 'tfuse');
$this->strings['process_failed'] = __('Update failed.', 'tfuse');
$this->strings['process_success'] = __('Package updated successfully.', 'tfuse');
$this->strings['tf_backup'] = __('Backing up files…', 'tfuse');
$this->strings['tf_bk_mkdir_failed'] = __('Could not create backup directory.', 'tfuse');
}
示例4: array
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);
//.........这里部分代码省略.........
示例5: upgrade_strings
/**
* @since 1.0
* @access internal
*
* @return array Void.
*/
public function upgrade_strings()
{
parent::upgrade_strings();
$this->strings['downloading_package'] = __('Downloading upgrade package from the Envato API…', 'envato');
}
示例6: upgrade_strings
/**
* Initialize the upgrade strings.
*
* @since 1.0.0
*/
public function upgrade_strings()
{
parent::upgrade_strings();
$this->strings['downloading_package'] = __('Downloading the Envato Market upgrade package…', 'envato-market');
}