Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update LRC filters prefix #6947

Merged
merged 3 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public function is_allowed( array $data = [] ): bool {
*
* @param bool $allow True to allow, false otherwise.
*/
return wpm_apply_filters_typed( 'boolean', 'rocket_lazy_render_content_optimization', true );
return wpm_apply_filters_typed( 'boolean', 'rocket_lrc_optimization', true );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ trait HelperTrait {
protected function get_depth() {
/**
* Filter the depth integer value.
* The actual applied depth in the source is the default + 1 after the body or rocket_lazy_render_content_depth+1 after the body if the filter is set
* The actual applied depth in the source is the default + 1 after the body or rocket_lrc_depth+1 after the body if the filter is set
*
* @param int $depth Depth value.
*/
return wpm_apply_filters_typed( 'integer', 'rocket_lazy_render_content_depth', 2 );
return wpm_apply_filters_typed( 'integer', 'rocket_lrc_depth', 2 );
}

/**
Expand All @@ -33,7 +33,7 @@ protected function get_processed_tags() {
*/
$tags = wpm_apply_filters_typed(
'array',
'rocket_lazy_render_content_processed_tags',
'rocket_lrc_processed_tags',
[
'DIV',
'MAIN',
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function () {

// Disable ATF & LRC optimizations to prevent DB requests (unrelated to other tests).
add_filter( 'rocket_above_the_fold_optimization', '__return_false' );
add_filter( 'rocket_lazy_render_content_optimization', '__return_false' );
add_filter( 'rocket_lrc_optimization', '__return_false' );

if ( BootstrapManager::isGroup( 'TranslatePress' ) ) {
require WP_ROCKET_TESTS_FIXTURES_DIR . '/classes/TRP_Translate_Press.php';
Expand Down Expand Up @@ -265,7 +265,7 @@ function () {

if ( BootstrapManager::isGroup( 'PerformanceHints' ) ) {
add_filter( 'rocket_above_the_fold_optimization', '__return_true' );
add_filter( 'rocket_lazy_render_content_optimization', '__return_true' );
add_filter( 'rocket_lrc_optimization', '__return_true' );
}

// Load the plugin.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class Test_lrcProcessedTagsFilter extends TestCase
{
public function testShouldReturnAsExpected() {
add_filter( 'rocket_lazy_render_content_processed_tags', function( $tags ) {
add_filter( 'rocket_lrc_processed_tags', function( $tags ) {
$tags[]= 'h2';
$tags[]= 'h1';
$tags[]= 'li';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function set_up()
public function tear_down()
{
$this->restoreWpHook('rocket_critical_image_saas_visit_buffer');
remove_filter( 'rocket_lazy_render_content_optimization', '__return_false' );
remove_filter( 'rocket_lrc_optimization', '__return_false' );

parent::tear_down();
}
Expand All @@ -44,7 +44,7 @@ public function tear_down()
public function testShouldWorkAsExpected( $config, $expected ) {
self::addLrc($config['row']);

add_filter( 'rocket_lazy_render_content_optimization', '__return_true' );
add_filter( 'rocket_lrc_optimization', '__return_true' );

$this->assertSame(
$expected['html'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function set_up() {
*/
public function testShouldReturnExpected( $config, $expected ) {
Functions\when( 'get_option' )->justReturn( $config['licence'] );
Filters\expectApplied( 'rocket_lazy_render_content_optimization' )
Filters\expectApplied( 'rocket_lrc_optimization' )
->andReturn( $config['filter'] );

$this->assertSame(
Expand Down
Loading