Version Description
- 04.01.2015 = Initial release.
Download this release
Release Info
| Developer | woothemes |
| Plugin | |
| Version | 1.0.0 |
| Comparing to | |
| See all releases | |
Version 1.0.0
- assets/css/style.css +51 -0
- assets/css/style.scss +86 -0
- changelog.txt +4 -0
- index.php +1 -0
- languages/storefront-product-sharing.pot +65 -0
- readme.txt +37 -0
- storefront-product-sharing.php +226 -0
assets/css/style.css
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.storefront-product-sharing {
|
| 2 |
+
clear: both; }
|
| 3 |
+
.storefront-product-sharing ul {
|
| 4 |
+
margin-left: 0; }
|
| 5 |
+
.storefront-product-sharing ul li {
|
| 6 |
+
list-style: none; }
|
| 7 |
+
.storefront-product-sharing ul li a:before {
|
| 8 |
+
font-family: "FontAwesome";
|
| 9 |
+
font-weight: 400;
|
| 10 |
+
margin-right: 1em; }
|
| 11 |
+
.storefront-product-sharing ul li.facebook a:before {
|
| 12 |
+
content: "\f230";
|
| 13 |
+
color: #3b5998; }
|
| 14 |
+
.storefront-product-sharing ul li.twitter a:before {
|
| 15 |
+
content: "\f081";
|
| 16 |
+
color: #00aced; }
|
| 17 |
+
.storefront-product-sharing ul li.pinterest a:before {
|
| 18 |
+
content: "\f0d3";
|
| 19 |
+
color: #cb2027; }
|
| 20 |
+
.storefront-product-sharing ul li.email a:before {
|
| 21 |
+
content: "\f199"; }
|
| 22 |
+
|
| 23 |
+
@media screen and (min-width: 768px) {
|
| 24 |
+
.storefront-product-sharing {
|
| 25 |
+
padding: 2.618em 0;
|
| 26 |
+
border-top: 1px solid rgba(0, 0, 0, 0.1); }
|
| 27 |
+
.storefront-product-sharing ul {
|
| 28 |
+
margin: 0; }
|
| 29 |
+
.storefront-product-sharing ul::after {
|
| 30 |
+
clear: both;
|
| 31 |
+
content: "";
|
| 32 |
+
display: table; }
|
| 33 |
+
.storefront-product-sharing ul li {
|
| 34 |
+
width: 25%;
|
| 35 |
+
float: left;
|
| 36 |
+
text-align: center; }
|
| 37 |
+
.storefront-product-sharing ul li a {
|
| 38 |
+
display: block; }
|
| 39 |
+
.storefront-product-sharing ul li a:before {
|
| 40 |
+
display: block;
|
| 41 |
+
margin: 0 auto .007em;
|
| 42 |
+
font-size: 2.618em;
|
| 43 |
+
-webkit-transition: all, ease, 0.2s;
|
| 44 |
+
-moz-transition: all, ease, 0.2s;
|
| 45 |
+
transition: all, ease, 0.2s; }
|
| 46 |
+
.storefront-product-sharing ul li a:hover:before {
|
| 47 |
+
-webkit-transform: translateY(-0.236em);
|
| 48 |
+
-moz-transform: translateY(-0.236em);
|
| 49 |
+
-ms-transform: translateY(-0.236em);
|
| 50 |
+
-o-transform: translateY(-0.236em);
|
| 51 |
+
transform: translateY(-0.236em); } }
|
assets/css/style.scss
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@import 'susy';
|
| 2 |
+
@import 'bourbon';
|
| 3 |
+
@import '../../../../themes/storefront/sass/utils/variables';
|
| 4 |
+
|
| 5 |
+
// Styles for mobile
|
| 6 |
+
.storefront-product-sharing {
|
| 7 |
+
clear: both;
|
| 8 |
+
ul {
|
| 9 |
+
margin-left: 0;
|
| 10 |
+
|
| 11 |
+
li {
|
| 12 |
+
list-style: none;
|
| 13 |
+
|
| 14 |
+
a:before {
|
| 15 |
+
font-family: "FontAwesome";
|
| 16 |
+
font-weight: 400;
|
| 17 |
+
margin-right: 1em;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
&.facebook {
|
| 21 |
+
a:before {
|
| 22 |
+
content: "\f230";
|
| 23 |
+
color: #3b5998;
|
| 24 |
+
}
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
&.twitter {
|
| 28 |
+
a:before {
|
| 29 |
+
content: "\f081";
|
| 30 |
+
color: #00aced;
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
&.pinterest {
|
| 35 |
+
a:before {
|
| 36 |
+
content: "\f0d3";
|
| 37 |
+
color: #cb2027;
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
&.email {
|
| 42 |
+
a:before {
|
| 43 |
+
content: "\f199";
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
@media screen and (min-width: 768px) {
|
| 51 |
+
|
| 52 |
+
// Styles for desktop
|
| 53 |
+
.storefront-product-sharing {
|
| 54 |
+
padding: 2.618em 0;
|
| 55 |
+
border-top: 1px solid $color_border;
|
| 56 |
+
|
| 57 |
+
ul {
|
| 58 |
+
@include clearfix;
|
| 59 |
+
margin: 0;
|
| 60 |
+
|
| 61 |
+
li {
|
| 62 |
+
width: 25%;
|
| 63 |
+
float: left;
|
| 64 |
+
text-align: center;
|
| 65 |
+
|
| 66 |
+
a {
|
| 67 |
+
display: block;
|
| 68 |
+
|
| 69 |
+
&:before {
|
| 70 |
+
display: block;
|
| 71 |
+
margin: 0 auto .007em;
|
| 72 |
+
font-size: 2.618em;
|
| 73 |
+
@include transition(all,ease,.2s);
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
&:hover {
|
| 77 |
+
&:before {
|
| 78 |
+
@include transform(translateY(-.236em));
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
}
|
changelog.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*** Storefront Product Sharing Changelog ***
|
| 2 |
+
|
| 3 |
+
2015.04.22 - version 1.0.0
|
| 4 |
+
* Initial release
|
index.php
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
| 1 |
+
<?php // Silence is golden... ?>
|
languages/storefront-product-sharing.pot
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (C) 2015 Storefront Product Sharing
|
| 2 |
+
# This file is distributed under the same license as the Storefront Product Sharing package.
|
| 3 |
+
msgid ""
|
| 4 |
+
msgstr ""
|
| 5 |
+
"Project-Id-Version: Storefront Product Sharing 1.0.0\n"
|
| 6 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/storefront-product-sharing\n"
|
| 7 |
+
"POT-Creation-Date: 2015-04-22 12:36:47+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: 2015-MO-DA HO:MI+ZONE\n"
|
| 12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
| 13 |
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
| 14 |
+
|
| 15 |
+
#: storefront-product-sharing.php:128 storefront-product-sharing.php:137
|
| 16 |
+
msgid "Cheatin’ huh?"
|
| 17 |
+
msgstr ""
|
| 18 |
+
|
| 19 |
+
#: storefront-product-sharing.php:190
|
| 20 |
+
msgid ""
|
| 21 |
+
"Storefront Product Sharing requires that you use Storefront as your parent "
|
| 22 |
+
"theme."
|
| 23 |
+
msgstr ""
|
| 24 |
+
|
| 25 |
+
#: storefront-product-sharing.php:190
|
| 26 |
+
msgid "Install Storefront now"
|
| 27 |
+
msgstr ""
|
| 28 |
+
|
| 29 |
+
#: storefront-product-sharing.php:218
|
| 30 |
+
msgid "Share on Twitter"
|
| 31 |
+
msgstr ""
|
| 32 |
+
|
| 33 |
+
#: storefront-product-sharing.php:219
|
| 34 |
+
msgid "Share on Facebook"
|
| 35 |
+
msgstr ""
|
| 36 |
+
|
| 37 |
+
#: storefront-product-sharing.php:220
|
| 38 |
+
msgid "Pin this product"
|
| 39 |
+
msgstr ""
|
| 40 |
+
|
| 41 |
+
#: storefront-product-sharing.php:221
|
| 42 |
+
msgid "Share via Email"
|
| 43 |
+
msgstr ""
|
| 44 |
+
|
| 45 |
+
#. Plugin Name of the plugin/theme
|
| 46 |
+
msgid "Storefront Product Sharing"
|
| 47 |
+
msgstr ""
|
| 48 |
+
|
| 49 |
+
#. Plugin URI of the plugin/theme
|
| 50 |
+
msgid "http://woothemes.com/products/storefront-product-sharing/"
|
| 51 |
+
msgstr ""
|
| 52 |
+
|
| 53 |
+
#. Description of the plugin/theme
|
| 54 |
+
msgid ""
|
| 55 |
+
"Add attractive social sharing icons for Facebook, Twitter, Pinterest and "
|
| 56 |
+
"Email to your product pages."
|
| 57 |
+
msgstr ""
|
| 58 |
+
|
| 59 |
+
#. Author of the plugin/theme
|
| 60 |
+
msgid "WooThemes"
|
| 61 |
+
msgstr ""
|
| 62 |
+
|
| 63 |
+
#. Author URI of the plugin/theme
|
| 64 |
+
msgid "http://woothemes.com/"
|
| 65 |
+
msgstr ""
|
readme.txt
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
=== Storefront Product Sharing ===
|
| 2 |
+
Contributors: jameskoster, woothemes
|
| 3 |
+
Tags: woocommerce, ecommerce, storefront, social, sharing, seo
|
| 4 |
+
Requires at least: 3.5
|
| 5 |
+
Tested up to: 4.1.2
|
| 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 |
+
Add attractive social sharing icons for Facebook, Twitter, Pinterest and Email to your product pages.
|
| 11 |
+
|
| 12 |
+
== Description ==
|
| 13 |
+
|
| 14 |
+
A simple plugin that adds an attractive sharing component to product pages. Prompt visitors to share your products on Facebook, Twitter, Pinterest or via Email.
|
| 15 |
+
|
| 16 |
+
This plugin requires the Storefront theme and WooCommerce plugin to be installed.
|
| 17 |
+
|
| 18 |
+
== Installation ==
|
| 19 |
+
|
| 20 |
+
1. Upload `storefront-product-sharing` to the `/wp-content/plugins/` directory
|
| 21 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress
|
| 22 |
+
3. Done!
|
| 23 |
+
|
| 24 |
+
== Frequently Asked Questions ==
|
| 25 |
+
|
| 26 |
+
= I installed the plugin but cannot see the sharing buttons =
|
| 27 |
+
|
| 28 |
+
This plugin will only work with the [Storefront](http://wordpress.org/themes/storefront/) theme and the [WooCommerce](http://wordpress.org/plugins/woocommerce/) plugin.
|
| 29 |
+
|
| 30 |
+
== Screenshots ==
|
| 31 |
+
|
| 32 |
+
1. The sharing buttons in action.
|
| 33 |
+
|
| 34 |
+
== Changelog ==
|
| 35 |
+
|
| 36 |
+
= 1.0.0 - 04.01.2015 =
|
| 37 |
+
Initial release.
|
storefront-product-sharing.php
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Plugin Name: Storefront Product Sharing
|
| 4 |
+
* Plugin URI: http://woothemes.com/products/storefront-product-sharing/
|
| 5 |
+
* Description: Add attractive social sharing icons for Facebook, Twitter, Pinterest and Email to your product pages.
|
| 6 |
+
* Version: 1.0.0
|
| 7 |
+
* Author: WooThemes
|
| 8 |
+
* Author URI: http://woothemes.com/
|
| 9 |
+
* Requires at least: 4.0.0
|
| 10 |
+
* Tested up to: 4.0.0
|
| 11 |
+
*
|
| 12 |
+
* Text Domain: storefront-product-sharing
|
| 13 |
+
* Domain Path: /languages/
|
| 14 |
+
*
|
| 15 |
+
* @package Storefront_Product_Sharing
|
| 16 |
+
* @category Core
|
| 17 |
+
* @author James Koster
|
| 18 |
+
*/
|
| 19 |
+
|
| 20 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Returns the main instance of Storefront_Product_Sharing to prevent the need to use globals.
|
| 25 |
+
*
|
| 26 |
+
* @since 1.0.0
|
| 27 |
+
* @return object Storefront_Product_Sharing
|
| 28 |
+
*/
|
| 29 |
+
function Storefront_Product_Sharing() {
|
| 30 |
+
return Storefront_Product_Sharing::instance();
|
| 31 |
+
} // End Storefront_Product_Sharing()
|
| 32 |
+
|
| 33 |
+
Storefront_Product_Sharing();
|
| 34 |
+
|
| 35 |
+
/**
|
| 36 |
+
* Main Storefront_Product_Sharing Class
|
| 37 |
+
*
|
| 38 |
+
* @class Storefront_Product_Sharing
|
| 39 |
+
* @version 1.0.0
|
| 40 |
+
* @since 1.0.0
|
| 41 |
+
* @package Storefront_Product_Sharing
|
| 42 |
+
*/
|
| 43 |
+
final class Storefront_Product_Sharing {
|
| 44 |
+
/**
|
| 45 |
+
* Storefront_Product_Sharing The single instance of Storefront_Product_Sharing.
|
| 46 |
+
* @var object
|
| 47 |
+
* @access private
|
| 48 |
+
* @since 1.0.0
|
| 49 |
+
*/
|
| 50 |
+
private static $_instance = null;
|
| 51 |
+
|
| 52 |
+
/**
|
| 53 |
+
* The token.
|
| 54 |
+
* @var string
|
| 55 |
+
* @access public
|
| 56 |
+
* @since 1.0.0
|
| 57 |
+
*/
|
| 58 |
+
public $token;
|
| 59 |
+
|
| 60 |
+
/**
|
| 61 |
+
* The version number.
|
| 62 |
+
* @var string
|
| 63 |
+
* @access public
|
| 64 |
+
* @since 1.0.0
|
| 65 |
+
*/
|
| 66 |
+
public $version;
|
| 67 |
+
|
| 68 |
+
// Admin - Start
|
| 69 |
+
/**
|
| 70 |
+
* The admin object.
|
| 71 |
+
* @var object
|
| 72 |
+
* @access public
|
| 73 |
+
* @since 1.0.0
|
| 74 |
+
*/
|
| 75 |
+
public $admin;
|
| 76 |
+
|
| 77 |
+
/**
|
| 78 |
+
* Constructor function.
|
| 79 |
+
* @access public
|
| 80 |
+
* @since 1.0.0
|
| 81 |
+
* @return void
|
| 82 |
+
*/
|
| 83 |
+
public function __construct() {
|
| 84 |
+
$this->token = 'storefront-product-sharing';
|
| 85 |
+
$this->plugin_url = plugin_dir_url( __FILE__ );
|
| 86 |
+
$this->plugin_path = plugin_dir_path( __FILE__ );
|
| 87 |
+
$this->version = '1.0.0';
|
| 88 |
+
|
| 89 |
+
register_activation_hook( __FILE__, array( $this, 'install' ) );
|
| 90 |
+
|
| 91 |
+
add_action( 'init', array( $this, 'sps_load_plugin_textdomain' ) );
|
| 92 |
+
|
| 93 |
+
add_action( 'init', array( $this, 'sps_setup' ) );
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
/**
|
| 97 |
+
* Main Storefront_Product_Sharing Instance
|
| 98 |
+
*
|
| 99 |
+
* Ensures only one instance of Storefront_Product_Sharing is loaded or can be loaded.
|
| 100 |
+
*
|
| 101 |
+
* @since 1.0.0
|
| 102 |
+
* @static
|
| 103 |
+
* @see Storefront_Product_Sharing()
|
| 104 |
+
* @return Main Storefront_Product_Sharing instance
|
| 105 |
+
*/
|
| 106 |
+
public static function instance() {
|
| 107 |
+
if ( is_null( self::$_instance ) )
|
| 108 |
+
self::$_instance = new self();
|
| 109 |
+
return self::$_instance;
|
| 110 |
+
} // End instance()
|
| 111 |
+
|
| 112 |
+
/**
|
| 113 |
+
* Load the localisation file.
|
| 114 |
+
* @access public
|
| 115 |
+
* @since 1.0.0
|
| 116 |
+
* @return void
|
| 117 |
+
*/
|
| 118 |
+
public function sps_load_plugin_textdomain() {
|
| 119 |
+
load_plugin_textdomain( 'storefront-product-sharing', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
/**
|
| 123 |
+
* Cloning is forbidden.
|
| 124 |
+
*
|
| 125 |
+
* @since 1.0.0
|
| 126 |
+
*/
|
| 127 |
+
public function __clone() {
|
| 128 |
+
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?' ), '1.0.0' );
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
/**
|
| 132 |
+
* Unserializing instances of this class is forbidden.
|
| 133 |
+
*
|
| 134 |
+
* @since 1.0.0
|
| 135 |
+
*/
|
| 136 |
+
public function __wakeup() {
|
| 137 |
+
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?' ), '1.0.0' );
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
/**
|
| 141 |
+
* Installation.
|
| 142 |
+
* Runs on activation. Logs the version number and assigns a notice message to a WordPress option.
|
| 143 |
+
* @access public
|
| 144 |
+
* @since 1.0.0
|
| 145 |
+
* @return void
|
| 146 |
+
*/
|
| 147 |
+
public function install() {
|
| 148 |
+
$this->_log_version_number();
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
/**
|
| 152 |
+
* Log the plugin version number.
|
| 153 |
+
* @access private
|
| 154 |
+
* @since 1.0.0
|
| 155 |
+
* @return void
|
| 156 |
+
*/
|
| 157 |
+
private function _log_version_number() {
|
| 158 |
+
// Log the version number.
|
| 159 |
+
update_option( $this->token . '-version', $this->version );
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
/**
|
| 163 |
+
* Setup all the things.
|
| 164 |
+
* Only executes if Storefront or a child theme using Storefront as a parent is active and the extension specific filter returns true.
|
| 165 |
+
* Child themes can disable this extension using the storefront_extension_boilerplate_enabled filter
|
| 166 |
+
* @return void
|
| 167 |
+
*/
|
| 168 |
+
public function sps_setup() {
|
| 169 |
+
$theme = wp_get_theme();
|
| 170 |
+
|
| 171 |
+
if ( 'Storefront' == $theme->name || 'storefront' == $theme->template && apply_filters( 'storefront_extension_boilerplate_supported', true ) ) {
|
| 172 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'sps_styles' ), 999 );
|
| 173 |
+
add_action( 'woocommerce_after_single_product_summary', array( $this, 'sps_product_sharing' ), 5 );
|
| 174 |
+
|
| 175 |
+
// Hide the 'More' section in the customizer
|
| 176 |
+
add_filter( 'storefront_customizer_more', '__return_false' );
|
| 177 |
+
} else {
|
| 178 |
+
add_action( 'admin_notices', array( $this, 'sps_install_storefront_notice' ) );
|
| 179 |
+
}
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
/**
|
| 183 |
+
* Storefront install
|
| 184 |
+
* If the user activates the plugin while having a different parent theme active, prompt them to install Storefront.
|
| 185 |
+
* @since 1.0.0
|
| 186 |
+
* @return void
|
| 187 |
+
*/
|
| 188 |
+
public function sps_install_storefront_notice() {
|
| 189 |
+
echo '<div class="updated">
|
| 190 |
+
<p>' . __( 'Storefront Product Sharing requires that you use Storefront as your parent theme.', 'storefront-product-sharing' ) . ' <a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=install-theme&theme=storefront' ), 'install-theme_boutique' ) ) .'">' . __( 'Install Storefront now', 'storefront-product-sharing' ) . '</a></p>
|
| 191 |
+
</div>';
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
/**
|
| 195 |
+
* Enqueue CSS.
|
| 196 |
+
* @since 1.0.0
|
| 197 |
+
* @return void
|
| 198 |
+
*/
|
| 199 |
+
public function sps_styles() {
|
| 200 |
+
wp_enqueue_style( 'sps-styles', plugins_url( '/assets/css/style.css', __FILE__ ) );
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
/**
|
| 204 |
+
* Product sharing links
|
| 205 |
+
*/
|
| 206 |
+
public function sps_product_sharing() {
|
| 207 |
+
$product_title = get_the_title();
|
| 208 |
+
$product_url = get_permalink();
|
| 209 |
+
$product_img = wp_get_attachment_url( get_post_thumbnail_id() );
|
| 210 |
+
|
| 211 |
+
$facebook_url = 'https://www.facebook.com/sharer/sharer.php?u=' . $product_url;
|
| 212 |
+
$twitter_url = 'http://twitter.com/intent/tweet?status=' . $product_title . '+' . $product_url;
|
| 213 |
+
$pinterest_url = 'http://pinterest.com/pin/create/bookmarklet/?media=' . $product_img . '&url=' . $product_url . '&is_video=false&description=' . $product_title;
|
| 214 |
+
$email_url = 'mailto:?subject=' . $product_title . '&body=' . $product_url;
|
| 215 |
+
?>
|
| 216 |
+
<div class="storefront-product-sharing">
|
| 217 |
+
<ul>
|
| 218 |
+
<li class="twitter"><a href="<?php echo esc_url( $twitter_url ); ?>"><?php _e( 'Share on Twitter', 'storefront-product-sharing' ); ?></a></li>
|
| 219 |
+
<li class="facebook"><a href="<?php echo esc_url( $facebook_url ); ?>"><?php _e( 'Share on Facebook', 'storefront-product-sharing' ); ?></a></li>
|
| 220 |
+
<li class="pinterest"><a href="<?php echo esc_url( $pinterest_url ); ?>"><?php _e( 'Pin this product', 'storefront-product-sharing' ); ?></a></li>
|
| 221 |
+
<li class="email"><a href="<?php echo esc_url( $email_url ); ?>"><?php _e( 'Share via Email', 'storefront-product-sharing' ); ?></a></li>
|
| 222 |
+
</ul>
|
| 223 |
+
</div>
|
| 224 |
+
<?php
|
| 225 |
+
}
|
| 226 |
+
} // End Class
|
