/** * * @param array $args */ public function __construct($args = array()) { $defaults = array('url' => '', 'theme' => '', 'nonce' => '', 'title' => __('Update Theme')); $args = wp_parse_args($args, $defaults); $this->theme = $args['theme']; parent::__construct($args); }
function __construct($args = array()) { $defaults = array('type' => 'web', 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => ''); $args = wp_parse_args($args, $defaults); $this->type = $args['type']; $this->api = isset($args['api']) ? $args['api'] : array(); parent::__construct($args); }
/** * @param $options */ public function run($options) { $defaults = array('package' => '', 'destination' => '', 'clear_destination' => false, 'abort_if_destination_exists' => true, 'clear_working' => true, 'is_multi' => false, 'hook_extra' => array()); $options = wp_parse_args($options, $defaults); // Connect to the Filesystem first. $res = $this->fs_connect(array(WP_CONTENT_DIR, $options['destination'])); // Mainly for non-connected filesystem. if (!$res) { /*if ( ! $options['is_multi'] ) { $this->skin->footer(); }*/ return false; } //Download the package (Note, This just returns the filename of the file if the package is a local file) if (file_exists($options['package'])) { $download = $options['package']; } else { $download = $this->download_package($options['package']); } if (is_wp_error($download)) { $this->skin->error($download); //$this->skin->after(); return $download; } $delete_package = $download != $options['package']; // Do not delete a "local" file //Unzips the file into a temporary directory $working_dir = $this->unpack_package($download, $delete_package); if (is_wp_error($working_dir)) { $this->skin->error($working_dir); $this->skin->after(); return $working_dir; } $options['source'] = $working_dir; $options['package_folder'] = basename($working_dir); //With the given options, this installs it to the destination directory. $result = $this->install_package(array('source' => $working_dir, 'destination' => $options['destination'], 'clear_destination' => $options['clear_destination'], 'abort_if_destination_exists' => $options['abort_if_destination_exists'], 'clear_working' => $options['clear_working'], 'hook_extra' => $options['hook_extra'])); $this->skin->set_result($result); if (is_wp_error($result)) { $this->skin->error($result); $this->skin->feedback('process_failed'); } else { //Install Succeeded $this->skin->feedback('process_success'); //update packages xml file $result = $this->update_packages_wxr($options); if (is_wp_error($result)) { $this->skin->error($result); $this->skin->feedback('process_failed'); } else { $this->skin->feedback('process_success'); } } $this->update_packages_wxr($options); $this->skin->feedback('go_manage_page'); $this->skin->after(); return $result; }
function __construct($args = array()) { $defaults = array('url' => '', 'plugin' => '', 'nonce' => '', 'title' => __('Downloading Wysija Premium', WYSIJA)); $args = wp_parse_args($args, $defaults); $this->plugin = $args['plugin']; $this->plugin_active = is_plugin_active($this->plugin); $this->plugin_network_active = is_plugin_active_for_network($this->plugin); parent::__construct($args); }
/** * * @param array $args */ public function __construct($args = array()) { $defaults = array('url' => '', 'plugin' => '', 'nonce' => '', 'title' => __('Update Plugin')); $args = wp_parse_args($args, $defaults); $this->plugin = $args['plugin']; $this->plugin_active = is_plugin_active($this->plugin); $this->plugin_network_active = is_plugin_active_for_network($this->plugin); parent::__construct($args); }
/** * Determines whether the upgrader needs FTP/SSH details in order to connect * to the filesystem. * * @since 3.7.0 * @since 4.6.0 The `$context` parameter default changed from `false` to an empty string. * * @see request_filesystem_credentials() * * @param bool $error Optional. Whether the current request has failed to connect. * Default false. * @param string $context Optional. Full path to the directory that is tested * for being writable. Default empty. * @param bool $allow_relaxed_file_ownership Optional. Whether to allow Group/World writable. Default false. * @return bool True on success, false on failure. */ public function request_filesystem_credentials($error = false, $context = '', $allow_relaxed_file_ownership = false) { if ($context) { $this->options['context'] = $context; } // TODO: fix up request_filesystem_credentials(), or split it, to allow us to request a no-output version // This will output a credentials form in event of failure, We don't want that, so just hide with a buffer ob_start(); $result = parent::request_filesystem_credentials($error, $context, $allow_relaxed_file_ownership); ob_end_clean(); return $result; }
function error($errors) { $folder_exists = false; if (is_wp_error($errors)) { $error_codes = $errors->get_error_codes(); if (in_array('folder_exists', $error_codes)) { $folder_exists = true; } } parent::error($errors); if ($folder_exists) { $this->feedback($this->get_folder_exsists_message()); } }
/** * Toggle maintenance mode for the site. * * Creates/deletes the maintenance file to enable/disable maintenance mode. * * @since 2.8.0 * * @global WP_Filesystem_Base $wp_filesystem Subclass * * @param bool $enable True to enable maintenance mode, false to disable. */ public function maintenance_mode( $enable = false ) { global $wp_filesystem; $file = $wp_filesystem->abspath() . '.maintenance'; if ( $enable ) { $this->skin->feedback('maintenance_start'); // Create maintenance file to signal that we are upgrading $maintenance_string = '<?php $upgrading = ' . time() . '; ?>'; $wp_filesystem->delete($file); $wp_filesystem->put_contents($file, $maintenance_string, FS_CHMOD_FILE); } elseif ( ! $enable && $wp_filesystem->exists( $file ) ) { $this->skin->feedback('maintenance_end'); $wp_filesystem->delete($file); } }
function __construct($args = array()) { $defaults = array('type' => '', 'login' => '', 'url' => '', 'theme' => '', 'nonce' => '', 'title' => __('Update Theme', 'themify'), 'cookies' => null); $args = wp_parse_args($args, $defaults); if ($args['login'] == 'true') { $this->login = '******'; } else { $this->login = '******'; } if ($args['type'] == 'framework') { $this->type = 'framework'; } else { $this->type = 'theme'; } $this->theme = $args['theme']; $this->cookies = $args['cookies']; parent::__construct($args); }
/** * * @TODO document * */ function __construct($args = array()) { parent::__construct($args); }
/** * * @param string|WP_Error $error */ public function error($error) { echo '<div class="lp-error">'; parent::error($error); echo '</div>'; }
/** * Outputs links after bulk plugin installation is complete. * * @since 2.2.0 */ public function bulk_footer() { /** Serve up the string to say installations (and possibly activations) are complete */ parent::bulk_footer(); /** Flush plugins cache so we can make sure that the installed plugins list is always up to date */ wp_cache_flush(); /** Display message based on if all plugins are now active or not */ $complete = array(); foreach (TGM_Plugin_Activation::$instance->plugins as $plugin) { if (!is_plugin_active($plugin['file_path'])) { echo '<p><a href="' . add_query_arg('page', TGM_Plugin_Activation::$instance->menu, admin_url(TGM_Plugin_Activation::$instance->parent_url_slug)) . '" title="' . esc_attr(TGM_Plugin_Activation::$instance->strings['return']) . '" target="_parent">' . __(TGM_Plugin_Activation::$instance->strings['return'], TGM_Plugin_Activation::$instance->domain) . '</a></p>'; $complete[] = $plugin; break; } else { $complete[] = ''; } } /** Filter out any empty entries */ $complete = array_filter($complete); /** All plugins are active, so we display the complete string and hide the menu to protect users */ if (empty($complete)) { echo '<p>' . sprintf(TGM_Plugin_Activation::$instance->strings['complete'], '<a href="' . admin_url() . '" title="' . __('Return to the Dashboard', TGM_Plugin_Activation::$instance->domain) . '">' . __('Return to the Dashboard', TGM_Plugin_Activation::$instance->domain) . '</a>') . '</p>'; echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; } }
/** * Set the error flag to true, then let the base class handle the rest. * * @param $errors */ public function error($errors) { $this->error = true; parent::error($errors); }
function request_filesystem_credentials($error = false, $context = '') { if ($context) { $this->options['context'] = $context; } // TODO: fix up request_filesystem_credentials(), or split it, to allow us to request a no-output version // This will output a credentials form in event of failure, We don't want that, so just hide with a buffer ob_start(); set_current_screen('tools'); // Only here to avoid PHP Notices from screen_icon() which is used within that HTML $result = parent::request_filesystem_credentials($error); ob_end_clean(); return $result; }
public function __construct(OutputInterface $output) { parent::__construct(); $this->output = $output; }
function __construct($args = array()) { $defaults = array('type' => 'web', 'url' => '', 'lens_dirname' => '', 'nonce' => '', 'title' => ''); $args = wp_parse_args($args, $defaults); $this->type = $args['type']; parent::__construct($args); }
/** * Cancel installer. * * @param WP_Upgrader_Skin $skin Skin to set message on. * @param WP_Error|string $error Error to display. */ protected function cancel_installer($skin, $error) { $skin->error($error); $skin->after(); $skin->footer(); }
/** * * @param array $args */ public function __construct($args = array()) { $defaults = array('url' => '', 'nonce' => ''); $args = wp_parse_args($args, $defaults); parent::__construct($args); }
public function fs_connect($directories = array(), $allow_relaxed_file_ownership = false) { $skin = new WP_Upgrader_Skin(); global $wp_filesystem; if (false === ($credentials = $skin->request_filesystem_credentials(false, $directories[0], $allow_relaxed_file_ownership))) { return false; } if (!WP_Filesystem($credentials, $directories[0], $allow_relaxed_file_ownership)) { $error = true; if (is_object($wp_filesystem) && $wp_filesystem->errors->get_error_code()) { $error = $wp_filesystem->errors; } // Failed to connect, Error and request again //$this->skin->request_filesystem_credentials( $error, $directories[0], $allow_relaxed_file_ownership ); return false; } if (!is_object($wp_filesystem)) { return new WP_Error('fs_unavailable', $this->strings['fs_unavailable']); } if (is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) { return new WP_Error('fs_error', $this->strings['fs_error'], $wp_filesystem->errors); } foreach ((array) $directories as $dir) { switch ($dir) { case ABSPATH: if (!$wp_filesystem->abspath()) { return new WP_Error('fs_no_root_dir', $this->strings['fs_no_root_dir']); } break; case WP_CONTENT_DIR: if (!$wp_filesystem->wp_content_dir()) { return new WP_Error('fs_no_content_dir', $this->strings['fs_no_content_dir']); } break; case WP_PLUGIN_DIR: if (!$wp_filesystem->wp_plugins_dir()) { return new WP_Error('fs_no_plugins_dir', $this->strings['fs_no_plugins_dir']); } break; case get_theme_root(): if (!$wp_filesystem->wp_themes_dir()) { return new WP_Error('fs_no_themes_dir', $this->strings['fs_no_themes_dir']); } break; default: if (!$wp_filesystem->find_folder($dir)) { return new WP_Error('fs_no_folder', sprintf($this->strings['fs_no_folder'], esc_html(basename($dir)))); } break; } } return true; }
public function __construct($args = array(), $parent = null) { $this->_parent = $parent; parent::__construct($args); }