Skip to content

Commit

Permalink
Merge pull request #1532 from wp-media/branch-3.2.5
Browse files Browse the repository at this point in the history
3.2.5
  • Loading branch information
Tabrisrp committed Feb 11, 2019
2 parents c92efa3 + f8d15ac commit 79fe1d8
Show file tree
Hide file tree
Showing 27 changed files with 1,878 additions and 965 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",
"phpcompatibility/phpcompatibility-wp": "*",
"squizlabs/php_codesniffer": "^3.2",
"wp-coding-standards/wpcs": "^1.0.0"
"wp-coding-standards/wpcs": "^2.0.0"
},
"autoload": {
"classmap": [
Expand Down
90 changes: 46 additions & 44 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion inc/3rd-party/plugins/security/wps-hide-login.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );

if ( class_exists( 'WPS_Hide_Login' ) || class_exists( 'WPS\WPS_Hide_Login\Plugin ' ) ) :
if ( class_exists( 'WPS_Hide_Login' ) || defined( 'WPS_HIDE_LOGIN_VERSION' ) ) :
add_action( 'update_option_whl_page', 'rocket_after_update_single_options', 10, 2 );
add_filter( 'rocket_cache_reject_uri', 'rocket_exlude_wps_hide_login_page' );
endif;
Expand Down
17 changes: 17 additions & 0 deletions inc/3rd-party/themes/uncode.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,21 @@ function rocket_exclude_inline_js_uncode( $inline_js ) {
return $inline_js;
}
add_filter( 'rocket_excluded_inline_js_content', 'rocket_exclude_inline_js_uncode' );

/**
* Excludes Uncode JS files from defer JS
*
* @since 3.2.5
* @author Remy Perona
*
* @param array $exclude_defer_js Array of JS filepaths to be excluded.
* @return array
*/
function rocket_exclude_defer_js_uncode( $exclude_defer_js ) {
$exclude_defer_js[] = rocket_clean_exclude_file( get_template_directory_uri() . '/library/js/init.js' );
$exclude_defer_js[] = rocket_clean_exclude_file( get_template_directory_uri() . '/library/js/min/init.min.js' );

return $exclude_defer_js;
}
add_filter( 'rocket_exclude_defer_js', 'rocket_exclude_defer_js_uncode' );
}
37 changes: 21 additions & 16 deletions inc/admin/ui/meta-boxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function rocket_post_submitbox_start() {
if ( current_user_can( apply_filters( 'rocket_capacity', 'manage_options' ) ) ) {
global $post;
$url = wp_nonce_url( admin_url( 'admin-post.php?action=purge_cache&type=post-' . $post->ID ), 'purge_cache_post-' . $post->ID );
printf( '<div id="purge-action"><a class="button-secondary" href="%s">%s</a></div>', $url, __( 'Clear cache', 'rocket' ) );
printf( '<div id="purge-action"><a class="button-secondary" href="%s">%s</a></div>', esc_url( $url ), esc_html__( 'Clear cache', 'rocket' ) );
}
}
add_action( 'post_submitbox_start', 'rocket_post_submitbox_start' );
Expand All @@ -33,7 +33,7 @@ function rocket_cache_options_meta_boxes() {

foreach ( $cpts as $cpt => $cpt_object ) {
$label = $cpt_object->labels->singular_name;
add_meta_box( 'rocket_post_exclude', sprintf( __( 'Cache Options', 'rocket' ), $label ), 'rocket_display_cache_options_meta_boxes', $cpt, 'side', 'core' );
add_meta_box( 'rocket_post_exclude', sprintf( __( 'WP Rocket Options', 'rocket' ), $label ), 'rocket_display_cache_options_meta_boxes', $cpt, 'side', 'core' );
}
}
}
Expand All @@ -56,18 +56,18 @@ function rocket_display_cache_options_meta_boxes() {
$reject_current_uri = false;
if ( 'post-new.php' !== $pagenow ) {
$rejected_uris = array_flip( get_rocket_option( 'cache_reject_uri' ) );
$path = rocket_clean_exclude_file( get_permalink( $post->ID ) );
$path = rocket_clean_exclude_file( get_permalink( $post->ID ) );

if ( isset( $rejected_uris[ $path ] ) ) {
$reject_current_uri = true;
}
}
?>
<input name="rocket_post_nocache" id="rocket_post_nocache" type="checkbox" title="<?php _e( 'Never cache this page', 'rocket' ); ?>" <?php checked( $reject_current_uri, true ); ?>><label for="rocket_post_nocache"><?php _e( 'Never cache this page', 'rocket' ); ?></label>
<input name="rocket_post_nocache" id="rocket_post_nocache" type="checkbox" title="<?php esc_html_e( 'Never cache this page', 'rocket' ); ?>" <?php checked( $reject_current_uri, true ); ?>><label for="rocket_post_nocache"><?php esc_html_e( 'Never cache this page', 'rocket' ); ?></label>
</div>

<div class="misc-pub-section">
<p><?php _e( 'Activate these options on this post:', 'rocket' ); ?></p>
<p><?php esc_html_e( 'Activate these options on this post:', 'rocket' ); ?></p>
<?php
$fields = array(
'lazyload' => __( 'LazyLoad for images', 'rocket' ),
Expand All @@ -83,23 +83,28 @@ function rocket_display_cache_options_meta_boxes() {
foreach ( $fields as $field => $label ) {
$disabled = disabled( ! get_rocket_option( $field ), true, false );
// translators: %s is the name of the option.
$title = $disabled ? ' title="' . sprintf( __( 'Activate first the %s option.', 'rocket' ), esc_attr( $label ) ) . '"' : '';
$class = $disabled ? ' class="rkt-disabled"' : '';
$checked = ! $disabled ? checked( ! get_post_meta( $post->ID, '_rocket_exclude_' . $field, true ), true, false ) : '';
?>
$title = $disabled ? ' title="' . esc_attr( sprintf( __( 'Activate first the %s option.', 'rocket' ), $label ) ) . '"' : '';
$class = $disabled ? ' class="rkt-disabled"' : '';
$checked = ! $disabled ? checked( ! get_post_meta( $post->ID, '_rocket_exclude_' . $field, true ), true, false ) : '';
?>

<input name="rocket_post_exclude_hidden[<?php echo $field; ?>]" type="hidden" value="on">
<input name="rocket_post_exclude[<?php echo $field; ?>]" id="rocket_post_exclude_<?php echo $field; ?>" type="checkbox"<?php echo $title; ?><?php echo $checked; ?><?php echo $disabled; ?>>
<label for="rocket_post_exclude_<?php echo $field; ?>"<?php echo $title; ?><?php echo $class; ?>><?php echo $label; ?></label><br>
<input name="rocket_post_exclude_hidden[<?php echo esc_attr( $field ); ?>]" type="hidden" value="on">
<input name="rocket_post_exclude[<?php echo esc_attr( $field ); ?>]" id="rocket_post_exclude_<?php echo esc_attr( $field ); ?>" type="checkbox"<?php echo $title; ?><?php echo $checked; ?><?php echo $disabled; ?>>
<label for="rocket_post_exclude_<?php echo esc_attr( $field ); ?>"<?php echo $title; ?><?php echo $class; ?>><?php echo $label; ?></label><br>

<?php
}
?>

<p class="rkt-note"><?php _e( '<strong>Note:</strong> None of these options will be applied if this post has been excluded from cache in the global cache settings.', 'rocket' ); ?></p>
<p class="rkt-note">
<?php
// translators: %1$s = opening strong tag, %2$s = closing strong tag.
printf( esc_html__( '%1$sNote:%2$s None of these options will be applied if this post has been excluded from cache in the global cache settings.', 'rocket' ), '<strong>', '</strong>' );
?>
</p>
</div>

<?php
<?php
}
}

Expand All @@ -117,8 +122,8 @@ function rocket_save_metabox_options() {
// No cache field.
if ( 'publish' === $_POST['post_status'] ) {
$new_cache_reject_uri = $cache_reject_uri = get_rocket_option( 'cache_reject_uri' );
$rejected_uris = array_flip( $cache_reject_uri );
$path = rocket_clean_exclude_file( get_permalink( $_POST['post_ID'] ) );
$rejected_uris = array_flip( $cache_reject_uri );
$path = rocket_clean_exclude_file( get_permalink( $_POST['post_ID'] ) );

if ( isset( $_POST['rocket_post_nocache'] ) && $_POST['rocket_post_nocache'] ) {
if ( ! isset( $rejected_uris[ $path ] ) ) {
Expand Down
Loading

0 comments on commit 79fe1d8

Please sign in to comment.