Skip to content

Commit

Permalink
3.15.3 (#6239)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tabrisrp authored Oct 24, 2023
2 parents 619644d + a233ee5 commit 62f7a3d
Show file tree
Hide file tree
Showing 86 changed files with 3,153 additions and 925 deletions.
2 changes: 1 addition & 1 deletion assets/js/lazyload-scripts.min.js

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
},
"scripts": {
"test-unit": "\"vendor/bin/phpunit\" --testsuite unit --colors=always --configuration tests/Unit/phpunit.xml.dist",
"test-integration": "\"vendor/bin/phpunit\" --testsuite integration --colors=always --configuration tests/Integration/phpunit.xml.dist --exclude-group AdminOnly,BeaverBuilder,Elementor,Hummingbird,WithSmush,WithWoo,WithAmp,WithAmpAndCloudflare,WithSCCSS,Cloudways,Dreampress,Cloudflare,CloudflareAdmin,Multisite,WPEngine,SpinUpWP,WordPressCom,O2Switch,PDFEmbedder,PDFEmbedderPremium,PDFEmbedderSecure,Godaddy,LiteSpeed,RevolutionSlider,WordFence,ConvertPlug,Kinsta,Jetpack,RankMathSEO,AllInOneSeoPack,SEOPress,TheSEOFramework,OneCom,RocketLazyLoad,WPXCloud,TheEventsCalendar,Perfmatters,RapidLoad,ProIsp,TranslatePress,WPGeotargeting",
"test-integration": "\"vendor/bin/phpunit\" --testsuite integration --colors=always --configuration tests/Integration/phpunit.xml.dist --exclude-group AdminOnly,BeaverBuilder,Elementor,Hummingbird,WithSmush,WithWoo,WithAmp,WithAmpAndCloudflare,WithSCCSS,Cloudways,Dreampress,Cloudflare,CloudflareAdmin,Multisite,WPEngine,SpinUpWP,WordPressCom,O2Switch,PDFEmbedder,PDFEmbedderPremium,PDFEmbedderSecure,Godaddy,LiteSpeed,RevolutionSlider,WordFence,ConvertPlug,Kinsta,Jetpack,RankMathSEO,AllInOneSeoPack,SEOPress,TheSEOFramework,OneCom,RocketLazyLoad,WPXCloud,TheEventsCalendar,Perfmatters,RapidLoad,ProIsp,TranslatePress,WPGeotargeting,Pressidium",
"test-integration-adminonly": "\"vendor/bin/phpunit\" --testsuite integration --colors=always --configuration tests/Integration/phpunit.xml.dist --group AdminOnly",
"test-integration-bb": "\"vendor/bin/phpunit\" --testsuite integration --colors=always --configuration tests/Integration/phpunit.xml.dist --group BeaverBuilder",
"test-integration-cloudflare": "\"vendor/bin/phpunit\" --testsuite integration --colors=always --configuration tests/Integration/phpunit.xml.dist --group Cloudflare",
Expand Down Expand Up @@ -158,7 +158,9 @@
"test-integration-rapidload": "\"vendor/bin/phpunit\" --testsuite integration --colors=always --configuration tests/Integration/phpunit.xml.dist --group RapidLoad",
"test-integration-proisp": "\"vendor/bin/phpunit\" --testsuite integration --colors=always --configuration tests/Integration/phpunit.xml.dist --group ProIsp",
"test-integration-wp-geotargeting": "\"vendor/bin/phpunit\" --testsuite integration --colors=always --configuration tests/Integration/phpunit.xml.dist --group WPGeotargeting",
"test-integration-translatepress": "\"vendor/bin/phpunit\" --testsuite integration --colors=always --configuration tests/Integration/phpunit.xml.dist --group TranslatePress",
"test-integration-translatepress": "\"vendor/bin/phpunit\" --testsuite integration --colors=always --configuration tests/Integration/phpunit.xml.dist --group TranslatePress",
"test-integration-pressidium": "\"vendor/bin/phpunit\" --testsuite integration --colors=always --configuration tests/Integration/phpunit.xml.dist --group Pressidium",

"run-tests": [
"@test-unit",
"@test-integration",
Expand Down Expand Up @@ -200,7 +202,8 @@
"@test-integration-rapidload",
"@test-integration-proisp",
"@test-integration-wp-geotargeting",
"@test-integration-translatepress"
"@test-integration-translatepress",
"@test-integration-pressidium"
],
"run-stan": "vendor/bin/phpstan analyze --memory-limit=2G --no-progress",
"install-codestandards": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run",
Expand Down
2 changes: 1 addition & 1 deletion dynamic-lists-delayjs.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion inc/3rd-party/3rd-party.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

require WP_ROCKET_3RD_PARTY_PATH . 'hosting/pagely.php';
require WP_ROCKET_3RD_PARTY_PATH . 'hosting/nginx.php';
require WP_ROCKET_3RD_PARTY_PATH . 'hosting/pressidium.php';

require WP_ROCKET_3RD_PARTY_PATH . 'plugins/slider/meta-slider.php';
require WP_ROCKET_3RD_PARTY_PATH . 'plugins/slider/soliloquy.php';
Expand Down
61 changes: 0 additions & 61 deletions inc/3rd-party/hosting/pressidium.php

This file was deleted.

16 changes: 16 additions & 0 deletions inc/Engine/Cache/PurgeActionsSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public static function get_subscribed_events() {
'rocket_after_save_dynamic_lists' => 'purge_cache_after_saving_dynamic_lists',
'update_option_' . $slug => [ 'purge_cache_reject_uri_partially', 10, 2 ],
'update_option_blog_public' => 'purge_cache',
'wp_rocket_upgrade' => [ 'on_update', 10, 2 ],
];
}

Expand Down Expand Up @@ -193,4 +194,19 @@ public function purge_cache_after_saving_dynamic_lists( $should_purge = true ) {
}
$this->purge_cache();
}

/**
* Regenerate the advanced cache file on update
*
* @param string $new_version New plugin version.
* @param string $old_version Previous plugin version.
*
* @return void
*/
public function on_update( $new_version, $old_version ) {
if ( version_compare( $old_version, '3.15.3', '>=' ) ) {
return;
}
rocket_generate_advanced_cache_file();
}
}
48 changes: 0 additions & 48 deletions inc/Engine/Media/Lazyload/CSS/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ public static function get_subscribed_events() {
'rocket_buffer' => [ 'maybe_replace_css_images', 1002 ],
'after_rocket_clean_domain' => 'clear_generated_css',
'wp_enqueue_scripts' => 'insert_lazyload_script',
'rocket_exclude_js' => 'add_lazyload_script_exclude_js',
'rocket_exclude_defer_js' => 'add_lazyload_script_rocket_exclude_defer_js',
'rocket_delay_js_exclusions' => 'add_lazyload_script_rocket_delay_js_exclusions',
'rocket_css_image_lazyload_images_load' => [ 'exclude_rocket_lazyload_excluded_src', 10, 2 ],
'rocket_lazyload_css_ignored_urls' => 'remove_svg_from_lazyload_css',
];
Expand Down Expand Up @@ -560,51 +557,6 @@ protected function is_excluded( string $string ) { // phpcs:ignore Universal.Nam
return false;
}

/**
* Add the lazyload script to exclude js exclusions.
*
* @param array $js_files Exclusions.
* @return array
*/
public function add_lazyload_script_exclude_js( array $js_files ) {
if ( ! $this->is_activated() ) {
return $js_files;
}

$js_files [] = '#rocket_lazyload_css-js-after';
return $js_files;
}

/**
* Add the lazyload script to defer js exclusions.
*
* @param array $exclude_defer_js Exclusions.
* @return array
*/
public function add_lazyload_script_rocket_exclude_defer_js( array $exclude_defer_js ) {
if ( ! $this->is_activated() ) {
return $exclude_defer_js;
}

$exclude_defer_js [] = '#rocket_lazyload_css-js-after';
return $exclude_defer_js;
}

/**
* Add the lazyload script to delay js exclusions.
*
* @param array $js_files Exclusions.
* @return array
*/
public function add_lazyload_script_rocket_delay_js_exclusions( array $js_files ) {
if ( ! $this->is_activated() ) {
return $js_files;
}

$js_files [] = '#rocket_lazyload_css-js-after';
return $js_files;
}

/**
* Is the feature activated.
*
Expand Down
3 changes: 1 addition & 2 deletions inc/Engine/Optimization/RUCSS/AbstractAPIClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ private function handle_request( array $args, string $type = 'post' ) {
];

$args['method'] = strtoupper( $type );

$response = wp_remote_request(
$response = wp_remote_request(
$api_url . $this->request_path,
$args
);
Expand Down
56 changes: 56 additions & 0 deletions inc/Engine/Optimization/RUCSS/Context/RUCSSContext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

namespace WP_Rocket\Engine\Optimization\RUCSS\Context;

use WP_Rocket\Admin\Options_Data;
use WP_Rocket\Engine\Common\Context\AbstractContext;
use WP_Rocket\Engine\Optimization\RUCSS\Controller\Filesystem;

class RUCSSContext extends AbstractContext {



/**
* Filesystem instance
*
* @var Filesystem
*/
protected $filesystem;

/**
* Instantiate the class.
*
* @param Options_Data $options Options.
* @param Filesystem $filesystem Filesystem instance.
*/
public function __construct( Options_Data $options, Filesystem $filesystem ) {
parent::__construct( $options );
$this->filesystem = $filesystem;
}


/**
* Check if the operation is allowed.
*
* @param array $data Data to provide to the context.
* @return bool
*/
public function is_allowed( array $data = [] ): bool {
$is_allowed = $this->run_common_checks(
[
'do_not_optimize' => false,
'bypass' => false,
'option' => 'remove_unused_css',
'password_protected' => false,
'post_excluded' => 'remove_unused_css',
'logged_in' => false,
]
);

if ( ! $is_allowed ) {
return false;
}

return $this->filesystem->is_writable_folder();
}
}
46 changes: 46 additions & 0 deletions inc/Engine/Optimization/RUCSS/Context/RUCSSOptimizeContext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

namespace WP_Rocket\Engine\Optimization\RUCSS\Context;

use WP_Rocket\Engine\Common\Context\AbstractContext;

class RUCSSOptimizeContext extends AbstractContext {

/**
* Check if the operation is allowed.
*
* @param array $data Data to provide to the context.
* @return bool
*/
public function is_allowed( array $data = [] ): bool {
$is_allowed = $this->run_common_checks(
[
'bypass' => false,
'option' => 'remove_unused_css',
'post_excluded' => 'remove_unused_css',
]
);

if ( 'local' === wp_get_environment_type() ) {
return false;
}

if ( ! current_user_can( 'rocket_remove_unused_css' ) ) {
return false;
}

if ( is_admin() ) {
return false;
}

if ( ! $is_allowed ) {
return false;
}

if ( ! rocket_can_display_options() ) {
return false;
}

return true;
}
}
Loading

0 comments on commit 62f7a3d

Please sign in to comment.