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

Introduce new wpl_iframe_src filter to enable filtering arguments to Likes iframes. #40276

Merged
merged 5 commits into from
Nov 26, 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
@@ -0,0 +1,4 @@
Significance: minor
Type: other

Likes: Add a filter to the iframe url to enable future expansion and modularity.
3 changes: 3 additions & 0 deletions projects/plugins/jetpack/modules/likes.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,9 @@ function_exists( '\Activitypub\is_activitypub_request' )

$title = esc_html__( 'Like or Reblog', 'jetpack' );

/** This filter is documented in modules/likes/jetpack-likes-master-iframe.php */
$src = apply_filters( 'jetpack_likes_iframe_src', $src );

$html = "<div class='sharedaddy sd-block sd-like jetpack-likes-widget-wrapper jetpack-likes-widget-unloaded' id='$wrapper' data-src='$src' data-name='$name' data-title='$title'>";
$html .= $headline;
$html .= "<div class='likes-widget-placeholder post-likes-widget-placeholder' style='height: 55px;'><span class='button'><span>" . esc_html__( 'Like', 'jetpack' ) . '</span></span> <span class="loading">' . esc_html__( 'Loading...', 'jetpack' ) . '</span></div>';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ function jetpack_likes_master_iframe() {
$new_layout
);

/**
* Filters the Likes iframe src, if any parameters need to be overridden or tracked.
*
* @module likes
*
* @since $$next-version$$
*
* @param string URL to https://widgets.wp.com/ with various arguments appended to the get string and fragment.
*/
$src = apply_filters( 'jetpack_likes_iframe_src', $src );

if ( $new_layout ) {
// The span content is replaced by queuehandler when showOtherGravatars is called.
$likers_text = wp_kses( '<span>%d</span>', array( 'span' => array() ) );
Expand Down
Loading