Ocean Product Sharing - Version 1.0.0

Version Description

Initial release.

Download this release

Release Info

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

Version 1.0.0

assets/css/rtl.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ .woocommerce div.product .product-share ul li { border-left-width: 1px; border-right-width: 0; }
2
+ .woocommerce div.product .product-share ul li:last-child { border-left-width: 0; }
3
+ .woocommerce div.product .product-share ul li a .product-share-text { padding: 0 10px 0 0; }
assets/css/style.css ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .woocommerce div.product .product-share {
2
+ display: block;
3
+ border-top: 1px solid #e9e9e9;
4
+ border-bottom: 1px solid #e9e9e9;
5
+ margin-top: 70px;
6
+ padding: 0;
7
+ text-align: center; }
8
+ .woocommerce div.product .product-share ul {
9
+ float: none; }
10
+ .woocommerce div.product .product-share ul li {
11
+ display: inline-block;
12
+ float: none;
13
+ width: 24%;
14
+ border-right-width: 1px;
15
+ border-style: solid;
16
+ border-color: #e9e9e9;
17
+ padding: 20px 30px; }
18
+ .woocommerce div.product .product-share ul li:last-child {
19
+ border-right: 0; }
20
+ .woocommerce div.product .product-share ul li a {
21
+ display: block;
22
+ border: 0;
23
+ width: auto;
24
+ height: auto;
25
+ font-size: 13px;
26
+ line-height: 1.5;
27
+ margin: 0 !important;
28
+ border-radius: 0; }
29
+ .woocommerce div.product .product-share ul li a .fa {
30
+ display: inline-block;
31
+ background-color: #333;
32
+ color: #fff;
33
+ width: 40px;
34
+ height: 40px;
35
+ line-height: 40px;
36
+ font-size: 16px;
37
+ border-radius: 50%;
38
+ vertical-align: middle;
39
+ transition: all .3s ease; }
40
+ .woocommerce div.product .product-share ul li a .product-share-text {
41
+ display: inline-block;
42
+ vertical-align: middle;
43
+ padding: 0 0 0 10px;
44
+ width: calc(100% - 50px); }
45
+ .woocommerce div.product .product-share ul li.twitter a:hover {
46
+ color: #00aced; }
47
+ .woocommerce div.product .product-share ul li.twitter a:hover .fa {
48
+ background-color: #00aced; }
49
+ .woocommerce div.product .product-share ul li.facebook a:hover {
50
+ color: #3b5998; }
51
+ .woocommerce div.product .product-share ul li.facebook a:hover .fa {
52
+ background-color: #3b5998; }
53
+ .woocommerce div.product .product-share ul li.pinterest a:hover {
54
+ color: #cb2027; }
55
+ .woocommerce div.product .product-share ul li.pinterest a:hover .fa {
56
+ background-color: #cb2027; }
57
+ .woocommerce div.product .product-share ul li.email a:hover {
58
+ color: #3fc387; }
59
+ .woocommerce div.product .product-share ul li.email a:hover .fa {
60
+ background-color: #3fc387; }
61
+
62
+ .content-full-width.woocommerce div.product .product-share ul li a .product-share-text,
63
+ .content-full-screen.woocommerce div.product .product-share ul li a .product-share-text {
64
+ width: calc(80% - 50px); }
65
+
66
+ /*------------------------------------*
67
+ Responsive
68
+ *------------------------------------*/
69
+ @media only screen and (max-width: 1280px) {
70
+ .woocommerce div.product .product-share ul li {
71
+ padding: 20px 12px; }
72
+ .woocommerce div.product .product-share ul li a .fa {
73
+ display: block;
74
+ margin: 0 auto 12px auto; }
75
+ .woocommerce div.product .product-share ul li a .product-share-text {
76
+ display: block;
77
+ padding: 0;
78
+ width: auto; } }
79
+
80
+ /*------------------------------------*
81
+ Phone Portrait and Landscape
82
+ *------------------------------------*/
83
+ @media only screen and (max-width: 767px) {
84
+ .woocommerce div.product .product-share ul li {
85
+ width: 100%;
86
+ border-right-width: 0;
87
+ border-left-width: 0;
88
+ border-bottom-width: 1px;
89
+ padding: 20px 0; }
90
+ .woocommerce div.product .product-share ul li:last-child {
91
+ border-bottom-width: 0; }
92
+ .woocommerce div.product .product-share ul li a {
93
+ display: inline-block; } }
assets/css/style.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .woocommerce div.product .product-share{display:block;border-top:1px solid #e9e9e9;border-bottom:1px solid #e9e9e9;margin-top:70px;padding:0;text-align:center}.woocommerce div.product .product-share ul{float:none}.woocommerce div.product .product-share ul li{display:inline-block;float:none;width:24%;border-right-width:1px;border-style:solid;border-color:#e9e9e9;padding:20px 30px}.woocommerce div.product .product-share ul li:last-child{border-right:0}.woocommerce div.product .product-share ul li a{display:block;border:0;width:auto;height:auto;font-size:13px;line-height:1.5;margin:0 !important;border-radius:0}.woocommerce div.product .product-share ul li a .fa{display:inline-block;background-color:#333;color:#fff;width:40px;height:40px;line-height:40px;font-size:16px;border-radius:50%;vertical-align:middle;transition:all .3s ease}.woocommerce div.product .product-share ul li a .product-share-text{display:inline-block;vertical-align:middle;padding:0 0 0 10px;width:calc(100% - 50px)}.woocommerce div.product .product-share ul li.twitter a:hover{color:#00aced}.woocommerce div.product .product-share ul li.twitter a:hover .fa{background-color:#00aced}.woocommerce div.product .product-share ul li.facebook a:hover{color:#3b5998}.woocommerce div.product .product-share ul li.facebook a:hover .fa{background-color:#3b5998}.woocommerce div.product .product-share ul li.pinterest a:hover{color:#cb2027}.woocommerce div.product .product-share ul li.pinterest a:hover .fa{background-color:#cb2027}.woocommerce div.product .product-share ul li.email a:hover{color:#3fc387}.woocommerce div.product .product-share ul li.email a:hover .fa{background-color:#3fc387}.content-full-width.woocommerce div.product .product-share ul li a .product-share-text,.content-full-screen.woocommerce div.product .product-share ul li a .product-share-text{width:calc(80% - 50px)}@media only screen and (max-width: 1280px){.woocommerce div.product .product-share ul li{padding:20px 12px}.woocommerce div.product .product-share ul li a .fa{display:block;margin:0 auto 12px auto}.woocommerce div.product .product-share ul li a .product-share-text{display:block;padding:0;width:auto}}@media only screen and (max-width: 767px){.woocommerce div.product .product-share ul li{width:100%;border-right-width:0;border-left-width:0;border-bottom-width:1px;padding:20px 0}.woocommerce div.product .product-share ul li:last-child{border-bottom-width:0}.woocommerce div.product .product-share ul li a{display:inline-block}}
assets/css/style.scss ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .woocommerce div.product .product-share {
2
+ display: block;
3
+ border-top: 1px solid #e9e9e9;
4
+ border-bottom: 1px solid #e9e9e9;
5
+ margin-top: 70px;
6
+ padding: 0;
7
+ text-align: center;
8
+
9
+ ul {
10
+ float: none;
11
+
12
+ li {
13
+ display: inline-block;
14
+ float: none;
15
+ width: 24%;
16
+ border-right-width: 1px;
17
+ border-style: solid;
18
+ border-color: #e9e9e9;
19
+ padding: 20px 30px;
20
+
21
+ &:last-child {
22
+ border-right: 0;
23
+ }
24
+
25
+ a {
26
+ display: block;
27
+ border: 0;
28
+ width: auto;
29
+ height: auto;
30
+ font-size: 13px;
31
+ line-height: 1.5;
32
+ margin: 0 !important;
33
+ border-radius: 0;
34
+
35
+ .fa {
36
+ display: inline-block;
37
+ background-color: #333;
38
+ color: #fff;
39
+ width: 40px;
40
+ height: 40px;
41
+ line-height: 40px;
42
+ font-size: 16px;
43
+ border-radius: 50%;
44
+ vertical-align: middle;
45
+ transition: all .3s ease;
46
+ }
47
+
48
+ .product-share-text {
49
+ display: inline-block;
50
+ vertical-align: middle;
51
+ padding: 0 0 0 10px;
52
+ width: calc(100% - 50px);
53
+ }
54
+ }
55
+
56
+ &.twitter a:hover {
57
+ color: #00aced;
58
+
59
+ .fa {
60
+ background-color: #00aced;
61
+ }
62
+ }
63
+
64
+ &.facebook a:hover {
65
+ color: #3b5998;
66
+
67
+ .fa {
68
+ background-color: #3b5998;
69
+ }
70
+ }
71
+
72
+ &.pinterest a:hover {
73
+ color: #cb2027;
74
+
75
+ .fa {
76
+ background-color: #cb2027;
77
+ }
78
+ }
79
+
80
+ &.email a:hover {
81
+ color: #3fc387;
82
+
83
+ .fa {
84
+ background-color: #3fc387;
85
+ }
86
+ }
87
+ }
88
+ }
89
+ }
90
+
91
+ .content-full-width.woocommerce div.product .product-share ul li a .product-share-text,
92
+ .content-full-screen.woocommerce div.product .product-share ul li a .product-share-text {
93
+ width: calc(80% - 50px);
94
+ }
95
+
96
+ /*------------------------------------*
97
+ Responsive
98
+ *------------------------------------*/
99
+ @media only screen and (max-width: 1280px) {
100
+
101
+ .woocommerce div.product .product-share ul li { padding: 20px 12px; }
102
+ .woocommerce div.product .product-share ul li a .fa { display: block; margin: 0 auto 12px auto; }
103
+ .woocommerce div.product .product-share ul li a .product-share-text { display: block; padding: 0; width: auto; }
104
+
105
+ }
106
+
107
+ /*------------------------------------*
108
+ Phone Portrait and Landscape
109
+ *------------------------------------*/
110
+ @media only screen and (max-width: 767px) {
111
+
112
+ .woocommerce div.product .product-share ul li { width: 100%; border-right-width: 0; border-left-width: 0; border-bottom-width: 1px; padding: 20px 0; }
113
+ .woocommerce div.product .product-share ul li:last-child { border-bottom-width: 0; }
114
+ .woocommerce div.product .product-share ul li a { display: inline-block; }
115
+
116
+ }
assets/js/customizer.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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( 'ops_sharing_borders_color', function( value ) {
9
+ value.bind( function( to ) {
10
+ $( '.woocommerce div.product .product-share,.woocommerce div.product .product-share ul li' ).css( 'border-color', to );
11
+ } );
12
+ } );
13
+ wp.customize( 'ops_sharing_icons_bg', function( value ) {
14
+ value.bind( function( to ) {
15
+ $( '.woocommerce div.product .product-share ul li a .fa' ).css( 'background-color', to );
16
+ } );
17
+ } );
18
+ wp.customize( 'ops_sharing_icons_color', function( value ) {
19
+ value.bind( function( to ) {
20
+ $( '.woocommerce div.product .product-share ul li a .fa' ).css( 'color', to );
21
+ } );
22
+ } );
23
+ } )( jQuery );
assets/js/customizer.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(a){wp.customize("ops_sharing_borders_color",function(b){b.bind(function(b){a(".woocommerce div.product .product-share,.woocommerce div.product .product-share ul li").css("border-color",b)})}),wp.customize("ops_sharing_icons_bg",function(b){b.bind(function(b){a(".woocommerce div.product .product-share ul li a .fa").css("background-color",b)})}),wp.customize("ops_sharing_icons_color",function(b){b.bind(function(b){a(".woocommerce div.product .product-share ul li a .fa").css("color",b)})})}(jQuery);
index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden... ?>
languages/ocean-product-sharing.pot ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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:18:27+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-product-sharing.php:132 ocean-product-sharing.php:141
28
+ msgid "Cheatin&#8217; huh?"
29
+ msgstr ""
30
+
31
+ #: ocean-product-sharing.php:194
32
+ msgid "Ocean Product Sharing requires that you use ocean as your parent theme."
33
+ msgstr ""
34
+
35
+ #: ocean-product-sharing.php:194
36
+ msgid "Install Ocean Now"
37
+ msgstr ""
38
+
39
+ #: ocean-product-sharing.php:208
40
+ msgid "Product Sharing"
41
+ msgstr ""
42
+
43
+ #: ocean-product-sharing.php:222
44
+ msgid "Borders Color"
45
+ msgstr ""
46
+
47
+ #: ocean-product-sharing.php:238
48
+ msgid "Icons Background Color"
49
+ msgstr ""
50
+
51
+ #: ocean-product-sharing.php:254
52
+ msgid "Icons Color"
53
+ msgstr ""
54
+
55
+ #: template/product-share.php:25
56
+ msgid "Tweet This Product"
57
+ msgstr ""
58
+
59
+ #: template/product-share.php:32
60
+ msgid "Share on Facebook"
61
+ msgstr ""
62
+
63
+ #: template/product-share.php:39
64
+ msgid "Pin This Product"
65
+ msgstr ""
66
+
67
+ #: template/product-share.php:46
68
+ msgid "Mail This Product"
69
+ msgstr ""
ocean-product-sharing.php ADDED
@@ -0,0 +1,341 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Name: Ocean Product Sharing
4
+ * Plugin URI: https://oceanwp.org/extension/ocean-product-sharing/
5
+ * Description: A simple plugin to add social share buttons to your product page.
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.7
11
+ *
12
+ * Text Domain: ocean-product-sharing
13
+ * Domain Path: /languages/
14
+ *
15
+ * @package Ocean_Product_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_Product_Sharing to prevent the need to use globals.
27
+ *
28
+ * @since 1.0.0
29
+ * @return object Ocean_Product_Sharing
30
+ */
31
+ function Ocean_Product_Sharing() {
32
+ return Ocean_Product_Sharing::instance();
33
+ } // End Ocean_Product_Sharing()
34
+
35
+ Ocean_Product_Sharing();
36
+
37
+ /**
38
+ * Main Ocean_Product_Sharing Class
39
+ *
40
+ * @class Ocean_Product_Sharing
41
+ * @version 1.0.0
42
+ * @since 1.0.0
43
+ * @package Ocean_Product_Sharing
44
+ */
45
+ final class Ocean_Product_Sharing {
46
+ /**
47
+ * Ocean_Product_Sharing The single instance of Ocean_Product_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-product-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( 'OPS_ROOT', dirname( __FILE__ ) );
92
+
93
+ register_activation_hook( __FILE__, array( $this, 'install' ) );
94
+
95
+ add_action( 'init', array( $this, 'ops_load_plugin_textdomain' ) );
96
+
97
+ add_action( 'init', array( $this, 'ops_setup' ) );
98
+ }
99
+
100
+ /**
101
+ * Main Ocean_Product_Sharing Instance
102
+ *
103
+ * Ensures only one instance of Ocean_Product_Sharing is loaded or can be loaded.
104
+ *
105
+ * @since 1.0.0
106
+ * @static
107
+ * @see Ocean_Product_Sharing()
108
+ * @return Main Ocean_Product_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 ops_load_plugin_textdomain() {
123
+ load_plugin_textdomain( 'ocean-product-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_product_sharing filter
170
+ * @return void
171
+ */
172
+ public function ops_setup() {
173
+ $theme = wp_get_theme();
174
+
175
+ if ( 'Ocean' == $theme->name || 'ocean' == $theme->template && apply_filters( 'ocean_product_sharing', true ) ) {
176
+ add_action( 'customize_register', array( $this, 'customizer_register' ) );
177
+ add_action( 'customize_preview_init', array( $this, 'customize_preview_js' ) );
178
+ add_action( 'wp_enqueue_scripts', array( $this, 'get_style' ), 999 );
179
+ add_action( 'woocommerce_after_single_product_summary', array( $this, 'product_share' ) );
180
+ add_filter( 'ocean_head_css', array( $this, 'head_css' ) );
181
+ } else {
182
+ add_action( 'admin_notices', array( $this, 'ops_install_ocean_notice' ) );
183
+ }
184
+ }
185
+
186
+ /**
187
+ * Ocean install
188
+ * If the user activates the plugin while having a different parent theme active, prompt them to install Ocean.
189
+ * @since 1.0.0
190
+ * @return void
191
+ */
192
+ public function ops_install_ocean_notice() {
193
+ echo '<div class="notice is-dismissible updated">
194
+ <p>' . esc_html__( 'Ocean Product Sharing requires that you use ocean as your parent theme.', 'ocean-product-sharing' ) . ' <a href="https://oceanwp.com/">' . esc_html__( 'Install Ocean Now', 'ocean-product-sharing' ) . '</a></p>
195
+ </div>';
196
+ }
197
+
198
+ /**
199
+ * Customizer Controls and settings
200
+ * @param WP_Customize_Manager $wp_customize Theme Customizer object.
201
+ */
202
+ public function customizer_register( $wp_customize ) {
203
+
204
+ /**
205
+ * Add a new section
206
+ */
207
+ $wp_customize->add_section( 'ops_product_sharing_section' , array(
208
+ 'title' => esc_html__( 'Product Sharing', 'ocean-product-sharing' ),
209
+ 'priority' => 210,
210
+ ) );
211
+
212
+ /**
213
+ * Borders color
214
+ */
215
+ $wp_customize->add_setting( 'ops_product_sharing_borders_color', array(
216
+ 'default' => '#e9e9e9',
217
+ 'transport' => 'postMessage',
218
+ 'sanitize_callback' => false,
219
+ ) );
220
+
221
+ $wp_customize->add_control( new Ocean_Customizer_Color_Control( $wp_customize, 'ops_product_sharing_borders_color', array(
222
+ 'label' => esc_html__( 'Borders Color', 'ocean-product-sharing' ),
223
+ 'section' => 'ops_product_sharing_section',
224
+ 'settings' => 'ops_product_sharing_borders_color',
225
+ 'priority' => 10,
226
+ ) ) );
227
+
228
+ /**
229
+ * Icons background color
230
+ */
231
+ $wp_customize->add_setting( 'ops_product_sharing_icons_bg', array(
232
+ 'default' => '#333333',
233
+ 'transport' => 'postMessage',
234
+ 'sanitize_callback' => false,
235
+ ) );
236
+
237
+ $wp_customize->add_control( new Ocean_Customizer_Color_Control( $wp_customize, 'ops_product_sharing_icons_bg', array(
238
+ 'label' => esc_html__( 'Icons Background Color', 'ocean-product-sharing' ),
239
+ 'section' => 'ops_product_sharing_section',
240
+ 'settings' => 'ops_product_sharing_icons_bg',
241
+ 'priority' => 10,
242
+ ) ) );
243
+
244
+ /**
245
+ * Icons color
246
+ */
247
+ $wp_customize->add_setting( 'ops_product_sharing_icons_color', array(
248
+ 'default' => '#ffffff',
249
+ 'transport' => 'postMessage',
250
+ 'sanitize_callback' => false,
251
+ ) );
252
+
253
+ $wp_customize->add_control( new Ocean_Customizer_Color_Control( $wp_customize, 'ops_product_sharing_icons_color', array(
254
+ 'label' => esc_html__( 'Icons Color', 'ocean-product-sharing' ),
255
+ 'section' => 'ops_product_sharing_section',
256
+ 'settings' => 'ops_product_sharing_icons_color',
257
+ 'priority' => 10,
258
+ ) ) );
259
+
260
+ }
261
+
262
+ /**
263
+ * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
264
+ */
265
+ public function customize_preview_js() {
266
+ wp_enqueue_script( 'ops-customizer', plugins_url( '/assets/js/customizer.min.js', __FILE__ ), array( 'customize-preview' ), '1.1', true );
267
+ }
268
+
269
+ /**
270
+ * Enqueue style.
271
+ * @since 1.0.0
272
+ */
273
+ public function get_style() {
274
+
275
+ // Load main stylesheet
276
+ wp_enqueue_style( 'ops-product-share-style', plugins_url( '/assets/css/style.min.css', __FILE__ ) );
277
+
278
+ // If rtl
279
+ if ( is_RTL() ) {
280
+ wp_enqueue_style( 'ops-product-share-rtl', plugins_url( '/assets/css/rtl.css', __FILE__ ) );
281
+ }
282
+
283
+ }
284
+
285
+ /**
286
+ * Product sharing links
287
+ */
288
+ public function product_share() {
289
+
290
+ $file = $this->plugin_path . 'template/product-share.php';
291
+ $theme_file = get_stylesheet_directory() . '/templates/extra/product-share.php';
292
+
293
+ if ( file_exists( $theme_file ) ) {
294
+ $file = $theme_file;
295
+ }
296
+
297
+ if ( file_exists( $file ) ) {
298
+ include $file;
299
+ }
300
+
301
+ }
302
+
303
+ /**
304
+ * Add css in head tag.
305
+ */
306
+ public function head_css( $output ) {
307
+
308
+ // Global vars
309
+ $product_sharing_borders = get_theme_mod( 'ops_product_sharing_borders_color', '#e9e9e9' );
310
+ $product_sharing_icons_bg = get_theme_mod( 'ops_product_sharing_icons_bg', '#333333' );
311
+ $product_sharing_icons_color = get_theme_mod( 'ops_product_sharing_icons_color', '#ffffff' );
312
+
313
+ // Define css var
314
+ $css = '';
315
+
316
+ // Add borders color
317
+ if ( ! empty( $product_sharing_borders ) && '#e9e9e9' != $product_sharing_borders ) {
318
+ $css .= '.woocommerce div.product .entry-share,.woocommerce div.product .entry-share ul li{border-color:'. $product_sharing_borders .';}';
319
+ }
320
+
321
+ // Add icon background
322
+ if ( ! empty( $product_sharing_icons_bg ) && '#333333' != $product_sharing_icons_bg ) {
323
+ $css .= '.woocommerce div.product .entry-share ul li a .fa{background-color:'. $product_sharing_icons_bg .';}';
324
+ }
325
+
326
+ // Add icon color
327
+ if ( ! empty( $product_sharing_icons_color ) && '#ffffff' != $product_sharing_icons_color ) {
328
+ $css .= '.woocommerce div.product .entry-share ul li a .fa{color:'. $product_sharing_icons_color .';}';
329
+ }
330
+
331
+ // Return CSS
332
+ if ( ! empty( $css ) ) {
333
+ $output .= '/* Extra CSS */'. $css;
334
+ }
335
+
336
+ // Return output css
337
+ return $output;
338
+
339
+ }
340
+
341
+ } // End Class
readme.txt ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Ocean Product Sharing ===
2
+ Contributors: oceanwp
3
+ Tags: social, social sharing, social share product, share product, ocean
4
+ Requires at least: 3.5
5
+ Tested up to: 4.7
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 product page.
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-product-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 sharing buttons.
31
+ 2. On full width page.
32
+
33
+ == Changelog ==
34
+
35
+ = 1.0.0 =
36
+ Initial release.
template/product-share.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ // Vars
14
+ $product_title = get_the_title();
15
+ $product_url = get_permalink();
16
+ $product_img = wp_get_attachment_url( get_post_thumbnail_id() ); ?>
17
+
18
+ <div class="product-share clr">
19
+
20
+ <ul class="ocean-social-share clr">
21
+
22
+ <li class="twitter">
23
+ <a href="http://twitter.com/intent/tweet?status=<?php echo rawurlencode( $product_title ); ?>+<?php echo esc_url( $product_url ); ?>" target="_blank">
24
+ <span class="fa fa-twitter"></span>
25
+ <div class="product-share-text"><?php esc_html_e( 'Tweet This Product', 'ocean-product-sharing' ); ?></div>
26
+ </a>
27
+ </li>
28
+
29
+ <li class="facebook">
30
+ <a href="http://www.facebook.com/share.php?u=<?php echo rawurlencode( esc_url( $product_url ) ); ?>" target="_blank">
31
+ <span class="fa fa-facebook"></span>
32
+ <div class="product-share-text"><?php esc_html_e( 'Share on Facebook', 'ocean-product-sharing' ); ?></div>
33
+ </a>
34
+ </li>
35
+
36
+ <li class="pinterest">
37
+ <a href="https://www.pinterest.com/pin/create/button/?url=<?php echo rawurlencode( esc_url( $product_url ) ); ?>&amp;media=<?php echo wp_get_attachment_url( get_post_thumbnail_id() ); ?>&amp;description=<?php echo rawurlencode( $product_title ); ?>" target="_blank">
38
+ <span class="fa fa-pinterest-p"></span>
39
+ <div class="product-share-text"><?php esc_html_e( 'Pin This Product', 'ocean-product-sharing' ); ?></div>
40
+ </a>
41
+ </li>
42
+
43
+ <li class="email">
44
+ <a href="mailto:?subject=<?php echo rawurlencode( $product_title ); ?>&amp;body=<?php echo esc_url( $product_url ); ?>" target="_blank">
45
+ <span class="fa fa-envelope-o"></span>
46
+ <div class="product-share-text"><?php esc_html_e( 'Mail This Product', 'ocean-product-sharing' ); ?></div>
47
+ </a>
48
+ </li>
49
+
50
+ </ul>
51
+
52
+ </div><!-- .entry-share -->