Ocean Social Sharing - Version 1.0.0

Version Description

Initial release.

Download this release

Release Info

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

Version 1.0.0

assets/css/rtl.css ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ /* Social share */
2
+ .entry-share .theme-heading { float: right; }
3
+ .entry-share ul { float: left; }
4
+ .entry-share ul li { float: right; }
5
+ .entry-share ul li a { margin-left: 12px; margin-right: 0; }
6
+ .entry-share ul li:last-child a { margin-left: 0; }
assets/css/style.css ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Social Share
3
+ */
4
+ .entry-share .theme-heading {
5
+ line-height: 40px;
6
+ float: left;
7
+ margin: 0;
8
+ }
9
+ .entry-share .theme-heading .text:before,
10
+ .entry-share .theme-heading .text:after {
11
+ display: none !important;
12
+ }
13
+
14
+ .entry-share ul {
15
+ float: right;
16
+ margin: 0;
17
+ padding: 0;
18
+ list-style: none;
19
+ }
20
+ .entry-share ul li {
21
+ float: left;
22
+ }
23
+ .entry-share ul li a {
24
+ font-size: 14px;
25
+ line-height: 40px;
26
+ position: relative;
27
+ display: inline-block;
28
+ width: 40px;
29
+ height: 40px;
30
+ margin-right: 12px;
31
+ text-align: center;
32
+ color: #bbb;
33
+ border: 1px solid #e9e9e9;
34
+ border-radius: 50%;
35
+ }
36
+ .entry-share ul li:last-child a {
37
+ margin-right: 0;
38
+ }
39
+ .entry-share ul li.twitter a:hover {
40
+ color: #00aced;
41
+ border-color: #00aced;
42
+ }
43
+ .entry-share ul li.facebook a:hover {
44
+ color: #3b5998;
45
+ border-color: #3b5998;
46
+ }
47
+ .entry-share ul li.googleplus a:hover {
48
+ color: #dd4b39;
49
+ border-color: #dd4b39;
50
+ }
51
+ .entry-share ul li.linkedin a:hover {
52
+ color: #39c;
53
+ border-color: #39c;
54
+ }
55
+ .entry-share ul li.pinterest a:hover {
56
+ color: #cb2027;
57
+ border-color: #cb2027;
58
+ }
59
+
60
+ .single .entry-share {
61
+ margin-top: 30px;
62
+ padding-top: 30px;
63
+ border-top: 1px solid #f1f1f1;
64
+ }
65
+
66
+ /*------------------------------------*
67
+ Phone Landscape
68
+ *------------------------------------*/
69
+ @media only screen and (max-width: 480px) {
70
+ .entry-share .theme-heading {
71
+ line-height: 1;
72
+ float: none;
73
+ margin: 0 0 20px;
74
+ text-align: center;
75
+ }
76
+ .entry-share ul {
77
+ float: none;
78
+ text-align: center;
79
+ }
80
+ .entry-share ul li {
81
+ display: inline-block;
82
+ float: none;
83
+ }
84
+ }
assets/css/style.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .entry-share .theme-heading{float:left;margin:0;line-height:40px}.entry-share .theme-heading .text:before,.entry-share .theme-heading .text:after{display:none !important}.entry-share ul{float:right;margin:0;padding:0;list-style:none}.entry-share ul li{float:left}.entry-share ul li a{display:inline-block;position:relative;color:#bbb;border:1px solid #e9e9e9;width:40px;height:40px;line-height:40px;font-size:14px;margin-right:12px;text-align:center;border-radius:50%}.entry-share ul li:last-child a{margin-right:0}.entry-share ul li.twitter a:hover{color:#00aced;border-color:#00aced}.entry-share ul li.facebook a:hover{color:#3b5998;border-color:#3b5998}.entry-share ul li.googleplus a:hover{color:#dd4b39;border-color:#dd4b39}.entry-share ul li.linkedin a:hover{color:#3399CC;border-color:#3399CC}.entry-share ul li.pinterest a:hover{color:#cb2027;border-color:#cb2027}.single .entry-share{margin-top:30px;padding-top:30px;border-top:1px solid #f1f1f1}@media only screen and (max-width: 480px){.entry-share .theme-heading{float:none;margin:0 0 20px;line-height:1;text-align:center}.entry-share ul{float:none;text-align:center}.entry-share ul li{float:none;display:inline-block}}
assets/css/style.scss ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Social Share
3
+ */
4
+ .entry-share {
5
+ .theme-heading {
6
+ float: left;
7
+ margin: 0;
8
+ line-height: 40px;
9
+
10
+ .text:before,
11
+ .text:after {
12
+ display: none !important;
13
+ }
14
+ }
15
+
16
+ ul {
17
+ float: right;
18
+ margin: 0;
19
+ padding: 0;
20
+ list-style: none;
21
+
22
+ li {
23
+ float: left;
24
+
25
+ a {
26
+ display: inline-block;
27
+ position: relative;
28
+ color: #bbb;
29
+ border: 1px solid #e9e9e9;
30
+ width: 40px;
31
+ height: 40px;
32
+ line-height: 40px;
33
+ font-size: 14px;
34
+ margin-right: 12px;
35
+ text-align: center;
36
+ border-radius: 50%;
37
+ }
38
+
39
+ &:last-child a {
40
+ margin-right: 0;
41
+ }
42
+
43
+ &.twitter a:hover {
44
+ color: #00aced;
45
+ border-color: #00aced;
46
+ }
47
+
48
+ &.facebook a:hover {
49
+ color: #3b5998;
50
+ border-color: #3b5998;
51
+ }
52
+
53
+ &.googleplus a:hover {
54
+ color: #dd4b39;
55
+ border-color: #dd4b39;
56
+ }
57
+
58
+ &.linkedin a:hover {
59
+ color: #3399CC;
60
+ border-color: #3399CC;
61
+ }
62
+
63
+ &.pinterest a:hover {
64
+ color: #cb2027;
65
+ border-color: #cb2027;
66
+ }
67
+ }
68
+ }
69
+ }
70
+
71
+ .single .entry-share {
72
+ margin-top: 30px;
73
+ padding-top: 30px;
74
+ border-top: 1px solid #f1f1f1;
75
+ }
76
+
77
+ /*------------------------------------*
78
+ Phone Landscape
79
+ *------------------------------------*/
80
+ @media only screen and (max-width: 480px) {
81
+ .entry-share .theme-heading { float: none; margin: 0 0 20px; line-height: 1; text-align: center; }
82
+ .entry-share ul { float: none; text-align: center; }
83
+ .entry-share ul li { float: none; display: inline-block; }
84
+ }
assets/js/customizer.js ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Customizer enhancements for a better user experience.
3
+ *
4
+ * Contains handlers to make Theme Customizer preview reload changes asynchronously.
5
+ */
6
+
7
+ ( function( $ ) {
8
+ wp.customize('oss_social_share_heading', function( value ) {
9
+ var heading = $( '.social-share-title span.text' );
10
+ if ( heading.length ) {
11
+ var ogheading = heading.html();
12
+ value.bind( function( newval ) {
13
+ if ( newval ) {
14
+ heading.html( newval );
15
+ } else {
16
+ heading.html( ogheading );
17
+ }
18
+ });
19
+ }
20
+ } );
21
+ wp.customize( 'oss_sharing_borders_color', function( value ) {
22
+ value.bind( function( to ) {
23
+ $( '.entry-share ul li a' ).css( 'border-color', to );
24
+ } );
25
+ } );
26
+ wp.customize( 'oss_sharing_icons_bg', function( value ) {
27
+ value.bind( function( to ) {
28
+ $( '.entry-share ul li a' ).css( 'background-color', to );
29
+ } );
30
+ } );
31
+ wp.customize( 'oss_sharing_icons_color', function( value ) {
32
+ value.bind( function( to ) {
33
+ $( '.entry-share ul li a' ).css( 'color', to );
34
+ } );
35
+ } );
36
+ } )( jQuery );
assets/js/customizer.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(a){wp.customize("oss_social_share_heading",function(b){var c=a(".social-share-title span.text");if(c.length){var d=c.html();b.bind(function(a){a?c.html(a):c.html(d)})}}),wp.customize("oss_sharing_borders_color",function(b){b.bind(function(b){a(".entry-share ul li a").css("border-color",b)})}),wp.customize("oss_sharing_icons_bg",function(b){b.bind(function(b){a(".entry-share ul li a").css("background-color",b)})}),wp.customize("oss_sharing_icons_color",function(b){b.bind(function(b){a(".entry-share ul li a").css("color",b)})})}(jQuery);
includes/helpers.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Helper functions.
4
+ *
5
+ * @package Ocean WordPress theme
6
+ */
7
+
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
+ }
index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden... ?>
languages/ocean-social-sharing.pot ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2016
2
+ # This file is distributed under the same license as the package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: \n"
6
+ "Report-Msgid-Bugs-To: https://wordpress.org/support/theme/style\n"
7
+ "POT-Creation-Date: 2016-10-10 21:19:12+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=utf-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: OceanWP\n"
13
+ "Language-Team: OceanWP\n"
14
+ "X-Generator: grunt-wp-i18n 0.5.3\n"
15
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
16
+ "X-Poedit-Basepath: ..\n"
17
+ "X-Poedit-Language: English\n"
18
+ "X-Poedit-Country: UNITED STATES\n"
19
+ "X-Poedit-SourceCharset: utf-8\n"
20
+ "X-Poedit-SearchPath-0: .\n"
21
+ "X-Poedit-KeywordsList: "
22
+ "_esc_attr__;esc_attr_x;esc_attr_e;esc_html__;esc_html_e;esc_html_x;__;_e;__"
23
+ "ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c;_nc:4c,1,2;_x:1,2c;_"
24
+ "ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
25
+ "X-Textdomain-Support: yes\n"
26
+
27
+ #: ocean-social-sharing.php:132 ocean-social-sharing.php:141
28
+ msgid "Cheatin&#8217; huh?"
29
+ msgstr ""
30
+
31
+ #: ocean-social-sharing.php:195
32
+ msgid "Ocean Social Sharing requires that you use ocean as your parent theme."
33
+ msgstr ""
34
+
35
+ #: ocean-social-sharing.php:195
36
+ msgid "Install Ocean Now"
37
+ msgstr ""
38
+
39
+ #: ocean-social-sharing.php:209
40
+ msgid "Social Sharing"
41
+ msgstr ""
42
+
43
+ #: ocean-social-sharing.php:222
44
+ msgid "Sharing Buttons"
45
+ msgstr ""
46
+
47
+ #: ocean-social-sharing.php:239 template/social-share.php:28
48
+ msgid "Please Share This"
49
+ msgstr ""
50
+
51
+ #: ocean-social-sharing.php:245
52
+ msgid "Heading on Posts"
53
+ msgstr ""
54
+
55
+ #: ocean-social-sharing.php:261
56
+ msgid "Twitter Handle"
57
+ msgstr ""
58
+
59
+ #: ocean-social-sharing.php:278
60
+ msgid "Links Borders Color"
61
+ msgstr ""
62
+
63
+ #: ocean-social-sharing.php:294
64
+ msgid "Icons Background Color"
65
+ msgstr ""
66
+
67
+ #: ocean-social-sharing.php:310
68
+ msgid "Icons Color"
69
+ msgstr ""
70
+
71
+ #: template/social-share.php:66
72
+ msgid "Share on Twitter"
73
+ msgstr ""
74
+
75
+ #: template/social-share.php:76
76
+ msgid "Share on Facebook"
77
+ msgstr ""
78
+
79
+ #: template/social-share.php:86
80
+ msgid "Share on Google+"
81
+ msgstr ""
82
+
83
+ #: template/social-share.php:96
84
+ msgid "Share on Pinterest"
85
+ msgstr ""
86
+
87
+ #: template/social-share.php:106
88
+ msgid "Share on LinkedIn"
89
+ msgstr ""
ocean-social-sharing.php ADDED
@@ -0,0 +1,397 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
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.0
7
+ * Author: OceanWP
8
+ * Author URI: https://oceanwp.org/
9
+ * Requires at least: 4.0.0
10
+ * Tested up to: 4.6.1
11
+ *
12
+ * Text Domain: ocean-social-sharing
13
+ * Domain Path: /languages/
14
+ *
15
+ * @package Ocean_Social_Sharing
16
+ * @category Core
17
+ * @author OceanWP
18
+ */
19
+
20
+ // Exit if accessed directly
21
+ if ( ! defined( 'ABSPATH' ) ) {
22
+ exit;
23
+ }
24
+
25
+ /**
26
+ * Returns the main instance of Ocean_Social_Sharing to prevent the need to use globals.
27
+ *
28
+ * @since 1.0.0
29
+ * @return object Ocean_Social_Sharing
30
+ */
31
+ function Ocean_Social_Sharing() {
32
+ return Ocean_Social_Sharing::instance();
33
+ } // End Ocean_Social_Sharing()
34
+
35
+ Ocean_Social_Sharing();
36
+
37
+ /**
38
+ * Main Ocean_Social_Sharing Class
39
+ *
40
+ * @class Ocean_Social_Sharing
41
+ * @version 1.0.0
42
+ * @since 1.0.0
43
+ * @package Ocean_Social_Sharing
44
+ */
45
+ final class Ocean_Social_Sharing {
46
+ /**
47
+ * Ocean_Social_Sharing The single instance of Ocean_Social_Sharing.
48
+ * @var object
49
+ * @access private
50
+ * @since 1.0.0
51
+ */
52
+ private static $_instance = null;
53
+
54
+ /**
55
+ * The token.
56
+ * @var string
57
+ * @access public
58
+ * @since 1.0.0
59
+ */
60
+ public $token;
61
+
62
+ /**
63
+ * The version number.
64
+ * @var string
65
+ * @access public
66
+ * @since 1.0.0
67
+ */
68
+ public $version;
69
+
70
+ // Admin - Start
71
+ /**
72
+ * The admin object.
73
+ * @var object
74
+ * @access public
75
+ * @since 1.0.0
76
+ */
77
+ public $admin;
78
+
79
+ /**
80
+ * Constructor function.
81
+ * @access public
82
+ * @since 1.0.0
83
+ * @return void
84
+ */
85
+ public function __construct( $widget_areas = array() ) {
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.0';
90
+
91
+ define( 'OSS_ROOT', dirname( __FILE__ ) );
92
+
93
+ register_activation_hook( __FILE__, array( $this, 'install' ) );
94
+
95
+ add_action( 'init', array( $this, 'oss_load_plugin_textdomain' ) );
96
+
97
+ add_action( 'init', array( $this, 'oss_setup' ) );
98
+ }
99
+
100
+ /**
101
+ * Main Ocean_Social_Sharing Instance
102
+ *
103
+ * Ensures only one instance of Ocean_Social_Sharing is loaded or can be loaded.
104
+ *
105
+ * @since 1.0.0
106
+ * @static
107
+ * @see Ocean_Social_Sharing()
108
+ * @return Main Ocean_Social_Sharing instance
109
+ */
110
+ public static function instance() {
111
+ if ( is_null( self::$_instance ) )
112
+ self::$_instance = new self();
113
+ return self::$_instance;
114
+ } // End instance()
115
+
116
+ /**
117
+ * Load the localisation file.
118
+ * @access public
119
+ * @since 1.0.0
120
+ * @return void
121
+ */
122
+ public function oss_load_plugin_textdomain() {
123
+ load_plugin_textdomain( 'ocean-social-sharing', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
124
+ }
125
+
126
+ /**
127
+ * Cloning is forbidden.
128
+ *
129
+ * @since 1.0.0
130
+ */
131
+ public function __clone() {
132
+ _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?' ), '1.0.0' );
133
+ }
134
+
135
+ /**
136
+ * Unserializing instances of this class is forbidden.
137
+ *
138
+ * @since 1.0.0
139
+ */
140
+ public function __wakeup() {
141
+ _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?' ), '1.0.0' );
142
+ }
143
+
144
+ /**
145
+ * Installation.
146
+ * Runs on activation. Logs the version number and assigns a notice message to a WordPress option.
147
+ * @access public
148
+ * @since 1.0.0
149
+ * @return void
150
+ */
151
+ public function install() {
152
+ $this->_log_version_number();
153
+ }
154
+
155
+ /**
156
+ * Log the plugin version number.
157
+ * @access private
158
+ * @since 1.0.0
159
+ * @return void
160
+ */
161
+ private function _log_version_number() {
162
+ // Log the version number.
163
+ update_option( $this->token . '-version', $this->version );
164
+ }
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 );
180
+ add_action( 'ocean_social_share', array( $this, 'social_share' ) );
181
+ add_filter( 'ocean_head_css', array( $this, 'head_css' ) );
182
+ } else {
183
+ add_action( 'admin_notices', array( $this, 'oss_install_ocean_notice' ) );
184
+ }
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
+
199
+ /**
200
+ * Customizer Controls and settings
201
+ * @param WP_Customize_Manager $wp_customize Theme Customizer object.
202
+ */
203
+ public function customizer_register( $wp_customize ) {
204
+
205
+ /**
206
+ * Add a new section
207
+ */
208
+ $wp_customize->add_section( 'oss_sharing_section' , array(
209
+ 'title' => esc_html__( 'Social Sharing', 'ocean-social-sharing' ),
210
+ 'priority' => 210,
211
+ ) );
212
+
213
+ /**
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
+ /**
236
+ * Sharing title
237
+ */
238
+ $wp_customize->add_setting( 'oss_social_share_heading', array(
239
+ 'default' => esc_html__( 'Please Share This', 'ocean-social-sharing' ),
240
+ 'transport' => 'postMessage',
241
+ 'sanitize_callback' => false,
242
+ ) );
243
+
244
+ $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'oss_social_share_heading', array(
245
+ 'label' => esc_html__( 'Heading on Posts', 'ocean-social-sharing' ),
246
+ 'section' => 'oss_sharing_section',
247
+ 'settings' => 'oss_social_share_heading',
248
+ 'type' => 'text',
249
+ 'priority' => 10,
250
+ ) ) );
251
+
252
+ /**
253
+ * Sharing title
254
+ */
255
+ $wp_customize->add_setting( 'oss_social_share_twitter_handle', array(
256
+ 'default' => '',
257
+ 'sanitize_callback' => false,
258
+ ) );
259
+
260
+ $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'oss_social_share_twitter_handle', array(
261
+ 'label' => esc_html__( 'Twitter Handle', 'ocean-social-sharing' ),
262
+ 'section' => 'oss_sharing_section',
263
+ 'settings' => 'oss_social_share_twitter_handle',
264
+ 'type' => 'text',
265
+ 'priority' => 10,
266
+ ) ) );
267
+
268
+ /**
269
+ * Borders color
270
+ */
271
+ $wp_customize->add_setting( 'oss_sharing_borders_color', array(
272
+ 'default' => '#e9e9e9',
273
+ 'transport' => 'postMessage',
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',
281
+ 'priority' => 10,
282
+ ) ) );
283
+
284
+ /**
285
+ * Icons background color
286
+ */
287
+ $wp_customize->add_setting( 'oss_sharing_icons_bg', array(
288
+ 'default' => '#ffffff',
289
+ 'transport' => 'postMessage',
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',
297
+ 'priority' => 10,
298
+ ) ) );
299
+
300
+ /**
301
+ * Icons color
302
+ */
303
+ $wp_customize->add_setting( 'oss_sharing_icons_color', array(
304
+ 'default' => '#bbbbbb',
305
+ 'transport' => 'postMessage',
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',
313
+ 'priority' => 10,
314
+ ) ) );
315
+
316
+ }
317
+
318
+ /**
319
+ * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
320
+ */
321
+ public function customize_preview_js() {
322
+ wp_enqueue_script( 'oss-customizer', plugins_url( '/assets/js/customizer.min.js', __FILE__ ), array( 'customize-preview' ), '1.1', true );
323
+ }
324
+
325
+ /**
326
+ * Enqueue style.
327
+ * @since 1.0.0
328
+ */
329
+ public function get_style() {
330
+
331
+ // Load main stylesheet
332
+ wp_enqueue_style( 'oss-social-share-style', plugins_url( '/assets/css/style.min.css', __FILE__ ) );
333
+
334
+ // If rtl
335
+ if ( is_RTL() ) {
336
+ wp_enqueue_style( 'oss-social-share-rtl', plugins_url( '/assets/css/rtl.css', __FILE__ ) );
337
+ }
338
+
339
+ }
340
+
341
+ /**
342
+ * Social sharing links
343
+ */
344
+ public function social_share() {
345
+
346
+ $file = $this->plugin_path . 'template/social-share.php';
347
+ $theme_file = get_stylesheet_directory() . '/templates/extra/social-share.php';
348
+
349
+ if ( file_exists( $theme_file ) ) {
350
+ $file = $theme_file;
351
+ }
352
+
353
+ if ( file_exists( $file ) ) {
354
+ include $file;
355
+ }
356
+
357
+ }
358
+
359
+ /**
360
+ * Add css in head tag.
361
+ */
362
+ public function head_css( $output ) {
363
+
364
+ // Global vars
365
+ $sharing_borders = get_theme_mod( 'oss_sharing_borders_color', '#e9e9e9' );
366
+ $sharing_icons_bg = get_theme_mod( 'oss_sharing_icons_bg', '#ffffff' );
367
+ $sharing_icons_color = get_theme_mod( 'oss_sharing_icons_color', '#bbbbbb' );
368
+
369
+ // Define css var
370
+ $css = '';
371
+
372
+ // Add borders color
373
+ if ( ! empty( $sharing_borders ) && '#e9e9e9' != $sharing_borders ) {
374
+ $css .= '.entry-share ul li a{border-color:'. $sharing_borders .';}';
375
+ }
376
+
377
+ // Add icon background
378
+ if ( ! empty( $sharing_icons_bg ) ) {
379
+ $css .= '.entry-share ul li a{background-color:'. $sharing_icons_bg .';}';
380
+ }
381
+
382
+ // Add icon color
383
+ if ( ! empty( $sharing_icons_color ) && '#bbbbbb' != $sharing_icons_color ) {
384
+ $css .= '.entry-share ul li a{color:'. $sharing_icons_color .';}';
385
+ }
386
+
387
+ // Return CSS
388
+ if ( ! empty( $css ) ) {
389
+ $output .= '/* Social Sharing CSS */'. $css;
390
+ }
391
+
392
+ // Return output css
393
+ return $output;
394
+
395
+ }
396
+
397
+ } // End Class
readme.txt ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.6.1
6
+ Stable tag: 1.0.0
7
+ License: GPLv2 or later
8
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
+
10
+ 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
+
18
+ 1. Upload `ocean-social-sharing` to the `/wp-content/plugins/` directory
19
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
20
+ 3. Done!
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
+
30
+ 1. The social buttons.
31
+
32
+ == Changelog ==
33
+
34
+ = 1.0.0 =
35
+ Initial release.
template/social-share.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Social Share Buttons Output
4
+ *
5
+ * @package Ocean WordPress theme
6
+ */
7
+
8
+ // Exit if accessed directly
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ // Disabled if post is password protected or if disabled
14
+ if ( post_password_required() ) {
15
+ return;
16
+ }
17
+
18
+ // Get sharing sites
19
+ $sites = oss_social_share_sites();
20
+
21
+ // Return if there aren't any sites enabled
22
+ if ( empty( $sites ) ) {
23
+ return;
24
+ }
25
+
26
+ // Declare main vars
27
+ $heading = get_theme_mod( 'oss_social_share_heading' );
28
+ $heading = $heading ? $heading : esc_html__( 'Please Share This', 'ocean-social-sharing' );
29
+ $post_id = get_the_ID();
30
+ $url = apply_filters( 'oss_social_share_url', get_permalink( $post_id ) );
31
+ $title = get_the_title();
32
+
33
+ // Get and encode summary
34
+ $summary = ocean_excerpt( 40 ); ?>
35
+
36
+ <div class="entry-share clr">
37
+
38
+ <h2 class="theme-heading social-share-title">
39
+ <span class="text"><?php echo esc_attr( $heading ); ?></span>
40
+ </h2>
41
+
42
+ <ul class="oss-social-share clr">
43
+
44
+ <?php
45
+ // Loop through sites
46
+ foreach ( $sites as $site ) :
47
+
48
+ // Twitter
49
+ if ( 'twitter' == $site ) {
50
+
51
+ // Get SEO meta and use instead if they exist
52
+ if ( defined( 'WPSEO_VERSION' ) ) {
53
+ if ( $meta = get_post_meta( $post_id, '_yoast_wpseo_twitter-title', true ) ) {
54
+ $title = $meta;
55
+ }
56
+ if ( $meta = get_post_meta( $post_id, '_yoast_wpseo_twitter-description', true ) ) {
57
+ $title = $title .': '. $meta;
58
+ $title = rawurlencode( $title );
59
+ }
60
+ }
61
+
62
+ // Get twitter handle
63
+ $handle = get_theme_mod( 'oss_social_share_twitter_handle' ); ?>
64
+
65
+ <li class="twitter">
66
+ <a href="http://twitter.com/share?text=<?php echo rawurlencode( $title ); ?>&amp;url=<?php echo rawurlencode( esc_url( $url ) ); ?><?php if ( $handle ) echo '&amp;via='. esc_attr( $handle ); ?>" title="<?php esc_html_e( 'Share on Twitter', 'ocean-social-sharing' ); ?>" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">
67
+ <span class="fa fa-twitter"></span>
68
+ </a>
69
+ </li>
70
+
71
+ <?php }
72
+ // Facebook
73
+ if ( 'facebook' == $site ) { ?>
74
+
75
+ <li class="facebook">
76
+ <a href="http://www.facebook.com/share.php?u=<?php echo rawurlencode( esc_url( $url ) ); ?>" title="<?php esc_html_e( 'Share on Facebook', 'ocean-social-sharing' ); ?>" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">
77
+ <span class="fa fa-facebook"></span>
78
+ </a>
79
+ </li>
80
+
81
+ <?php }
82
+ // Google+
83
+ if ( 'google_plus' == $site ) { ?>
84
+
85
+ <li class="googleplus">
86
+ <a href="https://plus.google.com/share?url=<?php echo rawurlencode( esc_url( $url ) ); ?>" title="<?php esc_html_e( 'Share on Google+', 'ocean-social-sharing' ); ?>" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">
87
+ <span class="fa fa-google-plus"></span>
88
+ </a>
89
+ </li>
90
+
91
+ <?php }
92
+ // Pinterest
93
+ if ( 'pinterest' == $site ) { ?>
94
+
95
+ <li class="pinterest">
96
+ <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;">
97
+ <span class="fa fa-pinterest-p"></span>
98
+ </a>
99
+ </li>
100
+
101
+ <?php }
102
+ // LinkedIn
103
+ if ( 'linkedin' == $site ) { ?>
104
+
105
+ <li class="linkedin">
106
+ <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;">
107
+ <span class="fa fa-linkedin"></span>
108
+ </a>
109
+ </li>
110
+
111
+ <?php } ?>
112
+
113
+ <?php endforeach; ?>
114
+
115
+ </ul>
116
+
117
+ </div><!-- .entry-share -->