Ocean Social Sharing - Version 1.0.2

Version Description

  • Multicheck field replaced by sortable control, now you can change positioning of the social buttons.
  • Support OceanWP 1.1.
Download this release

Release Info

Developer oceanwp
Plugin Icon 128x128 Ocean Social Sharing
Version 1.0.2
Comparing to
See all releases

Code changes from version 1.0.1 to 1.0.2

includes/helpers.php CHANGED
@@ -8,11 +8,27 @@
8
  /**
9
  * Returns social sharing template part
10
  */
11
- function oss_social_share_sites() {
12
- $sites = get_theme_mod( 'oss_social_share_sites', array( 'twitter', 'facebook', 'google_plus', 'pinterest', 'linkedin' ) );
13
- $sites = apply_filters( 'oss_social_share_sites_filter', $sites );
14
- if ( $sites && ! is_array( $sites ) ) {
15
- $sites = explode( ',', $sites );
16
- }
17
- return $sites;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  }
8
  /**
9
  * Returns social sharing template part
10
  */
11
+ if ( ! function_exists( 'oss_social_share_sites' ) ) {
12
+
13
+ function oss_social_share_sites() {
14
+
15
+ // Default socials
16
+ $socials = array( 'twitter', 'facebook', 'google_plus', 'pinterest', 'linkedin' );
17
+
18
+ // Get socials from Customizer
19
+ $socials = get_theme_mod( 'oss_social_share_sites', $socials );
20
+
21
+ // Turn into array if string
22
+ if ( $socials && ! is_array( $socials ) ) {
23
+ $socials = explode( ',', $socials );
24
+ }
25
+
26
+ // Apply filters for easy modification
27
+ $socials = apply_filters( 'oss_social_share_sites_filter', $socials );
28
+
29
+ // Return socials
30
+ return $socials;
31
+
32
+ }
33
+
34
  }
ocean-social-sharing.php CHANGED
@@ -3,11 +3,11 @@
3
  * Plugin Name: Ocean Social Sharing
4
  * Plugin URI: https://oceanwp.org/extension/ocean-social-sharing/
5
  * Description: A simple plugin to add social share buttons to your posts.
6
- * Version: 1.0.1
7
  * Author: OceanWP
8
  * Author URI: https://oceanwp.org/
9
  * Requires at least: 4.0.0
10
- * Tested up to: 4.7
11
  *
12
  * Text Domain: ocean-social-sharing
13
  * Domain Path: /languages/
@@ -86,9 +86,7 @@ final class Ocean_Social_Sharing {
86
  $this->token = 'ocean-social-sharing';
87
  $this->plugin_url = plugin_dir_url( __FILE__ );
88
  $this->plugin_path = plugin_dir_path( __FILE__ );
89
- $this->version = '1.0.1';
90
-
91
- define( 'OSS_ROOT', dirname( __FILE__ ) );
92
 
93
  register_activation_hook( __FILE__, array( $this, 'install' ) );
94
 
@@ -165,15 +163,14 @@ final class Ocean_Social_Sharing {
165
 
166
  /**
167
  * Setup all the things.
168
- * Only executes if Ocean or a child theme using Ocean as a parent is active and the extension specific filter returns true.
169
- * Child themes can disable this extension using the ocean_social_sharing filter
170
  * @return void
171
  */
172
  public function oss_setup() {
173
  $theme = wp_get_theme();
174
 
175
- if ( 'Ocean' == $theme->name || 'ocean' == $theme->template && apply_filters( 'ocean_social_sharing', true ) ) {
176
- require_once( OSS_ROOT .'/includes/helpers.php' );
177
  add_action( 'customize_register', array( $this, 'customizer_register' ) );
178
  add_action( 'customize_preview_init', array( $this, 'customize_preview_js' ) );
179
  add_action( 'wp_enqueue_scripts', array( $this, 'get_style' ), 999 );
@@ -185,14 +182,14 @@ final class Ocean_Social_Sharing {
185
  }
186
 
187
  /**
188
- * Ocean install
189
- * If the user activates the plugin while having a different parent theme active, prompt them to install Ocean.
190
  * @since 1.0.0
191
  * @return void
192
  */
193
  public function oss_install_ocean_notice() {
194
  echo '<div class="notice is-dismissible updated">
195
- <p>' . esc_html__( 'Ocean Social Sharing requires that you use ocean as your parent theme.', 'ocean-social-sharing' ) . ' <a href="https://oceanwp.com/">' . esc_html__( 'Install Ocean Now', 'ocean-social-sharing' ) . '</a></p>
196
  </div>';
197
  }
198
 
@@ -214,22 +211,22 @@ final class Ocean_Social_Sharing {
214
  * Sharing sites
215
  */
216
  $wp_customize->add_setting( 'oss_social_share_sites', array(
217
- 'default' => array( 'twitter', 'facebook', 'google_plus', 'pinterest', 'linkedin' ),
218
- 'sanitize_callback' => false,
219
  ) );
220
 
221
- $wp_customize->add_control( new Ocean_Customize_Multicheck_Control( $wp_customize, 'oss_social_share_sites', array(
222
- 'label' => esc_html__( 'Sharing Buttons', 'ocean-social-sharing' ),
223
- 'section' => 'oss_sharing_section',
224
- 'settings' => 'oss_social_share_sites',
225
- 'choices' => array(
 
226
  'twitter' => 'Twitter',
227
  'facebook' => 'Facebook',
228
  'google_plus' => 'Google Plus',
229
  'pinterest' => 'Pinterest',
230
  'linkedin' => 'LinkedIn',
231
  ),
232
- 'priority' => 10,
233
  ) ) );
234
 
235
  /**
@@ -274,7 +271,7 @@ final class Ocean_Social_Sharing {
274
  'sanitize_callback' => false,
275
  ) );
276
 
277
- $wp_customize->add_control( new Ocean_Customizer_Color_Control( $wp_customize, 'oss_sharing_borders_color', array(
278
  'label' => esc_html__( 'Links Borders Color', 'ocean-social-sharing' ),
279
  'section' => 'oss_sharing_section',
280
  'settings' => 'oss_sharing_borders_color',
@@ -290,7 +287,7 @@ final class Ocean_Social_Sharing {
290
  'sanitize_callback' => false,
291
  ) );
292
 
293
- $wp_customize->add_control( new Ocean_Customizer_Color_Control( $wp_customize, 'oss_sharing_icons_bg', array(
294
  'label' => esc_html__( 'Icons Background Color', 'ocean-social-sharing' ),
295
  'section' => 'oss_sharing_section',
296
  'settings' => 'oss_sharing_icons_bg',
@@ -306,7 +303,7 @@ final class Ocean_Social_Sharing {
306
  'sanitize_callback' => false,
307
  ) );
308
 
309
- $wp_customize->add_control( new Ocean_Customizer_Color_Control( $wp_customize, 'oss_sharing_icons_color', array(
310
  'label' => esc_html__( 'Icons Color', 'ocean-social-sharing' ),
311
  'section' => 'oss_sharing_section',
312
  'settings' => 'oss_sharing_icons_color',
3
  * Plugin Name: Ocean Social Sharing
4
  * Plugin URI: https://oceanwp.org/extension/ocean-social-sharing/
5
  * Description: A simple plugin to add social share buttons to your posts.
6
+ * Version: 1.0.2
7
  * Author: OceanWP
8
  * Author URI: https://oceanwp.org/
9
  * Requires at least: 4.0.0
10
+ * Tested up to: 4.7.2
11
  *
12
  * Text Domain: ocean-social-sharing
13
  * Domain Path: /languages/
86
  $this->token = 'ocean-social-sharing';
87
  $this->plugin_url = plugin_dir_url( __FILE__ );
88
  $this->plugin_path = plugin_dir_path( __FILE__ );
89
+ $this->version = '1.0.2';
 
 
90
 
91
  register_activation_hook( __FILE__, array( $this, 'install' ) );
92
 
163
 
164
  /**
165
  * Setup all the things.
166
+ * Only executes if OceanWP or a child theme using OceanWP as a parent is active and the extension specific filter returns true.
 
167
  * @return void
168
  */
169
  public function oss_setup() {
170
  $theme = wp_get_theme();
171
 
172
+ if ( 'OceanWP' == $theme->name || 'oceanwp' == $theme->template ) {
173
+ require_once( $this->plugin_path .'/includes/helpers.php' );
174
  add_action( 'customize_register', array( $this, 'customizer_register' ) );
175
  add_action( 'customize_preview_init', array( $this, 'customize_preview_js' ) );
176
  add_action( 'wp_enqueue_scripts', array( $this, 'get_style' ), 999 );
182
  }
183
 
184
  /**
185
+ * OceanWP install
186
+ * If the user activates the plugin while having a different parent theme active, prompt them to install OceanWP.
187
  * @since 1.0.0
188
  * @return void
189
  */
190
  public function oss_install_ocean_notice() {
191
  echo '<div class="notice is-dismissible updated">
192
+ <p>' . esc_html__( 'Ocean Social Sharing requires that you use OceanWP as your parent theme.', 'ocean-social-sharing' ) . ' <a href="https://oceanwp.org/">' . esc_html__( 'Install OceanWP Now', 'ocean-social-sharing' ) . '</a></p>
193
  </div>';
194
  }
195
 
211
  * Sharing sites
212
  */
213
  $wp_customize->add_setting( 'oss_social_share_sites', array(
214
+ 'default' => array( 'twitter', 'facebook', 'google_plus', 'pinterest', 'linkedin' ),
215
+ 'sanitize_callback' => false,
216
  ) );
217
 
218
+ $wp_customize->add_control( new OceanWP_Customizer_Sortable_Control( $wp_customize, 'oss_social_share_sites', array(
219
+ 'label' => esc_html__( 'Sharing Buttons', 'ocean-social-sharing' ),
220
+ 'section' => 'oss_sharing_section',
221
+ 'settings' => 'oss_social_share_sites',
222
+ 'priority' => 10,
223
+ 'choices' => array(
224
  'twitter' => 'Twitter',
225
  'facebook' => 'Facebook',
226
  'google_plus' => 'Google Plus',
227
  'pinterest' => 'Pinterest',
228
  'linkedin' => 'LinkedIn',
229
  ),
 
230
  ) ) );
231
 
232
  /**
271
  'sanitize_callback' => false,
272
  ) );
273
 
274
+ $wp_customize->add_control( new OceanWP_Customizer_Color_Control( $wp_customize, 'oss_sharing_borders_color', array(
275
  'label' => esc_html__( 'Links Borders Color', 'ocean-social-sharing' ),
276
  'section' => 'oss_sharing_section',
277
  'settings' => 'oss_sharing_borders_color',
287
  'sanitize_callback' => false,
288
  ) );
289
 
290
+ $wp_customize->add_control( new OceanWP_Customizer_Color_Control( $wp_customize, 'oss_sharing_icons_bg', array(
291
  'label' => esc_html__( 'Icons Background Color', 'ocean-social-sharing' ),
292
  'section' => 'oss_sharing_section',
293
  'settings' => 'oss_sharing_icons_bg',
303
  'sanitize_callback' => false,
304
  ) );
305
 
306
+ $wp_customize->add_control( new OceanWP_Customizer_Color_Control( $wp_customize, 'oss_sharing_icons_color', array(
307
  'label' => esc_html__( 'Icons Color', 'ocean-social-sharing' ),
308
  'section' => 'oss_sharing_section',
309
  'settings' => 'oss_sharing_icons_color',
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Ocean Social Sharing ===
2
  Contributors: oceanwp
3
- Tags: social, social sharing, social share, share, ocean
4
  Requires at least: 3.5
5
- Tested up to: 4.7
6
- Stable tag: 1.0.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -11,7 +11,7 @@ A simple plugin to add social share buttons to your posts.
11
 
12
  == Description ==
13
 
14
- This plugin requires the [Ocean](https://oceanwp.org/) theme to be installed.
15
 
16
  == Installation ==
17
 
@@ -21,9 +21,9 @@ This plugin requires the [Ocean](https://oceanwp.org/) theme to be installed.
21
 
22
  == Frequently Asked Questions ==
23
 
24
- = I installed the plugin but the panel do not appear =
25
 
26
- This plugin will only work with the [Ocean](https://oceanwp.org/) theme.
27
 
28
  == Screenshots ==
29
 
@@ -31,8 +31,12 @@ This plugin will only work with the [Ocean](https://oceanwp.org/) theme.
31
 
32
  == Changelog ==
33
 
 
 
 
 
34
  = 1.0.1 =
35
- Fixed problem excerpt before the social links.
36
 
37
  = 1.0.0 =
38
- Initial release.
1
  === Ocean Social Sharing ===
2
  Contributors: oceanwp
3
+ Tags: social, social sharing, social share, share, oceanwp
4
  Requires at least: 3.5
5
+ Tested up to: 4.7.2
6
+ Stable tag: 1.0.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
11
 
12
  == Description ==
13
 
14
+ This plugin requires the [OceanWP](https://oceanwp.org/) theme to be installed.
15
 
16
  == Installation ==
17
 
21
 
22
  == Frequently Asked Questions ==
23
 
24
+ = I installed the plugin but it does not work =
25
 
26
+ This plugin will only work with the [OceanWP](https://oceanwp.org/) theme.
27
 
28
  == Screenshots ==
29
 
31
 
32
  == Changelog ==
33
 
34
+ = 1.0.2 =
35
+ - Multicheck field replaced by sortable control, now you can change positioning of the social buttons.
36
+ - Support OceanWP 1.1.
37
+
38
  = 1.0.1 =
39
+ - Fixed problem excerpt before the social links.
40
 
41
  = 1.0.0 =
42
+ - Initial release.
template/social-share.php CHANGED
@@ -90,7 +90,7 @@ $title = get_the_title(); ?>
90
  if ( 'pinterest' == $site ) { ?>
91
 
92
  <li class="pinterest">
93
- <a href="https://www.pinterest.com/pin/create/button/?url=<?php echo rawurlencode( esc_url( $url ) ); ?>&amp;media=<?php echo wp_get_attachment_url( get_post_thumbnail_id( $post_id ) ); ?>&amp;description=<?php echo ocean_excerpt( 40 ); ?>" title="<?php esc_html_e( 'Share on Pinterest', 'ocean-social-sharing' ); ?>" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">
94
  <span class="fa fa-pinterest-p"></span>
95
  </a>
96
  </li>
@@ -100,7 +100,7 @@ $title = get_the_title(); ?>
100
  if ( 'linkedin' == $site ) { ?>
101
 
102
  <li class="linkedin">
103
- <a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=<?php echo rawurlencode( esc_url( $url ) ); ?>&amp;title=<?php echo rawurlencode( $title ); ?>&amp;summary=<?php echo ocean_excerpt( 40 ); ?>&amp;source=<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php esc_html_e( 'Share on LinkedIn', 'ocean-social-sharing' ); ?>" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">
104
  <span class="fa fa-linkedin"></span>
105
  </a>
106
  </li>
90
  if ( 'pinterest' == $site ) { ?>
91
 
92
  <li class="pinterest">
93
+ <a href="https://www.pinterest.com/pin/create/button/?url=<?php echo rawurlencode( esc_url( $url ) ); ?>&amp;media=<?php echo wp_get_attachment_url( get_post_thumbnail_id( $post_id ) ); ?>&amp;description=<?php echo oceanwp_excerpt( 40 ); ?>" title="<?php esc_html_e( 'Share on Pinterest', 'ocean-social-sharing' ); ?>" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">
94
  <span class="fa fa-pinterest-p"></span>
95
  </a>
96
  </li>
100
  if ( 'linkedin' == $site ) { ?>
101
 
102
  <li class="linkedin">
103
+ <a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=<?php echo rawurlencode( esc_url( $url ) ); ?>&amp;title=<?php echo rawurlencode( $title ); ?>&amp;summary=<?php echo oceanwp_excerpt( 40 ); ?>&amp;source=<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php esc_html_e( 'Share on LinkedIn', 'ocean-social-sharing' ); ?>" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">
104
  <span class="fa fa-linkedin"></span>
105
  </a>
106
  </li>