Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-admin/includes
File: class-theme-upgrader.php
// Prevent credentials auth screen from displaying multiple times.
[500] Fix | Delete
if ( false === $result ) {
[501] Fix | Delete
break;
[502] Fix | Delete
}
[503] Fix | Delete
} // End foreach $themes.
[504] Fix | Delete
[505] Fix | Delete
$this->maintenance_mode( false );
[506] Fix | Delete
[507] Fix | Delete
// Refresh the Theme Update information.
[508] Fix | Delete
wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
[509] Fix | Delete
[510] Fix | Delete
/** This action is documented in wp-admin/includes/class-wp-upgrader.php */
[511] Fix | Delete
do_action(
[512] Fix | Delete
'upgrader_process_complete',
[513] Fix | Delete
$this,
[514] Fix | Delete
array(
[515] Fix | Delete
'action' => 'update',
[516] Fix | Delete
'type' => 'theme',
[517] Fix | Delete
'bulk' => true,
[518] Fix | Delete
'themes' => $themes,
[519] Fix | Delete
)
[520] Fix | Delete
);
[521] Fix | Delete
[522] Fix | Delete
$this->skin->bulk_footer();
[523] Fix | Delete
[524] Fix | Delete
$this->skin->footer();
[525] Fix | Delete
[526] Fix | Delete
// Cleanup our hooks, in case something else does an upgrade on this connection.
[527] Fix | Delete
remove_filter( 'upgrader_pre_install', array( $this, 'current_before' ) );
[528] Fix | Delete
remove_filter( 'upgrader_post_install', array( $this, 'current_after' ) );
[529] Fix | Delete
remove_filter( 'upgrader_clear_destination', array( $this, 'delete_old_theme' ) );
[530] Fix | Delete
[531] Fix | Delete
/*
[532] Fix | Delete
* Ensure any future auto-update failures trigger a failure email by removing
[533] Fix | Delete
* the last failure notification from the list when themes update successfully.
[534] Fix | Delete
*/
[535] Fix | Delete
$past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() );
[536] Fix | Delete
[537] Fix | Delete
foreach ( $results as $theme => $result ) {
[538] Fix | Delete
// Maintain last failure notification when themes failed to update manually.
[539] Fix | Delete
if ( ! $result || is_wp_error( $result ) || ! isset( $past_failure_emails[ $theme ] ) ) {
[540] Fix | Delete
continue;
[541] Fix | Delete
}
[542] Fix | Delete
[543] Fix | Delete
unset( $past_failure_emails[ $theme ] );
[544] Fix | Delete
}
[545] Fix | Delete
[546] Fix | Delete
update_option( 'auto_plugin_theme_update_emails', $past_failure_emails );
[547] Fix | Delete
[548] Fix | Delete
return $results;
[549] Fix | Delete
}
[550] Fix | Delete
[551] Fix | Delete
/**
[552] Fix | Delete
* Checks that the package source contains a valid theme.
[553] Fix | Delete
*
[554] Fix | Delete
* Hooked to the {@see 'upgrader_source_selection'} filter by Theme_Upgrader::install().
[555] Fix | Delete
*
[556] Fix | Delete
* @since 3.3.0
[557] Fix | Delete
*
[558] Fix | Delete
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
[559] Fix | Delete
* @global string $wp_version The WordPress version string.
[560] Fix | Delete
*
[561] Fix | Delete
* @param string $source The path to the downloaded package source.
[562] Fix | Delete
* @return string|WP_Error The source as passed, or a WP_Error object on failure.
[563] Fix | Delete
*/
[564] Fix | Delete
public function check_package( $source ) {
[565] Fix | Delete
global $wp_filesystem, $wp_version;
[566] Fix | Delete
[567] Fix | Delete
$this->new_theme_data = array();
[568] Fix | Delete
[569] Fix | Delete
if ( is_wp_error( $source ) ) {
[570] Fix | Delete
return $source;
[571] Fix | Delete
}
[572] Fix | Delete
[573] Fix | Delete
// Check that the folder contains a valid theme.
[574] Fix | Delete
$working_directory = str_replace( $wp_filesystem->wp_content_dir(), trailingslashit( WP_CONTENT_DIR ), $source );
[575] Fix | Delete
if ( ! is_dir( $working_directory ) ) { // Confidence check, if the above fails, let's not prevent installation.
[576] Fix | Delete
return $source;
[577] Fix | Delete
}
[578] Fix | Delete
[579] Fix | Delete
// A proper archive should have a style.css file in the single subdirectory.
[580] Fix | Delete
if ( ! file_exists( $working_directory . 'style.css' ) ) {
[581] Fix | Delete
return new WP_Error(
[582] Fix | Delete
'incompatible_archive_theme_no_style',
[583] Fix | Delete
$this->strings['incompatible_archive'],
[584] Fix | Delete
sprintf(
[585] Fix | Delete
/* translators: %s: style.css */
[586] Fix | Delete
__( 'The theme is missing the %s stylesheet.' ),
[587] Fix | Delete
'<code>style.css</code>'
[588] Fix | Delete
)
[589] Fix | Delete
);
[590] Fix | Delete
}
[591] Fix | Delete
[592] Fix | Delete
// All these headers are needed on Theme_Installer_Skin::do_overwrite().
[593] Fix | Delete
$info = get_file_data(
[594] Fix | Delete
$working_directory . 'style.css',
[595] Fix | Delete
array(
[596] Fix | Delete
'Name' => 'Theme Name',
[597] Fix | Delete
'Version' => 'Version',
[598] Fix | Delete
'Author' => 'Author',
[599] Fix | Delete
'Template' => 'Template',
[600] Fix | Delete
'RequiresWP' => 'Requires at least',
[601] Fix | Delete
'RequiresPHP' => 'Requires PHP',
[602] Fix | Delete
)
[603] Fix | Delete
);
[604] Fix | Delete
[605] Fix | Delete
if ( empty( $info['Name'] ) ) {
[606] Fix | Delete
return new WP_Error(
[607] Fix | Delete
'incompatible_archive_theme_no_name',
[608] Fix | Delete
$this->strings['incompatible_archive'],
[609] Fix | Delete
sprintf(
[610] Fix | Delete
/* translators: %s: style.css */
[611] Fix | Delete
__( 'The %s stylesheet does not contain a valid theme header.' ),
[612] Fix | Delete
'<code>style.css</code>'
[613] Fix | Delete
)
[614] Fix | Delete
);
[615] Fix | Delete
}
[616] Fix | Delete
[617] Fix | Delete
/*
[618] Fix | Delete
* Parent themes must contain an index file:
[619] Fix | Delete
* - classic themes require /index.php
[620] Fix | Delete
* - block themes require /templates/index.html or block-templates/index.html (deprecated 5.9.0).
[621] Fix | Delete
*/
[622] Fix | Delete
if (
[623] Fix | Delete
empty( $info['Template'] ) &&
[624] Fix | Delete
! file_exists( $working_directory . 'index.php' ) &&
[625] Fix | Delete
! file_exists( $working_directory . 'templates/index.html' ) &&
[626] Fix | Delete
! file_exists( $working_directory . 'block-templates/index.html' )
[627] Fix | Delete
) {
[628] Fix | Delete
return new WP_Error(
[629] Fix | Delete
'incompatible_archive_theme_no_index',
[630] Fix | Delete
$this->strings['incompatible_archive'],
[631] Fix | Delete
sprintf(
[632] Fix | Delete
/* translators: 1: templates/index.html, 2: index.php, 3: Documentation URL, 4: Template, 5: style.css */
[633] Fix | Delete
__( 'Template is missing. Standalone themes need to have a %1$s or %2$s template file. <a href="%3$s">Child themes</a> need to have a %4$s header in the %5$s stylesheet.' ),
[634] Fix | Delete
'<code>templates/index.html</code>',
[635] Fix | Delete
'<code>index.php</code>',
[636] Fix | Delete
__( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ),
[637] Fix | Delete
'<code>Template</code>',
[638] Fix | Delete
'<code>style.css</code>'
[639] Fix | Delete
)
[640] Fix | Delete
);
[641] Fix | Delete
}
[642] Fix | Delete
[643] Fix | Delete
$requires_php = isset( $info['RequiresPHP'] ) ? $info['RequiresPHP'] : null;
[644] Fix | Delete
$requires_wp = isset( $info['RequiresWP'] ) ? $info['RequiresWP'] : null;
[645] Fix | Delete
[646] Fix | Delete
if ( ! is_php_version_compatible( $requires_php ) ) {
[647] Fix | Delete
$error = sprintf(
[648] Fix | Delete
/* translators: 1: Current PHP version, 2: Version required by the uploaded theme. */
[649] Fix | Delete
__( 'The PHP version on your server is %1$s, however the uploaded theme requires %2$s.' ),
[650] Fix | Delete
PHP_VERSION,
[651] Fix | Delete
$requires_php
[652] Fix | Delete
);
[653] Fix | Delete
[654] Fix | Delete
return new WP_Error( 'incompatible_php_required_version', $this->strings['incompatible_archive'], $error );
[655] Fix | Delete
}
[656] Fix | Delete
if ( ! is_wp_version_compatible( $requires_wp ) ) {
[657] Fix | Delete
$error = sprintf(
[658] Fix | Delete
/* translators: 1: Current WordPress version, 2: Version required by the uploaded theme. */
[659] Fix | Delete
__( 'Your WordPress version is %1$s, however the uploaded theme requires %2$s.' ),
[660] Fix | Delete
$wp_version,
[661] Fix | Delete
$requires_wp
[662] Fix | Delete
);
[663] Fix | Delete
[664] Fix | Delete
return new WP_Error( 'incompatible_wp_required_version', $this->strings['incompatible_archive'], $error );
[665] Fix | Delete
}
[666] Fix | Delete
[667] Fix | Delete
$this->new_theme_data = $info;
[668] Fix | Delete
[669] Fix | Delete
return $source;
[670] Fix | Delete
}
[671] Fix | Delete
[672] Fix | Delete
/**
[673] Fix | Delete
* Turns on maintenance mode before attempting to upgrade the active theme.
[674] Fix | Delete
*
[675] Fix | Delete
* Hooked to the {@see 'upgrader_pre_install'} filter by Theme_Upgrader::upgrade() and
[676] Fix | Delete
* Theme_Upgrader::bulk_upgrade().
[677] Fix | Delete
*
[678] Fix | Delete
* @since 2.8.0
[679] Fix | Delete
*
[680] Fix | Delete
* @param bool|WP_Error $response The installation response before the installation has started.
[681] Fix | Delete
* @param array $theme Theme arguments.
[682] Fix | Delete
* @return bool|WP_Error The original `$response` parameter or WP_Error.
[683] Fix | Delete
*/
[684] Fix | Delete
public function current_before( $response, $theme ) {
[685] Fix | Delete
if ( is_wp_error( $response ) ) {
[686] Fix | Delete
return $response;
[687] Fix | Delete
}
[688] Fix | Delete
[689] Fix | Delete
$theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
[690] Fix | Delete
[691] Fix | Delete
// Only run if active theme.
[692] Fix | Delete
if ( get_stylesheet() !== $theme ) {
[693] Fix | Delete
return $response;
[694] Fix | Delete
}
[695] Fix | Delete
[696] Fix | Delete
// Change to maintenance mode. Bulk edit handles this separately.
[697] Fix | Delete
if ( ! $this->bulk ) {
[698] Fix | Delete
$this->maintenance_mode( true );
[699] Fix | Delete
}
[700] Fix | Delete
[701] Fix | Delete
return $response;
[702] Fix | Delete
}
[703] Fix | Delete
[704] Fix | Delete
/**
[705] Fix | Delete
* Turns off maintenance mode after upgrading the active theme.
[706] Fix | Delete
*
[707] Fix | Delete
* Hooked to the {@see 'upgrader_post_install'} filter by Theme_Upgrader::upgrade()
[708] Fix | Delete
* and Theme_Upgrader::bulk_upgrade().
[709] Fix | Delete
*
[710] Fix | Delete
* @since 2.8.0
[711] Fix | Delete
*
[712] Fix | Delete
* @param bool|WP_Error $response The installation response after the installation has finished.
[713] Fix | Delete
* @param array $theme Theme arguments.
[714] Fix | Delete
* @return bool|WP_Error The original `$response` parameter or WP_Error.
[715] Fix | Delete
*/
[716] Fix | Delete
public function current_after( $response, $theme ) {
[717] Fix | Delete
if ( is_wp_error( $response ) ) {
[718] Fix | Delete
return $response;
[719] Fix | Delete
}
[720] Fix | Delete
[721] Fix | Delete
$theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
[722] Fix | Delete
[723] Fix | Delete
// Only run if active theme.
[724] Fix | Delete
if ( get_stylesheet() !== $theme ) {
[725] Fix | Delete
return $response;
[726] Fix | Delete
}
[727] Fix | Delete
[728] Fix | Delete
// Ensure stylesheet name hasn't changed after the upgrade:
[729] Fix | Delete
if ( get_stylesheet() === $theme && $theme !== $this->result['destination_name'] ) {
[730] Fix | Delete
wp_clean_themes_cache();
[731] Fix | Delete
$stylesheet = $this->result['destination_name'];
[732] Fix | Delete
switch_theme( $stylesheet );
[733] Fix | Delete
}
[734] Fix | Delete
[735] Fix | Delete
// Time to remove maintenance mode. Bulk edit handles this separately.
[736] Fix | Delete
if ( ! $this->bulk ) {
[737] Fix | Delete
$this->maintenance_mode( false );
[738] Fix | Delete
}
[739] Fix | Delete
return $response;
[740] Fix | Delete
}
[741] Fix | Delete
[742] Fix | Delete
/**
[743] Fix | Delete
* Deletes the old theme during an upgrade.
[744] Fix | Delete
*
[745] Fix | Delete
* Hooked to the {@see 'upgrader_clear_destination'} filter by Theme_Upgrader::upgrade()
[746] Fix | Delete
* and Theme_Upgrader::bulk_upgrade().
[747] Fix | Delete
*
[748] Fix | Delete
* @since 2.8.0
[749] Fix | Delete
*
[750] Fix | Delete
* @global WP_Filesystem_Base $wp_filesystem Subclass
[751] Fix | Delete
*
[752] Fix | Delete
* @param bool $removed
[753] Fix | Delete
* @param string $local_destination
[754] Fix | Delete
* @param string $remote_destination
[755] Fix | Delete
* @param array $theme
[756] Fix | Delete
* @return bool
[757] Fix | Delete
*/
[758] Fix | Delete
public function delete_old_theme( $removed, $local_destination, $remote_destination, $theme ) {
[759] Fix | Delete
global $wp_filesystem;
[760] Fix | Delete
[761] Fix | Delete
if ( is_wp_error( $removed ) ) {
[762] Fix | Delete
return $removed; // Pass errors through.
[763] Fix | Delete
}
[764] Fix | Delete
[765] Fix | Delete
if ( ! isset( $theme['theme'] ) ) {
[766] Fix | Delete
return $removed;
[767] Fix | Delete
}
[768] Fix | Delete
[769] Fix | Delete
$theme = $theme['theme'];
[770] Fix | Delete
$themes_dir = trailingslashit( $wp_filesystem->wp_themes_dir( $theme ) );
[771] Fix | Delete
if ( $wp_filesystem->exists( $themes_dir . $theme ) ) {
[772] Fix | Delete
if ( ! $wp_filesystem->delete( $themes_dir . $theme, true ) ) {
[773] Fix | Delete
return false;
[774] Fix | Delete
}
[775] Fix | Delete
}
[776] Fix | Delete
[777] Fix | Delete
return true;
[778] Fix | Delete
}
[779] Fix | Delete
[780] Fix | Delete
/**
[781] Fix | Delete
* Gets the WP_Theme object for a theme.
[782] Fix | Delete
*
[783] Fix | Delete
* @since 2.8.0
[784] Fix | Delete
* @since 3.0.0 The `$theme` argument was added.
[785] Fix | Delete
*
[786] Fix | Delete
* @param string $theme The directory name of the theme. This is optional, and if not supplied,
[787] Fix | Delete
* the directory name from the last result will be used.
[788] Fix | Delete
* @return WP_Theme|false The theme's info object, or false `$theme` is not supplied
[789] Fix | Delete
* and the last result isn't set.
[790] Fix | Delete
*/
[791] Fix | Delete
public function theme_info( $theme = null ) {
[792] Fix | Delete
if ( empty( $theme ) ) {
[793] Fix | Delete
if ( ! empty( $this->result['destination_name'] ) ) {
[794] Fix | Delete
$theme = $this->result['destination_name'];
[795] Fix | Delete
} else {
[796] Fix | Delete
return false;
[797] Fix | Delete
}
[798] Fix | Delete
}
[799] Fix | Delete
[800] Fix | Delete
$theme = wp_get_theme( $theme );
[801] Fix | Delete
$theme->cache_delete();
[802] Fix | Delete
[803] Fix | Delete
return $theme;
[804] Fix | Delete
}
[805] Fix | Delete
}
[806] Fix | Delete
[807] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function