Completed
Push — renovate/major-eslint-and-plug... ( 32931a...ea602c )
by Jeremy
41:27 queued 30:19
created

story.php ➔ render_block()   B

Complexity

Conditions 4
Paths 4

Size

Total Lines 55

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
nc 4
nop 1
dl 0
loc 55
rs 8.9818
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 * Story Block.
4
 *
5
 * @since 8.6.1
6
 *
7
 * @package automattic/jetpack
8
 */
9
10
namespace Automattic\Jetpack\Extensions\Story;
11
12
use Automattic\Jetpack\Blocks;
13
use Jetpack;
14
use Jetpack_Gutenberg;
15
16
const FEATURE_NAME = 'story';
17
const BLOCK_NAME   = 'jetpack/' . FEATURE_NAME;
18
19
const EMBED_SIZE        = array( 180, 320 );
20
const CROP_UP_TO        = 0.2;
21
const MAX_BULLETS       = 7;
22
const IMAGE_BREAKPOINTS = '(max-width: 460px) 576w, (max-width: 614px) 768w, 120vw'; // 120vw to match the 20% CROP_UP_TO ratio
23
24
/**
25
 * Registers the block for use in Gutenberg
26
 * This is done via an action so that we can disable
27
 * registration if we need to.
28
 */
29
function register_block() {
30
	Blocks::jetpack_register_block(
31
		BLOCK_NAME,
32
		array( 'render_callback' => __NAMESPACE__ . '\render_block' )
33
	);
34
}
35
add_action( 'init', __NAMESPACE__ . '\register_block' );
36
37
/**
38
 * Add missing `width`, `height`, `srcset` and `sizes` properties to images of the mediaFiles block attributes
39
 *
40
 * @param array $media_files  - List of media, each as an array containing the media attributes.
41
 *
42
 * @returns array $media_files
43
 */
44
function with_width_height_srcset_and_sizes( $media_files ) {
45
	return array_map(
46
		function ( $media_file ) {
47
			if ( ! isset( $media_file['id'] ) || ! empty( $media_file['srcset'] ) ) {
48
				return $media_file;
49
			}
50
			$attachment_id = $media_file['id'];
51
			if ( 'image' === $media_file['type'] ) {
52
				$image = wp_get_attachment_image_src( $attachment_id, 'full', false );
53
				if ( ! $image ) {
54
					return $media_file;
55
				}
56
				list( $src, $width, $height ) = $image;
57
				$image_meta                   = wp_get_attachment_metadata( $attachment_id );
58
				if ( ! is_array( $image_meta ) ) {
59
					return $media_file;
60
				}
61
				$size_array = array( absint( $width ), absint( $height ) );
62
				return array_merge(
63
					$media_file,
64
					array(
65
						'width'   => absint( $width ),
66
						'height'  => absint( $height ),
67
						'srcset'  => wp_calculate_image_srcset( $size_array, $src, $image_meta, $attachment_id ),
68
						'sizes'   => IMAGE_BREAKPOINTS,
69
						'title'   => get_the_title( $attachment_id ),
70
						'alt'     => get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ),
71
						'caption' => wp_get_attachment_caption( $attachment_id ),
72
					)
73
				);
74
			} else {
75
				$video_meta = wp_get_attachment_metadata( $attachment_id );
76
				if ( ! isset( $video_meta['width'] ) || ! isset( $video_meta['height'] ) ) {
77
					return $media_file;
78
				}
79
				$url         = ! empty( $video_meta['original']['url'] ) ? $video_meta['original']['url'] : $media_file['url'];
80
				$description = ! empty( $video_meta['videopress']['description'] ) ? $video_meta['videopress']['description'] : $media_file['alt'];
81
				$media_file  = array_merge(
82
					$media_file,
83
					array(
84
						'width'   => absint( $video_meta['width'] ),
85
						'height'  => absint( $video_meta['height'] ),
86
						'alt'     => $description,
87
						'url'     => $url,
88
						'title'   => get_the_title( $attachment_id ),
89
						'caption' => wp_get_attachment_caption( $attachment_id ),
90
					)
91
				);
92
93
				// Set the poster attribute for the video tag if a poster image is available.
94
				if ( ! empty( $video_meta['videopress']['poster'] ) ) {
95
					$poster_url = $video_meta['videopress']['poster'];
96
				} elseif ( ! empty( $video_meta['thumb'] ) ) {
97
					$video_url  = wp_get_attachment_url( $attachment_id );
98
					$poster_url = str_replace( wp_basename( $video_url ), $video_meta['thumb'], $video_url );
99
				}
100
101
				if ( $poster_url ) {
102
					$poster_width  = esc_attr( $media_file['width'] );
103
					$poster_height = esc_attr( $media_file['height'] );
104
					$content_width = (int) Jetpack::get_content_width();
105 View Code Duplication
					if ( is_numeric( $content_width ) ) {
106
						$poster_height = round( ( $content_width * $poster_height ) / $poster_width );
107
						$poster_width  = $content_width;
108
					}
109
					$media_file = array_merge(
110
						$media_file,
111
						array(
112
							'poster' => add_query_arg( 'resize', rawurlencode( $poster_width . ',' . $poster_height ), $poster_url ),
0 ignored issues
show
Bug introduced by
The variable $poster_url does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
113
						)
114
					);
115
				}
116
				return $media_file;
117
			}
118
		},
119
		$media_files
120
	);
121
}
122
123
/**
124
 * Render an image inside a slide
125
 *
126
 * @param array $media  - Image information.
127
 *
128
 * @returns string
129
 */
130
function render_image( $media ) {
131
	if ( empty( $media['id'] ) || empty( $media['url'] ) ) {
132
		return __( 'Error retrieving media', 'jetpack' );
133
	}
134
	$image      = wp_get_attachment_image_src( $media['id'], 'full', false );
135
	$crop_class = '';
136
	if ( $image ) {
137
		list( , $width, $height ) = $image;
138
		$crop_class               = get_image_crop_class( $width, $height );
139
	}
140
	// need to specify the size of the embed so it picks an image that is large enough for the `src` attribute
141
	// `sizes` is optimized for 1080x1920 (9:16) images
142
	// Note that the Story block does not have thumbnail support, it will load the right
143
	// image based on the viewport size only.
144
	return wp_get_attachment_image(
145
		$media['id'],
146
		EMBED_SIZE,
147
		false,
148
		array(
149
			'class' => sprintf( 'wp-story-image wp-image-%d %s', $media['id'], $crop_class ),
150
			'sizes' => IMAGE_BREAKPOINTS,
151
			'title' => get_the_title( $media['id'] ),
152
		)
153
	);
154
}
155
156
/**
157
 * Return the css crop class if image width and height requires it
158
 *
159
 * @param int $width   - Image width.
160
 * @param int $height  - Image height.
161
 *
162
 * @returns string The CSS class which will display a cropped image
163
 */
164
function get_image_crop_class( $width, $height ) {
165
	$crop_class          = '';
166
	$media_aspect_ratio  = $width / $height;
167
	$target_aspect_ratio = EMBED_SIZE[0] / EMBED_SIZE[1];
168
	if ( $media_aspect_ratio >= $target_aspect_ratio ) {
169
		// image wider than canvas.
170
		$media_too_wide_to_crop = $media_aspect_ratio > $target_aspect_ratio / ( 1 - CROP_UP_TO );
171
		if ( ! $media_too_wide_to_crop ) {
172
			$crop_class = 'wp-story-crop-wide';
173
		}
174
	} else {
175
		// image narrower than canvas.
176
		$media_too_narrow_to_crop = $media_aspect_ratio < $target_aspect_ratio * ( 1 - CROP_UP_TO );
177
		if ( ! $media_too_narrow_to_crop ) {
178
			$crop_class = 'wp-story-crop-narrow';
179
		}
180
	}
181
	return $crop_class;
182
}
183
184
/**
185
 * Render a video inside a slide
186
 *
187
 * @param array $media  - Video information.
188
 *
189
 * @returns string
190
 */
191
function render_video( $media ) {
192
	if ( empty( $media['id'] ) || empty( $media['mime'] ) || empty( $media['url'] ) ) {
193
		return __( 'Error retrieving media', 'jetpack' );
194
	}
195
196
	$metadata = wp_get_attachment_metadata( $media['id'] );
197
198
	if ( ! empty( $metadata ) && ! empty( $metadata['videopress'] ) ) {
199
		// Use poster image for VideoPress videos.
200
		$poster_url  = $metadata['videopress']['poster'];
201
		$description = ! empty( $metadata['videopress']['description'] ) ? $metadata['videopress']['description'] : '';
202
		$meta_width  = ! empty( $metadata['videopress']['width'] ) ? $metadata['videopress']['width'] : '';
203
		$meta_height = ! empty( $metadata['videopress']['height'] ) ? $metadata['videopress']['height'] : '';
204
	} elseif ( ! empty( $metadata['thumb'] ) ) {
205
		// On WordPress.com, VideoPress videos have a 'thumb' property with the
206
		// poster image filename instead.
207
		$video_url   = wp_get_attachment_url( $media['id'] );
208
		$poster_url  = str_replace( wp_basename( $video_url ), $metadata['thumb'], $video_url );
209
		$description = ! empty( $media['alt'] ) ? $media['alt'] : '';
210
		$meta_width  = ! empty( $metadata['width'] ) ? $metadata['width'] : '';
211
		$meta_height = ! empty( $metadata['height'] ) ? $metadata['height'] : '';
212
	}
213
214
	if ( ! empty( $poster_url ) ) {
215
		$poster_width  = esc_attr( $meta_width );
0 ignored issues
show
Bug introduced by
The variable $meta_width does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
216
		$poster_height = esc_attr( $meta_height );
0 ignored issues
show
Bug introduced by
The variable $meta_height does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
217
		$content_width = (int) Jetpack::get_content_width();
218 View Code Duplication
		if ( is_numeric( $content_width ) ) {
219
			$poster_height = round( ( $content_width * $poster_height ) / $poster_width );
220
			$poster_width  = $content_width;
221
		}
222
		return sprintf(
223
			'<img title="%1$s" alt="%2$s" class="%3$s" src="%4$s"%5$s%6$s>',
224
			esc_attr( get_the_title( $media['id'] ) ),
225
			esc_attr( $description ),
0 ignored issues
show
Bug introduced by
The variable $description does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
226
			'wp-block-jetpack-story_image wp-story-image ' .
227
			get_image_crop_class( $meta_width, $meta_height ),
228
			esc_attr( add_query_arg( 'resize', rawurlencode( $poster_width . ',' . $poster_height ), $poster_url ) ),
229
			! empty( $meta_width ) ? ' width="' . esc_attr( $meta_width ) . '"' : '',
230
			! empty( $meta_height ) ? ' height="' . esc_attr( $meta_height ) . '"' : ''
231
		);
232
	}
233
234
	return sprintf(
235
		'<video
236
			title="%1$s"
237
			type="%2$s"
238
			class="wp-story-video intrinsic-ignore wp-video-%3$s"
239
			data-id="%3$s"
240
			src="%4$s">
241
		</video>',
242
		esc_attr( get_the_title( $media['id'] ) ),
243
		esc_attr( $media['mime'] ),
244
		$media['id'],
245
		esc_attr( $media['url'] )
246
	);
247
}
248
249
/**
250
 * Render a slide
251
 *
252
 * @param array $media  - Media information.
253
 * @param int   $index  - Index of the slide, first slide will be displayed by default, others hidden.
254
 *
255
 * @returns string
256
 */
257
function render_slide( $media, $index = 0 ) {
258
	$media_template = '';
259
	$media_type     = ! empty( $media['type'] ) ? $media['type'] : null;
260
	if ( ! $media_type ) {
261
		return '';
262
	}
263
	switch ( $media_type ) {
264
		case 'image':
265
			$media_template = render_image( $media, $index );
266
			break;
267
		case 'video':
268
			$media_template = render_video( $media, $index );
269
			break;
270
		case 'file':
271
			// VideoPress videos can sometimes have type 'file', and mime 'video/videopress' or 'video/mp4'.
272
			if ( 'video' === substr( $media['mime'], 0, 5 ) ) {
273
				$media_template = render_video( $media, $index );
274
			}
275
			break;
276
	}
277
	return sprintf(
278
		'<div class="wp-story-slide" style="display: %s;">
279
			<figure>%s</figure>
280
		</div>',
281
		0 === $index ? 'block' : 'none',
282
		$media_template
283
	);
284
}
285
286
/**
287
 * Render the top right icon on top of the story embed
288
 *
289
 * @param array $settings  - The block settings.
290
 *
291
 * @returns string
292
 */
293
function render_top_right_icon( $settings ) {
294
	$show_slide_count = isset( $settings['showSlideCount'] ) ? $settings['showSlideCount'] : false;
295
	$slide_count      = isset( $settings['slides'] ) ? count( $settings['slides'] ) : 0;
296
	if ( $show_slide_count ) {
297
		// Render the story block icon along with the slide count.
298
		return sprintf(
299
			'<div class="wp-story-embed-icon">
300
				<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" role="img" aria-hidden="true" focusable="false">
301
					<path d="M0 0h24v24H0z" fill="none"></path>
302
					<path fill-rule="evenodd" clip-rule="evenodd" d="M6 3H14V17H6L6 3ZM4 3C4 1.89543 4.89543 1 6 1H14C15.1046 1 16 1.89543 16 3V17C16 18.1046 15.1046 19 14 19H6C4.89543 19 4 18.1046 4 17V3ZM18 5C19.1046 5 20 5.89543 20 7V21C20 22.1046 19.1046 23 18 23H10C8.89543 23 8 22.1046 8 21H18V5Z"></path>
303
				</svg>
304
				<span>%d</span>
305
			</div>',
306
			$slide_count
307
		);
308
	} else {
309
		// Render the Fullscreen Gridicon.
310
		return (
311
			'<div class="wp-story-embed-icon-expand">
312
				<svg class="gridicon gridicons-fullscreen" role="img" height="24" width="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
313
					<g>
314
						<path d="M21 3v6h-2V6.41l-3.29 3.3-1.42-1.42L17.59 5H15V3zM3 3v6h2V6.41l3.29 3.3 1.42-1.42L6.41 5H9V3zm18 18v-6h-2v2.59l-3.29-3.29-1.41 1.41L17.59 19H15v2zM9 21v-2H6.41l3.29-3.29-1.41-1.42L5 17.59V15H3v6z"></path>
315
					</g>
316
				</svg>
317
			</div>'
318
		);
319
	}
320
}
321
322
/**
323
 * Render a pagination bullet
324
 *
325
 * @param int    $slide_index  - The slide index it corresponds to.
326
 * @param string $class_name   - Optional css class name(s) to customize the bullet element.
327
 *
328
 * @returns string
329
 */
330
function render_pagination_bullet( $slide_index, $class_name = '' ) {
331
	return sprintf(
332
		'<a href="#" class="wp-story-pagination-bullet %s" aria-label="%s">
333
			<div class="wp-story-pagination-bullet-bar"></div>
334
		</a>',
335
		esc_attr( $class_name ),
336
		/* translators: %d is the slide number (1, 2, 3...) */
337
		sprintf( __( 'Go to slide %d', 'jetpack' ), $slide_index )
338
	);
339
}
340
341
/**
342
 * Render pagination on top of the story embed
343
 *
344
 * @param array $settings  - The block settings.
345
 *
346
 * @returns string
347
 */
348
function render_pagination( $settings ) {
349
	$show_slide_count = isset( $settings['showSlideCount'] ) ? $settings['showSlideCount'] : false;
350
	if ( $show_slide_count ) {
351
		return '';
352
	}
353
	$slide_count     = isset( $settings['slides'] ) ? count( $settings['slides'] ) : 0;
354
	$bullet_count    = min( $slide_count, MAX_BULLETS );
355
	$bullet_ellipsis = $slide_count > $bullet_count
356
		? render_pagination_bullet( $bullet_count + 1, 'wp-story-pagination-ellipsis' )
357
		: '';
358
	return sprintf(
359
		'<div class="wp-story-pagination wp-story-pagination-bullets">
360
			%s
361
		</div>',
362
		join( "\n", array_map( __NAMESPACE__ . '\render_pagination_bullet', range( 1, $bullet_count ) ) ) . $bullet_ellipsis
363
	);
364
}
365
366
/**
367
 * Render story block
368
 *
369
 * @param array $attributes  - Block attributes.
370
 *
371
 * @returns string
372
 */
373
function render_block( $attributes ) {
374
	Jetpack_Gutenberg::load_assets_as_required( FEATURE_NAME );
375
376
	$media_files              = isset( $attributes['mediaFiles'] ) ? $attributes['mediaFiles'] : array();
377
	$settings_from_attributes = isset( $attributes['settings'] ) ? $attributes['settings'] : array();
378
379
	$settings = array_merge(
380
		$settings_from_attributes,
381
		array(
382
			'slides' => with_width_height_srcset_and_sizes( $media_files ),
383
		)
384
	);
385
386
	return sprintf(
387
		'<div class="%1$s" data-id="%2$s" data-settings="%3$s">
388
			<div class="wp-story-app">
389
				<div class="wp-story-display-contents" style="display: contents;">
390
					<div role="button" class="wp-story-container">
391
						<div class="wp-story-meta">
392
							<div class="wp-story-icon">
393
								<img alt="%4$s" src="%5$s" width="40" height="40">
394
							</div>
395
							<div>
396
								<div class="wp-story-title">
397
									%6$s
398
								</div>
399
							</div>
400
							<a class="wp-story-exit-fullscreen jetpack-mdc-icon-button">
401
								<i class="jetpack-material-icons close md-24"></i>
402
							</a>
403
						</div>
404
						<div class="wp-story-wrapper">
405
							%7$s
406
						</div>
407
						<a class="wp-story-overlay" href="%8$s" title="%9$s">
408
							%10$s
409
						</a>
410
						%11$s
411
					</div>
412
				</div>
413
			</div>
414
		</div>',
415
		esc_attr( Blocks::classes( FEATURE_NAME, $attributes, array( 'wp-story', 'aligncenter' ) ) ),
416
		esc_attr( 'wp-story-' . get_the_ID() ),
417
		filter_var( wp_json_encode( $settings ), FILTER_SANITIZE_SPECIAL_CHARS ),
418
		__( 'Site icon', 'jetpack' ),
419
		esc_attr( get_site_icon_url( 80, includes_url( 'images/w-logo-blue.png' ) ) ),
420
		esc_html( get_the_title() ),
421
		! empty( $media_files[0] ) ? render_slide( $media_files[0] ) : '',
422
		get_permalink() . '?wp-story-load-in-fullscreen=true&amp;wp-story-play-on-load=true',
423
		__( 'Play story in new tab', 'jetpack' ),
424
		render_top_right_icon( $settings ),
425
		render_pagination( $settings )
426
	);
427
}
428