summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYury German <blueknight@gentoo.org>2016-02-12 22:22:00 -0500
committerYury German <blueknight@gentoo.org>2016-02-12 22:22:00 -0500
commit657cafe0e955cf88033597f131aa50835140c617 (patch)
treecf21a30d319cb2a238a6cfb8b4eb3b20b1b5dcff /plugins/jetpack/modules/sharedaddy/sharing-service.php
parentAdding New Mantra version 2.4.1.1 - Bug 574468 (diff)
downloadblogs-gentoo-657cafe0e955cf88033597f131aa50835140c617.tar.gz
blogs-gentoo-657cafe0e955cf88033597f131aa50835140c617.tar.bz2
blogs-gentoo-657cafe0e955cf88033597f131aa50835140c617.zip
Updating plugins easy-table, jetpack, openid, public-post preview, talbe-of-contents-plus, wordress-mobile-pack - Bug 574468
Diffstat (limited to 'plugins/jetpack/modules/sharedaddy/sharing-service.php')
-rw-r--r--plugins/jetpack/modules/sharedaddy/sharing-service.php90
1 files changed, 56 insertions, 34 deletions
diff --git a/plugins/jetpack/modules/sharedaddy/sharing-service.php b/plugins/jetpack/modules/sharedaddy/sharing-service.php
index 6fcd9939..8966600a 100644
--- a/plugins/jetpack/modules/sharedaddy/sharing-service.php
+++ b/plugins/jetpack/modules/sharedaddy/sharing-service.php
@@ -6,7 +6,7 @@ define( 'WP_SHARING_PLUGIN_VERSION', JETPACK__VERSION );
class Sharing_Service {
private $global = false;
- var $default_sharing_label = '';
+ public $default_sharing_label = '';
public function __construct() {
$this->default_sharing_label = __( 'Share this:', 'jetpack' );
@@ -49,13 +49,13 @@ class Sharing_Service {
'facebook' => 'Share_Facebook',
'linkedin' => 'Share_LinkedIn',
'reddit' => 'Share_Reddit',
- 'stumbleupon' => 'Share_Stumbleupon',
'twitter' => 'Share_Twitter',
'press-this' => 'Share_PressThis',
'google-plus-1' => 'Share_GooglePlus1',
'tumblr' => 'Share_Tumblr',
'pinterest' => 'Share_Pinterest',
'pocket' => 'Share_Pocket',
+ 'skype' => 'Share_Skype',
);
if ( $include_custom ) {
@@ -69,6 +69,8 @@ class Sharing_Service {
/**
* Filters the list of available Sharing Services.
*
+ * @module sharedaddy
+ *
* @since 1.1.0
*
* @param array $services Array of all available Sharing Services.
@@ -136,6 +138,8 @@ class Sharing_Service {
/**
* Control the state of the list of sharing services.
*
+ * @module sharedaddy
+ *
* @since 1.1.0
*
* @param array $args {
@@ -179,6 +183,8 @@ class Sharing_Service {
/**
* Filters the list of default Sharing Services.
*
+ * @module sharedaddy
+ *
* @since 1.1.0
*
* @param array $enabled Array of default Sharing Services.
@@ -204,6 +210,8 @@ class Sharing_Service {
/**
* Filters the list of enabled Sharing Services.
*
+ * @module sharedaddy
+ *
* @since 1.1.0
*
* @param array $blog Array of enabled Sharing Services.
@@ -240,7 +248,7 @@ class Sharing_Service {
// Defaults
$options['global'] = array(
- 'button_style' => 'icon',
+ 'button_style' => 'icon-text',
'sharing_label' => $this->default_sharing_label,
'open_links' => 'same',
'show' => array(),
@@ -250,6 +258,8 @@ class Sharing_Service {
/**
* Filters global sharing settings.
*
+ * @module sharedaddy
+ *
* @since 1.1.0
*
* @param array $options['global'] Array of global sharing settings.
@@ -342,6 +352,8 @@ class Sharing_Service {
/**
* Get the state of a sharing button.
*
+ * @module sharedaddy
+ *
* @since 1.1.0
*
* @param array $args {
@@ -411,12 +423,12 @@ class Sharing_Service {
}
class Sharing_Service_Total {
- var $id = '';
- var $name = '';
- var $service = '';
- var $total = 0;
+ public $id = '';
+ public $name = '';
+ public $service = '';
+ public $total = 0;
- public function Sharing_Service_Total( $id, $total ) {
+ public function __construct( $id, $total ) {
$services = new Sharing_Service();
$this->id = esc_html( $id );
$this->service = $services->get_service( $id );
@@ -433,12 +445,12 @@ class Sharing_Service_Total {
}
class Sharing_Post_Total {
- var $id = 0;
- var $total = 0;
- var $title = '';
- var $url = '';
+ public $id = 0;
+ public $total = 0;
+ public $title = '';
+ public $url = '';
- public function Sharing_Post_Total( $id, $total ) {
+ public function __construct( $id, $total ) {
$this->id = (int) $id;
$this->total = (int) $total;
$this->title = get_the_title( $this->id );
@@ -475,6 +487,8 @@ function sharing_maybe_enqueue_scripts() {
/**
* Filter to decide when sharing scripts should be enqueued.
*
+ * @module sharedaddy
+ *
* @since 3.2.0
*
* @param bool $enqueue Decide if the sharing scripts should be enqueued.
@@ -486,17 +500,21 @@ function sharing_add_footer() {
global $jetpack_sharing_counts;
/**
- * Filter all Javascript output by the sharing module.
+ * Filter all JavaScript output by the sharing module.
+ *
+ * @module sharedaddy
*
* @since 1.1.0
*
- * @param bool true Control whether the sharing module should add any Javascript to the site. Default to true.
+ * @param bool true Control whether the sharing module should add any JavaScript to the site. Default to true.
*/
if ( apply_filters( 'sharing_js', true ) && sharing_maybe_enqueue_scripts() ) {
/**
* Filter the display of sharing counts next to the sharing buttons.
*
+ * @module sharedaddy
+ *
* @since 3.2.0
*
* @param bool true Control the display of counters next to the sharing buttons. Default to true.
@@ -504,16 +522,10 @@ function sharing_add_footer() {
if ( apply_filters( 'jetpack_sharing_counts', true ) && is_array( $jetpack_sharing_counts ) && count( $jetpack_sharing_counts ) ) :
$sharing_post_urls = array_filter( $jetpack_sharing_counts );
if ( $sharing_post_urls ) :
- $is_jetpack = true === apply_filters( 'is_jetpack_site', false, get_current_blog_id() );
- $site_id = $is_jetpack ? Jetpack_Options::get_option( 'id' ) : get_current_blog_id();
?>
<script type="text/javascript">
window.WPCOM_sharing_counts = <?php echo json_encode( array_flip( $sharing_post_urls ) ); ?>;
- window.WPCOM_jetpack = <?php echo var_export( $is_jetpack, true ); ?>;
- <?php if ( is_int( $site_id ) ): ?>
- window.WPCOM_site_ID = <?php echo $site_id ?>;
- <?php endif; ?>
</script>
<?php
endif;
@@ -544,13 +556,8 @@ function sharing_add_header() {
}
if ( count( $enabled['all'] ) > 0 && sharing_maybe_enqueue_scripts() ) {
- // @todo: Remove this opt-out filter in the future
- if ( ( ! defined( 'IS_WPCOM' ) ) || ( ! IS_WPCOM ) || apply_filters( 'wpl_sharing_2014_1', true ) ) {
- wp_enqueue_style( 'sharedaddy', plugin_dir_url( __FILE__ ) .'sharing.css', array(), JETPACK__VERSION );
- wp_enqueue_style( 'genericons' );
- } else {
- wp_enqueue_style( 'sharedaddy', plugin_dir_url( __FILE__ ) .'sharing-legacy.css', array(), JETPACK__VERSION );
- }
+ wp_enqueue_style( 'sharedaddy', plugin_dir_url( __FILE__ ) .'sharing.css', array(), JETPACK__VERSION );
+ wp_enqueue_style( 'genericons' );
}
}
@@ -577,7 +584,7 @@ function sharing_display( $text = '', $echo = false ) {
if ( empty( $post ) )
return $text;
- if ( is_preview() || is_admin() ) {
+ if ( ( is_preview() || is_admin() ) && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
return $text;
}
@@ -617,7 +624,7 @@ function sharing_display( $text = '', $echo = false ) {
if ( !is_feed() ) {
if ( is_singular() && in_array( get_post_type(), $global['show'] ) ) {
$show = true;
- } elseif ( in_array( 'index', $global['show'] ) && ( is_home() || is_archive() || is_search() || in_array( get_post_type(), $global['show'] ) ) ) {
+ } elseif ( in_array( 'index', $global['show'] ) && ( is_home() || is_front_page() || is_archive() || is_search() || in_array( get_post_type(), $global['show'] ) ) ) {
$show = true;
}
}
@@ -625,9 +632,11 @@ function sharing_display( $text = '', $echo = false ) {
/**
* Filter to decide if sharing buttons should be displayed.
*
+ * @module sharedaddy
+ *
* @since 1.1.0
*
- * @param
+ * @param bool $show Should the sharing buttons be displayed.
* @param WP_Post $post The post to share.
*/
$show = apply_filters( 'sharing_show', $show, $post );
@@ -641,7 +650,7 @@ function sharing_display( $text = '', $echo = false ) {
// Private post?
$post_status = get_post_status( $post->ID );
- if ( $post_status == 'private' ) {
+ if ( 'private' === $post_status ) {
$show = false;
}
@@ -655,6 +664,8 @@ function sharing_display( $text = '', $echo = false ) {
/**
* Filters the list of enabled Sharing Services.
*
+ * @module sharedaddy
+ *
* @since 2.2.3
*
* @param array $sharer->get_blog_services() Array of Sharing Services currently enabled.
@@ -738,10 +749,21 @@ function sharing_display( $text = '', $echo = false ) {
}
}
+ /**
+ * Filters the content markup of the Jetpack sharing links
+ *
+ * @module sharedaddy
+ *
+ * @since 3.8.0
+ *
+ * @param string $sharing_content Content markup of the Jetpack sharing links
+ */
+ $sharing_markup = apply_filters( 'jetpack_sharing_display_markup', $sharing_content );
+
if ( $echo )
- echo $text.$sharing_content;
+ echo $text . $sharing_markup;
else
- return $text.$sharing_content;
+ return $text . $sharing_markup;
}
add_filter( 'the_content', 'sharing_display', 19 );