Merged in feature/81-dev-dev01 (pull request #5)
auto-patch 81-dev-dev01-2023-12-05T22_45_26 * auto-patch 81-dev-dev01-2023-12-05T22_45_26
This commit is contained in:
@@ -153,7 +153,7 @@ if ( current_user_can( 'install_themes' ) ) {
|
||||
} else {
|
||||
$help_install = '<p>' . sprintf(
|
||||
/* translators: %s: https://wordpress.org/themes/ */
|
||||
__( 'If you would like to see more themes to choose from, click on the “Add New” button and you will be able to browse or search for additional themes from the <a href="%s">WordPress Theme Directory</a>. Themes in the WordPress Theme Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!' ),
|
||||
__( 'If you would like to see more themes to choose from, click on the “Add New Theme” button and you will be able to browse or search for additional themes from the <a href="%s">WordPress Theme Directory</a>. Themes in the WordPress Theme Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!' ),
|
||||
__( 'https://wordpress.org/themes/' )
|
||||
) . '</p>';
|
||||
}
|
||||
@@ -252,7 +252,7 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
|
||||
</h1>
|
||||
|
||||
<?php if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?>
|
||||
<a href="<?php echo esc_url( admin_url( 'theme-install.php' ) ); ?>" class="hide-if-no-js page-title-action"><?php echo esc_html_x( 'Add New', 'theme' ); ?></a>
|
||||
<a href="<?php echo esc_url( admin_url( 'theme-install.php' ) ); ?>" class="hide-if-no-js page-title-action"><?php echo esc_html__( 'Add New Theme' ); ?></a>
|
||||
<?php endif; ?>
|
||||
|
||||
<form class="search-form"></form>
|
||||
@@ -260,49 +260,97 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
|
||||
<hr class="wp-header-end">
|
||||
<?php
|
||||
if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) {
|
||||
?>
|
||||
<div id="message1" class="updated notice is-dismissible"><p><?php _e( 'The active theme is broken. Reverting to the default theme.' ); ?></p></div>
|
||||
<?php
|
||||
wp_admin_notice(
|
||||
__( 'The active theme is broken. Reverting to the default theme.' ),
|
||||
array(
|
||||
'id' => 'message1',
|
||||
'additional_classes' => array( 'updated' ),
|
||||
'dismissible' => true,
|
||||
)
|
||||
);
|
||||
} elseif ( isset( $_GET['activated'] ) ) {
|
||||
if ( isset( $_GET['previewed'] ) ) {
|
||||
?>
|
||||
<div id="message2" class="updated notice is-dismissible"><p><?php _e( 'Settings saved and theme activated.' ); ?> <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php _e( 'Visit site' ); ?></a></p></div>
|
||||
<?php
|
||||
wp_admin_notice(
|
||||
__( 'Settings saved and theme activated.' ) . ' <a href="' . esc_url( home_url( '/' ) ) . '">' . __( 'Visit site' ) . '</a>',
|
||||
array(
|
||||
'id' => 'message2',
|
||||
'additional_classes' => array( 'updated' ),
|
||||
'dismissible' => true,
|
||||
)
|
||||
);
|
||||
} else {
|
||||
?>
|
||||
<div id="message2" class="updated notice is-dismissible"><p><?php _e( 'New theme activated.' ); ?> <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php _e( 'Visit site' ); ?></a></p></div>
|
||||
<?php
|
||||
wp_admin_notice(
|
||||
__( 'New theme activated.' ) . ' <a href="' . esc_url( home_url( '/' ) ) . '">' . __( 'Visit site' ) . '</a>',
|
||||
array(
|
||||
'id' => 'message2',
|
||||
'additional_classes' => array( 'updated' ),
|
||||
'dismissible' => true,
|
||||
)
|
||||
);
|
||||
}
|
||||
} elseif ( isset( $_GET['deleted'] ) ) {
|
||||
?>
|
||||
<div id="message3" class="updated notice is-dismissible"><p><?php _e( 'Theme deleted.' ); ?></p></div>
|
||||
<?php
|
||||
wp_admin_notice(
|
||||
__( 'Theme deleted.' ),
|
||||
array(
|
||||
'id' => 'message3',
|
||||
'additional_classes' => array( 'updated' ),
|
||||
'dismissible' => true,
|
||||
)
|
||||
);
|
||||
} elseif ( isset( $_GET['delete-active-child'] ) ) {
|
||||
?>
|
||||
<div id="message4" class="error"><p><?php _e( 'You cannot delete a theme while it has an active child theme.' ); ?></p></div>
|
||||
<?php
|
||||
wp_admin_notice(
|
||||
__( 'You cannot delete a theme while it has an active child theme.' ),
|
||||
array(
|
||||
'id' => 'message4',
|
||||
'additional_classes' => array( 'error' ),
|
||||
)
|
||||
);
|
||||
} elseif ( isset( $_GET['resumed'] ) ) {
|
||||
?>
|
||||
<div id="message5" class="updated notice is-dismissible"><p><?php _e( 'Theme resumed.' ); ?></p></div>
|
||||
<?php
|
||||
wp_admin_notice(
|
||||
__( 'Theme resumed.' ),
|
||||
array(
|
||||
'id' => 'message5',
|
||||
'additional_classes' => array( 'updated' ),
|
||||
'dismissible' => true,
|
||||
)
|
||||
);
|
||||
} elseif ( isset( $_GET['error'] ) && 'resuming' === $_GET['error'] ) {
|
||||
?>
|
||||
<div id="message6" class="error"><p><?php _e( 'Theme could not be resumed because it triggered a <strong>fatal error</strong>.' ); ?></p></div>
|
||||
<?php
|
||||
wp_admin_notice(
|
||||
__( 'Theme could not be resumed because it triggered a <strong>fatal error</strong>.' ),
|
||||
array(
|
||||
'id' => 'message6',
|
||||
'additional_classes' => array( 'error' ),
|
||||
)
|
||||
);
|
||||
} elseif ( isset( $_GET['enabled-auto-update'] ) ) {
|
||||
?>
|
||||
<div id="message7" class="updated notice is-dismissible"><p><?php _e( 'Theme will be auto-updated.' ); ?></p></div>
|
||||
<?php
|
||||
wp_admin_notice(
|
||||
__( 'Theme will be auto-updated.' ),
|
||||
array(
|
||||
'id' => 'message7',
|
||||
'additional_classes' => array( 'updated' ),
|
||||
'dismissible' => true,
|
||||
)
|
||||
);
|
||||
} elseif ( isset( $_GET['disabled-auto-update'] ) ) {
|
||||
?>
|
||||
<div id="message8" class="updated notice is-dismissible"><p><?php _e( 'Theme will no longer be auto-updated.' ); ?></p></div>
|
||||
<?php
|
||||
wp_admin_notice(
|
||||
__( 'Theme will no longer be auto-updated.' ),
|
||||
array(
|
||||
'id' => 'message8',
|
||||
'additional_classes' => array( 'updated' ),
|
||||
'dismissible' => true,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$current_theme = wp_get_theme();
|
||||
|
||||
if ( $current_theme->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) {
|
||||
echo '<div class="error"><p>' . __( 'Error:' ) . ' ' . $current_theme->errors()->get_error_message() . '</p></div>';
|
||||
wp_admin_notice(
|
||||
__( 'Error:' ) . ' ' . $current_theme->errors()->get_error_message(),
|
||||
array(
|
||||
'additional_classes' => array( 'error' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$current_theme_actions = array();
|
||||
@@ -395,130 +443,144 @@ foreach ( $themes as $theme ) :
|
||||
<?php } ?>
|
||||
|
||||
<?php if ( $theme['hasUpdate'] ) : ?>
|
||||
<?php if ( $theme['updateResponse']['compatibleWP'] && $theme['updateResponse']['compatiblePHP'] ) : ?>
|
||||
<div class="update-message notice inline notice-warning notice-alt"><p>
|
||||
<?php if ( $theme['hasPackage'] ) : ?>
|
||||
<?php _e( 'New version available. <button class="button-link" type="button">Update now</button>' ); ?>
|
||||
<?php else : ?>
|
||||
<?php _e( 'New version available.' ); ?>
|
||||
<?php endif; ?>
|
||||
</p></div>
|
||||
<?php else : ?>
|
||||
<div class="update-message notice inline notice-error notice-alt"><p>
|
||||
<?php
|
||||
if ( ! $theme['updateResponse']['compatibleWP'] && ! $theme['updateResponse']['compatiblePHP'] ) {
|
||||
printf(
|
||||
/* translators: %s: Theme name. */
|
||||
__( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ),
|
||||
$theme['name']
|
||||
<?php
|
||||
if ( $theme['updateResponse']['compatibleWP'] && $theme['updateResponse']['compatiblePHP'] ) :
|
||||
if ( $theme['hasPackage'] ) {
|
||||
$new_version_available = __( 'New version available. <button class="button-link" type="button">Update now</button>' );
|
||||
} else {
|
||||
$new_version_available = __( 'New version available.' );
|
||||
}
|
||||
wp_admin_notice(
|
||||
$new_version_available,
|
||||
array(
|
||||
'type' => 'warning',
|
||||
'additional_classes' => array( 'notice-alt', 'inline', 'update-message' ),
|
||||
)
|
||||
);
|
||||
else :
|
||||
$theme_update_error = '';
|
||||
if ( ! $theme['updateResponse']['compatibleWP'] && ! $theme['updateResponse']['compatiblePHP'] ) {
|
||||
$theme_update_error .= sprintf(
|
||||
/* translators: %s: Theme name. */
|
||||
__( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ),
|
||||
$theme['name']
|
||||
);
|
||||
if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
|
||||
$theme_update_error .= sprintf(
|
||||
/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
|
||||
' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
|
||||
self_admin_url( 'update-core.php' ),
|
||||
esc_url( wp_get_update_php_url() )
|
||||
);
|
||||
if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
|
||||
printf(
|
||||
/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
|
||||
' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
|
||||
self_admin_url( 'update-core.php' ),
|
||||
esc_url( wp_get_update_php_url() )
|
||||
);
|
||||
wp_update_php_annotation( '</p><p><em>', '</em>' );
|
||||
} elseif ( current_user_can( 'update_core' ) ) {
|
||||
printf(
|
||||
/* translators: %s: URL to WordPress Updates screen. */
|
||||
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
|
||||
self_admin_url( 'update-core.php' )
|
||||
);
|
||||
} elseif ( current_user_can( 'update_php' ) ) {
|
||||
printf(
|
||||
/* translators: %s: URL to Update PHP page. */
|
||||
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
|
||||
esc_url( wp_get_update_php_url() )
|
||||
);
|
||||
wp_update_php_annotation( '</p><p><em>', '</em>' );
|
||||
}
|
||||
} elseif ( ! $theme['updateResponse']['compatibleWP'] ) {
|
||||
printf(
|
||||
/* translators: %s: Theme name. */
|
||||
__( 'There is a new version of %s available, but it does not work with your version of WordPress.' ),
|
||||
$theme['name']
|
||||
wp_update_php_annotation( '</p><p><em>', '</em>', false );
|
||||
} elseif ( current_user_can( 'update_core' ) ) {
|
||||
$theme_update_error .= sprintf(
|
||||
/* translators: %s: URL to WordPress Updates screen. */
|
||||
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
|
||||
self_admin_url( 'update-core.php' )
|
||||
);
|
||||
if ( current_user_can( 'update_core' ) ) {
|
||||
printf(
|
||||
/* translators: %s: URL to WordPress Updates screen. */
|
||||
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
|
||||
self_admin_url( 'update-core.php' )
|
||||
);
|
||||
}
|
||||
} elseif ( ! $theme['updateResponse']['compatiblePHP'] ) {
|
||||
printf(
|
||||
/* translators: %s: Theme name. */
|
||||
__( 'There is a new version of %s available, but it does not work with your version of PHP.' ),
|
||||
$theme['name']
|
||||
} elseif ( current_user_can( 'update_php' ) ) {
|
||||
$theme_update_error .= sprintf(
|
||||
/* translators: %s: URL to Update PHP page. */
|
||||
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
|
||||
esc_url( wp_get_update_php_url() )
|
||||
);
|
||||
if ( current_user_can( 'update_php' ) ) {
|
||||
printf(
|
||||
/* translators: %s: URL to Update PHP page. */
|
||||
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
|
||||
esc_url( wp_get_update_php_url() )
|
||||
);
|
||||
wp_update_php_annotation( '</p><p><em>', '</em>' );
|
||||
}
|
||||
wp_update_php_annotation( '</p><p><em>', '</em>', false );
|
||||
}
|
||||
?>
|
||||
</p></div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
} elseif ( ! $theme['updateResponse']['compatibleWP'] ) {
|
||||
$theme_update_error .= sprintf(
|
||||
/* translators: %s: Theme name. */
|
||||
__( 'There is a new version of %s available, but it does not work with your version of WordPress.' ),
|
||||
$theme['name']
|
||||
);
|
||||
if ( current_user_can( 'update_core' ) ) {
|
||||
$theme_update_error .= sprintf(
|
||||
/* translators: %s: URL to WordPress Updates screen. */
|
||||
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
|
||||
self_admin_url( 'update-core.php' )
|
||||
);
|
||||
}
|
||||
} elseif ( ! $theme['updateResponse']['compatiblePHP'] ) {
|
||||
$theme_update_error .= sprintf(
|
||||
/* translators: %s: Theme name. */
|
||||
__( 'There is a new version of %s available, but it does not work with your version of PHP.' ),
|
||||
$theme['name']
|
||||
);
|
||||
if ( current_user_can( 'update_php' ) ) {
|
||||
$theme_update_error .= sprintf(
|
||||
/* translators: %s: URL to Update PHP page. */
|
||||
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
|
||||
esc_url( wp_get_update_php_url() )
|
||||
);
|
||||
wp_update_php_annotation( '</p><p><em>', '</em>', false );
|
||||
}
|
||||
}
|
||||
wp_admin_notice(
|
||||
$theme_update_error,
|
||||
array(
|
||||
'type' => 'error',
|
||||
'additional_classes' => array( 'notice-alt', 'inline', 'update-message' ),
|
||||
)
|
||||
);
|
||||
endif;
|
||||
endif;
|
||||
|
||||
<?php
|
||||
if ( ! $theme['compatibleWP'] || ! $theme['compatiblePHP'] ) {
|
||||
echo '<div class="notice inline notice-error notice-alt"><p>';
|
||||
$message = '';
|
||||
if ( ! $theme['compatibleWP'] && ! $theme['compatiblePHP'] ) {
|
||||
_e( 'This theme does not work with your versions of WordPress and PHP.' );
|
||||
$message = __( 'This theme does not work with your versions of WordPress and PHP.' );
|
||||
if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
|
||||
printf(
|
||||
$message .= sprintf(
|
||||
/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
|
||||
' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
|
||||
self_admin_url( 'update-core.php' ),
|
||||
esc_url( wp_get_update_php_url() )
|
||||
);
|
||||
wp_update_php_annotation( '</p><p><em>', '</em>' );
|
||||
$message .= wp_update_php_annotation( '</p><p><em>', '</em>', false );
|
||||
} elseif ( current_user_can( 'update_core' ) ) {
|
||||
printf(
|
||||
$message .= sprintf(
|
||||
/* translators: %s: URL to WordPress Updates screen. */
|
||||
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
|
||||
self_admin_url( 'update-core.php' )
|
||||
);
|
||||
} elseif ( current_user_can( 'update_php' ) ) {
|
||||
printf(
|
||||
$message .= sprintf(
|
||||
/* translators: %s: URL to Update PHP page. */
|
||||
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
|
||||
esc_url( wp_get_update_php_url() )
|
||||
);
|
||||
wp_update_php_annotation( '</p><p><em>', '</em>' );
|
||||
$message .= wp_update_php_annotation( '</p><p><em>', '</em>', false );
|
||||
}
|
||||
} elseif ( ! $theme['compatibleWP'] ) {
|
||||
_e( 'This theme does not work with your version of WordPress.' );
|
||||
$message .= __( 'This theme does not work with your version of WordPress.' );
|
||||
if ( current_user_can( 'update_core' ) ) {
|
||||
printf(
|
||||
$message .= sprintf(
|
||||
/* translators: %s: URL to WordPress Updates screen. */
|
||||
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
|
||||
self_admin_url( 'update-core.php' )
|
||||
);
|
||||
}
|
||||
} elseif ( ! $theme['compatiblePHP'] ) {
|
||||
_e( 'This theme does not work with your version of PHP.' );
|
||||
$message .= __( 'This theme does not work with your version of PHP.' );
|
||||
if ( current_user_can( 'update_php' ) ) {
|
||||
printf(
|
||||
$message .= sprintf(
|
||||
/* translators: %s: URL to Update PHP page. */
|
||||
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
|
||||
esc_url( wp_get_update_php_url() )
|
||||
);
|
||||
wp_update_php_annotation( '</p><p><em>', '</em>' );
|
||||
$message .= wp_update_php_annotation( '</p><p><em>', '</em>', false );
|
||||
}
|
||||
}
|
||||
echo '</p></div>';
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
wp_admin_notice(
|
||||
$message,
|
||||
array(
|
||||
'type' => 'error',
|
||||
'additional_classes' => array( 'inline', 'notice-alt' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/* translators: %s: Theme name. */
|
||||
$details_aria_label = sprintf( _x( 'View Theme Details for %s', 'theme' ), $theme['name'] );
|
||||
?>
|
||||
@@ -612,7 +674,9 @@ if ( ! is_multisite() && $broken_themes ) {
|
||||
<td></td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php foreach ( $broken_themes as $broken_theme ) : ?>
|
||||
<?php
|
||||
foreach ( $broken_themes as $broken_theme ) :
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $broken_theme->get( 'Name' ) ? $broken_theme->display( 'Name' ) : esc_html( $broken_theme->get_stylesheet() ); ?></td>
|
||||
<td><?php echo $broken_theme->errors()->get_error_message(); ?></td>
|
||||
@@ -673,7 +737,9 @@ if ( ! is_multisite() && $broken_themes ) {
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php
|
||||
endforeach;
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -692,6 +758,13 @@ if ( ! is_multisite() && $broken_themes ) {
|
||||
* @return string The template for displaying the auto-update setting link.
|
||||
*/
|
||||
function wp_theme_auto_update_setting_template() {
|
||||
$notice = wp_get_admin_notice(
|
||||
'',
|
||||
array(
|
||||
'type' => 'error',
|
||||
'additional_classes' => array( 'notice-alt', 'inline', 'hidden' ),
|
||||
)
|
||||
);
|
||||
$template = '
|
||||
<div class="theme-autoupdate">
|
||||
<# if ( data.autoupdate.supported ) { #>
|
||||
@@ -717,7 +790,7 @@ function wp_theme_auto_update_setting_template() {
|
||||
<# } #>
|
||||
<br />' . wp_get_auto_update_message() . '</span>
|
||||
<# } #>
|
||||
<div class="notice notice-error notice-alt inline hidden"><p></p></div>
|
||||
' . $notice . '
|
||||
</div>
|
||||
';
|
||||
|
||||
@@ -1148,23 +1221,23 @@ function wp_theme_auto_update_setting_template() {
|
||||
/* translators: %s: Theme name. */
|
||||
$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
|
||||
?>
|
||||
<# if ( data.actions.activate ) { #>
|
||||
<a href="{{{ data.actions.activate }}}" class="button activate" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
|
||||
<# } #>
|
||||
<# if ( ! data.blockTheme ) { #>
|
||||
<a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php _e( 'Live Preview' ); ?></a>
|
||||
<# } #>
|
||||
<# if ( data.actions.activate ) { #>
|
||||
<a href="{{{ data.actions.activate }}}" class="button activate" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
|
||||
<# } #>
|
||||
<# } else { #>
|
||||
<?php
|
||||
/* translators: %s: Theme name. */
|
||||
$aria_label = sprintf( _x( 'Cannot Activate %s', 'theme' ), '{{ data.name }}' );
|
||||
?>
|
||||
<# if ( data.actions.activate ) { #>
|
||||
<a class="button disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
|
||||
<# } #>
|
||||
<# if ( ! data.blockTheme ) { #>
|
||||
<a class="button button-primary hide-if-no-customize disabled"><?php _e( 'Live Preview' ); ?></a>
|
||||
<# } #>
|
||||
<# if ( data.actions.activate ) { #>
|
||||
<a class="button disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
|
||||
<# } #>
|
||||
<# } #>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user