summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYury German <blueknight@gentoo.org>2022-01-23 18:37:36 -0500
committerYury German <blueknight@gentoo.org>2022-01-23 18:37:36 -0500
commitf18b23a3a9378fb0a98856d436aa9ebf94e47429 (patch)
treee418433e22854ebd2d77eaa869d5d0470a973317 /plugins/jetpack/modules/custom-css/custom-css-4.7.php
parentAdd classic-editor 1.5 (diff)
downloadblogs-gentoo-f18b23a3a9378fb0a98856d436aa9ebf94e47429.tar.gz
blogs-gentoo-f18b23a3a9378fb0a98856d436aa9ebf94e47429.tar.bz2
blogs-gentoo-f18b23a3a9378fb0a98856d436aa9ebf94e47429.zip
Updating Classic Editor, Google Authenticatior, Jetpack, Public Post Preview, Table of Contents, Wordpress Importer
Signed-off-by: Yury German <blueknight@gentoo.org>
Diffstat (limited to 'plugins/jetpack/modules/custom-css/custom-css-4.7.php')
-rw-r--r--plugins/jetpack/modules/custom-css/custom-css-4.7.php40
1 files changed, 26 insertions, 14 deletions
diff --git a/plugins/jetpack/modules/custom-css/custom-css-4.7.php b/plugins/jetpack/modules/custom-css/custom-css-4.7.php
index 4a706f6c..cdce3444 100644
--- a/plugins/jetpack/modules/custom-css/custom-css-4.7.php
+++ b/plugins/jetpack/modules/custom-css/custom-css-4.7.php
@@ -7,7 +7,7 @@ use Automattic\Jetpack\Assets;
*
* @since 4.4.2
*
- * @package Jetpack
+ * @package automattic/jetpack
*/
/**
@@ -135,10 +135,10 @@ class Jetpack_Custom_CSS_Enhancements {
*/
public static function admin_menu() {
// Add in our legacy page to support old bookmarks and such.
- add_submenu_page( null, __( 'CSS', 'jetpack' ), __( 'Edit CSS', 'jetpack' ), 'edit_theme_options', 'editcss', array( __CLASS__, 'admin_page' ) );
+ add_submenu_page( null, __( 'CSS', 'jetpack' ), __( 'Additional CSS', 'jetpack' ), 'edit_theme_options', 'editcss', array( __CLASS__, 'admin_page' ) );
// Add in our new page slug that will redirect to the customizer.
- $hook = add_theme_page( __( 'CSS', 'jetpack' ), __( 'Edit CSS', 'jetpack' ), 'edit_theme_options', 'editcss-customizer-redirect', array( __CLASS__, 'admin_page' ) );
+ $hook = add_theme_page( __( 'CSS', 'jetpack' ), __( 'Additional CSS', 'jetpack' ), 'edit_theme_options', 'editcss-customizer-redirect', array( __CLASS__, 'admin_page' ) );
add_action( "load-{$hook}", array( __CLASS__, 'customizer_redirect' ) );
}
@@ -199,17 +199,29 @@ class Jetpack_Custom_CSS_Enhancements {
*/
public static function wp_custom_css_cb() {
$styles = wp_get_custom_css();
- if ( strlen( $styles ) > 2000 && ! is_customize_preview() ) :
+ if ( ! $styles ) {
+ return;
+ }
+
+ $should_embed = strlen( $styles ) < 2000;
+ /** This filter is documented in projects/plugins/jetpack/modules/custom-css/custom-css.php */
+ $should_embed = apply_filters( 'safecss_embed_style', $should_embed, $styles );
+
+ if ( $should_embed || is_customize_preview() ) {
+ printf(
+ '<style type="text/css" id="wp-custom-css">%1$s</style>',
+ wp_strip_all_tags( $styles ) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ );
+ } else {
// Add a cache buster to the url.
$url = home_url( '/' );
$url = add_query_arg( 'custom-css', substr( md5( $styles ), -10 ), $url );
- ?>
- <link rel="stylesheet" type="text/css" id="wp-custom-css" href="<?php echo esc_url( $url ); ?>" />
- <?php elseif ( $styles || is_customize_preview() ) : ?>
- <style type="text/css" id="wp-custom-css">
- <?php echo strip_tags( $styles ); // Note that esc_html() cannot be used because `div &gt; span` is not interpreted properly. ?>
- </style>
- <?php endif;
+
+ printf(
+ '<link rel="stylesheet" type="text/css" id="wp-custom-css" href="%1$s" />', // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedStylesheet
+ esc_url( $url )
+ );
+ }
}
/**
@@ -365,9 +377,9 @@ class Jetpack_Custom_CSS_Enhancements {
$content_help = __( 'Set a different content width for full size images.', 'jetpack' );
if ( ! empty( $GLOBALS['content_width'] ) ) {
$content_help .= sprintf(
- _n( ' The default content width for the <strong>%1$s</strong> theme is %2$d pixel.', ' The default content width for the <strong>%1$s</strong> theme is %2$d pixels.', intval( $GLOBALS['content_width'] ), 'jetpack' ),
+ _n( ' The default content width for the <strong>%1$s</strong> theme is %2$d pixel.', ' The default content width for the <strong>%1$s</strong> theme is %2$d pixels.', (int) $GLOBALS['content_width'], 'jetpack' ),
wp_get_theme()->Name,
- intval( $GLOBALS['content_width'] )
+ (int) $GLOBALS['content_width']
);
}
@@ -1017,7 +1029,7 @@ class Jetpack_Custom_CSS_Enhancements {
* @return int Integer.
*/
public static function intval_base10( $value ) {
- return intval( $value, 10 );
+ return (int) $value;
}
/**