| @@ -30,8 +30,8 @@ discard block | ||
| 30 | 30 | */ | 
| 31 | 31 |  	public static function initialize() { | 
| 32 | 32 | |
| 33 | - add_action( 'wp_enqueue_scripts', array( __CLASS__, '_wp_enqueue_scripts' ) ); | |
| 34 | - add_action( 'wp_head', array( __CLASS__, '_wp_head' ) ); | |
| 33 | +		add_action('wp_enqueue_scripts', array(__CLASS__, '_wp_enqueue_scripts')); | |
| 34 | +		add_action('wp_head', array(__CLASS__, '_wp_head')); | |
| 35 | 35 | |
| 36 | 36 | } | 
| 37 | 37 | |
| @@ -42,7 +42,7 @@ discard block | ||
| 42 | 42 | |
| 43 | 43 | $id = self::$_id; | 
| 44 | 44 | |
| 45 | -		wp_enqueue_script('sharethis', "//platform-api.sharethis.com/js/sharethis.js#property={$id}&product=unknown", null, false, true ); | |
| 45 | +		wp_enqueue_script('sharethis', "//platform-api.sharethis.com/js/sharethis.js#property={$id}&product=unknown", null, false, true); | |
| 46 | 46 | |
| 47 | 47 | } | 
| 48 | 48 | |
| @@ -51,7 +51,7 @@ discard block | ||
| 51 | 51 | */ | 
| 52 | 52 |  	public static function _wp_head() { | 
| 53 | 53 | |
| 54 | -		if ( self::$_facebook_og ) { | |
| 54 | +		if (self::$_facebook_og) { | |
| 55 | 55 | self::_facebook_og(); | 
| 56 | 56 | } | 
| 57 | 57 | |
| @@ -62,7 +62,7 @@ discard block | ||
| 62 | 62 | * | 
| 63 | 63 | * @param string $id | 
| 64 | 64 | */ | 
| 65 | -	public static function register_id( $id ) { | |
| 65 | +	public static function register_id($id) { | |
| 66 | 66 | |
| 67 | 67 | self::$_id = $id; | 
| 68 | 68 | |
| @@ -72,18 +72,18 @@ discard block | ||
| 72 | 72 | * @param string $service | 
| 73 | 73 | * @param array $params | 
| 74 | 74 | */ | 
| 75 | -	public static function register_service( $service, $params = array() ) { | |
| 75 | +	public static function register_service($service, $params = array()) { | |
| 76 | 76 | |
| 77 | - self::$_services[ $service ] = $params; | |
| 77 | + self::$_services[$service] = $params; | |
| 78 | 78 | |
| 79 | 79 | } | 
| 80 | 80 | |
| 81 | 81 | /** | 
| 82 | 82 | * | 
| 83 | 83 | */ | 
| 84 | -	public static function the_sharing_links( $post = null ) { | |
| 84 | +	public static function the_sharing_links($post = null) { | |
| 85 | 85 | |
| 86 | - array_walk( self::$_services, array( __CLASS__, '_render_sharing_link' ), $post ); | |
| 86 | + array_walk(self::$_services, array(__CLASS__, '_render_sharing_link'), $post); | |
| 87 | 87 | |
| 88 | 88 | } | 
| 89 | 89 | |
| @@ -92,12 +92,12 @@ discard block | ||
| 92 | 92 | * @param string $service | 
| 93 | 93 | * @param \WP_Post $post | 
| 94 | 94 | */ | 
| 95 | -	public static function _render_sharing_link( $params, $service, $post ) { | |
| 95 | +	public static function _render_sharing_link($params, $service, $post) { | |
| 96 | 96 | |
| 97 | 97 | $classes = array(); | 
| 98 | 98 | |
| 99 | 99 | // set some defaults | 
| 100 | - $args = wp_parse_args( $params, array( | |
| 100 | + $args = wp_parse_args($params, array( | |
| 101 | 101 | 'url' => null, | 
| 102 | 102 | 'short-url' => null, | 
| 103 | 103 | 'title' => null, | 
| @@ -106,39 +106,39 @@ discard block | ||
| 106 | 106 | 'username' => null, | 
| 107 | 107 | 'message' => null, | 
| 108 | 108 | 'share_count' => true, | 
| 109 | - ) ); | |
| 109 | + )); | |
| 110 | 110 | |
| 111 | 111 | // if we have a post, we will use post values for the defaults | 
| 112 | -		if ( $post instanceof \WP_Post ) { | |
| 113 | - $args = wp_parse_args( $params, array( | |
| 114 | - 'url' => get_permalink( $post ), | |
| 112 | +		if ($post instanceof \WP_Post) { | |
| 113 | + $args = wp_parse_args($params, array( | |
| 114 | + 'url' => get_permalink($post), | |
| 115 | 115 | 'short-url' => null, | 
| 116 | 116 | 'title' => $post->post_title, | 
| 117 | 117 | 'image' => null, | 
| 118 | - 'description' => get_the_excerpt( $post ), | |
| 118 | + 'description' => get_the_excerpt($post), | |
| 119 | 119 | 'username' => null, | 
| 120 | 120 | 'message' => null, | 
| 121 | 121 | 'share_count' => true, | 
| 122 | - ) ); | |
| 122 | + )); | |
| 123 | 123 | |
| 124 | -			if ( has_post_thumbnail( $post ) ) { | |
| 125 | - $args['image'] = get_the_post_thumbnail_url( $post ); | |
| 124 | +			if (has_post_thumbnail($post)) { | |
| 125 | + $args['image'] = get_the_post_thumbnail_url($post); | |
| 126 | 126 | } | 
| 127 | 127 | } | 
| 128 | 128 | |
| 129 | 129 | printf( | 
| 130 | 130 | '<div data-network="%1$s" class="st-custom-button %2$s"%3$s%4$s%5$s%6$s%7$s%8$s%9$s>%10$s%11$s</div>', | 
| 131 | 131 | $service, | 
| 132 | - implode( ' ', apply_filters( 'wpst_link_classes', $classes, $service ) ), | |
| 133 | - self::_item_sharing_property( 'url', $args['url'] ), | |
| 134 | - self::_item_sharing_property( 'short_url', $args['short_url'] ), | |
| 135 | - self::_item_sharing_property( 'title', $args['title'] ), | |
| 136 | - self::_item_sharing_property( 'image', $args['image'] ), | |
| 137 | - self::_item_sharing_property( 'description', $args['description'] ), | |
| 138 | - self::_item_sharing_property( 'username', $args['username'] ), | |
| 139 | - self::_item_sharing_property( 'message', $args['message'] ), | |
| 140 | - apply_filters( 'wpst_link_text', ucfirst( $service ) ), | |
| 141 | - self::_item_sharing_count( $args['share_count'] ) | |
| 132 | +			implode(' ', apply_filters('wpst_link_classes', $classes, $service)), | |
| 133 | +			self::_item_sharing_property('url', $args['url']), | |
| 134 | +			self::_item_sharing_property('short_url', $args['short_url']), | |
| 135 | +			self::_item_sharing_property('title', $args['title']), | |
| 136 | +			self::_item_sharing_property('image', $args['image']), | |
| 137 | +			self::_item_sharing_property('description', $args['description']), | |
| 138 | +			self::_item_sharing_property('username', $args['username']), | |
| 139 | +			self::_item_sharing_property('message', $args['message']), | |
| 140 | +			apply_filters('wpst_link_text', ucfirst($service)), | |
| 141 | + self::_item_sharing_count($args['share_count']) | |
| 142 | 142 | ); | 
| 143 | 143 | |
| 144 | 144 | } | 
| @@ -148,16 +148,16 @@ discard block | ||
| 148 | 148 | */ | 
| 149 | 149 |  	private static function _facebook_og() { | 
| 150 | 150 | |
| 151 | - printf( '<meta property="og:url" content="%1$s" />' . PHP_EOL, self::_og_url() ); | |
| 151 | +		printf('<meta property="og:url" content="%1$s" />' . PHP_EOL, self::_og_url()); | |
| 152 | 152 | print '<meta property="og:type" content="article" />' . PHP_EOL; | 
| 153 | - printf( '<meta property="og:title" content="%1$s" />' . PHP_EOL, self::_og_title() ); | |
| 153 | +		printf('<meta property="og:title" content="%1$s" />' . PHP_EOL, self::_og_title()); | |
| 154 | 154 | |
| 155 | -		if ( ! ( empty( $description = self::_og_description() ) ) ) { | |
| 156 | - printf( '<meta property="og:description" content="%1$s" />' . PHP_EOL, $description ); | |
| 155 | +		if ( ! (empty($description = self::_og_description()))) { | |
| 156 | +			printf('<meta property="og:description" content="%1$s" />' . PHP_EOL, $description); | |
| 157 | 157 | } | 
| 158 | 158 | |
| 159 | -		if ( $image_url = self::_og_image() ) { | |
| 160 | - printf( '<meta property="og:image" content="%1$s" />' . PHP_EOL, $image_url ); | |
| 159 | +		if ($image_url = self::_og_image()) { | |
| 160 | +			printf('<meta property="og:image" content="%1$s" />' . PHP_EOL, $image_url); | |
| 161 | 161 | } | 
| 162 | 162 | |
| 163 | 163 | } | 
| @@ -169,11 +169,11 @@ discard block | ||
| 169 | 169 | |
| 170 | 170 | $url = get_permalink(); | 
| 171 | 171 | |
| 172 | -		if ( is_home() || is_front_page() ) { | |
| 172 | +		if (is_home() || is_front_page()) { | |
| 173 | 173 | $url = home_url(); | 
| 174 | 174 | } | 
| 175 | 175 | |
| 176 | - return apply_filters( 'wpst_og_url', esc_url( $url ) ); | |
| 176 | +		return apply_filters('wpst_og_url', esc_url($url)); | |
| 177 | 177 | |
| 178 | 178 | } | 
| 179 | 179 | |
| @@ -184,11 +184,11 @@ discard block | ||
| 184 | 184 | |
| 185 | 185 | $title = get_the_title(); | 
| 186 | 186 | |
| 187 | -		if ( is_home() || is_front_page() ) { | |
| 188 | - $title = get_bloginfo( 'name' ); | |
| 187 | +		if (is_home() || is_front_page()) { | |
| 188 | +			$title = get_bloginfo('name'); | |
| 189 | 189 | } | 
| 190 | 190 | |
| 191 | - return apply_filters( 'wpst_og_title', wp_kses_post( $title ) ); | |
| 191 | +		return apply_filters('wpst_og_title', wp_kses_post($title)); | |
| 192 | 192 | |
| 193 | 193 | } | 
| 194 | 194 | |
| @@ -197,13 +197,13 @@ discard block | ||
| 197 | 197 | */ | 
| 198 | 198 |  	private static function _og_description() { | 
| 199 | 199 | |
| 200 | - $description = apply_filters( 'the_excerpt', get_the_excerpt() ); | |
| 200 | +		$description = apply_filters('the_excerpt', get_the_excerpt()); | |
| 201 | 201 | |
| 202 | -		if ( is_home() || is_front_page() ) { | |
| 203 | - $description = get_bloginfo( 'description' ); | |
| 202 | +		if (is_home() || is_front_page()) { | |
| 203 | +			$description = get_bloginfo('description'); | |
| 204 | 204 | } | 
| 205 | 205 | |
| 206 | - return apply_filters( 'wpst_og_description', wp_kses_post( $description ) ); | |
| 206 | +		return apply_filters('wpst_og_description', wp_kses_post($description)); | |
| 207 | 207 | |
| 208 | 208 | } | 
| 209 | 209 | |
| @@ -214,11 +214,11 @@ discard block | ||
| 214 | 214 | |
| 215 | 215 | $image_url = get_the_post_thumbnail_url(); | 
| 216 | 216 | |
| 217 | -		if ( is_home() || is_front_page() ) { | |
| 217 | +		if (is_home() || is_front_page()) { | |
| 218 | 218 | $image_url = ''; | 
| 219 | 219 | } | 
| 220 | 220 | |
| 221 | - return apply_filters( 'wpst_og_image', esc_url( $image_url ) ); | |
| 221 | +		return apply_filters('wpst_og_image', esc_url($image_url)); | |
| 222 | 222 | |
| 223 | 223 | } | 
| 224 | 224 | |
| @@ -228,13 +228,13 @@ discard block | ||
| 228 | 228 | * | 
| 229 | 229 | * @return string | 
| 230 | 230 | */ | 
| 231 | -	private static function _item_sharing_property( $property, $value ) { | |
| 231 | +	private static function _item_sharing_property($property, $value) { | |
| 232 | 232 | |
| 233 | 233 | $text = ''; | 
| 234 | -		$maybe = apply_filters( "wpst_item_{$property}", $value ); | |
| 234 | +		$maybe = apply_filters("wpst_item_{$property}", $value); | |
| 235 | 235 | |
| 236 | -		if ( ! empty( $maybe ) ) { | |
| 237 | -			$text = sprintf( ' data-%1$s="%2$s" ', str_replace('_', '-', $property ), esc_attr( $maybe ) ); | |
| 236 | +		if ( ! empty($maybe)) { | |
| 237 | +			$text = sprintf(' data-%1$s="%2$s" ', str_replace('_', '-', $property), esc_attr($maybe)); | |
| 238 | 238 | } | 
| 239 | 239 | |
| 240 | 240 | return $text; | 
| @@ -246,11 +246,11 @@ discard block | ||
| 246 | 246 | * | 
| 247 | 247 | * @return string | 
| 248 | 248 | */ | 
| 249 | -	private static function _item_sharing_count( $show ) { | |
| 249 | +	private static function _item_sharing_count($show) { | |
| 250 | 250 | |
| 251 | 251 | $text = ''; | 
| 252 | 252 | |
| 253 | -		if ( $show ) { | |
| 253 | +		if ($show) { | |
| 254 | 254 | $text = '<span class="count"></span>'; | 
| 255 | 255 | } | 
| 256 | 256 | |