Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/jetpack/modules/carousel
File: jetpack-carousel.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
[0] Fix | Delete
/**
[1] Fix | Delete
* Module: Jetpack Carousel
[2] Fix | Delete
*
[3] Fix | Delete
* @package automattic/jetpack
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
use Automattic\Jetpack\Assets;
[7] Fix | Delete
use Automattic\Jetpack\Stats\Options as Stats_Options;
[8] Fix | Delete
use Automattic\Jetpack\Status;
[9] Fix | Delete
use Automattic\Jetpack\Status\Host;
[10] Fix | Delete
[11] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[12] Fix | Delete
exit( 0 );
[13] Fix | Delete
}
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* Jetpack_Carousel class.
[17] Fix | Delete
*
[18] Fix | Delete
* @phan-constructor-used-for-side-effects
[19] Fix | Delete
*/
[20] Fix | Delete
class Jetpack_Carousel {
[21] Fix | Delete
/**
[22] Fix | Delete
* Defines Carousel pre-built widths
[23] Fix | Delete
*
[24] Fix | Delete
* @var array
[25] Fix | Delete
*/
[26] Fix | Delete
public $prebuilt_widths = array( 370, 700, 1000, 1200, 1400, 2000 );
[27] Fix | Delete
[28] Fix | Delete
/**
[29] Fix | Delete
* Localization strings and other data for the JavaScript
[30] Fix | Delete
*
[31] Fix | Delete
* @var array
[32] Fix | Delete
*/
[33] Fix | Delete
public $localize_strings;
[34] Fix | Delete
[35] Fix | Delete
/**
[36] Fix | Delete
* Represents whether or not this is the first load of Carousel on a page. Default is true.
[37] Fix | Delete
*
[38] Fix | Delete
* @var bool
[39] Fix | Delete
*/
[40] Fix | Delete
public $first_run = true;
[41] Fix | Delete
[42] Fix | Delete
/**
[43] Fix | Delete
* Determines whether or not to set in the gallery. Default is false.
[44] Fix | Delete
*
[45] Fix | Delete
* @deprecated since 10.8
[46] Fix | Delete
*
[47] Fix | Delete
* @var bool
[48] Fix | Delete
*/
[49] Fix | Delete
public $in_gallery = false;
[50] Fix | Delete
[51] Fix | Delete
/**
[52] Fix | Delete
* Determines whether the module runs in the Jetpack plugin, as opposed to WP.com Simple site environment
[53] Fix | Delete
*
[54] Fix | Delete
* @var bool
[55] Fix | Delete
*/
[56] Fix | Delete
public $in_jetpack = true;
[57] Fix | Delete
[58] Fix | Delete
/**
[59] Fix | Delete
* Determines whether or not a single image gallery is enabled. Default is false.
[60] Fix | Delete
*
[61] Fix | Delete
* @var bool
[62] Fix | Delete
*/
[63] Fix | Delete
public $single_image_gallery_enabled = false;
[64] Fix | Delete
[65] Fix | Delete
/**
[66] Fix | Delete
* Determines whether images that link to themselves should be replaced with a one image gallery. Default is false.
[67] Fix | Delete
*
[68] Fix | Delete
* @var bool
[69] Fix | Delete
*/
[70] Fix | Delete
public $single_image_gallery_enabled_media_file = false;
[71] Fix | Delete
[72] Fix | Delete
/**
[73] Fix | Delete
* Constructor.
[74] Fix | Delete
*/
[75] Fix | Delete
public function __construct() {
[76] Fix | Delete
add_action( 'init', array( $this, 'init' ) );
[77] Fix | Delete
}
[78] Fix | Delete
[79] Fix | Delete
/**
[80] Fix | Delete
* Initialize class
[81] Fix | Delete
*/
[82] Fix | Delete
public function init() {
[83] Fix | Delete
if ( $this->maybe_disable_jp_carousel() ) {
[84] Fix | Delete
return;
[85] Fix | Delete
}
[86] Fix | Delete
[87] Fix | Delete
$this->in_jetpack = ! ( new Host() )->is_wpcom_simple();
[88] Fix | Delete
[89] Fix | Delete
$this->single_image_gallery_enabled = ! $this->maybe_disable_jp_carousel_single_images();
[90] Fix | Delete
$this->single_image_gallery_enabled_media_file = $this->maybe_enable_jp_carousel_single_images_media_file();
[91] Fix | Delete
[92] Fix | Delete
if ( is_admin() ) {
[93] Fix | Delete
// Register the Carousel-related related settings.
[94] Fix | Delete
add_action( 'admin_init', array( $this, 'register_settings' ), 5 );
[95] Fix | Delete
if ( ! $this->in_jetpack ) {
[96] Fix | Delete
if ( 0 === $this->test_1or0_option( get_option( 'carousel_enable_it' ), true ) ) {
[97] Fix | Delete
return; // Carousel disabled, abort early, but still register setting so user can switch it back on.
[98] Fix | Delete
}
[99] Fix | Delete
}
[100] Fix | Delete
// If in admin, register the ajax endpoints.
[101] Fix | Delete
add_action( 'wp_ajax_get_attachment_comments', array( $this, 'get_attachment_comments' ) );
[102] Fix | Delete
add_action( 'wp_ajax_nopriv_get_attachment_comments', array( $this, 'get_attachment_comments' ) );
[103] Fix | Delete
add_action( 'wp_ajax_post_attachment_comment', array( $this, 'post_attachment_comment' ) );
[104] Fix | Delete
add_action( 'wp_ajax_nopriv_post_attachment_comment', array( $this, 'post_attachment_comment' ) );
[105] Fix | Delete
} else {
[106] Fix | Delete
if ( ! $this->in_jetpack ) {
[107] Fix | Delete
if ( 0 === $this->test_1or0_option( get_option( 'carousel_enable_it' ), true ) ) {
[108] Fix | Delete
return; // Carousel disabled, abort early.
[109] Fix | Delete
}
[110] Fix | Delete
}
[111] Fix | Delete
// If on front-end, do the Carousel thang.
[112] Fix | Delete
/**
[113] Fix | Delete
* Filter the array of default prebuilt widths used in Carousel.
[114] Fix | Delete
*
[115] Fix | Delete
* @module carousel
[116] Fix | Delete
*
[117] Fix | Delete
* @since 1.6.0
[118] Fix | Delete
*
[119] Fix | Delete
* @param array $this->prebuilt_widths Array of default widths.
[120] Fix | Delete
*/
[121] Fix | Delete
$this->prebuilt_widths = apply_filters( 'jp_carousel_widths', $this->prebuilt_widths );
[122] Fix | Delete
// below: load later than other callbacks hooked it (e.g. 3rd party plugins handling gallery shortcode).
[123] Fix | Delete
add_filter( 'post_gallery', array( $this, 'check_if_shortcode_processed_and_enqueue_assets' ), 1000, 2 );
[124] Fix | Delete
add_filter( 'post_gallery', array( $this, 'set_in_gallery' ), -1000 );
[125] Fix | Delete
add_filter( 'gallery_style', array( $this, 'add_data_to_container' ) );
[126] Fix | Delete
add_filter( 'wp_get_attachment_image_attributes', array( $this, 'add_data_to_images' ), 10, 2 );
[127] Fix | Delete
add_filter( 'jetpack_tiled_galleries_block_content', array( $this, 'add_data_img_tags_and_enqueue_assets' ) );
[128] Fix | Delete
if ( $this->single_image_gallery_enabled ) {
[129] Fix | Delete
add_filter( 'the_content', array( $this, 'add_data_img_tags_and_enqueue_assets' ) );
[130] Fix | Delete
}
[131] Fix | Delete
[132] Fix | Delete
add_filter( 'render_block_data', array( $this, 'remove_core_lightbox_in_gallery' ), 10, 3 );
[133] Fix | Delete
[134] Fix | Delete
// `is_amp_request()` can't be called until the 'wp' filter.
[135] Fix | Delete
add_action( 'wp', array( $this, 'check_amp_support' ) );
[136] Fix | Delete
}
[137] Fix | Delete
[138] Fix | Delete
if ( $this->in_jetpack ) {
[139] Fix | Delete
Jetpack::enable_module_configurable( dirname( __DIR__ ) . '/carousel.php' );
[140] Fix | Delete
}
[141] Fix | Delete
}
[142] Fix | Delete
[143] Fix | Delete
/**
[144] Fix | Delete
* Check AMP and add filters.
[145] Fix | Delete
*/
[146] Fix | Delete
public function check_amp_support() {
[147] Fix | Delete
if (
[148] Fix | Delete
! class_exists( 'Jetpack_AMP_Support' )
[149] Fix | Delete
|| ! Jetpack_AMP_Support::is_amp_request()
[150] Fix | Delete
) {
[151] Fix | Delete
add_filter( 'render_block_core/gallery', array( $this, 'filter_gallery_block_render' ), 10, 2 );
[152] Fix | Delete
add_filter( 'render_block_jetpack/tiled-gallery', array( $this, 'filter_gallery_block_render' ), 10, 2 );
[153] Fix | Delete
}
[154] Fix | Delete
}
[155] Fix | Delete
[156] Fix | Delete
/**
[157] Fix | Delete
* Returns the value of the applied jp_carousel_maybe_disable filter
[158] Fix | Delete
*
[159] Fix | Delete
* @since 1.6.0
[160] Fix | Delete
*
[161] Fix | Delete
* @return bool - Should Carousel be disabled? Default to false.
[162] Fix | Delete
 */
[163] Fix | Delete
public function maybe_disable_jp_carousel() {
[164] Fix | Delete
/**
[165] Fix | Delete
* Allow third-party plugins or themes to disable Carousel.
[166] Fix | Delete
*
[167] Fix | Delete
* @module carousel
[168] Fix | Delete
*
[169] Fix | Delete
* @since 1.6.0
[170] Fix | Delete
*
[171] Fix | Delete
* @param bool false Should Carousel be disabled? Default to false.
[172] Fix | Delete
*/
[173] Fix | Delete
return apply_filters( 'jp_carousel_maybe_disable', false );
[174] Fix | Delete
}
[175] Fix | Delete
[176] Fix | Delete
/**
[177] Fix | Delete
* Returns the value of the applied jp_carousel_maybe_disable_single_images filter
[178] Fix | Delete
*
[179] Fix | Delete
* @since 4.5.0
[180] Fix | Delete
*
[181] Fix | Delete
* @return bool - Should Carousel be disabled for single images? Default to false.
[182] Fix | Delete
*/
[183] Fix | Delete
public function maybe_disable_jp_carousel_single_images() {
[184] Fix | Delete
/**
[185] Fix | Delete
* Allow third-party plugins or themes to disable Carousel for single images.
[186] Fix | Delete
*
[187] Fix | Delete
* @module carousel
[188] Fix | Delete
*
[189] Fix | Delete
* @since 4.5.0
[190] Fix | Delete
*
[191] Fix | Delete
* @param bool false Should Carousel be disabled for single images? Default to false.
[192] Fix | Delete
*/
[193] Fix | Delete
return apply_filters( 'jp_carousel_maybe_disable_single_images', false );
[194] Fix | Delete
}
[195] Fix | Delete
[196] Fix | Delete
/**
[197] Fix | Delete
* Returns the value of the applied jp_carousel_load_for_images_linked_to_file filter
[198] Fix | Delete
*
[199] Fix | Delete
* @since 4.5.0
[200] Fix | Delete
*
[201] Fix | Delete
* @return bool - Should Carousel be enabled for single images linking to 'Media File'? Default to false.
[202] Fix | Delete
*/
[203] Fix | Delete
public function maybe_enable_jp_carousel_single_images_media_file() {
[204] Fix | Delete
/**
[205] Fix | Delete
* Allow third-party plugins or themes to enable Carousel
[206] Fix | Delete
* for single images linking to 'Media File' (full size image).
[207] Fix | Delete
*
[208] Fix | Delete
* @module carousel
[209] Fix | Delete
*
[210] Fix | Delete
* @since 4.5.0
[211] Fix | Delete
*
[212] Fix | Delete
* @param bool false Should Carousel be enabled for single images linking to 'Media File'? Default to false.
[213] Fix | Delete
*/
[214] Fix | Delete
return apply_filters( 'jp_carousel_load_for_images_linked_to_file', false );
[215] Fix | Delete
}
[216] Fix | Delete
[217] Fix | Delete
/**
[218] Fix | Delete
* Returns the value of the applied jp_carousel_asset_version filter
[219] Fix | Delete
*
[220] Fix | Delete
* @since 1.6.0
[221] Fix | Delete
*
[222] Fix | Delete
* @param string $version Asset version.
[223] Fix | Delete
*
[224] Fix | Delete
* @return string
[225] Fix | Delete
*/
[226] Fix | Delete
public function asset_version( $version ) {
[227] Fix | Delete
/**
[228] Fix | Delete
* Filter the version string used when enqueuing Carousel assets.
[229] Fix | Delete
*
[230] Fix | Delete
* @module carousel
[231] Fix | Delete
*
[232] Fix | Delete
* @since 1.6.0
[233] Fix | Delete
*
[234] Fix | Delete
* @param string $version Asset version.
[235] Fix | Delete
*/
[236] Fix | Delete
return apply_filters( 'jp_carousel_asset_version', $version );
[237] Fix | Delete
}
[238] Fix | Delete
[239] Fix | Delete
/**
[240] Fix | Delete
* Displays a message on top of gallery if carousel has bailed.
[241] Fix | Delete
*
[242] Fix | Delete
* @param string $output Gallery shortcode output.
[243] Fix | Delete
*
[244] Fix | Delete
* @return string Shortcode output with bail message prepended.
[245] Fix | Delete
*/
[246] Fix | Delete
public function display_bail_message( $output = '' ) {
[247] Fix | Delete
$message = '<div class="jp-carousel-msg"><p>';
[248] Fix | Delete
$message .= __( 'Jetpack\'s Carousel has been disabled, because another plugin or your theme is overriding the [gallery] shortcode.', 'jetpack' );
[249] Fix | Delete
$message .= '</p></div>';
[250] Fix | Delete
// put before gallery output.
[251] Fix | Delete
$output = $message . $output;
[252] Fix | Delete
return $output;
[253] Fix | Delete
}
[254] Fix | Delete
[255] Fix | Delete
/**
[256] Fix | Delete
* Determine whether Carousel is enabled, and adjust filters and enqueue assets accordingly.
[257] Fix | Delete
*
[258] Fix | Delete
* If no other filter hook produced output for the gallery shortcode or something returns true for
[259] Fix | Delete
* the `jp_carousel_force_enable` filter, Carousel is enabled and we queue our assets. Otherwise
[260] Fix | Delete
* it's disabled and we remove some of our subsequent filter hooks.
[261] Fix | Delete
*
[262] Fix | Delete
* @since 1.9.0
[263] Fix | Delete
*
[264] Fix | Delete
* @param string $output Gallery shortcode output.
[265] Fix | Delete
*
[266] Fix | Delete
* @return string Gallery shortcode output.
[267] Fix | Delete
*/
[268] Fix | Delete
public function check_if_shortcode_processed_and_enqueue_assets( $output ) {
[269] Fix | Delete
if (
[270] Fix | Delete
class_exists( 'Jetpack_AMP_Support' )
[271] Fix | Delete
&& Jetpack_AMP_Support::is_amp_request()
[272] Fix | Delete
) {
[273] Fix | Delete
return $output;
[274] Fix | Delete
}
[275] Fix | Delete
[276] Fix | Delete
if (
[277] Fix | Delete
! empty( $output ) &&
[278] Fix | Delete
/**
[279] Fix | Delete
* Allow third-party plugins or themes to force-enable Carousel.
[280] Fix | Delete
*
[281] Fix | Delete
* @module carousel
[282] Fix | Delete
*
[283] Fix | Delete
* @since 1.9.0
[284] Fix | Delete
*
[285] Fix | Delete
* @param bool false Should we force enable Carousel? Default to false.
[286] Fix | Delete
*/
[287] Fix | Delete
! apply_filters( 'jp_carousel_force_enable', false )
[288] Fix | Delete
) {
[289] Fix | Delete
// Bail because someone is overriding the [gallery] shortcode.
[290] Fix | Delete
remove_filter( 'gallery_style', array( $this, 'add_data_to_container' ) );
[291] Fix | Delete
remove_filter( 'wp_get_attachment_image_attributes', array( $this, 'add_data_to_images' ) );
[292] Fix | Delete
remove_filter( 'the_content', array( $this, 'add_data_img_tags_and_enqueue_assets' ) );
[293] Fix | Delete
// Display message that carousel has bailed, if user is super_admin, and if we're not on WordPress.com.
[294] Fix | Delete
if (
[295] Fix | Delete
is_super_admin() &&
[296] Fix | Delete
! ( defined( 'IS_WPCOM' ) && IS_WPCOM )
[297] Fix | Delete
) {
[298] Fix | Delete
add_filter( 'post_gallery', array( $this, 'display_bail_message' ) );
[299] Fix | Delete
}
[300] Fix | Delete
return $output;
[301] Fix | Delete
}
[302] Fix | Delete
[303] Fix | Delete
/**
[304] Fix | Delete
* Fires when thumbnails are shown in Carousel.
[305] Fix | Delete
*
[306] Fix | Delete
* @module carousel
[307] Fix | Delete
*
[308] Fix | Delete
* @since 1.6.0
[309] Fix | Delete
*/
[310] Fix | Delete
do_action( 'jp_carousel_thumbnails_shown' );
[311] Fix | Delete
[312] Fix | Delete
$this->enqueue_assets();
[313] Fix | Delete
[314] Fix | Delete
return $output;
[315] Fix | Delete
}
[316] Fix | Delete
[317] Fix | Delete
/**
[318] Fix | Delete
* Check if the content of a post uses gallery blocks. To be used by 'the_content' filter.
[319] Fix | Delete
*
[320] Fix | Delete
* @since 6.8.0
[321] Fix | Delete
* @deprecated since 11.3 We now hook into the 'block_render_{block_name}' hook to add markup.
[322] Fix | Delete
*
[323] Fix | Delete
* @param string $content Post content.
[324] Fix | Delete
*
[325] Fix | Delete
* @return string $content Post content.
[326] Fix | Delete
*/
[327] Fix | Delete
public function check_content_for_blocks( $content ) {
[328] Fix | Delete
_deprecated_function( __METHOD__, 'jetpack-11.3' );
[329] Fix | Delete
[330] Fix | Delete
if (
[331] Fix | Delete
class_exists( 'Jetpack_AMP_Support' )
[332] Fix | Delete
&& Jetpack_AMP_Support::is_amp_request()
[333] Fix | Delete
) {
[334] Fix | Delete
return $content;
[335] Fix | Delete
}
[336] Fix | Delete
[337] Fix | Delete
if ( has_block( 'gallery', $content ) || has_block( 'jetpack/tiled-gallery', $content ) ) {
[338] Fix | Delete
$this->enqueue_assets();
[339] Fix | Delete
$content = $this->add_data_to_container( $content );
[340] Fix | Delete
}
[341] Fix | Delete
[342] Fix | Delete
return $content;
[343] Fix | Delete
}
[344] Fix | Delete
[345] Fix | Delete
/**
[346] Fix | Delete
* Remove core lightbox settings from images in a gallery, if Carousel is enabled.
[347] Fix | Delete
*
[348] Fix | Delete
* @param array $parsed_block An associative array of the block being rendered.
[349] Fix | Delete
* @param array $source_block An un-modified copy of `$parsed_block`, as it appeared in the source content.
[350] Fix | Delete
* @param WP_Block|null $parent_block If this is a nested block, a reference to the parent block.
[351] Fix | Delete
* @return array The modified block data.
[352] Fix | Delete
*/
[353] Fix | Delete
public function remove_core_lightbox_in_gallery( $parsed_block, $source_block, $parent_block ) {
[354] Fix | Delete
if (
[355] Fix | Delete
! empty( $parsed_block['blockName'] ) &&
[356] Fix | Delete
'core/image' === $parsed_block['blockName'] &&
[357] Fix | Delete
! empty( $parent_block->name ) &&
[358] Fix | Delete
'core/gallery' === $parent_block->name
[359] Fix | Delete
) {
[360] Fix | Delete
unset( $parsed_block['attrs']['lightbox'] );
[361] Fix | Delete
}
[362] Fix | Delete
return $parsed_block;
[363] Fix | Delete
}
[364] Fix | Delete
[365] Fix | Delete
/**
[366] Fix | Delete
* Enrich the gallery block content using the render_block_{$this->name} filter.
[367] Fix | Delete
* This function is triggered after block render to make sure we track galleries within
[368] Fix | Delete
* reusable blocks.
[369] Fix | Delete
*
[370] Fix | Delete
* @see https://developer.wordpress.org/reference/hooks/render_block_this-name/
[371] Fix | Delete
*
[372] Fix | Delete
* @param string $block_content The rendered HTML for the carousel or gallery block.
[373] Fix | Delete
* @param array $block The parsed block details for the block.
[374] Fix | Delete
* @return string The fully-processed HTML for the carousel or gallery block.
[375] Fix | Delete
*
[376] Fix | Delete
* @since 11.3
[377] Fix | Delete
*/
[378] Fix | Delete
public function filter_gallery_block_render( $block_content, $block ) {
[379] Fix | Delete
global $post;
[380] Fix | Delete
[381] Fix | Delete
if ( empty( $block['blockName'] ) || ! in_array( $block['blockName'], array( 'core/gallery', 'jetpack/tiled-gallery' ), true ) ) {
[382] Fix | Delete
return $block_content;
[383] Fix | Delete
}
[384] Fix | Delete
[385] Fix | Delete
$this->enqueue_assets();
[386] Fix | Delete
[387] Fix | Delete
if ( ! $post instanceof WP_Post ) {
[388] Fix | Delete
return $block_content;
[389] Fix | Delete
}
[390] Fix | Delete
[391] Fix | Delete
$blog_id = (int) get_current_blog_id();
[392] Fix | Delete
[393] Fix | Delete
$extra_data = array(
[394] Fix | Delete
'data-carousel-extra' => array(
[395] Fix | Delete
'blog_id' => $blog_id,
[396] Fix | Delete
'permalink' => get_permalink( $post->ID ),
[397] Fix | Delete
),
[398] Fix | Delete
);
[399] Fix | Delete
[400] Fix | Delete
/**
[401] Fix | Delete
* Filter the data added to the Gallery container.
[402] Fix | Delete
*
[403] Fix | Delete
* @module carousel
[404] Fix | Delete
*
[405] Fix | Delete
* @since 1.6.0
[406] Fix | Delete
*
[407] Fix | Delete
* @param array $extra_data Array of data about the site and the post.
[408] Fix | Delete
*/
[409] Fix | Delete
$extra_data = apply_filters( 'jp_carousel_add_data_to_container', $extra_data );
[410] Fix | Delete
$extra_data = (array) $extra_data;
[411] Fix | Delete
[412] Fix | Delete
if ( empty( $extra_data ) ) {
[413] Fix | Delete
return $block_content;
[414] Fix | Delete
}
[415] Fix | Delete
[416] Fix | Delete
$extra_attributes = implode(
[417] Fix | Delete
' ',
[418] Fix | Delete
array_map(
[419] Fix | Delete
function ( $data_key, $data_values ) {
[420] Fix | Delete
return esc_attr( $data_key ) . "='" . wp_json_encode( $data_values ) . "'";
[421] Fix | Delete
},
[422] Fix | Delete
array_keys( $extra_data ),
[423] Fix | Delete
array_values( $extra_data )
[424] Fix | Delete
)
[425] Fix | Delete
);
[426] Fix | Delete
[427] Fix | Delete
// Add extra attributes to first HTML element (which may have leading whitespace)
[428] Fix | Delete
return preg_replace(
[429] Fix | Delete
'/^(\s*<(div|ul|figure))/',
[430] Fix | Delete
'$1 ' . $extra_attributes . ' ',
[431] Fix | Delete
$block_content,
[432] Fix | Delete
1
[433] Fix | Delete
);
[434] Fix | Delete
}
[435] Fix | Delete
[436] Fix | Delete
/**
[437] Fix | Delete
* Enqueueing Carousel assets.
[438] Fix | Delete
*/
[439] Fix | Delete
public function enqueue_assets() {
[440] Fix | Delete
if ( $this->first_run ) {
[441] Fix | Delete
wp_enqueue_script(
[442] Fix | Delete
'jetpack-carousel',
[443] Fix | Delete
Assets::get_file_url_for_environment(
[444] Fix | Delete
'_inc/build/carousel/jetpack-carousel.min.js',
[445] Fix | Delete
'modules/carousel/jetpack-carousel.js'
[446] Fix | Delete
),
[447] Fix | Delete
array(),
[448] Fix | Delete
$this->asset_version( JETPACK__VERSION ),
[449] Fix | Delete
true
[450] Fix | Delete
);
[451] Fix | Delete
[452] Fix | Delete
$swiper_library_path = array(
[453] Fix | Delete
'url' => plugins_url( '_inc/blocks/swiper.js', JETPACK__PLUGIN_FILE ),
[454] Fix | Delete
);
[455] Fix | Delete
wp_localize_script( 'jetpack-carousel', 'jetpackSwiperLibraryPath', $swiper_library_path );
[456] Fix | Delete
[457] Fix | Delete
// Note: using home_url() instead of admin_url() for ajaxurl to be sure to get same domain on wpcom when using mapped domains (also works on self-hosted).
[458] Fix | Delete
// Also: not hardcoding path since there is no guarantee site is running on site root in self-hosted context.
[459] Fix | Delete
$is_logged_in = is_user_logged_in();
[460] Fix | Delete
$comment_registration = (int) get_option( 'comment_registration' );
[461] Fix | Delete
$require_name_email = (int) get_option( 'require_name_email' );
[462] Fix | Delete
$localize_strings = array(
[463] Fix | Delete
'widths' => $this->prebuilt_widths,
[464] Fix | Delete
'is_logged_in' => $is_logged_in,
[465] Fix | Delete
'lang' => strtolower( substr( get_locale(), 0, 2 ) ),
[466] Fix | Delete
'ajaxurl' => set_url_scheme( admin_url( 'admin-ajax.php' ) ),
[467] Fix | Delete
'nonce' => wp_create_nonce( 'carousel_nonce' ),
[468] Fix | Delete
'display_exif' => $this->test_1or0_option( Jetpack_Options::get_option_and_ensure_autoload( 'carousel_display_exif', true ) ),
[469] Fix | Delete
'display_comments' => $this->test_1or0_option( Jetpack_Options::get_option_and_ensure_autoload( 'carousel_display_comments', true ) ),
[470] Fix | Delete
'single_image_gallery' => $this->single_image_gallery_enabled,
[471] Fix | Delete
'single_image_gallery_media_file' => $this->single_image_gallery_enabled_media_file,
[472] Fix | Delete
'background_color' => $this->carousel_background_color_sanitize( Jetpack_Options::get_option_and_ensure_autoload( 'carousel_background_color', '' ) ),
[473] Fix | Delete
'comment' => __( 'Comment', 'jetpack' ),
[474] Fix | Delete
'post_comment' => __( 'Post Comment', 'jetpack' ),
[475] Fix | Delete
'write_comment' => __( 'Write a Comment...', 'jetpack' ),
[476] Fix | Delete
'loading_comments' => __( 'Loading Comments...', 'jetpack' ),
[477] Fix | Delete
'image_label' => __( 'Open image in full-screen.', 'jetpack' ),
[478] Fix | Delete
'download_original' => sprintf(
[479] Fix | Delete
/* translators: %1s is the full-size image width, and %2s is the height. */
[480] Fix | Delete
__( 'View full size <span class="photo-size">%1$s<span class="photo-size-times">&times;</span>%2$s</span>', 'jetpack' ),
[481] Fix | Delete
'{0}',
[482] Fix | Delete
'{1}'
[483] Fix | Delete
),
[484] Fix | Delete
'no_comment_text' => __( 'Please be sure to submit some text with your comment.', 'jetpack' ),
[485] Fix | Delete
'no_comment_email' => __( 'Please provide an email address to comment.', 'jetpack' ),
[486] Fix | Delete
'no_comment_author' => __( 'Please provide your name to comment.', 'jetpack' ),
[487] Fix | Delete
'comment_post_error' => __( 'Sorry, but there was an error posting your comment. Please try again later.', 'jetpack' ),
[488] Fix | Delete
'comment_approved' => __( 'Your comment was approved.', 'jetpack' ),
[489] Fix | Delete
'comment_unapproved' => __( 'Your comment is in moderation.', 'jetpack' ),
[490] Fix | Delete
'camera' => __( 'Camera', 'jetpack' ),
[491] Fix | Delete
'aperture' => __( 'Aperture', 'jetpack' ),
[492] Fix | Delete
'shutter_speed' => __( 'Shutter Speed', 'jetpack' ),
[493] Fix | Delete
'focal_length' => __( 'Focal Length', 'jetpack' ),
[494] Fix | Delete
'copyright' => __( 'Copyright', 'jetpack' ),
[495] Fix | Delete
'comment_registration' => $comment_registration,
[496] Fix | Delete
'require_name_email' => $require_name_email,
[497] Fix | Delete
/** This action is documented in core/src/wp-includes/link-template.php */
[498] Fix | Delete
'login_url' => wp_login_url( apply_filters( 'the_permalink', get_permalink() ) ),
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function