Skip to content

Commit

Permalink
Remove pre 6.5 code
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed Dec 5, 2024
1 parent 3ad3319 commit 6dab4fb
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 288 deletions.
4 changes: 1 addition & 3 deletions includes/Renderer/Stories/Carousel_Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,7 @@ function () {
<?php
$content = (string) ob_get_clean();

if ( \function_exists( 'wp_interactivity_process_directives' ) ) {
$content = wp_interactivity_process_directives( $content );
}
$content = wp_interactivity_process_directives( $content );

/**
* Filters the Carousel renderer stories content.
Expand Down
4 changes: 1 addition & 3 deletions includes/Renderer/Stories/Generic_Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ function () {
$view_type = $this->get_view_type();
$content = (string) ob_get_clean();

if ( \function_exists( 'wp_interactivity_process_directives' ) ) {
$content = wp_interactivity_process_directives( $content );
}
$content = wp_interactivity_process_directives( $content );

/**
* Filters the Generic renderer stories content.
Expand Down
30 changes: 8 additions & 22 deletions includes/Renderer/Stories/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ abstract class Renderer implements RenderingInterface, Iterator {
*/
public const STYLE_HANDLE = 'web-stories-list-styles';

/**
* Web Stories stylesheet handle.
*/
public const LIGHTBOX_SCRIPT_HANDLE = 'web-stories-lightbox';

/**
* Number of instances invoked. Kept it static to keep track.
*/
Expand Down Expand Up @@ -277,9 +272,6 @@ public function load_assets(): void {
// Web Stories styles for AMP and non-AMP pages.
$this->assets->register_style_asset( self::STYLE_HANDLE );

// Web Stories lightbox script.
$this->assets->register_script_asset( self::LIGHTBOX_SCRIPT_HANDLE, [ AMP_Story_Player_Assets::SCRIPT_HANDLE ] );

if ( \defined( 'AMPFORWP_VERSION' ) ) {
add_action( 'amp_post_template_css', [ $this, 'add_amp_post_template_css' ] );
}
Expand Down Expand Up @@ -353,8 +345,7 @@ public function render_single_story_content(): void {
*
* @var Story $story
*/
$story = $this->current();
$wp_version = get_bloginfo( 'version' );
$story = $this->current();

$single_story_classes = $this->get_single_story_classes();
$lightbox_state = 'lightbox' . $story->get_id() . $this->instance_id;
Expand All @@ -378,23 +369,18 @@ class="<?php echo esc_attr( $single_story_classes ); ?>"
} else {
$this->assets->enqueue_style( AMP_Story_Player_Assets::SCRIPT_HANDLE );
$this->assets->enqueue_script( AMP_Story_Player_Assets::SCRIPT_HANDLE );
if ( version_compare( $wp_version, '6.5', '<' ) ) {
$this->assets->enqueue_script_asset( self::LIGHTBOX_SCRIPT_HANDLE );
}
?>
<div
<div
class="<?php echo esc_attr( $single_story_classes ); ?>"

Check warning on line 374 in includes/Renderer/Stories/Renderer.php

View check run for this annotation

Codecov / codecov/patch

includes/Renderer/Stories/Renderer.php#L373-L374

Added lines #L373 - L374 were not covered by tests
data-wp-interactive="web-stories-block"
<?php
if ( version_compare( $wp_version, '6.5', '>=' ) ) {
echo esc_attr(
wp_interactivity_data_wp_context(
[
'instanceId' => $this->instance_id,
]
)
);

Check warning on line 383 in includes/Renderer/Stories/Renderer.php

View check run for this annotation

Codecov / codecov/patch

includes/Renderer/Stories/Renderer.php#L377-L383

Added lines #L377 - L383 were not covered by tests
}
?>
data-wp-on--click="actions.open"
data-wp-on-window--popstate="actions.onPopstate"
Expand Down Expand Up @@ -429,11 +415,11 @@ public function render_stories_with_lightbox(): void {
];
?>
<div class="web-stories-list__lightbox">
<amp-story-player
width="3.6"
height="6"
layout="responsive"
data-wp-interactive="web-stories-block"
<amp-story-player
width="3.6"
height="6"
layout="responsive"
data-wp-interactive="web-stories-block"
data-wp-on--amp-story-player-close="actions.close"
data-wp-on--navigation="actions.navigation"
>

Check warning on line 425 in includes/Renderer/Stories/Renderer.php

View check run for this annotation

Codecov / codecov/patch

includes/Renderer/Stories/Renderer.php#L418-L425

Added lines #L418 - L425 were not covered by tests
Expand Down Expand Up @@ -858,7 +844,7 @@ class="story-lightbox__close-button"
width="3.6"
height="6"
layout="responsive"
data-wp-interactive="web-stories-block"
data-wp-interactive="web-stories-block"
data-wp-on--amp-story-player-close="actions.close"
data-wp-on--navigation="actions.navigation"
>
Expand Down
4 changes: 0 additions & 4 deletions includes/Renderer/Story/Singleton.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ public function __construct( Story $story, Assets $assets ) {
public function render( array $args = [] ): string {
++self::$instances;
$this->instance_id = self::$instances;
$wp_version = get_bloginfo( 'version' );

$defaults = [
'align' => 'none',
Expand All @@ -116,9 +115,6 @@ public function render( array $args = [] ): string {

$this->assets->enqueue_style( AMP_Story_Player_Assets::SCRIPT_HANDLE );
$this->assets->enqueue_script( AMP_Story_Player_Assets::SCRIPT_HANDLE );
if ( version_compare( $wp_version, '6.5', '<' ) ) {
$this->assets->enqueue_script_asset( Renderer::LIGHTBOX_SCRIPT_HANDLE );
}
$this->assets->enqueue_style_asset( Embed_Base::SCRIPT_HANDLE );

ob_start();
Expand Down
3 changes: 0 additions & 3 deletions packages/stories-lightbox/README.md

This file was deleted.

32 changes: 0 additions & 32 deletions packages/stories-lightbox/package.json

This file was deleted.

29 changes: 0 additions & 29 deletions packages/stories-lightbox/src/index.js

This file was deleted.

172 changes: 0 additions & 172 deletions packages/stories-lightbox/src/web-stories-lightbox.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,6 @@ public function test_init(): void {
$renderer->init();

$this->assertTrue( wp_style_is( $renderer::STYLE_HANDLE, 'registered' ) );
if ( version_compare( $wp_version, '6.5', '>=' ) ) {
$this->assertFalse( wp_script_is( $renderer::LIGHTBOX_SCRIPT_HANDLE, 'enqueued' ) );
} else {
$this->assertTrue( wp_script_is( $renderer::LIGHTBOX_SCRIPT_HANDLE, 'enqueued' ) );
}
$this->assertTrue( wp_script_is( $renderer::LIGHTBOX_SCRIPT_HANDLE, 'registered' ) );
$this->assertTrue( wp_script_is( $renderer::SCRIPT_HANDLE, 'registered' ) );
$this->assertTrue( wp_style_is( $renderer::SCRIPT_HANDLE, 'registered' ) );
}
Expand Down
Loading

0 comments on commit 6dab4fb

Please sign in to comment.