summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/sharedaddy/sharing-sources.php')
-rw-r--r--plugins/jetpack/modules/sharedaddy/sharing-sources.php257
1 files changed, 152 insertions, 105 deletions
diff --git a/plugins/jetpack/modules/sharedaddy/sharing-sources.php b/plugins/jetpack/modules/sharedaddy/sharing-sources.php
index 73f38553..ec87639d 100644
--- a/plugins/jetpack/modules/sharedaddy/sharing-sources.php
+++ b/plugins/jetpack/modules/sharedaddy/sharing-sources.php
@@ -1,8 +1,8 @@
<?php
abstract class Sharing_Source {
- public $button_style;
- public $smart;
+ public $button_style;
+ public $smart;
protected $open_link_in_new;
protected $id;
@@ -21,11 +21,13 @@ abstract class Sharing_Source {
*/
$this->open_link_in_new = apply_filters( 'jetpack_open_sharing_in_new_window', true );
- if ( isset( $settings['button_style'] ) )
+ if ( isset( $settings['button_style'] ) ) {
$this->button_style = $settings['button_style'];
+ }
- if ( isset( $settings['smart'] ) )
+ if ( isset( $settings['smart'] ) ) {
$this->smart = $settings['smart'];
+ }
}
public function http() {
@@ -79,17 +81,19 @@ abstract class Sharing_Source {
public function get_link( $url, $text, $title, $query = '', $id = false ) {
$args = func_get_args();
- $klasses = array( 'share-'.$this->get_class(), 'sd-button' );
+ $klasses = array( 'share-' . $this->get_class(), 'sd-button' );
- if ( 'icon' == $this->button_style || 'icon-text' == $this->button_style )
+ if ( 'icon' == $this->button_style || 'icon-text' == $this->button_style ) {
$klasses[] = 'share-icon';
+ }
if ( 'icon' == $this->button_style ) {
$text = $title;
$klasses[] = 'no-text';
- if ( true == $this->open_link_in_new )
+ if ( true == $this->open_link_in_new ) {
$text .= __( ' (Opens in new window)', 'jetpack' );
+ }
}
/**
@@ -144,15 +148,17 @@ abstract class Sharing_Source {
*/
$query = apply_filters( 'jetpack_sharing_display_query', $query, $this, $id, $args );
- if ( !empty( $query ) ) {
- if ( false === stripos( $url, '?' ) )
- $url .= '?'.$query;
- else
- $url .= '&amp;'.$query;
+ if ( ! empty( $query ) ) {
+ if ( false === stripos( $url, '?' ) ) {
+ $url .= '?' . $query;
+ } else {
+ $url .= '&amp;' . $query;
+ }
}
- if ( 'text' == $this->button_style )
+ if ( 'text' == $this->button_style ) {
$klasses[] = 'no-icon';
+ }
/**
* Filter the sharing display classes.
@@ -202,7 +208,6 @@ abstract class Sharing_Source {
( true == $this->open_link_in_new ) ? ' target="_blank"' : '',
$title,
( 'icon' == $this->button_style ) ? '></span><span class="sharing-screen-reader-text"' : '',
-
$text
);
}
@@ -237,20 +242,25 @@ abstract class Sharing_Source {
public function display_preview( $echo = true, $force_smart = false, $button_style = null ) {
$text = '&nbsp;';
$button_style = ( ! empty( $button_style ) ) ? $button_style : $this->button_style;
- if ( !$this->smart && ! $force_smart )
- if ( $button_style != 'icon' )
+ if ( ! $this->smart && ! $force_smart ) {
+ if ( $button_style != 'icon' ) {
$text = $this->get_name();
+ }
+ }
- $klasses = array( 'share-'.$this->get_class(), 'sd-button' );
+ $klasses = array( 'share-' . $this->get_class(), 'sd-button' );
- if ( $button_style == 'icon' || $button_style == 'icon-text' )
+ if ( $button_style == 'icon' || $button_style == 'icon-text' ) {
$klasses[] = 'share-icon';
+ }
- if ( $button_style == 'icon' )
+ if ( $button_style == 'icon' ) {
$klasses[] = 'no-text';
+ }
- if ( $button_style == 'text' )
+ if ( $button_style == 'text' ) {
$klasses[] = 'no-icon';
+ }
$link = sprintf(
'<a rel="nofollow" class="%s" href="javascript:void(0)" title="%s"><span>%s</span></a>',
@@ -261,8 +271,9 @@ abstract class Sharing_Source {
$smart = ( $this->smart || $force_smart ) ? 'on' : 'off';
$return = "<div class='option option-smart-$smart'>$link</div>";
- if ( $echo )
+ if ( $echo ) {
echo $return;
+ }
return $return;
}
@@ -274,24 +285,26 @@ abstract class Sharing_Source {
if ( $post == false ) {
// get total number of shares for service
- return (int) $wpdb->get_var( $wpdb->prepare( "SELECT SUM( count ) FROM sharing_stats WHERE blog_id = %d AND share_service = %s", $blog_id, $name ) );
+ return (int) $wpdb->get_var( $wpdb->prepare( 'SELECT SUM( count ) FROM sharing_stats WHERE blog_id = %d AND share_service = %s', $blog_id, $name ) );
}
// get total shares for a post
- return (int) $wpdb->get_var( $wpdb->prepare( "SELECT count FROM sharing_stats WHERE blog_id = %d AND post_id = %d AND share_service = %s", $blog_id, $post->ID, $name ) );
+ return (int) $wpdb->get_var( $wpdb->prepare( 'SELECT count FROM sharing_stats WHERE blog_id = %d AND post_id = %d AND share_service = %s', $blog_id, $post->ID, $name ) );
}
public function get_posts_total() {
global $wpdb, $blog_id;
$totals = array();
- $name = strtolower( $this->get_id() );
+ $name = strtolower( $this->get_id() );
- $my_data = $wpdb->get_results( $wpdb->prepare( "SELECT post_id as id, SUM( count ) as total FROM sharing_stats WHERE blog_id = %d AND share_service = %s GROUP BY post_id ORDER BY count DESC ", $blog_id, $name ) );
+ $my_data = $wpdb->get_results( $wpdb->prepare( 'SELECT post_id as id, SUM( count ) as total FROM sharing_stats WHERE blog_id = %d AND share_service = %s GROUP BY post_id ORDER BY count DESC ', $blog_id, $name ) );
- if ( !empty( $my_data ) )
- foreach( $my_data as $row )
+ if ( ! empty( $my_data ) ) {
+ foreach ( $my_data as $row ) {
$totals[] = new Sharing_Post_Total( $row->id, $row->total );
+ }
+ }
usort( $totals, array( 'Sharing_Post_Total', 'cmp' ) );
@@ -312,18 +325,19 @@ abstract class Sharing_Source {
}
public function js_dialog( $name, $params = array() ) {
- if ( true !== $this->open_link_in_new )
+ if ( true !== $this->open_link_in_new ) {
return;
+ }
$defaults = array(
- 'menubar' => 1,
+ 'menubar' => 1,
'resizable' => 1,
- 'width' => 600,
- 'height' => 400,
+ 'width' => 600,
+ 'height' => 400,
);
$params = array_merge( $defaults, $params );
$opts = array();
- foreach( $params as $key => $val ) {
+ foreach ( $params as $key => $val ) {
$opts[] = "$key=$val";
}
$opts = implode( ',', $opts );
@@ -360,10 +374,11 @@ class Share_Email extends Sharing_Source {
public function __construct( $id, array $settings ) {
parent::__construct( $id, $settings );
- if ( 'official' == $this->button_style )
+ if ( 'official' == $this->button_style ) {
$this->smart = true;
- else
+ } else {
$this->smart = false;
+ }
}
public function get_name() {
@@ -373,16 +388,19 @@ class Share_Email extends Sharing_Source {
// Default does nothing
public function process_request( $post, array $post_data ) {
$ajax = false;
- if ( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) == 'xmlhttprequest' )
+ if ( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) == 'xmlhttprequest' ) {
$ajax = true;
+ }
$source_email = $target_email = $source_name = false;
- if ( isset( $post_data['source_email'] ) && is_email( $post_data['source_email'] ) )
+ if ( isset( $post_data['source_email'] ) && is_email( $post_data['source_email'] ) ) {
$source_email = $post_data['source_email'];
+ }
- if ( isset( $post_data['target_email'] ) && is_email( $post_data['target_email'] ) )
+ if ( isset( $post_data['target_email'] ) && is_email( $post_data['target_email'] ) ) {
$target_email = $post_data['target_email'];
+ }
if ( isset( $post_data['source_name'] ) && strlen( $post_data['source_name'] ) < 200 ) {
$source_name = $post_data['source_name'];
@@ -393,7 +411,7 @@ class Share_Email extends Sharing_Source {
}
// Test email
- $error = 1; // Failure in data
+ $error = 1; // Failure in data
if ( empty( $post_data['source_f_name'] ) && $source_email && $target_email && $source_name ) {
/**
* Allow plugins to stop the email sharing button from running the shared message through Akismet.
@@ -408,10 +426,10 @@ class Share_Email extends Sharing_Source {
*/
if ( apply_filters( 'sharing_email_check', true, $post, $post_data ) ) {
$data = array(
- 'post' => $post,
+ 'post' => $post,
'source' => $source_email,
'target' => $target_email,
- 'name' => $source_name
+ 'name' => $source_name,
);
// todo: implement an error message when email doesn't get sent.
/**
@@ -444,24 +462,25 @@ class Share_Email extends Sharing_Source {
?>
<div class="response">
<div class="response-title"><?php _e( 'This post has been shared!', 'jetpack' ); ?></div>
- <div class="response-sub"><?php printf( __( 'You have shared this post with %s', 'jetpack' ), esc_html( $target_email ) ); ?></div>
- <div class="response-close"><a href="#" class="sharing_cancel"><?php _e( 'Close', 'jetpack' ); ?></a></div>
+ <div class="response-sub"><?php printf( __( 'You have shared this post with %s', 'jetpack' ), esc_html( $target_email ) ); ?></div>
+ <div class="response-close"><a href="#" class="sharing_cancel"><?php _e( 'Close', 'jetpack' ); ?></a></div>
</div>
<?php
+ } else {
+ wp_safe_redirect( get_permalink( $post->ID ) . '?shared=email' );
}
- else
- wp_safe_redirect( get_permalink( $post->ID ).'?shared=email' );
die();
+ } else {
+ $error = 2; // Email check failed
}
- else
- $error = 2; // Email check failed
}
- if ( $ajax )
+ if ( $ajax ) {
echo $error;
- else
- wp_safe_redirect( get_permalink( $post->ID ).'?shared=email&msg=fail' );
+ } else {
+ wp_safe_redirect( get_permalink( $post->ID ) . '?shared=email&msg=fail' );
+ }
die();
}
@@ -542,10 +561,11 @@ class Share_Twitter extends Sharing_Source {
public function __construct( $id, array $settings ) {
parent::__construct( $id, $settings );
- if ( 'official' == $this->button_style )
+ if ( 'official' == $this->button_style ) {
$this->smart = true;
- else
+ } else {
$this->smart = false;
+ }
}
public function get_name() {
@@ -570,7 +590,7 @@ class Share_Twitter extends Sharing_Source {
* was introduced with the adding of the Twitter cards.
* This should be a temporary solution until a better method is setup.
*/
- if( 'jetpack' == $twitter_site_tag_value ) {
+ if ( 'jetpack' == $twitter_site_tag_value ) {
$twitter_site_tag_value = '';
}
@@ -609,8 +629,9 @@ class Share_Twitter extends Sharing_Source {
foreach ( $related_accounts as $related_account_username => $related_account_description ) {
// Join the description onto the end of the username
- if ( $related_account_description )
+ if ( $related_account_description ) {
$related_account_username .= ':' . $related_account_description;
+ }
$related[] = $related_account_username;
}
@@ -735,10 +756,11 @@ class Share_Reddit extends Sharing_Source {
public function __construct( $id, array $settings ) {
parent::__construct( $id, $settings );
- if ( 'official' == $this->button_style )
+ if ( 'official' == $this->button_style ) {
$this->smart = true;
- else
+ } else {
$this->smart = false;
+ }
}
public function get_name() {
@@ -746,10 +768,11 @@ class Share_Reddit extends Sharing_Source {
}
public function get_display( $post ) {
- if ( $this->smart )
+ if ( $this->smart ) {
return '<div class="reddit_button"><iframe src="' . $this->http() . '://www.reddit.com/static/button/button1.html?newwindow=true&width=120&amp;url=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&amp;title=' . rawurlencode( $this->get_share_title( $post->ID ) ) . '" height="22" width="120" scrolling="no" frameborder="0"></iframe></div>';
- else
+ } else {
return $this->get_link( $this->get_process_request_url( $post->ID ), _x( 'Reddit', 'share to', 'jetpack' ), __( 'Click to share on Reddit', 'jetpack' ), 'share=reddit' );
+ }
}
public function process_request( $post, array $post_data ) {
@@ -770,10 +793,11 @@ class Share_LinkedIn extends Sharing_Source {
public function __construct( $id, array $settings ) {
parent::__construct( $id, $settings );
- if ( 'official' == $this->button_style )
+ if ( 'official' == $this->button_style ) {
$this->smart = true;
- else
+ } else {
$this->smart = false;
+ }
}
public function get_name() {
@@ -808,7 +832,6 @@ class Share_LinkedIn extends Sharing_Source {
// Using the same URL as the official button, which is *not* LinkedIn's documented sharing link
// https://www.linkedin.com/cws/share?url={url}&token=&isFramed=false
-
$linkedin_url = add_query_arg( array(
'url' => rawurlencode( $post_link ),
), 'https://www.linkedin.com/cws/share?token=&isFramed=false' );
@@ -822,14 +845,14 @@ class Share_LinkedIn extends Sharing_Source {
}
public function display_footer() {
- if ( !$this->smart ) {
+ if ( ! $this->smart ) {
$this->js_dialog( $this->shortname, array( 'width' => 580, 'height' => 450 ) );
} else {
?><script type="text/javascript">
jQuery( document ).ready( function() {
- jQuery.getScript( 'https://platform.linkedin.com/in.js?async=true', function success() {
- IN.init();
- });
+ jQuery.getScript( 'https://platform.linkedin.com/in.js?async=true', function success() {
+ IN.init();
+ });
});
jQuery( document.body ).on( 'post-load', function() {
if ( typeof IN != 'undefined' )
@@ -848,13 +871,15 @@ class Share_Facebook extends Sharing_Source {
public function __construct( $id, array $settings ) {
parent::__construct( $id, $settings );
- if ( isset( $settings['share_type'] ) )
+ if ( isset( $settings['share_type'] ) ) {
$this->share_type = $settings['share_type'];
+ }
- if ( 'official' == $this->button_style )
+ if ( 'official' == $this->button_style ) {
$this->smart = true;
- else
+ } else {
$this->smart = false;
+ }
}
public function get_name() {
@@ -865,12 +890,12 @@ class Share_Facebook extends Sharing_Source {
}
function guess_locale_from_lang( $lang ) {
- if ( 'en' == $lang || 'en_US' == $lang || !$lang ) {
+ if ( 'en' == $lang || 'en_US' == $lang || ! $lang ) {
return 'en_US';
}
- if ( !class_exists( 'GP_Locales' ) ) {
- if ( !defined( 'JETPACK__GLOTPRESS_LOCALES_PATH' ) || !file_exists( JETPACK__GLOTPRESS_LOCALES_PATH ) ) {
+ if ( ! class_exists( 'GP_Locales' ) ) {
+ if ( ! defined( 'JETPACK__GLOTPRESS_LOCALES_PATH' ) || ! file_exists( JETPACK__GLOTPRESS_LOCALES_PATH ) ) {
return false;
}
@@ -979,10 +1004,11 @@ class Share_Print extends Sharing_Source {
public function __construct( $id, array $settings ) {
parent::__construct( $id, $settings );
- if ( 'official' == $this->button_style )
+ if ( 'official' == $this->button_style ) {
$this->smart = true;
- else
+ } else {
$this->smart = false;
+ }
}
public function get_name() {
@@ -1000,10 +1026,11 @@ class Share_PressThis extends Sharing_Source {
public function __construct( $id, array $settings ) {
parent::__construct( $id, $settings );
- if ( 'official' == $this->button_style )
+ if ( 'official' == $this->button_style ) {
$this->smart = true;
- else
+ } else {
$this->smart = false;
+ }
}
public function get_name() {
@@ -1038,10 +1065,11 @@ class Share_PressThis extends Sharing_Source {
$blog = current( $blogs );
- $url = $blog->siteurl.'/wp-admin/press-this.php?u='.rawurlencode( $this->get_share_url( $post->ID ) ).'&t='.rawurlencode( $this->get_share_title( $post->ID ) );
+ $url = $blog->siteurl . '/wp-admin/press-this.php?u=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&t=' . rawurlencode( $this->get_share_title( $post->ID ) );
- if ( isset( $_GET['sel'] ) )
- $url .= '&s='.rawurlencode( $_GET['sel'] );
+ if ( isset( $_GET['sel'] ) ) {
+ $url .= '&s=' . rawurlencode( $_GET['sel'] );
+ }
// Record stats
parent::process_request( $post, $post_data );
@@ -1064,10 +1092,11 @@ class Share_GooglePlus1 extends Sharing_Source {
public function __construct( $id, array $settings ) {
parent::__construct( $id, $settings );
- if ( 'official' == $this->button_style )
+ if ( 'official' == $this->button_style ) {
$this->smart = true;
- else
+ } else {
$this->smart = false;
+ }
}
public function get_name() {
@@ -1154,11 +1183,11 @@ class Share_GooglePlus1 extends Sharing_Source {
if ( $post == false ) {
// get total number of shares for service
- return $wpdb->get_var( $wpdb->prepare( "SELECT SUM( count ) FROM sharing_stats WHERE blog_id = %d AND share_service = %s", $blog_id, $name ) );
+ return $wpdb->get_var( $wpdb->prepare( 'SELECT SUM( count ) FROM sharing_stats WHERE blog_id = %d AND share_service = %s', $blog_id, $name ) );
}
- //get total shares for a post
- return $wpdb->get_var( $wpdb->prepare( "SELECT count FROM sharing_stats WHERE blog_id = %d AND post_id = %d AND share_service = %s", $blog_id, $post->ID, $name ) );
+ // get total shares for a post
+ return $wpdb->get_var( $wpdb->prepare( 'SELECT count FROM sharing_stats WHERE blog_id = %d AND post_id = %d AND share_service = %s', $blog_id, $post->ID, $name ) );
}
}
@@ -1200,8 +1229,9 @@ class Share_Custom extends Sharing_Advanced_Source {
}
}
- if ( isset( $settings['url'] ) )
+ if ( isset( $settings['url'] ) ) {
$this->url = $settings['url'];
+ }
}
public function get_name() {
@@ -1209,22 +1239,25 @@ class Share_Custom extends Sharing_Advanced_Source {
}
public function get_display( $post ) {
- $str = $this->get_link( $this->get_process_request_url( $post->ID ), esc_html( $this->name ), sprintf( __( 'Click to share on %s', 'jetpack' ), esc_attr( $this->name ) ), 'share='.$this->id );
+ $str = $this->get_link( $this->get_process_request_url( $post->ID ), esc_html( $this->name ), sprintf( __( 'Click to share on %s', 'jetpack' ), esc_attr( $this->name ) ), 'share=' . $this->id );
return str_replace( '<span>', '<span style="' . esc_attr( 'background-image:url("' . addcslashes( esc_url_raw( $this->icon ), '"' ) . '");' ) . '">', $str );
}
public function process_request( $post, array $post_data ) {
$url = str_replace( '&amp;', '&', $this->url );
+ $url = str_replace( '%post_id%', rawurlencode( $post->ID ), $url );
$url = str_replace( '%post_url%', rawurlencode( $this->get_share_url( $post->ID ) ), $url );
$url = str_replace( '%post_full_url%', rawurlencode( get_permalink( $post->ID ) ), $url );
$url = str_replace( '%post_title%', rawurlencode( $this->get_share_title( $post->ID ) ), $url );
+ $url = str_replace( '%home_url%', rawurlencode( home_url() ), $url );
+ $url = str_replace( '%post_slug%', rawurlencode( $post->post_name ), $url );
if ( strpos( $url, '%post_tags%' ) !== false ) {
- $tags = get_the_tags( $post->ID );
+ $tags = get_the_tags( $post->ID );
$tagged = '';
if ( $tags ) {
- foreach ( $tags AS $tag ) {
+ foreach ( $tags as $tag ) {
$tagged[] = rawurlencode( $tag->name );
}
@@ -1236,8 +1269,9 @@ class Share_Custom extends Sharing_Advanced_Source {
if ( strpos( $url, '%post_excerpt%' ) !== false ) {
$url_excerpt = $post->post_excerpt;
- if ( empty( $url_excerpt ) )
+ if ( empty( $url_excerpt ) ) {
$url_excerpt = $post->post_content;
+ }
$url_excerpt = strip_tags( strip_shortcodes( $url_excerpt ) );
$url_excerpt = wp_html_excerpt( $url_excerpt, 100 );
@@ -1291,14 +1325,17 @@ class Share_Custom extends Sharing_Advanced_Source {
$url = trim( esc_url_raw( $data['url'] ) );
$icon = trim( esc_url_raw( $data['icon'] ) );
- if ( $name )
+ if ( $name ) {
$this->name = $name;
+ }
- if ( $url )
- $this->url = $url;
+ if ( $url ) {
+ $this->url = $url;
+ }
- if ( $icon )
+ if ( $icon ) {
$this->icon = $icon;
+ }
}
public function get_options() {
@@ -1313,22 +1350,26 @@ class Share_Custom extends Sharing_Advanced_Source {
$opts = $this->get_options();
$text = '&nbsp;';
- if ( !$this->smart )
- if ( $this->button_style != 'icon' )
+ if ( ! $this->smart ) {
+ if ( $this->button_style != 'icon' ) {
$text = $this->get_name();
+ }
+ }
- $klasses = array( 'share-'.$this->shortname );
+ $klasses = array( 'share-' . $this->shortname );
- if ( $this->button_style == 'icon' || $this->button_style == 'icon-text' )
+ if ( $this->button_style == 'icon' || $this->button_style == 'icon-text' ) {
$klasses[] = 'share-icon';
+ }
if ( $this->button_style == 'icon' ) {
$text = '';
$klasses[] = 'no-text';
}
- if ( $this->button_style == 'text' )
+ if ( $this->button_style == 'text' ) {
$klasses[] = 'no-icon';
+ }
$link = sprintf(
'<a rel="nofollow" class="%s" href="javascript:void(0)" title="%s"><span style="background-image:url(&quot;%s&quot;) !important;background-position:left center;background-repeat:no-repeat;">%s</span></a>',
@@ -1349,10 +1390,11 @@ class Share_Tumblr extends Sharing_Source {
public $genericon = '\f214';
public function __construct( $id, array $settings ) {
parent::__construct( $id, $settings );
- if ( 'official' == $this->button_style )
+ if ( 'official' == $this->button_style ) {
$this->smart = true;
- else
+ } else {
$this->smart = false;
+ }
}
public function get_name() {
@@ -1362,8 +1404,9 @@ class Share_Tumblr extends Sharing_Source {
public function get_display( $post ) {
if ( $this->smart ) {
$target = '';
- if ( true == $this->open_link_in_new )
+ if ( true == $this->open_link_in_new ) {
$target = '_blank';
+ }
return '<a target="' . $target . '" href="https://www.tumblr.com/share/link/?url=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&name=' . rawurlencode( $this->get_share_title( $post->ID ) ) . '" title="' . __( 'Share on Tumblr', 'jetpack' ) . '" style="display:inline-block; text-indent:-9999px; overflow:hidden; width:62px; height:20px; background:url(\'https://platform.tumblr.com/v1/share_2.png\') top left no-repeat transparent;">' . __( 'Share on Tumblr', 'jetpack' ) . '</a>';
} else {
@@ -1396,10 +1439,11 @@ class Share_Pinterest extends Sharing_Source {
public function __construct( $id, array $settings ) {
parent::__construct( $id, $settings );
- if ( 'official' == $this->button_style )
+ if ( 'official' == $this->button_style ) {
$this->smart = true;
- else
+ } else {
$this->smart = false;
+ }
}
public function get_name() {
@@ -1481,7 +1525,7 @@ class Share_Pinterest extends Sharing_Source {
// Record stats
parent::process_request( $post, $post_data );
// If we're triggering the multi-select panel, then we don't need to redirect to Pinterest
- if ( !isset( $_GET['js_only'] ) ) {
+ if ( ! isset( $_GET['js_only'] ) ) {
$pinterest_url = esc_url_raw( $this->get_external_url( $post ) );
wp_redirect( $pinterest_url );
} else {
@@ -1508,7 +1552,9 @@ class Share_Pinterest extends Sharing_Source {
var s = document.createElement("script");
s.type = "text/javascript";
s.async = true;
- <?php if ( $jetpack_pinit_over ) echo "s.setAttribute('data-pin-hover', true);"; ?>
+ <?php if ( $jetpack_pinit_over ) {
+ echo "s.setAttribute('data-pin-hover', true);";
+ } ?>
s.src = window.location.protocol + "//assets.pinterest.com/js/pinit.js";
var x = document.getElementsByTagName("script")[0];
x.parentNode.insertBefore(s, x);
@@ -1546,10 +1592,11 @@ class Share_Pocket extends Sharing_Source {
public function __construct( $id, array $settings ) {
parent::__construct( $id, $settings );
- if ( 'official' == $this->button_style )
+ if ( 'official' == $this->button_style ) {
$this->smart = true;
- else
+ } else {
$this->smart = false;
+ }
}
public function get_name() {