/
home
/
desid573
/
public_html
/
magicride.ng
/
wp-admin
/
includes
/
/home/desid573/public_html/magicride.ng/wp-admin/includes
mkdir
upload
Name
Size
Mode
Actions
admin-filters.php
6804
0644
edit
dl
rm
admin.php
3002
0644
edit
dl
rm
ajax-actions.php
138057
0644
edit
dl
rm
bookmark.php
9247
0644
edit
dl
rm
class-automatic-upgrader-skin.php
3146
0644
edit
dl
rm
class-bulk-plugin-upgrader-skin.php
2056
0644
edit
dl
rm
class-bulk-theme-upgrader-skin.php
2091
0644
edit
dl
rm
class-bulk-upgrader-skin.php
5306
0644
edit
dl
rm
class-core-upgrader.php
14400
0644
edit
dl
rm
class-file-upload-upgrader.php
4167
0644
edit
dl
rm
class-ftp-pure.php
5400
0644
edit
dl
rm
class-ftp-sockets.php
8449
0644
edit
dl
rm
class-ftp.php
27125
0644
edit
dl
rm
class-language-pack-upgrader-skin.php
2365
0644
edit
dl
rm
class-language-pack-upgrader.php
14724
0644
edit
dl
rm
class-pclzip.php
195795
0644
edit
dl
rm
class-plugin-installer-skin.php
4459
0644
edit
dl
rm
class-plugin-upgrader-skin.php
2681
0644
edit
dl
rm
class-plugin-upgrader.php
15183
0644
edit
dl
rm
class-theme-installer-skin.php
4430
0644
edit
dl
rm
class-theme-upgrader-skin.php
3845
0644
edit
dl
rm
class-theme-upgrader.php
20286
0644
edit
dl
rm
class-walker-category-checklist.php
4255
0644
edit
dl
rm
class-walker-nav-menu-checklist.php
5015
0644
edit
dl
rm
class-walker-nav-menu-edit.php
11685
0644
edit
dl
rm
class-wp-ajax-upgrader-skin.php
3038
0644
edit
dl
rm
class-wp-automatic-updater.php
36027
0644
edit
dl
rm
class-wp-comments-list-table.php
27710
0644
edit
dl
rm
class-wp-community-events.php
15952
0644
edit
dl
rm
class-wp-debug-data.php
44205
0644
edit
dl
rm
class-wp-filesystem-base.php
23065
0644
edit
dl
rm
class-wp-filesystem-direct.php
16409
0644
edit
dl
rm
class-wp-filesystem-ftpext.php
19906
0644
edit
dl
rm
class-wp-filesystem-ftpsockets.php
16714
0644
edit
dl
rm
class-wp-filesystem-ssh2.php
21722
0644
edit
dl
rm
class-wp-importer.php
7522
0644
edit
dl
rm
class-wp-internal-pointers.php
4350
0644
edit
dl
rm
class-wp-links-list-table.php
7752
0644
edit
dl
rm
class-wp-list-table-compat.php
1071
0644
edit
dl
rm
class-wp-list-table.php
38370
0644
edit
dl
rm
class-wp-media-list-table.php
22911
0644
edit
dl
rm
class-wp-ms-sites-list-table.php
15848
0644
edit
dl
rm
class-wp-ms-themes-list-table.php
20538
0644
edit
dl
rm
class-wp-ms-users-list-table.php
13709
0644
edit
dl
rm
class-wp-plugin-install-list-table.php
22865
0644
edit
dl
rm
class-wp-plugins-list-table.php
35436
0644
edit
dl
rm
class-wp-post-comments-list-table.php
1472
0644
edit
dl
rm
class-wp-posts-list-table.php
56625
0644
edit
dl
rm
class-wp-screen.php
35701
0644
edit
dl
rm
class-wp-site-health-auto-updates.php
12512
0644
edit
dl
rm
class-wp-site-health.php
61019
0644
edit
dl
rm
class-wp-site-icon.php
6132
0644
edit
dl
rm
class-wp-terms-list-table.php
18566
0644
edit
dl
rm
class-wp-theme-install-list-table.php
15237
0644
edit
dl
rm
class-wp-themes-list-table.php
9533
0644
edit
dl
rm
class-wp-upgrader-skin.php
5164
0644
edit
dl
rm
class-wp-upgrader-skins.php
1456
0644
edit
dl
rm
class-wp-upgrader.php
35658
0644
edit
dl
rm
class-wp-users-list-table.php
17541
0644
edit
dl
rm
comment.php
6060
0644
edit
dl
rm
continents-cities.php
20750
0644
edit
dl
rm
credits.php
2208
0644
edit
dl
rm
dashboard.php
60348
0644
edit
dl
rm
deprecated.php
39173
0644
edit
dl
rm
edit-tag-messages.php
1412
0644
edit
dl
rm
export.php
23437
0644
edit
dl
rm
file.php
94623
0644
edit
dl
rm
image-edit.php
34711
0644
edit
dl
rm
image.php
22931
0644
edit
dl
rm
import.php
6697
0644
edit
dl
rm
list-table.php
2779
0644
edit
dl
rm
media.php
110241
0644
edit
dl
rm
menu.php
9114
0644
edit
dl
rm
meta-boxes.php
61143
0644
edit
dl
rm
misc.php
74239
0644
edit
dl
rm
ms-admin-filters.php
1370
0644
edit
dl
rm
ms-deprecated.php
3030
0644
edit
dl
rm
ms.php
34783
0644
edit
dl
rm
nav-menu.php
44314
0644
edit
dl
rm
network.php
24292
0644
edit
dl
rm
noop.php
1231
0644
edit
dl
rm
options.php
4097
0644
edit
dl
rm
plugin-install.php
33831
0644
edit
dl
rm
plugin.php
79127
0644
edit
dl
rm
post.php
74512
0644
edit
dl
rm
revision.php
15669
0644
edit
dl
rm
schema.php
41534
0644
edit
dl
rm
screen.php
6214
0644
edit
dl
rm
taxonomy.php
7914
0644
edit
dl
rm
template.php
87937
0644
edit
dl
rm
theme-install.php
6559
0644
edit
dl
rm
theme.php
33890
0644
edit
dl
rm
translation-install.php
8613
0644
edit
dl
rm
update-core.php
57736
0644
edit
dl
rm
update.php
27946
0644
edit
dl
rm
upgrade.php
101713
0644
edit
dl
rm
user.php
52820
0644
edit
dl
rm
widgets.php
10628
0644
edit
dl
rm
Edit:
/home/desid573/public_html/magicride.ng/wp-admin/includes/class-theme-upgrader.php
(20286B)
<?php /** * Upgrade API: Theme_Upgrader class * * @package WordPress * @subpackage Upgrader * @since 4.6.0 */ /** * Core class used for upgrading/installing themes. * * It is designed to upgrade/install themes from a local zip, remote zip URL, * or uploaded zip file. * * @since 2.8.0 * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader.php. * * @see WP_Upgrader */ class Theme_Upgrader extends WP_Upgrader { /** * Result of the theme upgrade offer. * * @since 2.8.0 * @var array|WP_Error $result * @see WP_Upgrader::$result */ public $result; /** * Whether multiple themes are being upgraded/installed in bulk. * * @since 2.9.0 * @var bool $bulk */ public $bulk = false; /** * Initialize the upgrade strings. * * @since 2.8.0 */ public function upgrade_strings() { $this->strings['up_to_date'] = __( 'The theme is at the latest version.' ); $this->strings['no_package'] = __( 'Update package not available.' ); /* translators: %s: package URL */ $this->strings['downloading_package'] = sprintf( __( 'Downloading update from %s…' ), '<span class="code">%s</span>' ); $this->strings['unpack_package'] = __( 'Unpacking the update…' ); $this->strings['remove_old'] = __( 'Removing the old version of the theme…' ); $this->strings['remove_old_failed'] = __( 'Could not remove the old theme.' ); $this->strings['process_failed'] = __( 'Theme update failed.' ); $this->strings['process_success'] = __( 'Theme updated successfully.' ); } /** * Initialize the installation strings. * * @since 2.8.0 */ public function install_strings() { $this->strings['no_package'] = __( 'Installation package not available.' ); /* translators: %s: package URL */ $this->strings['downloading_package'] = sprintf( __( 'Downloading installation package from %s…' ), '<span class="code">%s</span>' ); $this->strings['unpack_package'] = __( 'Unpacking the package…' ); $this->strings['installing_package'] = __( 'Installing the theme…' ); $this->strings['no_files'] = __( 'The theme contains no files.' ); $this->strings['process_failed'] = __( 'Theme installation failed.' ); $this->strings['process_success'] = __( 'Theme installed successfully.' ); /* translators: 1: theme name, 2: version */ $this->strings['process_success_specific'] = __( 'Successfully installed the theme <strong>%1$s %2$s</strong>.' ); $this->strings['parent_theme_search'] = __( 'This theme requires a parent theme. Checking if it is installed…' ); /* translators: 1: theme name, 2: version */ $this->strings['parent_theme_prepare_install'] = __( 'Preparing to install <strong>%1$s %2$s</strong>…' ); /* translators: 1: theme name, 2: version */ $this->strings['parent_theme_currently_installed'] = __( 'The parent theme, <strong>%1$s %2$s</strong>, is currently installed.' ); /* translators: 1: theme name, 2: version */ $this->strings['parent_theme_install_success'] = __( 'Successfully installed the parent theme, <strong>%1$s %2$s</strong>.' ); /* translators: %s: theme name */ $this->strings['parent_theme_not_found'] = sprintf( __( '<strong>The parent theme could not be found.</strong> You will need to install the parent theme, %s, before you can use this child theme.' ), '<strong>%s</strong>' ); } /** * Check if a child theme is being installed and we need to install its parent. * * Hooked to the {@see 'upgrader_post_install'} filter by Theme_Upgrader::install(). * * @since 3.4.0 * * @param bool $install_result * @param array $hook_extra * @param array $child_result * @return type */ public function check_parent_theme_filter( $install_result, $hook_extra, $child_result ) { // Check to see if we need to install a parent theme $theme_info = $this->theme_info(); if ( ! $theme_info->parent() ) { return $install_result; } $this->skin->feedback( 'parent_theme_search' ); if ( ! $theme_info->parent()->errors() ) { $this->skin->feedback( 'parent_theme_currently_installed', $theme_info->parent()->display( 'Name' ), $theme_info->parent()->display( 'Version' ) ); // We already have the theme, fall through. return $install_result; } // We don't have the parent theme, let's install it. $api = themes_api( 'theme_information', array( 'slug' => $theme_info->get( 'Template' ), 'fields' => array( 'sections' => false, 'tags' => false, ), ) ); //Save on a bit of bandwidth. if ( ! $api || is_wp_error( $api ) ) { $this->skin->feedback( 'parent_theme_not_found', $theme_info->get( 'Template' ) ); // Don't show activate or preview actions after installation add_filter( 'install_theme_complete_actions', array( $this, 'hide_activate_preview_actions' ) ); return $install_result; } // Backup required data we're going to override: $child_api = $this->skin->api; $child_success_message = $this->strings['process_success']; // Override them $this->skin->api = $api; $this->strings['process_success_specific'] = $this->strings['parent_theme_install_success'];//, $api->name, $api->version); $this->skin->feedback( 'parent_theme_prepare_install', $api->name, $api->version ); add_filter( 'install_theme_complete_actions', '__return_false', 999 ); // Don't show any actions after installing the theme. // Install the parent theme $parent_result = $this->run( array( 'package' => $api->download_link, 'destination' => get_theme_root(), 'clear_destination' => false, //Do not overwrite files. 'clear_working' => true, ) ); if ( is_wp_error( $parent_result ) ) { add_filter( 'install_theme_complete_actions', array( $this, 'hide_activate_preview_actions' ) ); } // Start cleaning up after the parents installation remove_filter( 'install_theme_complete_actions', '__return_false', 999 ); // Reset child's result and data $this->result = $child_result; $this->skin->api = $child_api; $this->strings['process_success'] = $child_success_message; return $install_result; } /** * Don't display the activate and preview actions to the user. * * Hooked to the {@see 'install_theme_complete_actions'} filter by * Theme_Upgrader::check_parent_theme_filter() when installing * a child theme and installing the parent theme fails. * * @since 3.4.0 * * @param array $actions Preview actions. * @return array */ public function hide_activate_preview_actions( $actions ) { unset( $actions['activate'], $actions['preview'] ); return $actions; } /** * Install a theme package. * * @since 2.8.0 * @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional. * * @param string $package The full local path or URI of the package. * @param array $args { * Optional. Other arguments for installing a theme package. Default empty array. * * @type bool $clear_update_cache Whether to clear the updates cache if successful. * Default true. * } * * @return bool|WP_Error True if the installation was successful, false or a WP_Error object otherwise. */ public function install( $package, $args = array() ) { $defaults = array( 'clear_update_cache' => true, ); $parsed_args = wp_parse_args( $args, $defaults ); $this->init(); $this->install_strings(); add_filter( 'upgrader_source_selection', array( $this, 'check_package' ) ); add_filter( 'upgrader_post_install', array( $this, 'check_parent_theme_filter' ), 10, 3 ); if ( $parsed_args['clear_update_cache'] ) { // Clear cache so wp_update_themes() knows about the new theme. add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 ); } $this->run( array( 'package' => $package, 'destination' => get_theme_root(), 'clear_destination' => false, //Do not overwrite files. 'clear_working' => true, 'hook_extra' => array( 'type' => 'theme', 'action' => 'install', ), ) ); remove_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9 ); remove_filter( 'upgrader_source_selection', array( $this, 'check_package' ) ); remove_filter( 'upgrader_post_install', array( $this, 'check_parent_theme_filter' ) ); if ( ! $this->result || is_wp_error( $this->result ) ) { return $this->result; } // Refresh the Theme Update information wp_clean_themes_cache( $parsed_args['clear_update_cache'] ); return true; } /** * Upgrade a theme. * * @since 2.8.0 * @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional. * * @param string $theme The theme slug. * @param array $args { * Optional. Other arguments for upgrading a theme. Default empty array. * * @type bool $clear_update_cache Whether to clear the update cache if successful. * Default true. * } * @return bool|WP_Error True if the upgrade was successful, false or a WP_Error object otherwise. */ public function upgrade( $theme, $args = array() ) { $defaults = array( 'clear_update_cache' => true, ); $parsed_args = wp_parse_args( $args, $defaults ); $this->init(); $this->upgrade_strings(); // Is an update available? $current = get_site_transient( 'update_themes' ); if ( ! isset( $current->response[ $theme ] ) ) { $this->skin->before(); $this->skin->set_result( false ); $this->skin->error( 'up_to_date' ); $this->skin->after(); return false; } $r = $current->response[ $theme ]; 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 ); if ( $parsed_args['clear_update_cache'] ) { // Clear cache so wp_update_themes() knows about the new theme. add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 ); } $this->run( array( 'package' => $r['package'], 'destination' => get_theme_root( $theme ), 'clear_destination' => true, 'clear_working' => true, 'hook_extra' => array( 'theme' => $theme, 'type' => 'theme', 'action' => 'update', ), ) ); remove_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9 ); 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; } wp_clean_themes_cache( $parsed_args['clear_update_cache'] ); return true; } /** * Upgrade several themes at once. * * @since 3.0.0 * @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional. * * @param string[] $themes Array of the theme slugs. * @param array $args { * Optional. Other arguments for upgrading several themes at once. Default empty array. * * @type bool $clear_update_cache Whether to clear the update cache if successful. * Default true. * } * @return array[]|false An array of results, or false if unable to connect to the filesystem. */ public function bulk_upgrade( $themes, $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( $themes ) ); 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++; $this->skin->theme_info = $this->theme_info( $theme ); if ( ! isset( $current->response[ $theme ] ) ) { $this->skin->set_result( true ); $this->skin->before(); $this->skin->feedback( 'up_to_date' ); $this->skin->after(); $results[ $theme ] = true; continue; } // Get the URL to the zip file $r = $current->response[ $theme ]; $result = $this->run( array( 'package' => $r['package'], 'destination' => get_theme_root( $theme ), 'clear_destination' => true, 'clear_working' => true, 'is_multi' => true, 'hook_extra' => array( 'theme' => $theme, ), ) ); $results[ $theme ] = $this->result; // Prevent credentials auth screen from displaying multiple times if ( false === $result ) { break; } } //end foreach $plugins $this->maintenance_mode( false ); // Refresh the Theme Update information wp_clean_themes_cache( $parsed_args['clear_update_cache'] ); /** This action is documented in wp-admin/includes/class-wp-upgrader.php */ do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'theme', 'bulk' => true, 'themes' => $themes, ) ); $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' ) ); return $results; } /** * Check that the package source contains a valid theme. * * Hooked to the {@see 'upgrader_source_selection'} filter by Theme_Upgrader::install(). * It will return an error if the theme doesn't have style.css or index.php * files. * * @since 3.3.0 * * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. * * @param string $source The full path to the package source. * @return string|WP_Error The source or a WP_Error. */ public function check_package( $source ) { global $wp_filesystem; if ( is_wp_error( $source ) ) { return $source; } // Check the folder contains a valid theme $working_directory = str_replace( $wp_filesystem->wp_content_dir(), trailingslashit( WP_CONTENT_DIR ), $source ); if ( ! is_dir( $working_directory ) ) { // Sanity check, if the above fails, let's not prevent installation. return $source; } // A proper archive should have a style.css file in the single subdirectory if ( ! file_exists( $working_directory . 'style.css' ) ) { return new WP_Error( 'incompatible_archive_theme_no_style', $this->strings['incompatible_archive'], sprintf( /* translators: %s: style.css */ __( 'The theme is missing the %s stylesheet.' ), '<code>style.css</code>' ) ); } $info = get_file_data( $working_directory . 'style.css', array( 'Name' => 'Theme Name', 'Template' => 'Template', ) ); if ( empty( $info['Name'] ) ) { return new WP_Error( 'incompatible_archive_theme_no_name', $this->strings['incompatible_archive'], sprintf( /* translators: %s: style.css */ __( 'The %s stylesheet doesn’t contain a valid theme header.' ), '<code>style.css</code>' ) ); } // If it's not a child theme, it must have at least an index.php to be legit. if ( empty( $info['Template'] ) && ! file_exists( $working_directory . 'index.php' ) ) { return new WP_Error( 'incompatible_archive_theme_no_index', $this->strings['incompatible_archive'], sprintf( /* translators: %s: index.php */ __( 'The theme is missing the %s file.' ), '<code>index.php</code>' ) ); } return $source; } /** * Turn on maintenance mode before attempting to upgrade the current theme. * * Hooked to the {@see 'upgrader_pre_install'} filter by Theme_Upgrader::upgrade() and * Theme_Upgrader::bulk_upgrade(). * * @since 2.8.0 * * @param bool|WP_Error $return * @param array $theme * @return bool|WP_Error */ public function current_before( $return, $theme ) { if ( is_wp_error( $return ) ) { return $return; } $theme = isset( $theme['theme'] ) ? $theme['theme'] : ''; if ( $theme != get_stylesheet() ) { //If not current return $return; } //Change to maintenance mode now. if ( ! $this->bulk ) { $this->maintenance_mode( true ); } return $return; } /** * Turn off maintenance mode after upgrading the current theme. * * Hooked to the {@see 'upgrader_post_install'} filter by Theme_Upgrader::upgrade() * and Theme_Upgrader::bulk_upgrade(). * * @since 2.8.0 * * @param bool|WP_Error $return * @param array $theme * @return bool|WP_Error */ public 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; } /** * Delete the old theme during an upgrade. * * Hooked to the {@see 'upgrader_clear_destination'} filter by Theme_Upgrader::upgrade() * and Theme_Upgrader::bulk_upgrade(). * * @since 2.8.0 * * @global WP_Filesystem_Base $wp_filesystem Subclass * * @param bool $removed * @param string $local_destination * @param string $remote_destination * @param array $theme * @return bool */ public function delete_old_theme( $removed, $local_destination, $remote_destination, $theme ) { global $wp_filesystem; if ( is_wp_error( $removed ) ) { return $removed; // Pass errors through. } if ( ! isset( $theme['theme'] ) ) { return $removed; } $theme = $theme['theme']; $themes_dir = trailingslashit( $wp_filesystem->wp_themes_dir( $theme ) ); if ( $wp_filesystem->exists( $themes_dir . $theme ) ) { if ( ! $wp_filesystem->delete( $themes_dir . $theme, true ) ) { return false; } } return true; } /** * Get the WP_Theme object for a theme. * * @since 2.8.0 * @since 3.0.0 The `$theme` argument was added. * * @param string $theme The directory name of the theme. This is optional, and if not supplied, * the directory name from the last result will be used. * @return WP_Theme|false The theme's info object, or false `$theme` is not supplied * and the last result isn't set. */ public function theme_info( $theme = null ) { if ( empty( $theme ) ) { if ( ! empty( $this->result['destination_name'] ) ) { $theme = $this->result['destination_name']; } else { return false; } } return wp_get_theme( $theme ); } }
Save
cmd:
run