Version Description
- Fixed: styling issues following removal of tweet count
Download this release
Release Info
| Developer | nathanrice |
| Plugin | |
| Version | 1.0.5 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.3 to 1.0.5
- Gruntfile.js +97 -0
- assets/banner-772x250.jpg +0 -0
- assets/icon-256x256.png +0 -0
- languages/genesis-simple-share.pot +161 -0
- lib/admin-icon-preview.php +3 -3
- lib/admin.php +3 -3
- lib/css/admin.css +1 -0
- lib/css/share.css +47 -4
- lib/front-end.php +250 -250
- lib/functions.php +3 -3
- lib/languages/genesis-simple-share.pot +161 -0
- lib/sharrre/error_log +0 -5
- lib/sharrre/jquery.sharrre.js +53 -43
- lib/sharrre/jquery.sharrre.min.js +42 -7
- package.json +37 -0
- plugin.php +18 -15
- readme.txt +10 -3
Gruntfile.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
module.exports = function(grunt) {
|
| 4 |
+
|
| 5 |
+
// Load tasks
|
| 6 |
+
require('load-grunt-tasks')(grunt);
|
| 7 |
+
|
| 8 |
+
grunt.initConfig({
|
| 9 |
+
pkg: grunt.file.readJSON('package.json'),
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
// Dependencies
|
| 13 |
+
|
| 14 |
+
// PHP
|
| 15 |
+
|
| 16 |
+
// Lint .php files for syntax errors
|
| 17 |
+
phplint: {
|
| 18 |
+
all: [ '*.php', 'lib/**/*.php' ]
|
| 19 |
+
},
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
// I18n
|
| 23 |
+
|
| 24 |
+
// Add text domain as last argument of i18n functions
|
| 25 |
+
addtextdomain: {
|
| 26 |
+
php: {
|
| 27 |
+
options: {
|
| 28 |
+
updateDomains: true
|
| 29 |
+
},
|
| 30 |
+
src: [
|
| 31 |
+
'*.php',
|
| 32 |
+
'lib/**/*.php'
|
| 33 |
+
]
|
| 34 |
+
}
|
| 35 |
+
},
|
| 36 |
+
|
| 37 |
+
// Check text domain is last argument of i18n functions
|
| 38 |
+
checktextdomain: {
|
| 39 |
+
options: {
|
| 40 |
+
text_domain: '<%= pkg.name %>',
|
| 41 |
+
keywords: [
|
| 42 |
+
'__:1,2d',
|
| 43 |
+
'_e:1,2d',
|
| 44 |
+
'_x:1,2c,3d',
|
| 45 |
+
'_ex:1,2c,3d',
|
| 46 |
+
'_n:1,2,4d',
|
| 47 |
+
'_nx:1,2,4c,5d',
|
| 48 |
+
'_n_noop:1,2,3d',
|
| 49 |
+
'_nx_noop:1,2,3c,4d',
|
| 50 |
+
'esc_attr__:1,2d',
|
| 51 |
+
'esc_html__:1,2d',
|
| 52 |
+
'esc_attr_e:1,2d',
|
| 53 |
+
'esc_html_e:1,2d',
|
| 54 |
+
'esc_attr_x:1,2c,3d',
|
| 55 |
+
'esc_html_x:1,2c,3d'
|
| 56 |
+
]
|
| 57 |
+
},
|
| 58 |
+
files: {
|
| 59 |
+
expand: true,
|
| 60 |
+
src: [
|
| 61 |
+
'*.php',
|
| 62 |
+
'lib/**/*.php'
|
| 63 |
+
]
|
| 64 |
+
}
|
| 65 |
+
},
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
// Build language .pot file
|
| 69 |
+
makepot: {
|
| 70 |
+
plugin: {
|
| 71 |
+
options: {
|
| 72 |
+
domainPath: '/languages',
|
| 73 |
+
processPot: function( pot ) {
|
| 74 |
+
pot.headers['report-msgid-bugs-to'] = 'StudioPress <translations@studiopress.com>';
|
| 75 |
+
pot.headers['last-translator'] = 'StudioPress <translations@studiopress.com>';
|
| 76 |
+
pot.headers['language-team'] = 'English <translations@studiopress.com>';
|
| 77 |
+
pot.headers['plural-forms'] = 'nplurals=2; plural=n != 1;';
|
| 78 |
+
pot.headers['x-generator'] = 'grunt-wp-i18n 0.4.4';
|
| 79 |
+
pot.headers['x-poedit-basepath'] = '.';
|
| 80 |
+
pot.headers['x-poedit-language'] = 'English';
|
| 81 |
+
pot.headers['x-poedit-country'] = 'UNITED STATES';
|
| 82 |
+
pot.headers['x-poedit-sourcecharset'] = 'utf-8';
|
| 83 |
+
pot.headers['x-poedit-keywordslist'] = '__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;';
|
| 84 |
+
pot.headers['x-poedit-bookmarks'] = '';
|
| 85 |
+
pot.headers['x-poedit-searchpath-0'] = '.';
|
| 86 |
+
pot.headers['x-textdomain-support'] = 'yes';
|
| 87 |
+
return pot;
|
| 88 |
+
},
|
| 89 |
+
type: 'wp-plugin'
|
| 90 |
+
}
|
| 91 |
+
}
|
| 92 |
+
},
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
});
|
| 96 |
+
|
| 97 |
+
};
|
assets/banner-772x250.jpg
ADDED
|
Binary file
|
assets/icon-256x256.png
ADDED
|
Binary file
|
languages/genesis-simple-share.pot
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (C) 2015 copyblogger
|
| 2 |
+
# This file is distributed under the same license as the Genesis Simple Share package.
|
| 3 |
+
msgid ""
|
| 4 |
+
msgstr ""
|
| 5 |
+
"Project-Id-Version: Genesis Simple Share 1.0.5\n"
|
| 6 |
+
"Report-Msgid-Bugs-To: StudioPress <translations@studiopress.com>\n"
|
| 7 |
+
"POT-Creation-Date: 2015-10-09 19:42:50+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: StudioPress <translations@studiopress.com>\n"
|
| 13 |
+
"Language-Team: English <translations@studiopress.com>\n"
|
| 14 |
+
"X-Generator: grunt-wp-i18n 0.4.4\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-KeywordsList: "
|
| 21 |
+
"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
|
| 22 |
+
"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
|
| 23 |
+
"X-Poedit-Bookmarks: \n"
|
| 24 |
+
"X-Poedit-SearchPath-0: .\n"
|
| 25 |
+
"X-Textdomain-Support: yes\n"
|
| 26 |
+
|
| 27 |
+
#: lib/admin-icon-preview.php:14 lib/admin.php:14 lib/functions.php:16
|
| 28 |
+
#: plugin.php:19
|
| 29 |
+
msgid "Sorry, you are not allowed to access this page directly."
|
| 30 |
+
msgstr ""
|
| 31 |
+
|
| 32 |
+
#: lib/admin.php:40
|
| 33 |
+
msgid "You can change button position by reordering these boxes:"
|
| 34 |
+
msgstr ""
|
| 35 |
+
|
| 36 |
+
#: lib/admin.php:64
|
| 37 |
+
msgid "Genesis Simple Share Settings"
|
| 38 |
+
msgstr ""
|
| 39 |
+
|
| 40 |
+
#: lib/admin.php:65
|
| 41 |
+
msgid "Simple Share"
|
| 42 |
+
msgstr ""
|
| 43 |
+
|
| 44 |
+
#: lib/admin.php:232
|
| 45 |
+
msgid "Google+"
|
| 46 |
+
msgstr ""
|
| 47 |
+
|
| 48 |
+
#: lib/admin.php:233
|
| 49 |
+
msgid "Facebook"
|
| 50 |
+
msgstr ""
|
| 51 |
+
|
| 52 |
+
#: lib/admin.php:234
|
| 53 |
+
msgid "Twitter"
|
| 54 |
+
msgstr ""
|
| 55 |
+
|
| 56 |
+
#: lib/admin.php:235
|
| 57 |
+
msgid "Pinterest"
|
| 58 |
+
msgstr ""
|
| 59 |
+
|
| 60 |
+
#: lib/admin.php:236
|
| 61 |
+
msgid "Linkedin"
|
| 62 |
+
msgstr ""
|
| 63 |
+
|
| 64 |
+
#: lib/admin.php:237
|
| 65 |
+
msgid "StumbleUpon"
|
| 66 |
+
msgstr ""
|
| 67 |
+
|
| 68 |
+
#: lib/admin.php:264
|
| 69 |
+
msgid "Icon Size"
|
| 70 |
+
msgstr ""
|
| 71 |
+
|
| 72 |
+
#: lib/admin.php:265
|
| 73 |
+
msgid "Small Bar"
|
| 74 |
+
msgstr ""
|
| 75 |
+
|
| 76 |
+
#: lib/admin.php:266
|
| 77 |
+
msgid "Medium Bar"
|
| 78 |
+
msgstr ""
|
| 79 |
+
|
| 80 |
+
#: lib/admin.php:267
|
| 81 |
+
msgid "Box"
|
| 82 |
+
msgstr ""
|
| 83 |
+
|
| 84 |
+
#: lib/admin.php:270
|
| 85 |
+
msgid "Icon Appearance"
|
| 86 |
+
msgstr ""
|
| 87 |
+
|
| 88 |
+
#: lib/admin.php:271
|
| 89 |
+
msgid "Outlined"
|
| 90 |
+
msgstr ""
|
| 91 |
+
|
| 92 |
+
#: lib/admin.php:272
|
| 93 |
+
msgid "Filled"
|
| 94 |
+
msgstr ""
|
| 95 |
+
|
| 96 |
+
#: lib/admin.php:319 lib/admin.php:336 lib/admin.php:353 lib/admin.php:374
|
| 97 |
+
#: lib/admin.php:389 lib/admin.php:409
|
| 98 |
+
msgid "Use this button?"
|
| 99 |
+
msgstr ""
|
| 100 |
+
|
| 101 |
+
#: lib/admin.php:356
|
| 102 |
+
msgid "Enter Twitter ID for @via to be added to default tweet text:"
|
| 103 |
+
msgstr ""
|
| 104 |
+
|
| 105 |
+
#: lib/admin.php:392
|
| 106 |
+
msgid ""
|
| 107 |
+
"Enter Default Image URL if there is no image available in content being "
|
| 108 |
+
"shared:"
|
| 109 |
+
msgstr ""
|
| 110 |
+
|
| 111 |
+
#: lib/admin.php:423
|
| 112 |
+
msgid "Icon Display Position"
|
| 113 |
+
msgstr ""
|
| 114 |
+
|
| 115 |
+
#: lib/admin.php:424
|
| 116 |
+
msgid "Select display position to enable icons."
|
| 117 |
+
msgstr ""
|
| 118 |
+
|
| 119 |
+
#: lib/admin.php:425
|
| 120 |
+
msgid "Before the Content"
|
| 121 |
+
msgstr ""
|
| 122 |
+
|
| 123 |
+
#: lib/admin.php:426
|
| 124 |
+
msgid "After the Content"
|
| 125 |
+
msgstr ""
|
| 126 |
+
|
| 127 |
+
#: lib/admin.php:427
|
| 128 |
+
msgid "Before and After the Content"
|
| 129 |
+
msgstr ""
|
| 130 |
+
|
| 131 |
+
#: lib/admin.php:477
|
| 132 |
+
msgid "Enable on:"
|
| 133 |
+
msgstr ""
|
| 134 |
+
|
| 135 |
+
#: lib/admin.php:484
|
| 136 |
+
msgid "Show on Archive Pages"
|
| 137 |
+
msgstr ""
|
| 138 |
+
|
| 139 |
+
#: lib/post-meta.php:18
|
| 140 |
+
msgid "Share Settings"
|
| 141 |
+
msgstr ""
|
| 142 |
+
|
| 143 |
+
#: lib/post-meta.php:37
|
| 144 |
+
msgid "Disable Share Buttons"
|
| 145 |
+
msgstr ""
|
| 146 |
+
|
| 147 |
+
#. Plugin Name of the plugin/theme
|
| 148 |
+
msgid "Genesis Simple Share"
|
| 149 |
+
msgstr ""
|
| 150 |
+
|
| 151 |
+
#. Description of the plugin/theme
|
| 152 |
+
msgid "A simple sharing plugin using the Share script."
|
| 153 |
+
msgstr ""
|
| 154 |
+
|
| 155 |
+
#. Author of the plugin/theme
|
| 156 |
+
msgid "copyblogger"
|
| 157 |
+
msgstr ""
|
| 158 |
+
|
| 159 |
+
#. Author URI of the plugin/theme
|
| 160 |
+
msgid "http://www.copyblogger.com"
|
| 161 |
+
msgstr ""
|
lib/admin-icon-preview.php
CHANGED
|
@@ -9,9 +9,9 @@
|
|
| 9 |
* @license http://www.opensource.org/licenses/gpl-license.php GPL-2.0+
|
| 10 |
*/
|
| 11 |
|
| 12 |
-
|
| 13 |
-
if ( !defined( 'ABSPATH' ) ) {
|
| 14 |
-
die(
|
| 15 |
}
|
| 16 |
|
| 17 |
/**
|
| 9 |
* @license http://www.opensource.org/licenses/gpl-license.php GPL-2.0+
|
| 10 |
*/
|
| 11 |
|
| 12 |
+
//* Prevent direct access to the plugin
|
| 13 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
| 14 |
+
die( __( 'Sorry, you are not allowed to access this page directly.', 'genesis-simple-share' ) );
|
| 15 |
}
|
| 16 |
|
| 17 |
/**
|
lib/admin.php
CHANGED
|
@@ -9,9 +9,9 @@
|
|
| 9 |
* @license http://www.opensource.org/licenses/gpl-license.php GPL-2.0+
|
| 10 |
*/
|
| 11 |
|
| 12 |
-
|
| 13 |
-
if ( !defined( 'ABSPATH' ) ) {
|
| 14 |
-
die(
|
| 15 |
}
|
| 16 |
|
| 17 |
|
| 9 |
* @license http://www.opensource.org/licenses/gpl-license.php GPL-2.0+
|
| 10 |
*/
|
| 11 |
|
| 12 |
+
//* Prevent direct access to the plugin
|
| 13 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
| 14 |
+
die( __( 'Sorry, you are not allowed to access this page directly.', 'genesis-simple-share' ) );
|
| 15 |
}
|
| 16 |
|
| 17 |
|
lib/css/admin.css
CHANGED
|
@@ -41,6 +41,7 @@
|
|
| 41 |
|
| 42 |
.genesis_page_genesis_simple_share_settings .meta-box-sortables .postbox h3.hndle {
|
| 43 |
color: #fff;
|
|
|
|
| 44 |
text-shadow: none;
|
| 45 |
}
|
| 46 |
|
| 41 |
|
| 42 |
.genesis_page_genesis_simple_share_settings .meta-box-sortables .postbox h3.hndle {
|
| 43 |
color: #fff;
|
| 44 |
+
display: block !important;
|
| 45 |
text-shadow: none;
|
| 46 |
}
|
| 47 |
|
lib/css/share.css
CHANGED
|
@@ -19,7 +19,17 @@
|
|
| 19 |
}
|
| 20 |
|
| 21 |
.share-after {
|
| 22 |
-
margin
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
}
|
| 24 |
|
| 25 |
/* Buttons */
|
|
@@ -41,6 +51,7 @@
|
|
| 41 |
}
|
| 42 |
|
| 43 |
.sharrre .share {
|
|
|
|
| 44 |
color: #fff;
|
| 45 |
float: left;
|
| 46 |
font-family: Helvetica, Arial, sans-serif;
|
|
@@ -84,6 +95,7 @@
|
|
| 84 |
.share-small .facebook:hover .share { width: 60px; }
|
| 85 |
.share-small .pinterest:hover .share { width: 45px; }
|
| 86 |
.share-small .googlePlus:hover .share { width: 60px; }
|
|
|
|
| 87 |
|
| 88 |
.share-small .count {
|
| 89 |
border-top-right-radius: 3px;
|
|
@@ -98,6 +110,10 @@
|
|
| 98 |
width: 65px;
|
| 99 |
}
|
| 100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
/* Medium */
|
| 102 |
.share-medium .share,
|
| 103 |
.share-medium .count {
|
|
@@ -124,6 +140,7 @@
|
|
| 124 |
.share-medium .facebook:hover .share { width: 65px; }
|
| 125 |
.share-medium .pinterest:hover .share { width: 50px; }
|
| 126 |
.share-medium .googlePlus:hover .share { width: 65px; }
|
|
|
|
| 127 |
|
| 128 |
.share-medium .no-count .share {
|
| 129 |
border-top-right-radius: 3px;
|
|
@@ -131,6 +148,10 @@
|
|
| 131 |
width: 75px;
|
| 132 |
}
|
| 133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
/* Tall */
|
| 135 |
.share-tall .share {
|
| 136 |
border-bottom-left-radius: 3px;
|
|
@@ -145,6 +166,7 @@
|
|
| 145 |
|
| 146 |
.share-tall .googlePlus .share { padding-left: 16px; }
|
| 147 |
.share-tall .facebook .share { padding-left: 18px; }
|
|
|
|
| 148 |
|
| 149 |
.share-tall .count {
|
| 150 |
border-top-left-radius: 3px;
|
|
@@ -158,9 +180,6 @@
|
|
| 158 |
}
|
| 159 |
|
| 160 |
.share-tall .no-count .share {
|
| 161 |
-
border-top-left-radius: 3px;
|
| 162 |
-
border-top-right-radius: 3px;
|
| 163 |
-
border-bottom-right-radius: 3px;
|
| 164 |
width: 75px;
|
| 165 |
}
|
| 166 |
|
|
@@ -245,6 +264,27 @@
|
|
| 245 |
font-size: 16px;
|
| 246 |
}
|
| 247 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
|
| 249 |
/* Appearance - filled */
|
| 250 |
.share-filled .twitter .share { background: #09b0ed; }
|
|
@@ -319,6 +359,9 @@
|
|
| 319 |
.share-outlined.share-small .share,
|
| 320 |
.share-outlined.share-medium .share { border-right: none !important; }
|
| 321 |
|
|
|
|
|
|
|
|
|
|
| 322 |
.share-outlined.share-tall .share { border-top: none !important; }
|
| 323 |
|
| 324 |
.share-outlined .twitter:hover .share,
|
| 19 |
}
|
| 20 |
|
| 21 |
.share-after {
|
| 22 |
+
margin: 25px 0;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
.share-before:after,
|
| 26 |
+
.share-after:after {
|
| 27 |
+
visibility: hidden;
|
| 28 |
+
display: block;
|
| 29 |
+
font-size: 0;
|
| 30 |
+
content: " ";
|
| 31 |
+
clear: both;
|
| 32 |
+
height: 0;
|
| 33 |
}
|
| 34 |
|
| 35 |
/* Buttons */
|
| 51 |
}
|
| 52 |
|
| 53 |
.sharrre .share {
|
| 54 |
+
background-color: #fff;
|
| 55 |
color: #fff;
|
| 56 |
float: left;
|
| 57 |
font-family: Helvetica, Arial, sans-serif;
|
| 95 |
.share-small .facebook:hover .share { width: 60px; }
|
| 96 |
.share-small .pinterest:hover .share { width: 45px; }
|
| 97 |
.share-small .googlePlus:hover .share { width: 60px; }
|
| 98 |
+
.share-small .twitter:hover .share { width: 65px; }
|
| 99 |
|
| 100 |
.share-small .count {
|
| 101 |
border-top-right-radius: 3px;
|
| 110 |
width: 65px;
|
| 111 |
}
|
| 112 |
|
| 113 |
+
.share-small .no-count .count {
|
| 114 |
+
display: none;
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
/* Medium */
|
| 118 |
.share-medium .share,
|
| 119 |
.share-medium .count {
|
| 140 |
.share-medium .facebook:hover .share { width: 65px; }
|
| 141 |
.share-medium .pinterest:hover .share { width: 50px; }
|
| 142 |
.share-medium .googlePlus:hover .share { width: 65px; }
|
| 143 |
+
.share-medium .twitter:hover .share { width: 75px; }
|
| 144 |
|
| 145 |
.share-medium .no-count .share {
|
| 146 |
border-top-right-radius: 3px;
|
| 148 |
width: 75px;
|
| 149 |
}
|
| 150 |
|
| 151 |
+
.share-medium .no-count .count {
|
| 152 |
+
display: none;
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
/* Tall */
|
| 156 |
.share-tall .share {
|
| 157 |
border-bottom-left-radius: 3px;
|
| 166 |
|
| 167 |
.share-tall .googlePlus .share { padding-left: 16px; }
|
| 168 |
.share-tall .facebook .share { padding-left: 18px; }
|
| 169 |
+
.share-tall .twitter .share { padding-left: 0; }
|
| 170 |
|
| 171 |
.share-tall .count {
|
| 172 |
border-top-left-radius: 3px;
|
| 180 |
}
|
| 181 |
|
| 182 |
.share-tall .no-count .share {
|
|
|
|
|
|
|
|
|
|
| 183 |
width: 75px;
|
| 184 |
}
|
| 185 |
|
| 264 |
font-size: 16px;
|
| 265 |
}
|
| 266 |
|
| 267 |
+
.share-tall .twitter .share:before { display: none; }
|
| 268 |
+
|
| 269 |
+
.share-tall .twitter .count:before {
|
| 270 |
+
content: '\f202';
|
| 271 |
+
display: block;
|
| 272 |
+
line-height: 1;
|
| 273 |
+
font-family: 'Genericons';
|
| 274 |
+
font-size: 20px;
|
| 275 |
+
padding-top: 17px;
|
| 276 |
+
-webkit-font-smoothing: antialiased;
|
| 277 |
+
-webkit-transition: all 0.3s ease-in-out;
|
| 278 |
+
-moz-transition: all 0.3s ease-in-out;
|
| 279 |
+
-ms-transition: all 0.3s ease-in-out;
|
| 280 |
+
-o-transition: all 0.3s ease-in-out;
|
| 281 |
+
transition: all 0.3s ease-in-out;
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
.share-tall .twitter:hover .count:before {
|
| 285 |
+
color: #fff;
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
|
| 289 |
/* Appearance - filled */
|
| 290 |
.share-filled .twitter .share { background: #09b0ed; }
|
| 359 |
.share-outlined.share-small .share,
|
| 360 |
.share-outlined.share-medium .share { border-right: none !important; }
|
| 361 |
|
| 362 |
+
.share-outlined.share-small .twitter .share,
|
| 363 |
+
.share-outlined.share-medium .twitter .share { border-right: 1px solid #09b0ed !important; }
|
| 364 |
+
|
| 365 |
.share-outlined.share-tall .share { border-top: none !important; }
|
| 366 |
|
| 367 |
.share-outlined .twitter:hover .share,
|
lib/front-end.php
CHANGED
|
@@ -8,10 +8,10 @@
|
|
| 8 |
* @author copyblogger
|
| 9 |
* @license http://www.opensource.org/licenses/gpl-license.php GPL-2.0+
|
| 10 |
*/
|
| 11 |
-
|
| 12 |
/* Prevent direct access to the plugin */
|
| 13 |
if ( !defined( 'ABSPATH' ) ) {
|
| 14 |
-
|
| 15 |
}
|
| 16 |
|
| 17 |
/**
|
|
@@ -23,13 +23,13 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
| 23 |
* @since 0.1.0
|
| 24 |
*/
|
| 25 |
class Gensis_Simple_Share_Front_End {
|
| 26 |
-
|
| 27 |
var $icons;
|
| 28 |
var $appearance;
|
| 29 |
var $size;
|
| 30 |
var $archive;
|
| 31 |
var $locations = array();
|
| 32 |
-
|
| 33 |
/**
|
| 34 |
* Create front end output.
|
| 35 |
*
|
|
@@ -37,59 +37,59 @@ class Gensis_Simple_Share_Front_End {
|
|
| 37 |
*
|
| 38 |
*/
|
| 39 |
function __construct() {
|
| 40 |
-
|
| 41 |
$icons = get_option( 'genesis_simple_share_sort', array(
|
| 42 |
-
|
| 43 |
) );
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
$icon_sort = array();
|
| 48 |
-
|
| 49 |
foreach( $icons as $icon ){
|
| 50 |
switch( $icon ){
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
}
|
| 77 |
}
|
| 78 |
-
|
| 79 |
//echo '<pre><code>'; var_dump($icon_sort); echo '</code></pre>';
|
| 80 |
-
|
| 81 |
$this->icons = $this->get_display_icons( $icon_sort );
|
| 82 |
$this->appearance = genesis_get_option( 'general_appearance', 'genesis_simple_share' );
|
| 83 |
$this->size = genesis_get_option( 'general_size' , 'genesis_simple_share' );
|
| 84 |
-
|
| 85 |
add_action( 'wp_enqueue_scripts', array( $this, 'load_scripts' ), 5 );
|
| 86 |
-
|
| 87 |
-
|
| 88 |
add_action( 'genesis_loop', array( $this, 'start_icon_actions' ), 5 );
|
| 89 |
add_action( 'genesis_loop', array( $this, 'end_icon_actions' ), 15 );
|
| 90 |
-
|
| 91 |
}
|
| 92 |
-
|
| 93 |
/**
|
| 94 |
* Loads required scripts.
|
| 95 |
*
|
|
@@ -97,50 +97,50 @@ class Gensis_Simple_Share_Front_End {
|
|
| 97 |
*
|
| 98 |
*/
|
| 99 |
function load_scripts() {
|
| 100 |
-
|
| 101 |
$url = preg_replace( '/^https?:/', '', plugins_url( '/', __FILE__ ) );
|
| 102 |
-
|
| 103 |
//use wp_enqueue_script() and wp_enqueue_style() to load scripts and styles
|
| 104 |
-
wp_register_script( 'genesis-simple-share-plugin-js',
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
wp_register_style(
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
wp_register_style(
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
wp_register_script( 'genesis-simple-share-waypoint-js',
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
if( $this->is_archive() && ! genesis_get_option( 'general_show_archive', 'genesis_simple_share' ) ) {
|
| 129 |
$this->archive = 'no-load';
|
| 130 |
return;
|
| 131 |
}
|
| 132 |
-
|
| 133 |
//use wp_enqueue_script() and wp_enqueue_style() to load scripts and styles
|
| 134 |
-
wp_enqueue_script( 'genesis-simple-share-plugin-js' );
|
| 135 |
-
wp_enqueue_style( 'genesis-simple-share-plugin-css' );
|
| 136 |
wp_enqueue_style( 'genesis-simple-share-genericons-css' );
|
| 137 |
-
|
| 138 |
if( $this->is_archive() ) {
|
| 139 |
wp_enqueue_script( 'genesis-simple-share-waypoint-js' );
|
| 140 |
}
|
| 141 |
-
|
| 142 |
}
|
| 143 |
-
|
| 144 |
/**
|
| 145 |
* Load the icon actions/filters only within the genesis_loop hook
|
| 146 |
*
|
|
@@ -148,19 +148,19 @@ class Gensis_Simple_Share_Front_End {
|
|
| 148 |
*
|
| 149 |
*/
|
| 150 |
function start_icon_actions(){
|
| 151 |
-
|
| 152 |
add_filter( 'the_content', array( $this, 'icon_output' ), 15 );
|
| 153 |
add_filter( 'the_excerpt', array( $this, 'icon_output' ), 15 );
|
| 154 |
-
|
| 155 |
if( genesis_get_option( 'content_archive_limit' ) && 'full' == genesis_get_option( 'content_archive' ) && $this->is_archive() ){
|
| 156 |
add_action( 'genesis_post_content' , array( $this, 'before_entry_icons' ), 9 );
|
| 157 |
add_action( 'genesis_entry_content', array( $this, 'before_entry_icons' ), 9 );
|
| 158 |
add_action( 'genesis_post_content' , array( $this, 'after_entry_icons' ), 11 );
|
| 159 |
add_action( 'genesis_entry_content', array( $this, 'after_entry_icons' ), 11 );
|
| 160 |
}
|
| 161 |
-
|
| 162 |
}
|
| 163 |
-
|
| 164 |
/**
|
| 165 |
* Remove the icon actions/filters after the loop has run
|
| 166 |
*
|
|
@@ -168,17 +168,17 @@ class Gensis_Simple_Share_Front_End {
|
|
| 168 |
*
|
| 169 |
*/
|
| 170 |
function end_icon_actions(){
|
| 171 |
-
|
| 172 |
remove_filter( 'the_content', array( $this, 'icon_output' ), 15 );
|
| 173 |
remove_filter( 'the_excerpt', array( $this, 'icon_output' ), 15 );
|
| 174 |
-
|
| 175 |
remove_action( 'genesis_post_content' , array( $this, 'before_entry_icons' ), 9 );
|
| 176 |
remove_action( 'genesis_entry_content', array( $this, 'before_entry_icons' ), 9 );
|
| 177 |
remove_action( 'genesis_post_content' , array( $this, 'after_entry_icons' ), 11 );
|
| 178 |
remove_action( 'genesis_entry_content', array( $this, 'after_entry_icons' ), 11 );
|
| 179 |
-
|
| 180 |
}
|
| 181 |
-
|
| 182 |
/**
|
| 183 |
* Conditionally outputs icon output
|
| 184 |
* Alters the_content if icons are available
|
|
@@ -191,33 +191,33 @@ class Gensis_Simple_Share_Front_End {
|
|
| 191 |
*
|
| 192 |
*/
|
| 193 |
function icon_output( $content ){
|
| 194 |
-
|
| 195 |
if( $this->archive === 'no-load' )
|
| 196 |
return $content;
|
| 197 |
-
|
| 198 |
if( ! $this->icons )
|
| 199 |
return $content; //return early if no icons available
|
| 200 |
-
|
| 201 |
switch( genesis_get_option( 'general_position', 'genesis_simple_share' ) ){
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
}
|
| 216 |
-
|
| 217 |
return $content;
|
| 218 |
-
|
| 219 |
}
|
| 220 |
-
|
| 221 |
/**
|
| 222 |
* Conditionally outputs icon output
|
| 223 |
* Alters the_content if icons are available
|
|
@@ -230,23 +230,23 @@ class Gensis_Simple_Share_Front_End {
|
|
| 230 |
*
|
| 231 |
*/
|
| 232 |
function before_entry_icons(){
|
| 233 |
-
|
| 234 |
if( $this->archive === 'no-load' )
|
| 235 |
return;
|
| 236 |
-
|
| 237 |
if( ! $this->icons )
|
| 238 |
return; //return early if no icons available
|
| 239 |
-
|
| 240 |
$position = genesis_get_option( 'general_position', 'genesis_simple_share' );
|
| 241 |
-
|
| 242 |
if( 'before_content' == $position || 'both' == $position ) {
|
| 243 |
-
|
| 244 |
echo $this->get_icon_output( 'before', $this->icons );
|
| 245 |
-
|
| 246 |
}
|
| 247 |
-
|
| 248 |
}
|
| 249 |
-
|
| 250 |
/**
|
| 251 |
* Conditionally outputs icon output
|
| 252 |
* Alters the_content if icons are available
|
|
@@ -259,23 +259,23 @@ class Gensis_Simple_Share_Front_End {
|
|
| 259 |
*
|
| 260 |
*/
|
| 261 |
function after_entry_icons(){
|
| 262 |
-
|
| 263 |
if( $this->archive === 'no-load' )
|
| 264 |
return;
|
| 265 |
-
|
| 266 |
if( ! $this->icons )
|
| 267 |
return; //return early if no icons available
|
| 268 |
-
|
| 269 |
$position = genesis_get_option( 'general_position', 'genesis_simple_share' );
|
| 270 |
-
|
| 271 |
if( 'after_content' == $position || 'both' == $position ) {
|
| 272 |
-
|
| 273 |
echo $this->get_icon_output( 'after', $this->icons );
|
| 274 |
-
|
| 275 |
}
|
| 276 |
-
|
| 277 |
}
|
| 278 |
-
|
| 279 |
/**
|
| 280 |
* Check to see if any icons are set to show for the post type and return array of icons or false
|
| 281 |
*
|
|
@@ -287,20 +287,20 @@ class Gensis_Simple_Share_Front_End {
|
|
| 287 |
*
|
| 288 |
*/
|
| 289 |
function get_display_icons( $icon_sort ){
|
| 290 |
-
|
| 291 |
$icons = array();
|
| 292 |
-
|
| 293 |
foreach( $icon_sort as $icon )
|
| 294 |
if( genesis_get_option( $icon, 'genesis_simple_share' ) )
|
| 295 |
$icons[] = $icon;
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
}
|
| 303 |
-
|
| 304 |
/**
|
| 305 |
* Build output for the icons based on position
|
| 306 |
*
|
|
@@ -312,55 +312,55 @@ class Gensis_Simple_Share_Front_End {
|
|
| 312 |
* @returns string HTML and JS required to build the share icons.
|
| 313 |
*
|
| 314 |
*/
|
| 315 |
-
function get_icon_output( $location, $icons = array() ){
|
| 316 |
-
|
| 317 |
if( is_feed() ) {
|
| 318 |
return;
|
| 319 |
}
|
| 320 |
-
|
| 321 |
$filter = 'the_excerpt' == current_filter() ? 'excerpt' : '';
|
| 322 |
-
|
| 323 |
-
if( in_array( $location . $filter . '-' . get_the_ID(), $this->locations ) ){
|
| 324 |
-
return '<!-- Genesis Simple Share error: This location has already been used. -->';
|
| 325 |
}
|
| 326 |
-
|
| 327 |
-
if( empty( $icons ) ||
|
| 328 |
-
(
|
| 329 |
-
in_array( $location, array( 'before', 'after' ) ) &&
|
| 330 |
-
(
|
| 331 |
-
! genesis_get_option( 'general_' . get_post_type(), 'genesis_simple_share' ) ||
|
| 332 |
-
get_post_meta( get_the_ID(), '_disable_gss', true )
|
| 333 |
-
)
|
| 334 |
-
)
|
| 335 |
) {
|
| 336 |
return;
|
| 337 |
}
|
| 338 |
-
|
| 339 |
$icons = empty( $icons ) ? $this->icons : $icons;
|
| 340 |
-
|
| 341 |
if( empty( $icons ) )
|
| 342 |
return;
|
| 343 |
-
|
| 344 |
$id = get_the_ID();
|
| 345 |
-
|
| 346 |
$scripts = '';
|
| 347 |
$buttons = array();
|
| 348 |
-
|
| 349 |
foreach( $icons as $icon ){
|
| 350 |
-
|
| 351 |
$shares[] = $icon .': true';
|
| 352 |
-
|
| 353 |
$div_id = strtolower( $icon .'-'. $location .'-'. $id );
|
| 354 |
-
|
| 355 |
$image = ( $image = genesis_get_image( array( 'format' => 'url', 'size' => 'full' ) ) ) ? $image : $this->get_first_image();
|
| 356 |
-
|
| 357 |
$image = $image ? $image : genesis_get_option( 'image_url', 'genesis_simple_share' );
|
| 358 |
$description = the_title_attribute( array( 'echo' => false ) );
|
| 359 |
-
|
| 360 |
//media
|
| 361 |
$button = 'twitter' == $icon && ( $via = genesis_get_option( 'twitter_id', 'genesis_simple_share' ) ) ? " twitter: { via: '". str_replace( '@', '', $via ) ."' }" : '';
|
| 362 |
$button = 'pinterest' == $icon && $image ? " pinterest: { media: '$image', description: '$description' }" : $button;
|
| 363 |
-
|
| 364 |
if( $this->is_archive() )
|
| 365 |
$scripts .= sprintf( "$('#%s').waypoint( function() {
|
| 366 |
$('#%s').sharrre({
|
|
@@ -378,13 +378,13 @@ class Gensis_Simple_Share_Front_End {
|
|
| 378 |
});
|
| 379 |
},
|
| 380 |
{ offset: 'bottom-in-view' });\n",
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
|
| 389 |
else
|
| 390 |
$scripts .= sprintf( "$('#%s').sharrre({
|
|
@@ -400,31 +400,31 @@ class Gensis_Simple_Share_Front_End {
|
|
| 400 |
api.openPopup('%s');
|
| 401 |
}
|
| 402 |
});\n",
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
switch( $icon ){
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
}
|
| 427 |
-
|
| 428 |
$buttons[] = sprintf( '<div class="%s" id="%s" data-url="%s" data-urlalt="%s" data-text="%s" data-title="%s"></div>',
|
| 429 |
$icon,
|
| 430 |
$div_id,
|
|
@@ -433,33 +433,33 @@ class Gensis_Simple_Share_Front_End {
|
|
| 433 |
$description,
|
| 434 |
$data_title
|
| 435 |
);
|
| 436 |
-
|
| 437 |
}
|
| 438 |
-
|
| 439 |
$divs = implode( '', $buttons );
|
| 440 |
-
|
| 441 |
$div_id = 'share-'. $location . '-' . $id;
|
| 442 |
-
|
| 443 |
$div = sprintf( '<div class="share-%s share-%s share-%s" id="%s">%s</div>',
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
|
| 450 |
-
|
| 451 |
$script = "
|
| 452 |
<script type='text/javascript'>
|
| 453 |
jQuery(document).ready(function($) {
|
| 454 |
$scripts
|
| 455 |
});
|
| 456 |
</script>";
|
| 457 |
-
|
| 458 |
$this->locations[] = $location . $filter . '-' . get_the_ID();
|
| 459 |
-
|
| 460 |
return $div . $script;
|
| 461 |
-
|
| 462 |
-
}
|
| 463 |
/**
|
| 464 |
* Build output for the icons based on position
|
| 465 |
*
|
|
@@ -473,31 +473,31 @@ class Gensis_Simple_Share_Front_End {
|
|
| 473 |
*/
|
| 474 |
function get_hide_icon_output( $location, $icons = array() ){
|
| 475 |
$id = get_the_ID();
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
|
| 495 |
-
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
<script type='text/javascript'>
|
| 502 |
jQuery(document).ready(function($) {
|
| 503 |
$('#$div_id').share({
|
|
@@ -519,11 +519,11 @@ class Gensis_Simple_Share_Front_End {
|
|
| 519 |
});
|
| 520 |
});
|
| 521 |
</script>";
|
| 522 |
-
|
| 523 |
-
|
| 524 |
-
|
| 525 |
}
|
| 526 |
-
|
| 527 |
/**
|
| 528 |
* Checks to see if any archive including home, search, and the blog template is being used
|
| 529 |
*
|
|
@@ -533,13 +533,13 @@ class Gensis_Simple_Share_Front_End {
|
|
| 533 |
*
|
| 534 |
*/
|
| 535 |
function is_archive() {
|
| 536 |
-
|
| 537 |
if( is_home() || is_archive() || is_search() || is_page_template('page_blog.php') )
|
| 538 |
return true;
|
| 539 |
-
|
| 540 |
return false;
|
| 541 |
}
|
| 542 |
-
|
| 543 |
/**
|
| 544 |
* Checks content for <img> tags and returns the src value of the first image tag
|
| 545 |
*
|
|
@@ -548,20 +548,20 @@ class Gensis_Simple_Share_Front_End {
|
|
| 548 |
* @returns mixed
|
| 549 |
*
|
| 550 |
*/
|
| 551 |
-
function get_first_image( ) {
|
| 552 |
-
|
| 553 |
$content = get_the_content();
|
| 554 |
-
|
| 555 |
-
$output = preg_match_all('/<img[^>]+src=[\'"]([^\'"]+)[\'"][^>]*>/i', $content, $matches);
|
| 556 |
-
|
| 557 |
if( $output )
|
| 558 |
-
return $matches[1][0];
|
| 559 |
-
|
| 560 |
return false;
|
| 561 |
-
|
| 562 |
-
}
|
| 563 |
|
| 564 |
-
|
|
|
|
|
|
|
| 565 |
}
|
| 566 |
|
| 567 |
/**
|
|
@@ -571,15 +571,15 @@ class Gensis_Simple_Share_Front_End {
|
|
| 571 |
*/
|
| 572 |
function genesis_simple_share() {
|
| 573 |
global $Genesis_Simple_Share;
|
| 574 |
-
|
| 575 |
$Genesis_Simple_Share = new Gensis_Simple_Share_Front_End;
|
| 576 |
-
|
| 577 |
}
|
| 578 |
|
| 579 |
genesis_simple_share();
|
| 580 |
|
| 581 |
/**
|
| 582 |
-
* Gets the Share Icon output.
|
| 583 |
* Can specify the icons to use in the optional second param
|
| 584 |
*
|
| 585 |
* @since 0.1.0
|
|
@@ -590,11 +590,11 @@ genesis_simple_share();
|
|
| 590 |
* @returns string HTML and JS required to build the share icons.
|
| 591 |
*
|
| 592 |
*/
|
| 593 |
-
function genesis_share_get_icon_output( $position, $icons = array() ) {
|
| 594 |
global $Genesis_Simple_Share;
|
| 595 |
-
|
| 596 |
-
return $Genesis_Simple_Share->get_icon_output( $position, $icons );
|
| 597 |
-
|
| 598 |
}
|
| 599 |
|
| 600 |
/**
|
|
@@ -609,8 +609,8 @@ function genesis_share_get_icon_output( $position, $icons = array() ) {
|
|
| 609 |
* @returns string HTML and JS required to build the share icons.
|
| 610 |
*
|
| 611 |
*/
|
| 612 |
-
function genesis_share_icon_output( $position, $icons = array() ) {
|
| 613 |
-
|
| 614 |
-
echo genesis_share_get_icon_output( $position, $icons );
|
| 615 |
-
|
| 616 |
}
|
| 8 |
* @author copyblogger
|
| 9 |
* @license http://www.opensource.org/licenses/gpl-license.php GPL-2.0+
|
| 10 |
*/
|
| 11 |
+
|
| 12 |
/* Prevent direct access to the plugin */
|
| 13 |
if ( !defined( 'ABSPATH' ) ) {
|
| 14 |
+
die( "Sorry, you are not allowed to access this page directly." );
|
| 15 |
}
|
| 16 |
|
| 17 |
/**
|
| 23 |
* @since 0.1.0
|
| 24 |
*/
|
| 25 |
class Gensis_Simple_Share_Front_End {
|
| 26 |
+
|
| 27 |
var $icons;
|
| 28 |
var $appearance;
|
| 29 |
var $size;
|
| 30 |
var $archive;
|
| 31 |
var $locations = array();
|
| 32 |
+
|
| 33 |
/**
|
| 34 |
* Create front end output.
|
| 35 |
*
|
| 37 |
*
|
| 38 |
*/
|
| 39 |
function __construct() {
|
| 40 |
+
|
| 41 |
$icons = get_option( 'genesis_simple_share_sort', array(
|
| 42 |
+
'main' => 'genesis_simple_share_google_plus,genesis_simple_share_facebook,genesis_simple_share_twitter,genesis_simple_share_pinterest,genesis_simple_share_linkedin,genesis_simple_share_stumbleupon'
|
| 43 |
) );
|
| 44 |
+
|
| 45 |
+
$icons = explode( ',', $icons['main'] );
|
| 46 |
+
|
| 47 |
$icon_sort = array();
|
| 48 |
+
|
| 49 |
foreach( $icons as $icon ){
|
| 50 |
switch( $icon ){
|
| 51 |
+
|
| 52 |
+
case 'genesis_simple_share_google_plus':
|
| 53 |
+
$icon_sort[] = 'googlePlus';
|
| 54 |
+
break;
|
| 55 |
+
|
| 56 |
+
case 'genesis_simple_share_facebook':
|
| 57 |
+
$icon_sort[] = 'facebook';
|
| 58 |
+
break;
|
| 59 |
+
|
| 60 |
+
case 'genesis_simple_share_twitter':
|
| 61 |
+
$icon_sort[] = 'twitter';
|
| 62 |
+
break;
|
| 63 |
+
|
| 64 |
+
case 'genesis_simple_share_pinterest':
|
| 65 |
+
$icon_sort[] = 'pinterest';
|
| 66 |
+
break;
|
| 67 |
+
|
| 68 |
+
case 'genesis_simple_share_linkedin':
|
| 69 |
+
$icon_sort[] = 'linkedin';
|
| 70 |
+
break;
|
| 71 |
+
|
| 72 |
+
case 'genesis_simple_share_stumbleupon':
|
| 73 |
+
$icon_sort[] = 'stumbleupon';
|
| 74 |
+
break;
|
| 75 |
+
|
| 76 |
}
|
| 77 |
}
|
| 78 |
+
|
| 79 |
//echo '<pre><code>'; var_dump($icon_sort); echo '</code></pre>';
|
| 80 |
+
|
| 81 |
$this->icons = $this->get_display_icons( $icon_sort );
|
| 82 |
$this->appearance = genesis_get_option( 'general_appearance', 'genesis_simple_share' );
|
| 83 |
$this->size = genesis_get_option( 'general_size' , 'genesis_simple_share' );
|
| 84 |
+
|
| 85 |
add_action( 'wp_enqueue_scripts', array( $this, 'load_scripts' ), 5 );
|
| 86 |
+
|
| 87 |
+
|
| 88 |
add_action( 'genesis_loop', array( $this, 'start_icon_actions' ), 5 );
|
| 89 |
add_action( 'genesis_loop', array( $this, 'end_icon_actions' ), 15 );
|
| 90 |
+
|
| 91 |
}
|
| 92 |
+
|
| 93 |
/**
|
| 94 |
* Loads required scripts.
|
| 95 |
*
|
| 97 |
*
|
| 98 |
*/
|
| 99 |
function load_scripts() {
|
| 100 |
+
|
| 101 |
$url = preg_replace( '/^https?:/', '', plugins_url( '/', __FILE__ ) );
|
| 102 |
+
|
| 103 |
//use wp_enqueue_script() and wp_enqueue_style() to load scripts and styles
|
| 104 |
+
wp_register_script( 'genesis-simple-share-plugin-js',
|
| 105 |
+
$url . 'sharrre/jquery.sharrre.min.js',
|
| 106 |
+
array( 'jquery' ),
|
| 107 |
+
'0.1.0'
|
| 108 |
+
);
|
| 109 |
+
|
| 110 |
+
wp_register_style( 'genesis-simple-share-plugin-css',
|
| 111 |
+
$url . 'css/share.css',
|
| 112 |
+
array(),
|
| 113 |
+
'0.1.0'
|
| 114 |
+
);
|
| 115 |
+
|
| 116 |
+
wp_register_style( 'genesis-simple-share-genericons-css',
|
| 117 |
+
$url . 'css/genericons.css',
|
| 118 |
+
array(),
|
| 119 |
+
'0.1.0'
|
| 120 |
+
);
|
| 121 |
+
|
| 122 |
+
wp_register_script( 'genesis-simple-share-waypoint-js',
|
| 123 |
+
$url . 'jquery-waypoints/waypoints.min.js',
|
| 124 |
+
array( 'jquery' ),
|
| 125 |
+
'0.1.0'
|
| 126 |
+
);
|
| 127 |
+
|
| 128 |
if( $this->is_archive() && ! genesis_get_option( 'general_show_archive', 'genesis_simple_share' ) ) {
|
| 129 |
$this->archive = 'no-load';
|
| 130 |
return;
|
| 131 |
}
|
| 132 |
+
|
| 133 |
//use wp_enqueue_script() and wp_enqueue_style() to load scripts and styles
|
| 134 |
+
wp_enqueue_script( 'genesis-simple-share-plugin-js' );
|
| 135 |
+
wp_enqueue_style( 'genesis-simple-share-plugin-css' );
|
| 136 |
wp_enqueue_style( 'genesis-simple-share-genericons-css' );
|
| 137 |
+
|
| 138 |
if( $this->is_archive() ) {
|
| 139 |
wp_enqueue_script( 'genesis-simple-share-waypoint-js' );
|
| 140 |
}
|
| 141 |
+
|
| 142 |
}
|
| 143 |
+
|
| 144 |
/**
|
| 145 |
* Load the icon actions/filters only within the genesis_loop hook
|
| 146 |
*
|
| 148 |
*
|
| 149 |
*/
|
| 150 |
function start_icon_actions(){
|
| 151 |
+
|
| 152 |
add_filter( 'the_content', array( $this, 'icon_output' ), 15 );
|
| 153 |
add_filter( 'the_excerpt', array( $this, 'icon_output' ), 15 );
|
| 154 |
+
|
| 155 |
if( genesis_get_option( 'content_archive_limit' ) && 'full' == genesis_get_option( 'content_archive' ) && $this->is_archive() ){
|
| 156 |
add_action( 'genesis_post_content' , array( $this, 'before_entry_icons' ), 9 );
|
| 157 |
add_action( 'genesis_entry_content', array( $this, 'before_entry_icons' ), 9 );
|
| 158 |
add_action( 'genesis_post_content' , array( $this, 'after_entry_icons' ), 11 );
|
| 159 |
add_action( 'genesis_entry_content', array( $this, 'after_entry_icons' ), 11 );
|
| 160 |
}
|
| 161 |
+
|
| 162 |
}
|
| 163 |
+
|
| 164 |
/**
|
| 165 |
* Remove the icon actions/filters after the loop has run
|
| 166 |
*
|
| 168 |
*
|
| 169 |
*/
|
| 170 |
function end_icon_actions(){
|
| 171 |
+
|
| 172 |
remove_filter( 'the_content', array( $this, 'icon_output' ), 15 );
|
| 173 |
remove_filter( 'the_excerpt', array( $this, 'icon_output' ), 15 );
|
| 174 |
+
|
| 175 |
remove_action( 'genesis_post_content' , array( $this, 'before_entry_icons' ), 9 );
|
| 176 |
remove_action( 'genesis_entry_content', array( $this, 'before_entry_icons' ), 9 );
|
| 177 |
remove_action( 'genesis_post_content' , array( $this, 'after_entry_icons' ), 11 );
|
| 178 |
remove_action( 'genesis_entry_content', array( $this, 'after_entry_icons' ), 11 );
|
| 179 |
+
|
| 180 |
}
|
| 181 |
+
|
| 182 |
/**
|
| 183 |
* Conditionally outputs icon output
|
| 184 |
* Alters the_content if icons are available
|
| 191 |
*
|
| 192 |
*/
|
| 193 |
function icon_output( $content ){
|
| 194 |
+
|
| 195 |
if( $this->archive === 'no-load' )
|
| 196 |
return $content;
|
| 197 |
+
|
| 198 |
if( ! $this->icons )
|
| 199 |
return $content; //return early if no icons available
|
| 200 |
+
|
| 201 |
switch( genesis_get_option( 'general_position', 'genesis_simple_share' ) ){
|
| 202 |
+
|
| 203 |
+
case 'before_content':
|
| 204 |
+
$content = $this->get_icon_output( 'before', $this->icons ) . $content;
|
| 205 |
+
break;
|
| 206 |
+
|
| 207 |
+
case 'after_content':
|
| 208 |
+
$content .= $this->get_icon_output( 'after', $this->icons );
|
| 209 |
+
break;
|
| 210 |
+
|
| 211 |
+
case 'both':
|
| 212 |
+
$content = $this->get_icon_output( 'before', $this->icons ) . $content . $this->get_icon_output( 'after', $this->icons );
|
| 213 |
+
break;
|
| 214 |
+
|
| 215 |
}
|
| 216 |
+
|
| 217 |
return $content;
|
| 218 |
+
|
| 219 |
}
|
| 220 |
+
|
| 221 |
/**
|
| 222 |
* Conditionally outputs icon output
|
| 223 |
* Alters the_content if icons are available
|
| 230 |
*
|
| 231 |
*/
|
| 232 |
function before_entry_icons(){
|
| 233 |
+
|
| 234 |
if( $this->archive === 'no-load' )
|
| 235 |
return;
|
| 236 |
+
|
| 237 |
if( ! $this->icons )
|
| 238 |
return; //return early if no icons available
|
| 239 |
+
|
| 240 |
$position = genesis_get_option( 'general_position', 'genesis_simple_share' );
|
| 241 |
+
|
| 242 |
if( 'before_content' == $position || 'both' == $position ) {
|
| 243 |
+
|
| 244 |
echo $this->get_icon_output( 'before', $this->icons );
|
| 245 |
+
|
| 246 |
}
|
| 247 |
+
|
| 248 |
}
|
| 249 |
+
|
| 250 |
/**
|
| 251 |
* Conditionally outputs icon output
|
| 252 |
* Alters the_content if icons are available
|
| 259 |
*
|
| 260 |
*/
|
| 261 |
function after_entry_icons(){
|
| 262 |
+
|
| 263 |
if( $this->archive === 'no-load' )
|
| 264 |
return;
|
| 265 |
+
|
| 266 |
if( ! $this->icons )
|
| 267 |
return; //return early if no icons available
|
| 268 |
+
|
| 269 |
$position = genesis_get_option( 'general_position', 'genesis_simple_share' );
|
| 270 |
+
|
| 271 |
if( 'after_content' == $position || 'both' == $position ) {
|
| 272 |
+
|
| 273 |
echo $this->get_icon_output( 'after', $this->icons );
|
| 274 |
+
|
| 275 |
}
|
| 276 |
+
|
| 277 |
}
|
| 278 |
+
|
| 279 |
/**
|
| 280 |
* Check to see if any icons are set to show for the post type and return array of icons or false
|
| 281 |
*
|
| 287 |
*
|
| 288 |
*/
|
| 289 |
function get_display_icons( $icon_sort ){
|
| 290 |
+
|
| 291 |
$icons = array();
|
| 292 |
+
|
| 293 |
foreach( $icon_sort as $icon )
|
| 294 |
if( genesis_get_option( $icon, 'genesis_simple_share' ) )
|
| 295 |
$icons[] = $icon;
|
| 296 |
+
|
| 297 |
+
if( ! empty( $icons ) )
|
| 298 |
+
return $icons;
|
| 299 |
+
|
| 300 |
+
return false;
|
| 301 |
+
|
| 302 |
}
|
| 303 |
+
|
| 304 |
/**
|
| 305 |
* Build output for the icons based on position
|
| 306 |
*
|
| 312 |
* @returns string HTML and JS required to build the share icons.
|
| 313 |
*
|
| 314 |
*/
|
| 315 |
+
function get_icon_output( $location, $icons = array(), $force_show = false ){
|
| 316 |
+
|
| 317 |
if( is_feed() ) {
|
| 318 |
return;
|
| 319 |
}
|
| 320 |
+
|
| 321 |
$filter = 'the_excerpt' == current_filter() ? 'excerpt' : '';
|
| 322 |
+
|
| 323 |
+
if( ! $force_show && in_array( $location . $filter . '-' . get_the_ID(), $this->locations ) ){
|
| 324 |
+
return '<!-- Genesis Simple Share error: This location ( '. $location .' ) has already been used. -->';
|
| 325 |
}
|
| 326 |
+
|
| 327 |
+
if( empty( $icons ) ||
|
| 328 |
+
(
|
| 329 |
+
in_array( $location, array( 'before', 'after' ) ) &&
|
| 330 |
+
(
|
| 331 |
+
! genesis_get_option( 'general_' . get_post_type(), 'genesis_simple_share' ) ||
|
| 332 |
+
get_post_meta( get_the_ID(), '_disable_gss', true )
|
| 333 |
+
)
|
| 334 |
+
)
|
| 335 |
) {
|
| 336 |
return;
|
| 337 |
}
|
| 338 |
+
|
| 339 |
$icons = empty( $icons ) ? $this->icons : $icons;
|
| 340 |
+
|
| 341 |
if( empty( $icons ) )
|
| 342 |
return;
|
| 343 |
+
|
| 344 |
$id = get_the_ID();
|
| 345 |
+
|
| 346 |
$scripts = '';
|
| 347 |
$buttons = array();
|
| 348 |
+
|
| 349 |
foreach( $icons as $icon ){
|
| 350 |
+
|
| 351 |
$shares[] = $icon .': true';
|
| 352 |
+
|
| 353 |
$div_id = strtolower( $icon .'-'. $location .'-'. $id );
|
| 354 |
+
|
| 355 |
$image = ( $image = genesis_get_image( array( 'format' => 'url', 'size' => 'full' ) ) ) ? $image : $this->get_first_image();
|
| 356 |
+
|
| 357 |
$image = $image ? $image : genesis_get_option( 'image_url', 'genesis_simple_share' );
|
| 358 |
$description = the_title_attribute( array( 'echo' => false ) );
|
| 359 |
+
|
| 360 |
//media
|
| 361 |
$button = 'twitter' == $icon && ( $via = genesis_get_option( 'twitter_id', 'genesis_simple_share' ) ) ? " twitter: { via: '". str_replace( '@', '', $via ) ."' }" : '';
|
| 362 |
$button = 'pinterest' == $icon && $image ? " pinterest: { media: '$image', description: '$description' }" : $button;
|
| 363 |
+
|
| 364 |
if( $this->is_archive() )
|
| 365 |
$scripts .= sprintf( "$('#%s').waypoint( function() {
|
| 366 |
$('#%s').sharrre({
|
| 378 |
});
|
| 379 |
},
|
| 380 |
{ offset: 'bottom-in-view' });\n",
|
| 381 |
+
$div_id,
|
| 382 |
+
$div_id,
|
| 383 |
+
$icon,
|
| 384 |
+
plugins_url( 'sharrre/sharrre.php', __FILE__ ),
|
| 385 |
+
$button,
|
| 386 |
+
$icon
|
| 387 |
+
);
|
| 388 |
|
| 389 |
else
|
| 390 |
$scripts .= sprintf( "$('#%s').sharrre({
|
| 400 |
api.openPopup('%s');
|
| 401 |
}
|
| 402 |
});\n",
|
| 403 |
+
$div_id,
|
| 404 |
+
$icon,
|
| 405 |
+
plugins_url( 'sharrre/sharrre.php', __FILE__ ),
|
| 406 |
+
$button,
|
| 407 |
+
$icon
|
| 408 |
+
);
|
| 409 |
+
|
| 410 |
switch( $icon ){
|
| 411 |
+
|
| 412 |
+
case 'twitter' :
|
| 413 |
+
|
| 414 |
+
$data_title = 'Tweet';
|
| 415 |
+
break;
|
| 416 |
+
|
| 417 |
+
case 'pinterest' :
|
| 418 |
+
|
| 419 |
+
$data_title = 'Pin';
|
| 420 |
+
break;
|
| 421 |
+
|
| 422 |
+
default:
|
| 423 |
+
|
| 424 |
+
$data_title = 'Share';
|
| 425 |
+
|
| 426 |
}
|
| 427 |
+
|
| 428 |
$buttons[] = sprintf( '<div class="%s" id="%s" data-url="%s" data-urlalt="%s" data-text="%s" data-title="%s"></div>',
|
| 429 |
$icon,
|
| 430 |
$div_id,
|
| 433 |
$description,
|
| 434 |
$data_title
|
| 435 |
);
|
| 436 |
+
|
| 437 |
}
|
| 438 |
+
|
| 439 |
$divs = implode( '', $buttons );
|
| 440 |
+
|
| 441 |
$div_id = 'share-'. $location . '-' . $id;
|
| 442 |
+
|
| 443 |
$div = sprintf( '<div class="share-%s share-%s share-%s" id="%s">%s</div>',
|
| 444 |
+
$location,
|
| 445 |
+
$this->appearance,
|
| 446 |
+
$this->size,
|
| 447 |
+
$div_id,
|
| 448 |
+
$divs
|
| 449 |
+
);
|
| 450 |
+
|
| 451 |
$script = "
|
| 452 |
<script type='text/javascript'>
|
| 453 |
jQuery(document).ready(function($) {
|
| 454 |
$scripts
|
| 455 |
});
|
| 456 |
</script>";
|
| 457 |
+
|
| 458 |
$this->locations[] = $location . $filter . '-' . get_the_ID();
|
| 459 |
+
|
| 460 |
return $div . $script;
|
| 461 |
+
|
| 462 |
+
}
|
| 463 |
/**
|
| 464 |
* Build output for the icons based on position
|
| 465 |
*
|
| 473 |
*/
|
| 474 |
function get_hide_icon_output( $location, $icons = array() ){
|
| 475 |
$id = get_the_ID();
|
| 476 |
+
|
| 477 |
+
$div_id = 'share-'. $location .'-' . $id;
|
| 478 |
+
|
| 479 |
+
$div = sprintf( '<div class="share-%s share-%s share-%s" id="%s" data-url="%s" data-urlalt="%s" data-text="%s" data-title="share"></div>',
|
| 480 |
+
$location,
|
| 481 |
+
$this->appearance,
|
| 482 |
+
$this->size,
|
| 483 |
+
$div_id,
|
| 484 |
+
get_permalink( $id ),
|
| 485 |
+
wp_get_shortlink( $id ),
|
| 486 |
+
the_title_attribute( array( 'echo' => false ) )
|
| 487 |
+
);
|
| 488 |
+
|
| 489 |
+
$shares = array();
|
| 490 |
+
$buttons = '';
|
| 491 |
+
|
| 492 |
+
foreach( $icons as $icon => $args ){
|
| 493 |
+
|
| 494 |
+
$shares[] = $icon .': true';
|
| 495 |
+
|
| 496 |
+
}
|
| 497 |
+
|
| 498 |
+
$share = implode( ',', $shares );
|
| 499 |
+
|
| 500 |
+
$script = "
|
| 501 |
<script type='text/javascript'>
|
| 502 |
jQuery(document).ready(function($) {
|
| 503 |
$('#$div_id').share({
|
| 519 |
});
|
| 520 |
});
|
| 521 |
</script>";
|
| 522 |
+
|
| 523 |
+
return $div . $script;
|
| 524 |
+
|
| 525 |
}
|
| 526 |
+
|
| 527 |
/**
|
| 528 |
* Checks to see if any archive including home, search, and the blog template is being used
|
| 529 |
*
|
| 533 |
*
|
| 534 |
*/
|
| 535 |
function is_archive() {
|
| 536 |
+
|
| 537 |
if( is_home() || is_archive() || is_search() || is_page_template('page_blog.php') )
|
| 538 |
return true;
|
| 539 |
+
|
| 540 |
return false;
|
| 541 |
}
|
| 542 |
+
|
| 543 |
/**
|
| 544 |
* Checks content for <img> tags and returns the src value of the first image tag
|
| 545 |
*
|
| 548 |
* @returns mixed
|
| 549 |
*
|
| 550 |
*/
|
| 551 |
+
function get_first_image( ) {
|
| 552 |
+
|
| 553 |
$content = get_the_content();
|
| 554 |
+
|
| 555 |
+
$output = preg_match_all('/<img[^>]+src=[\'"]([^\'"]+)[\'"][^>]*>/i', $content, $matches);
|
| 556 |
+
|
| 557 |
if( $output )
|
| 558 |
+
return $matches[1][0];
|
| 559 |
+
|
| 560 |
return false;
|
|
|
|
|
|
|
| 561 |
|
| 562 |
+
}
|
| 563 |
+
|
| 564 |
+
|
| 565 |
}
|
| 566 |
|
| 567 |
/**
|
| 571 |
*/
|
| 572 |
function genesis_simple_share() {
|
| 573 |
global $Genesis_Simple_Share;
|
| 574 |
+
|
| 575 |
$Genesis_Simple_Share = new Gensis_Simple_Share_Front_End;
|
| 576 |
+
|
| 577 |
}
|
| 578 |
|
| 579 |
genesis_simple_share();
|
| 580 |
|
| 581 |
/**
|
| 582 |
+
* Gets the Share Icon output.
|
| 583 |
* Can specify the icons to use in the optional second param
|
| 584 |
*
|
| 585 |
* @since 0.1.0
|
| 590 |
* @returns string HTML and JS required to build the share icons.
|
| 591 |
*
|
| 592 |
*/
|
| 593 |
+
function genesis_share_get_icon_output( $position, $icons = array(), $force_show = false ) {
|
| 594 |
global $Genesis_Simple_Share;
|
| 595 |
+
|
| 596 |
+
return $Genesis_Simple_Share->get_icon_output( $position, $icons, $force_show );
|
| 597 |
+
|
| 598 |
}
|
| 599 |
|
| 600 |
/**
|
| 609 |
* @returns string HTML and JS required to build the share icons.
|
| 610 |
*
|
| 611 |
*/
|
| 612 |
+
function genesis_share_icon_output( $position, $icons = array(), $force_show = false ) {
|
| 613 |
+
|
| 614 |
+
echo genesis_share_get_icon_output( $position, $icons, $force_show );
|
| 615 |
+
|
| 616 |
}
|
lib/functions.php
CHANGED
|
@@ -11,7 +11,7 @@
|
|
| 11 |
|
| 12 |
//add functions that are used in admin and front end of the site
|
| 13 |
|
| 14 |
-
|
| 15 |
-
if ( !defined( 'ABSPATH' ) ) {
|
| 16 |
-
die(
|
| 17 |
}
|
| 11 |
|
| 12 |
//add functions that are used in admin and front end of the site
|
| 13 |
|
| 14 |
+
//* Prevent direct access to the plugin
|
| 15 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
| 16 |
+
die( __( 'Sorry, you are not allowed to access this page directly.', 'genesis-simple-share' ) );
|
| 17 |
}
|
lib/languages/genesis-simple-share.pot
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (C) 2015 copyblogger
|
| 2 |
+
# This file is distributed under the same license as the Genesis Simple Share package.
|
| 3 |
+
msgid ""
|
| 4 |
+
msgstr ""
|
| 5 |
+
"Project-Id-Version: Genesis Simple Share 1.0.4\n"
|
| 6 |
+
"Report-Msgid-Bugs-To: StudioPress <translations@studiopress.com>\n"
|
| 7 |
+
"POT-Creation-Date: 2015-09-28 19:58: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: StudioPress <translations@studiopress.com>\n"
|
| 13 |
+
"Language-Team: English <translations@studiopress.com>\n"
|
| 14 |
+
"X-Generator: grunt-wp-i18n 0.4.4\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-KeywordsList: "
|
| 21 |
+
"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
|
| 22 |
+
"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
|
| 23 |
+
"X-Poedit-Bookmarks: \n"
|
| 24 |
+
"X-Poedit-SearchPath-0: .\n"
|
| 25 |
+
"X-Textdomain-Support: yes\n"
|
| 26 |
+
|
| 27 |
+
#: lib/admin-icon-preview.php:14 lib/admin.php:14 lib/functions.php:16
|
| 28 |
+
#: plugin.php:19
|
| 29 |
+
msgid "Sorry, you are not allowed to access this page directly."
|
| 30 |
+
msgstr ""
|
| 31 |
+
|
| 32 |
+
#: lib/admin.php:40
|
| 33 |
+
msgid "You can change button position by reordering these boxes:"
|
| 34 |
+
msgstr ""
|
| 35 |
+
|
| 36 |
+
#: lib/admin.php:64
|
| 37 |
+
msgid "Genesis Simple Share Settings"
|
| 38 |
+
msgstr ""
|
| 39 |
+
|
| 40 |
+
#: lib/admin.php:65
|
| 41 |
+
msgid "Simple Share"
|
| 42 |
+
msgstr ""
|
| 43 |
+
|
| 44 |
+
#: lib/admin.php:232
|
| 45 |
+
msgid "Google+"
|
| 46 |
+
msgstr ""
|
| 47 |
+
|
| 48 |
+
#: lib/admin.php:233
|
| 49 |
+
msgid "Facebook"
|
| 50 |
+
msgstr ""
|
| 51 |
+
|
| 52 |
+
#: lib/admin.php:234
|
| 53 |
+
msgid "Twitter"
|
| 54 |
+
msgstr ""
|
| 55 |
+
|
| 56 |
+
#: lib/admin.php:235
|
| 57 |
+
msgid "Pinterest"
|
| 58 |
+
msgstr ""
|
| 59 |
+
|
| 60 |
+
#: lib/admin.php:236
|
| 61 |
+
msgid "Linkedin"
|
| 62 |
+
msgstr ""
|
| 63 |
+
|
| 64 |
+
#: lib/admin.php:237
|
| 65 |
+
msgid "StumbleUpon"
|
| 66 |
+
msgstr ""
|
| 67 |
+
|
| 68 |
+
#: lib/admin.php:264
|
| 69 |
+
msgid "Icon Size"
|
| 70 |
+
msgstr ""
|
| 71 |
+
|
| 72 |
+
#: lib/admin.php:265
|
| 73 |
+
msgid "Small Bar"
|
| 74 |
+
msgstr ""
|
| 75 |
+
|
| 76 |
+
#: lib/admin.php:266
|
| 77 |
+
msgid "Medium Bar"
|
| 78 |
+
msgstr ""
|
| 79 |
+
|
| 80 |
+
#: lib/admin.php:267
|
| 81 |
+
msgid "Box"
|
| 82 |
+
msgstr ""
|
| 83 |
+
|
| 84 |
+
#: lib/admin.php:270
|
| 85 |
+
msgid "Icon Appearance"
|
| 86 |
+
msgstr ""
|
| 87 |
+
|
| 88 |
+
#: lib/admin.php:271
|
| 89 |
+
msgid "Outlined"
|
| 90 |
+
msgstr ""
|
| 91 |
+
|
| 92 |
+
#: lib/admin.php:272
|
| 93 |
+
msgid "Filled"
|
| 94 |
+
msgstr ""
|
| 95 |
+
|
| 96 |
+
#: lib/admin.php:319 lib/admin.php:336 lib/admin.php:353 lib/admin.php:374
|
| 97 |
+
#: lib/admin.php:389 lib/admin.php:409
|
| 98 |
+
msgid "Use this button?"
|
| 99 |
+
msgstr ""
|
| 100 |
+
|
| 101 |
+
#: lib/admin.php:356
|
| 102 |
+
msgid "Enter Twitter ID for @via to be added to default tweet text:"
|
| 103 |
+
msgstr ""
|
| 104 |
+
|
| 105 |
+
#: lib/admin.php:392
|
| 106 |
+
msgid ""
|
| 107 |
+
"Enter Default Image URL if there is no image available in content being "
|
| 108 |
+
"shared:"
|
| 109 |
+
msgstr ""
|
| 110 |
+
|
| 111 |
+
#: lib/admin.php:423
|
| 112 |
+
msgid "Icon Display Position"
|
| 113 |
+
msgstr ""
|
| 114 |
+
|
| 115 |
+
#: lib/admin.php:424
|
| 116 |
+
msgid "Select display position to enable icons."
|
| 117 |
+
msgstr ""
|
| 118 |
+
|
| 119 |
+
#: lib/admin.php:425
|
| 120 |
+
msgid "Before the Content"
|
| 121 |
+
msgstr ""
|
| 122 |
+
|
| 123 |
+
#: lib/admin.php:426
|
| 124 |
+
msgid "After the Content"
|
| 125 |
+
msgstr ""
|
| 126 |
+
|
| 127 |
+
#: lib/admin.php:427
|
| 128 |
+
msgid "Before and After the Content"
|
| 129 |
+
msgstr ""
|
| 130 |
+
|
| 131 |
+
#: lib/admin.php:477
|
| 132 |
+
msgid "Enable on:"
|
| 133 |
+
msgstr ""
|
| 134 |
+
|
| 135 |
+
#: lib/admin.php:484
|
| 136 |
+
msgid "Show on Archive Pages"
|
| 137 |
+
msgstr ""
|
| 138 |
+
|
| 139 |
+
#: lib/post-meta.php:18
|
| 140 |
+
msgid "Share Settings"
|
| 141 |
+
msgstr ""
|
| 142 |
+
|
| 143 |
+
#: lib/post-meta.php:37
|
| 144 |
+
msgid "Disable Share Buttons"
|
| 145 |
+
msgstr ""
|
| 146 |
+
|
| 147 |
+
#. Plugin Name of the plugin/theme
|
| 148 |
+
msgid "Genesis Simple Share"
|
| 149 |
+
msgstr ""
|
| 150 |
+
|
| 151 |
+
#. Description of the plugin/theme
|
| 152 |
+
msgid "A simple sharing plugin using the Share script."
|
| 153 |
+
msgstr ""
|
| 154 |
+
|
| 155 |
+
#. Author of the plugin/theme
|
| 156 |
+
msgid "copyblogger"
|
| 157 |
+
msgstr ""
|
| 158 |
+
|
| 159 |
+
#. Author URI of the plugin/theme
|
| 160 |
+
msgid "http://www.copyblogger.com"
|
| 161 |
+
msgstr ""
|
lib/sharrre/error_log
DELETED
|
@@ -1,5 +0,0 @@
|
|
| 1 |
-
[20-Feb-2014 01:28:53 UTC] PHP Warning: strpos() [<a href='function.strpos'>function.strpos</a>]: Empty delimiter in /home/fottsp/public_html/wp-content/plugins/genesis-simple-share/lib/sharrre/sharrre.php on line 98
|
| 2 |
-
[20-Feb-2014 01:30:09 UTC] PHP Warning: strpos() [<a href='function.strpos'>function.strpos</a>]: Empty delimiter in /home/fottsp/public_html/wp-content/plugins/genesis-simple-share/lib/sharrre/sharrre.php on line 98
|
| 3 |
-
[20-Feb-2014 01:33:18 UTC] PHP Parse error: syntax error, unexpected T_VARIABLE in /home/fottsp/public_html/wp-content/plugins/genesis-simple-share/lib/sharrre/sharrre.php on line 119
|
| 4 |
-
[20-Feb-2014 01:34:20 UTC] PHP Parse error: syntax error, unexpected T_VARIABLE in /home/fottsp/public_html/wp-content/plugins/genesis-simple-share/lib/sharrre/sharrre.php on line 121
|
| 5 |
-
[20-Feb-2014 01:34:58 UTC] PHP Parse error: syntax error, unexpected $end, expecting ')' in /home/fottsp/public_html/wp-content/plugins/genesis-simple-share/lib/sharrre/sharrre.php on line 59
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/sharrre/jquery.sharrre.js
CHANGED
|
@@ -448,54 +448,64 @@
|
|
| 448 |
var self = this,
|
| 449 |
count = 0,
|
| 450 |
url = urlJson[name].replace('{url}', encodeURIComponent(this.options.url));
|
| 451 |
-
self.options.hideCount = 0;
|
| 452 |
|
| 453 |
-
if(
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 478 |
self.rendererPerso();
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
|
| 482 |
self.renderer();
|
| 483 |
self.options.count[name] = 0;
|
| 484 |
self.rendererPerso();
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
})
|
| 488 |
-
.fail(function() {
|
| 489 |
-
self.options.hideCount = 1;
|
| 490 |
-
self.renderer();
|
| 491 |
-
self.options.count[name] = 0;
|
| 492 |
-
self.rendererPerso();
|
| 493 |
-
});
|
| 494 |
-
}
|
| 495 |
-
else{
|
| 496 |
-
self.renderer();
|
| 497 |
-
self.options.count[name] = 0;
|
| 498 |
-
self.rendererPerso();
|
| 499 |
}
|
| 500 |
};
|
| 501 |
|
| 448 |
var self = this,
|
| 449 |
count = 0,
|
| 450 |
url = urlJson[name].replace('{url}', encodeURIComponent(this.options.url));
|
|
|
|
| 451 |
|
| 452 |
+
if( 'twitter' == name ){ //twitter is dropping support for count service so for now we cannot get the count.
|
| 453 |
+
self.options.hideCount = 1;
|
| 454 |
+
self.renderer();
|
| 455 |
+
self.options.count[name] = 0;
|
| 456 |
+
self.rendererPerso();
|
| 457 |
+
} else {
|
| 458 |
+
|
| 459 |
+
self.options.hideCount = 0;
|
| 460 |
+
|
| 461 |
+
if(this.options.buttons[name].urlCount === true && this.options.buttons[name].url !== ''){
|
| 462 |
+
url = urlJson[name].replace('{url}', this.options.buttons[name].url);
|
| 463 |
+
}
|
| 464 |
+
//console.log('name : ' + name + ' - url : '+url); //debug
|
| 465 |
+
if(url != '' && self.options.urlCurl !== ''){ //urlCurl = '' if you don't want to used PHP script but used social button
|
| 466 |
+
$.getJSON(url, function(json){
|
| 467 |
+
if( null != json ){
|
| 468 |
+
|
| 469 |
+
if(typeof json.count !== "undefined"){ //GooglePlus, Stumbleupon, Twitter, Pinterest and Digg
|
| 470 |
+
var temp = json.count + '';
|
| 471 |
+
temp = temp.replace('\u00c2\u00a0', ''); //remove google plus special chars
|
| 472 |
+
count += parseInt(temp, 10);
|
| 473 |
+
}
|
| 474 |
+
//get the FB total count (shares, likes and more)
|
| 475 |
+
else if(json.data && json.data.length > 0 && typeof json.data[0].total_count !== "undefined"){ //Facebook total count
|
| 476 |
+
count += parseInt(json.data[0].total_count, 10);
|
| 477 |
+
}
|
| 478 |
+
else if(typeof json[0] !== "undefined"){ //Delicious
|
| 479 |
+
count += parseInt(json[0].total_posts, 10);
|
| 480 |
+
}
|
| 481 |
+
else if(typeof json[0] !== "undefined"){ //Stumbleupon
|
| 482 |
+
}
|
| 483 |
+
self.options.count[name] = count;
|
| 484 |
+
self.options.total += count;
|
| 485 |
+
self.renderer();
|
| 486 |
+
self.rendererPerso();
|
| 487 |
+
//console.log(json); //debug
|
| 488 |
+
}
|
| 489 |
+
else {
|
| 490 |
+
self.renderer();
|
| 491 |
+
self.options.count[name] = 0;
|
| 492 |
+
self.rendererPerso();
|
| 493 |
+
}
|
| 494 |
+
//console.log(json); //debug
|
| 495 |
+
})
|
| 496 |
+
.fail(function() {
|
| 497 |
+
self.options.hideCount = 1;
|
| 498 |
+
self.renderer();
|
| 499 |
+
self.options.count[name] = 0;
|
| 500 |
self.rendererPerso();
|
| 501 |
+
});
|
| 502 |
+
}
|
| 503 |
+
else{
|
| 504 |
self.renderer();
|
| 505 |
self.options.count[name] = 0;
|
| 506 |
self.rendererPerso();
|
| 507 |
+
}
|
| 508 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 509 |
}
|
| 510 |
};
|
| 511 |
|
lib/sharrre/jquery.sharrre.min.js
CHANGED
|
@@ -1,7 +1,42 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
(function(t,n,r,i){function h(e,n){this.element=e;this.options=t.extend(true,{},u,n);this.options.share=n.share;this._defaults=u;this._name=o;this.init()}var o="sharrre",u={className:"sharrre",share:{googlePlus:false,facebook:false,twitter:false,digg:false,delicious:false,stumbleupon:false,linkedin:false,pinterest:false},shareTotal:0,template:"",title:"",url:r.location.href,text:r.title,urlCurl:"sharrre.php",count:{},total:0,shorterTotal:true,enableHover:true,enableCounter:true,enableTracking:false,hover:function(){},hide:function(){},click:function(){},render:function(){},buttons:{googlePlus:{url:"",urlCount:false,size:"medium",lang:"en-US",annotation:""},facebook:{url:"",urlCount:false,action:"like",layout:"button_count",width:"",send:"false",faces:"false",colorscheme:"",font:"",lang:"en_US"},twitter:{url:"",urlCount:false,count:"horizontal",hashtags:"",via:"",related:"",lang:"en"},digg:{url:"",urlCount:false,type:"DiggCompact"},delicious:{url:"",urlCount:false,size:"medium"},stumbleupon:{url:"",urlCount:false,layout:"1"},linkedin:{url:"",urlCount:false,counter:""},pinterest:{url:"",media:"",description:"",layout:"horizontal"}}},a={googlePlus:"",facebook:"https://graph.facebook.com/fql?q=SELECT%20url,%20normalized_url,%20share_count,%20like_count,%20comment_count,%20total_count,commentsbox_count,%20comments_fbid,%20click_count%20FROM%20link_stat%20WHERE%20url=%27{url}%27&callback=?",twitter:"//cdn.api.twitter.com/1/urls/count.json?url={url}&callback=?",digg:"//services.digg.com/2.0/story.getInfo?links={url}&type=javascript&callback=?",delicious:"//feeds.delicious.com/v2/json/urlinfo/data?url={url}&callback=?",stumbleupon:"",linkedin:"//www.linkedin.com/countserv/count/share?format=jsonp&url={url}&callback=?",pinterest:"//api.pinterest.com/v1/urls/count.json?url={url}&callback=?"},f={googlePlus:function(e){var i=e.options.buttons.googlePlus;t(e.element).find(".buttons").append('<div class="button googleplus"><div class="g-plusone" data-size="'+i.size+'" data-href="'+(i.url!==""?i.url:e.options.url)+'" data-annotation="'+i.annotation+'"></div></div>');n.___gcfg={lang:e.options.buttons.googlePlus.lang};var s=0;if(typeof gapi==="undefined"&&s==0){s=1;(function(){var e=r.createElement("script");e.type="text/javascript";e.async=true;e.src="//apis.google.com/js/plusone.js";var t=r.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})()}else{gapi.plusone.go()}},facebook:function(e){var n=e.options.buttons.facebook;t(e.element).find(".buttons").append('<div class="button facebook"><div id="fb-root"></div><div class="fb-like" data-href="'+(n.url!==""?n.url:e.options.url)+'" data-send="'+n.send+'" data-layout="'+n.layout+'" data-width="'+n.width+'" data-show-faces="'+n.faces+'" data-action="'+n.action+'" data-colorscheme="'+n.colorscheme+'" data-font="'+n.font+'" data-via="'+n.via+'"></div></div>');var i=0;if(typeof FB==="undefined"&&i==0){i=1;(function(e,t,r){var i,s=e.getElementsByTagName(t)[0];if(e.getElementById(r)){return}i=e.createElement(t);i.id=r;i.src="//connect.facebook.net/"+n.lang+"/all.js#xfbml=1";s.parentNode.insertBefore(i,s)})(r,"script","facebook-jssdk")}else{FB.XFBML.parse()}},twitter:function(e){var n=e.options.buttons.twitter;t(e.element).find(".buttons").append('<div class="button twitter"><a href="https://twitter.com/share" class="twitter-share-button" data-url="'+(n.url!==""?n.url:e.options.url)+'" data-count="'+n.count+'" data-text="'+e.options.text+'" data-via="'+n.via+'" data-hashtags="'+n.hashtags+'" data-related="'+n.related+'" data-lang="'+n.lang+'">Tweet</a></div>');var i=0;if(typeof twttr==="undefined"&&i==0){i=1;(function(){var e=r.createElement("script");e.type="text/javascript";e.async=true;e.src="//platform.twitter.com/widgets.js";var t=r.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})()}else{t.ajax({url:"//platform.twitter.com/widgets.js",dataType:"script",cache:true})}},digg:function(e){var n=e.options.buttons.digg;t(e.element).find(".buttons").append('<div class="button digg"><a class="DiggThisButton '+n.type+'" rel="nofollow external" href="//digg.com/submit?url='+encodeURIComponent(n.url!==""?n.url:e.options.url)+'"></a></div>');var i=0;if(typeof __DBW==="undefined"&&i==0){i=1;(function(){var e=r.createElement("SCRIPT"),t=r.getElementsByTagName("SCRIPT")[0];e.type="text/javascript";e.async=true;e.src="//widgets.digg.com/buttons.js";t.parentNode.insertBefore(e,t)})()}},delicious:function(e){if(e.options.buttons.delicious.size=="tall"){var n="width:50px;",r="height:35px;width:50px;font-size:15px;line-height:35px;",i="height:18px;line-height:18px;margin-top:3px;"}else{var n="width:93px;",r="float:right;padding:0 3px;height:20px;width:26px;line-height:20px;",i="float:left;height:20px;line-height:20px;"}var s=e.shorterTotal(e.options.count.delicious);if(typeof s==="undefined"){s=0}t(e.element).find(".buttons").append('<div class="button delicious"><div style="'+n+'font:12px Arial,Helvetica,sans-serif;cursor:pointer;color:#666666;display:inline-block;float:none;height:20px;line-height:normal;margin:0;padding:0;text-indent:0;vertical-align:baseline;">'+'<div style="'+r+'background-color:#fff;margin-bottom:5px;overflow:hidden;text-align:center;border:1px solid #ccc;border-radius:3px;">'+s+"</div>"+'<div style="'+i+'display:block;padding:0;text-align:center;text-decoration:none;width:50px;background-color:#7EACEE;border:1px solid #40679C;border-radius:3px;color:#fff;">'+'<img src="//www.delicious.com/static/img/delicious.small.gif" height="10" width="10" alt="Delicious" /> Add</div></div></div>');t(e.element).find(".delicious").on("click",function(){e.openPopup("delicious")})},stumbleupon:function(e){var i=e.options.buttons.stumbleupon;t(e.element).find(".buttons").append('<div class="button stumbleupon"><su:badge layout="'+i.layout+'" location="'+(i.url!==""?i.url:e.options.url)+'"></su:badge></div>');var o=0;if(typeof STMBLPN==="undefined"&&o==0){o=1;(function(){var e=r.createElement("script");e.type="text/javascript";e.async=true;e.src="//platform.stumbleupon.com/1/widgets.js";var t=r.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})();s=n.setTimeout(function(){if(typeof STMBLPN!=="undefined"){STMBLPN.processWidgets();clearInterval(s)}},500)}else{STMBLPN.processWidgets()}},linkedin:function(e){var i=e.options.buttons.linkedin;t(e.element).find(".buttons").append('<div class="button linkedin"><script type="in/share" data-url="'+(i.url!==""?i.url:e.options.url)+'" data-counter="'+i.counter+'"></script></div>');var s=0;if(typeof n.IN==="undefined"&&s==0){s=1;(function(){var e=r.createElement("script");e.type="text/javascript";e.async=true;e.src="//platform.linkedin.com/in.js";var t=r.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})()}else{n.IN.init()}},pinterest:function(e){var n=e.options.buttons.pinterest;t(e.element).find(".buttons").append('<div class="button pinterest"><a href="//pinterest.com/pin/create/button/?url='+(n.url!==""?n.url:e.options.url)+"&media="+n.media+"&description="+n.description+'" class="pin-it-button" count-layout="'+n.layout+'">Pin It</a></div>');(function(){var e=r.createElement("script");e.type="text/javascript";e.async=true;e.src="//assets.pinterest.com/js/pinit.js";var t=r.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})()}},l={googlePlus:function(){},facebook:function(){fb=n.setInterval(function(){if(typeof FB!=="undefined"){FB.Event.subscribe("edge.create",function(e){_gaq.push(["_trackSocial","facebook","like",e])});FB.Event.subscribe("edge.remove",function(e){_gaq.push(["_trackSocial","facebook","unlike",e])});FB.Event.subscribe("message.send",function(e){_gaq.push(["_trackSocial","facebook","send",e])});clearInterval(fb)}},1e3)},twitter:function(){tw=n.setInterval(function(){if(typeof twttr!=="undefined"){twttr.events.bind("tweet",function(e){if(e){_gaq.push(["_trackSocial","twitter","tweet"])}});clearInterval(tw)}},1e3)},digg:function(){},delicious:function(){},stumbleupon:function(){},linkedin:function(){function e(){_gaq.push(["_trackSocial","linkedin","share"])}},pinterest:function(){}},c={googlePlus:function(e){n.open("https://plus.google.com/share?hl="+e.buttons.googlePlus.lang+"&url="+encodeURIComponent(e.buttons.googlePlus.url!==""?e.buttons.googlePlus.url:e.url),"","toolbar=0, status=0, width=900, height=500")},facebook:function(e){n.open("//www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(e.buttons.facebook.url!==""?e.buttons.facebook.url:e.url)+"&t="+e.text+"","","toolbar=0, status=0, width=900, height=500")},twitter:function(e){n.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(e.text)+"&url="+encodeURIComponent(e.buttons.twitter.url!==""?e.buttons.twitter.url:e.url)+(e.buttons.twitter.via!==""?"&via="+e.buttons.twitter.via:""),"","toolbar=0, status=0, width=650, height=360")},digg:function(e){n.open("//digg.com/tools/diggthis/submit?url="+encodeURIComponent(e.buttons.digg.url!==""?e.buttons.digg.url:e.url)+"&title="+e.text+"&related=true&style=true","","toolbar=0, status=0, width=650, height=360")},delicious:function(e){n.open("//www.delicious.com/save?v=5&noui&jump=close&url="+encodeURIComponent(e.buttons.delicious.url!==""?e.buttons.delicious.url:e.url)+"&title="+e.text,"delicious","toolbar=no,width=550,height=550")},stumbleupon:function(e){n.open("//www.stumbleupon.com/badge/?url="+encodeURIComponent(e.buttons.delicious.url!==""?e.buttons.delicious.url:e.url),"stumbleupon","toolbar=no,width=550,height=550")},linkedin:function(e){n.open("https://www.linkedin.com/cws/share?url="+encodeURIComponent(e.buttons.delicious.url!==""?e.buttons.delicious.url:e.url)+"&token=&isFramed=true","linkedin","toolbar=no,width=550,height=550")},pinterest:function(e){n.open("//pinterest.com/pin/create/button/?url="+encodeURIComponent(e.buttons.pinterest.url!==""?e.buttons.pinterest.url:e.url)+"&media="+encodeURIComponent(e.buttons.pinterest.media)+"&description="+e.buttons.pinterest.description,"pinterest","toolbar=no,width=700,height=300")}};h.prototype.init=function(){var e=this;if(this.options.urlCurl!==""){a.googlePlus=this.options.urlCurl+"?url={url}&type=googlePlus";a.stumbleupon=this.options.urlCurl+"?url={url}&type=stumbleupon"}t(this.element).addClass(this.options.className);if(typeof t(this.element).data("title")!=="undefined"){this.options.title=t(this.element).attr("data-title")}if(typeof t(this.element).data("url")!=="undefined"){this.options.url=t(this.element).data("url")}if(typeof t(this.element).data("urlalt")!=="undefined"){this.options.urlalt=t(this.element).data("urlalt")}if(typeof t(this.element).data("text")!=="undefined"){this.options.text=t(this.element).data("text")}t.each(this.options.share,function(t,n){if(n===true){e.options.shareTotal++}});if(e.options.enableCounter===true){t.each(this.options.share,function(t,n){if(n===true){try{e.getSocialJson(t);e.getSocialJson(getSocialAltJson)}catch(r){}}})}else if(e.options.template!==""){this.options.render(this,this.options)}else{this.loadButtons()}t(this.element).hover(function(){if(t(this).find(".buttons").length===0&&e.options.enableHover===true){e.loadButtons()}e.options.hover(e,e.options)},function(){e.options.hide(e,e.options)});t(this.element).click(function(){e.options.click(e,e.options);return false})};h.prototype.loadButtons=function(){var e=this;t(this.element).append('<div class="buttons"></div>');t.each(e.options.share,function(t,n){if(n==true){f[t](e);if(e.options.enableTracking===true){l[t]()}}})};h.prototype.getSocialJson=function(e){var n=this,r=0,i=a[e].replace("{url}",encodeURIComponent(this.options.url));n.options.hideCount=0;if(this.options.buttons[e].urlCount===true&&this.options.buttons[e].url!==""){i=a[e].replace("{url}",this.options.buttons[e].url)}if(i!=""&&n.options.urlCurl!==""){t.getJSON(i,function(t){if(null!=t){if(typeof t.count!=="undefined"){var i=t.count+"";i=i.replace("Â ","");r+=parseInt(i,10)}else if(t.data&&t.data.length>0&&typeof t.data[0].total_count!=="undefined"){r+=parseInt(t.data[0].total_count,10)}else if(typeof t[0]!=="undefined"){r+=parseInt(t[0].total_posts,10)}else if(typeof t[0]!=="undefined"){}n.options.count[e]=r;n.options.total+=r;n.renderer();n.rendererPerso()}else{n.renderer();n.options.count[e]=0;n.rendererPerso()}}).fail(function(){n.options.hideCount=1;n.renderer();n.options.count[e]=0;n.rendererPerso()})}else{n.renderer();n.options.count[e]=0;n.rendererPerso()}};h.prototype.getSocialAltJson=function(e){var n=this,r=0,i=a[e].replace("{url}",encodeURIComponent(this.options.urlalt));n.options.hideCount=0;if(this.options.buttons[e].urlCount===true&&this.options.buttons[e].url!==""){i=a[e].replace("{url}",this.options.buttons[e].url)}if(i!=""&&n.options.urlCurl!==""){t.getJSON(i,function(t){if(null!=t){if(typeof t.count!=="undefined"){var i=t.count+"";i=i.replace("Â ","");r+=parseInt(i,10)}else if(t.data&&t.data.length>0&&typeof t.data[0].total_count!=="undefined"){r+=parseInt(t.data[0].total_count,10)}else if(typeof t[0]!=="undefined"){r+=parseInt(t[0].total_posts,10)}else if(typeof t[0]!=="undefined"){}n.options.count[e]+=r;n.options.total+=r;n.renderer();n.rendererPerso()}else{n.renderer();n.rendererPerso()}}).fail(function(){n.renderer();n.rendererPerso()})}else{n.renderer();n.rendererPerso()}};h.prototype.rendererPerso=function(){var t=0;for(e in this.options.count){t++}if(t===this.options.shareTotal){this.options.render(this,this.options)}};h.prototype.renderer=function(){var e=this.options.total,n=this.options.template;hideCount=this.options.hideCount;if(hideCount){t(this.element).html('<div class="box no-count">'+(this.options.title!==""?'<a class="share" href="#">'+this.options.title+"</a>":"")+"</div>")}else{if(this.options.shorterTotal===true){e=this.shorterTotal(e)}if(n!==""){n=n.replace("{total}",e);t(this.element).html(n)}else{t(this.element).html('<div class="box"><a class="count" href="#">'+e+"</a>"+(this.options.title!==""?'<a class="share" href="#">'+this.options.title+"</a>":"")+"</div>")}}};h.prototype.shorterTotal=function(e){if(e>=1e6){e=(e/1e6).toFixed(2)+"M"}else if(e>=1e3){e=(e/1e3).toFixed(1)+"k"}return e};h.prototype.openPopup=function(e){c[e](this.options);if(this.options.enableTracking===true){var t={googlePlus:{site:"Google",action:"+1"},facebook:{site:"facebook",action:"like"},twitter:{site:"twitter",action:"tweet"},digg:{site:"digg",action:"add"},delicious:{site:"delicious",action:"add"},stumbleupon:{site:"stumbleupon",action:"add"},linkedin:{site:"linkedin",action:"share"},pinterest:{site:"pinterest",action:"pin"}};_gaq.push(["_trackSocial",t[e].site,t[e].action])}};h.prototype.simulateClick=function(){var e=t(this.element).html();t(this.element).html(e.replace(this.options.total,this.options.total+1))};h.prototype.update=function(e,t){if(e!==""){this.options.url=e}if(t!==""){this.options.text=t}};t.fn[o]=function(e){var n=arguments;if(e===i||typeof e==="object"){return this.each(function(){if(!t.data(this,"plugin_"+o)){t.data(this,"plugin_"+o,new h(this,e))}})}else if(typeof e==="string"&&e[0]!=="_"&&e!=="init"){return this.each(function(){var r=t.data(this,"plugin_"+o);if(r instanceof h&&typeof r[e]==="function"){r[e].apply(r,Array.prototype.slice.call(n,1))}})}}})(jQuery,window,document)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
;(function($,window,document,undefined){var pluginName='sharrre',defaults={className:'sharrre',share:{googlePlus:false,facebook:false,twitter:false,digg:false,delicious:false,stumbleupon:false,linkedin:false,pinterest:false},shareTotal:0,template:'',title:'',url:document.location.href,text:document.title,urlCurl:'sharrre.php',count:{},total:0,shorterTotal:true,enableHover:true,enableCounter:true,enableTracking:false,hover:function(){},hide:function(){},click:function(){},render:function(){},buttons:{googlePlus:{url:'',urlCount:false,size:'medium',lang:'en-US',annotation:''},facebook:{url:'',urlCount:false,action:'like',layout:'button_count',width:'',send:'false',faces:'false',colorscheme:'',font:'',lang:'en_US'},twitter:{url:'',urlCount:false,count:'horizontal',hashtags:'',via:'',related:'',lang:'en'},digg:{url:'',urlCount:false,type:'DiggCompact'},delicious:{url:'',urlCount:false,size:'medium'},stumbleupon:{url:'',urlCount:false,layout:'1'},linkedin:{url:'',urlCount:false,counter:''},pinterest:{url:'',media:'',description:'',layout:'horizontal'}}},urlJson={googlePlus:"",facebook:"https://graph.facebook.com/fql?q=SELECT%20url,%20normalized_url,%20share_count,%20like_count,%20comment_count,%20total_count,commentsbox_count,%20comments_fbid,%20click_count%20FROM%20link_stat%20WHERE%20url=%27{url}%27&callback=?",twitter:"//cdn.api.twitter.com/1/urls/count.json?url={url}&callback=?",digg:"//services.digg.com/2.0/story.getInfo?links={url}&type=javascript&callback=?",delicious:'//feeds.delicious.com/v2/json/urlinfo/data?url={url}&callback=?',stumbleupon:"",linkedin:"//www.linkedin.com/countserv/count/share?format=jsonp&url={url}&callback=?",pinterest:"//api.pinterest.com/v1/urls/count.json?url={url}&callback=?"},loadButton={googlePlus:function(self){var sett=self.options.buttons.googlePlus;$(self.element).find('.buttons').append('<div class="button googleplus"><div class="g-plusone" data-size="'+sett.size+'" data-href="'+(sett.url!==''?sett.url:self.options.url)+'" data-annotation="'+sett.annotation+'"></div></div>');window.___gcfg={lang:self.options.buttons.googlePlus.lang};var loading=0;if(typeof gapi==='undefined'&&loading==0){loading=1;(function(){var po=document.createElement('script');po.type='text/javascript';po.async=true;po.src='//apis.google.com/js/plusone.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(po,s);})();}
|
| 2 |
+
else{gapi.plusone.go();}},facebook:function(self){var sett=self.options.buttons.facebook;$(self.element).find('.buttons').append('<div class="button facebook"><div id="fb-root"></div><div class="fb-like" data-href="'+(sett.url!==''?sett.url:self.options.url)+'" data-send="'+sett.send+'" data-layout="'+sett.layout+'" data-width="'+sett.width+'" data-show-faces="'+sett.faces+'" data-action="'+sett.action+'" data-colorscheme="'+sett.colorscheme+'" data-font="'+sett.font+'" data-via="'+sett.via+'"></div></div>');var loading=0;if(typeof FB==='undefined'&&loading==0){loading=1;(function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(d.getElementById(id)){return;}
|
| 3 |
+
js=d.createElement(s);js.id=id;js.src='//connect.facebook.net/'+sett.lang+'/all.js#xfbml=1';fjs.parentNode.insertBefore(js,fjs);}(document,'script','facebook-jssdk'));}
|
| 4 |
+
else{FB.XFBML.parse();}},twitter:function(self){var sett=self.options.buttons.twitter;$(self.element).find('.buttons').append('<div class="button twitter"><a href="https://twitter.com/share" class="twitter-share-button" data-url="'+(sett.url!==''?sett.url:self.options.url)+'" data-count="'+sett.count+'" data-text="'+self.options.text+'" data-via="'+sett.via+'" data-hashtags="'+sett.hashtags+'" data-related="'+sett.related+'" data-lang="'+sett.lang+'">Tweet</a></div>');var loading=0;if(typeof twttr==='undefined'&&loading==0){loading=1;(function(){var twitterScriptTag=document.createElement('script');twitterScriptTag.type='text/javascript';twitterScriptTag.async=true;twitterScriptTag.src='//platform.twitter.com/widgets.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(twitterScriptTag,s);})();}
|
| 5 |
+
else{$.ajax({url:'//platform.twitter.com/widgets.js',dataType:'script',cache:true});}},digg:function(self){var sett=self.options.buttons.digg;$(self.element).find('.buttons').append('<div class="button digg"><a class="DiggThisButton '+sett.type+'" rel="nofollow external" href="//digg.com/submit?url='+encodeURIComponent((sett.url!==''?sett.url:self.options.url))+'"></a></div>');var loading=0;if(typeof __DBW==='undefined'&&loading==0){loading=1;(function(){var s=document.createElement('SCRIPT'),s1=document.getElementsByTagName('SCRIPT')[0];s.type='text/javascript';s.async=true;s.src='//widgets.digg.com/buttons.js';s1.parentNode.insertBefore(s,s1);})();}},delicious:function(self){if(self.options.buttons.delicious.size=='tall'){var css='width:50px;',cssCount='height:35px;width:50px;font-size:15px;line-height:35px;',cssShare='height:18px;line-height:18px;margin-top:3px;';}
|
| 6 |
+
else{var css='width:93px;',cssCount='float:right;padding:0 3px;height:20px;width:26px;line-height:20px;',cssShare='float:left;height:20px;line-height:20px;';}
|
| 7 |
+
var count=self.shorterTotal(self.options.count.delicious);if(typeof count==="undefined"){count=0;}
|
| 8 |
+
$(self.element).find('.buttons').append('<div class="button delicious"><div style="'+css+'font:12px Arial,Helvetica,sans-serif;cursor:pointer;color:#666666;display:inline-block;float:none;height:20px;line-height:normal;margin:0;padding:0;text-indent:0;vertical-align:baseline;">'+'<div style="'+cssCount+'background-color:#fff;margin-bottom:5px;overflow:hidden;text-align:center;border:1px solid #ccc;border-radius:3px;">'+count+'</div>'+'<div style="'+cssShare+'display:block;padding:0;text-align:center;text-decoration:none;width:50px;background-color:#7EACEE;border:1px solid #40679C;border-radius:3px;color:#fff;">'+'<img src="//www.delicious.com/static/img/delicious.small.gif" height="10" width="10" alt="Delicious" /> Add</div></div></div>');$(self.element).find('.delicious').on('click',function(){self.openPopup('delicious');});},stumbleupon:function(self){var sett=self.options.buttons.stumbleupon;$(self.element).find('.buttons').append('<div class="button stumbleupon"><su:badge layout="'+sett.layout+'" location="'+(sett.url!==''?sett.url:self.options.url)+'"></su:badge></div>');var loading=0;if(typeof STMBLPN==='undefined'&&loading==0){loading=1;(function(){var li=document.createElement('script');li.type='text/javascript';li.async=true;li.src='//platform.stumbleupon.com/1/widgets.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(li,s);})();s=window.setTimeout(function(){if(typeof STMBLPN!=='undefined'){STMBLPN.processWidgets();clearInterval(s);}},500);}
|
| 9 |
+
else{STMBLPN.processWidgets();}},linkedin:function(self){var sett=self.options.buttons.linkedin;$(self.element).find('.buttons').append('<div class="button linkedin"><script type="in/share" data-url="'+(sett.url!==''?sett.url:self.options.url)+'" data-counter="'+sett.counter+'"></script></div>');var loading=0;if(typeof window.IN==='undefined'&&loading==0){loading=1;(function(){var li=document.createElement('script');li.type='text/javascript';li.async=true;li.src='//platform.linkedin.com/in.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(li,s);})();}
|
| 10 |
+
else{window.IN.init();}},pinterest:function(self){var sett=self.options.buttons.pinterest;$(self.element).find('.buttons').append('<div class="button pinterest"><a href="//pinterest.com/pin/create/button/?url='+(sett.url!==''?sett.url:self.options.url)+'&media='+sett.media+'&description='+sett.description+'" class="pin-it-button" count-layout="'+sett.layout+'">Pin It</a></div>');(function(){var li=document.createElement('script');li.type='text/javascript';li.async=true;li.src='//assets.pinterest.com/js/pinit.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(li,s);})();}},tracking={googlePlus:function(){},facebook:function(){fb=window.setInterval(function(){if(typeof FB!=='undefined'){FB.Event.subscribe('edge.create',function(targetUrl){_gaq.push(['_trackSocial','facebook','like',targetUrl]);});FB.Event.subscribe('edge.remove',function(targetUrl){_gaq.push(['_trackSocial','facebook','unlike',targetUrl]);});FB.Event.subscribe('message.send',function(targetUrl){_gaq.push(['_trackSocial','facebook','send',targetUrl]);});clearInterval(fb);}},1000);},twitter:function(){tw=window.setInterval(function(){if(typeof twttr!=='undefined'){twttr.events.bind('tweet',function(event){if(event){_gaq.push(['_trackSocial','twitter','tweet']);}});clearInterval(tw);}},1000);},digg:function(){},delicious:function(){},stumbleupon:function(){},linkedin:function(){function LinkedInShare(){_gaq.push(['_trackSocial','linkedin','share']);}},pinterest:function(){}},popup={googlePlus:function(opt){window.open("https://plus.google.com/share?hl="+opt.buttons.googlePlus.lang+"&url="+encodeURIComponent((opt.buttons.googlePlus.url!==''?opt.buttons.googlePlus.url:opt.url)),"","toolbar=0, status=0, width=900, height=500");},facebook:function(opt){window.open("//www.facebook.com/sharer/sharer.php?u="+encodeURIComponent((opt.buttons.facebook.url!==''?opt.buttons.facebook.url:opt.url))+"&t="+opt.text+"","","toolbar=0, status=0, width=900, height=500");},twitter:function(opt){window.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(opt.text)+"&url="+encodeURIComponent((opt.buttons.twitter.url!==''?opt.buttons.twitter.url:opt.url))+(opt.buttons.twitter.via!==''?'&via='+opt.buttons.twitter.via:''),"","toolbar=0, status=0, width=650, height=360");},digg:function(opt){window.open("//digg.com/tools/diggthis/submit?url="+encodeURIComponent((opt.buttons.digg.url!==''?opt.buttons.digg.url:opt.url))+"&title="+opt.text+"&related=true&style=true","","toolbar=0, status=0, width=650, height=360");},delicious:function(opt){window.open('//www.delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent((opt.buttons.delicious.url!==''?opt.buttons.delicious.url:opt.url))+'&title='+opt.text,'delicious','toolbar=no,width=550,height=550');},stumbleupon:function(opt){window.open('//www.stumbleupon.com/badge/?url='+encodeURIComponent((opt.buttons.delicious.url!==''?opt.buttons.delicious.url:opt.url)),'stumbleupon','toolbar=no,width=550,height=550');},linkedin:function(opt){window.open('https://www.linkedin.com/cws/share?url='+encodeURIComponent((opt.buttons.delicious.url!==''?opt.buttons.delicious.url:opt.url))+'&token=&isFramed=true','linkedin','toolbar=no,width=550,height=550');},pinterest:function(opt){window.open('//pinterest.com/pin/create/button/?url='+encodeURIComponent((opt.buttons.pinterest.url!==''?opt.buttons.pinterest.url:opt.url))+'&media='+encodeURIComponent(opt.buttons.pinterest.media)+'&description='+opt.buttons.pinterest.description,'pinterest','toolbar=no,width=700,height=300');}};function Plugin(element,options){this.element=element;this.options=$.extend(true,{},defaults,options);this.options.share=options.share;this._defaults=defaults;this._name=pluginName;this.init();};Plugin.prototype.init=function(){var self=this;if(this.options.urlCurl!==''){urlJson.googlePlus=this.options.urlCurl+'?url={url}&type=googlePlus';urlJson.stumbleupon=this.options.urlCurl+'?url={url}&type=stumbleupon';}
|
| 11 |
+
$(this.element).addClass(this.options.className);if(typeof $(this.element).data('title')!=='undefined'){this.options.title=$(this.element).attr('data-title');}
|
| 12 |
+
if(typeof $(this.element).data('url')!=='undefined'){this.options.url=$(this.element).data('url');}
|
| 13 |
+
if(typeof $(this.element).data('urlalt')!=='undefined'){this.options.urlalt=$(this.element).data('urlalt');}
|
| 14 |
+
if(typeof $(this.element).data('text')!=='undefined'){this.options.text=$(this.element).data('text');}
|
| 15 |
+
$.each(this.options.share,function(name,val){if(val===true){self.options.shareTotal++;}});if(self.options.enableCounter===true){$.each(this.options.share,function(name,val){if(val===true){try{self.getSocialJson(name);self.getSocialJson(getSocialAltJson);}catch(e){}}});}
|
| 16 |
+
else if(self.options.template!==''){this.options.render(this,this.options);}
|
| 17 |
+
else{this.loadButtons();}
|
| 18 |
+
$(this.element).hover(function(){if($(this).find('.buttons').length===0&&self.options.enableHover===true){self.loadButtons();}
|
| 19 |
+
self.options.hover(self,self.options);},function(){self.options.hide(self,self.options);});$(this.element).click(function(){self.options.click(self,self.options);return false;});};Plugin.prototype.loadButtons=function(){var self=this;$(this.element).append('<div class="buttons"></div>');$.each(self.options.share,function(name,val){if(val==true){loadButton[name](self);if(self.options.enableTracking===true){tracking[name]();}}});};Plugin.prototype.getSocialJson=function(name){var self=this,count=0,url=urlJson[name].replace('{url}',encodeURIComponent(this.options.url));if('twitter'==name){self.options.hideCount=1;self.renderer();self.options.count[name]=0;self.rendererPerso();}else{self.options.hideCount=0;if(this.options.buttons[name].urlCount===true&&this.options.buttons[name].url!==''){url=urlJson[name].replace('{url}',this.options.buttons[name].url);}
|
| 20 |
+
if(url!=''&&self.options.urlCurl!==''){$.getJSON(url,function(json){if(null!=json){if(typeof json.count!=="undefined"){var temp=json.count+'';temp=temp.replace('\u00c2\u00a0','');count+=parseInt(temp,10);}
|
| 21 |
+
else if(json.data&&json.data.length>0&&typeof json.data[0].total_count!=="undefined"){count+=parseInt(json.data[0].total_count,10);}
|
| 22 |
+
else if(typeof json[0]!=="undefined"){count+=parseInt(json[0].total_posts,10);}
|
| 23 |
+
else if(typeof json[0]!=="undefined"){}
|
| 24 |
+
self.options.count[name]=count;self.options.total+=count;self.renderer();self.rendererPerso();}
|
| 25 |
+
else{self.renderer();self.options.count[name]=0;self.rendererPerso();}}).fail(function(){self.options.hideCount=1;self.renderer();self.options.count[name]=0;self.rendererPerso();});}
|
| 26 |
+
else{self.renderer();self.options.count[name]=0;self.rendererPerso();}}};Plugin.prototype.getSocialAltJson=function(name){var self=this,count=0,url=urlJson[name].replace('{url}',encodeURIComponent(this.options.urlalt));self.options.hideCount=0;if(this.options.buttons[name].urlCount===true&&this.options.buttons[name].url!==''){url=urlJson[name].replace('{url}',this.options.buttons[name].url);}
|
| 27 |
+
if(url!=''&&self.options.urlCurl!==''){$.getJSON(url,function(json){if(null!=json){if(typeof json.count!=="undefined"){var temp=json.count+'';temp=temp.replace('\u00c2\u00a0','');count+=parseInt(temp,10);}
|
| 28 |
+
else if(json.data&&json.data.length>0&&typeof json.data[0].total_count!=="undefined"){count+=parseInt(json.data[0].total_count,10);}
|
| 29 |
+
else if(typeof json[0]!=="undefined"){count+=parseInt(json[0].total_posts,10);}
|
| 30 |
+
else if(typeof json[0]!=="undefined"){}
|
| 31 |
+
self.options.count[name]+=count;self.options.total+=count;self.renderer();self.rendererPerso();}
|
| 32 |
+
else{self.renderer();self.rendererPerso();}}).fail(function(){self.renderer();self.rendererPerso();});}
|
| 33 |
+
else{self.renderer();self.rendererPerso();}};Plugin.prototype.rendererPerso=function(){var shareCount=0;for(e in this.options.count){shareCount++;}
|
| 34 |
+
if(shareCount===this.options.shareTotal){this.options.render(this,this.options);}};Plugin.prototype.renderer=function(){var total=this.options.total,template=this.options.template
|
| 35 |
+
hideCount=this.options.hideCount;if(hideCount){$(this.element).html('<div class="box no-count">'+
|
| 36 |
+
(this.options.title!==''?'<a class="share" href="#">'+this.options.title+'</a>':'')+'</div>');}
|
| 37 |
+
else{if(this.options.shorterTotal===true){total=this.shorterTotal(total);}
|
| 38 |
+
if(template!==''){template=template.replace('{total}',total);$(this.element).html(template);}
|
| 39 |
+
else{$(this.element).html('<div class="box"><a class="count" href="#">'+total+'</a>'+
|
| 40 |
+
(this.options.title!==''?'<a class="share" href="#">'+this.options.title+'</a>':'')+'</div>');}}};Plugin.prototype.shorterTotal=function(num){if(num>=1e6){num=(num/1e6).toFixed(2)+"M"}else if(num>=1e3){num=(num/1e3).toFixed(1)+"k"}
|
| 41 |
+
return num;};Plugin.prototype.openPopup=function(site){popup[site](this.options);if(this.options.enableTracking===true){var tracking={googlePlus:{site:'Google',action:'+1'},facebook:{site:'facebook',action:'like'},twitter:{site:'twitter',action:'tweet'},digg:{site:'digg',action:'add'},delicious:{site:'delicious',action:'add'},stumbleupon:{site:'stumbleupon',action:'add'},linkedin:{site:'linkedin',action:'share'},pinterest:{site:'pinterest',action:'pin'}};_gaq.push(['_trackSocial',tracking[site].site,tracking[site].action]);}};Plugin.prototype.simulateClick=function(){var html=$(this.element).html();$(this.element).html(html.replace(this.options.total,this.options.total+1));};Plugin.prototype.update=function(url,text){if(url!==''){this.options.url=url;}
|
| 42 |
+
if(text!==''){this.options.text=text;}};$.fn[pluginName]=function(options){var args=arguments;if(options===undefined||typeof options==='object'){return this.each(function(){if(!$.data(this,'plugin_'+pluginName)){$.data(this,'plugin_'+pluginName,new Plugin(this,options));}});}else if(typeof options==='string'&&options[0]!=='_'&&options!=='init'){return this.each(function(){var instance=$.data(this,'plugin_'+pluginName);if(instance instanceof Plugin&&typeof instance[options]==='function'){instance[options].apply(instance,Array.prototype.slice.call(args,1));}});}};})(jQuery,window,document);
|
package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "genesis-simple-share",
|
| 3 |
+
"description": "Development files for the Genesis Simple Share plugin.",
|
| 4 |
+
"repository": {
|
| 5 |
+
"type": "git",
|
| 6 |
+
"url": "https://github.com/copyblogger/genesis-simple-share"
|
| 7 |
+
},
|
| 8 |
+
"dependencies": {},
|
| 9 |
+
"devDependencies": {
|
| 10 |
+
"grunt": "^0.4.5",
|
| 11 |
+
"grunt-autoprefixer": "^0.8.1",
|
| 12 |
+
"grunt-checktextdomain": "^0.1.1",
|
| 13 |
+
"grunt-contrib-cssmin": "^0.10.0",
|
| 14 |
+
"grunt-contrib-imagemin": "^0.7.1",
|
| 15 |
+
"grunt-contrib-jshint": "^0.10.0",
|
| 16 |
+
"grunt-contrib-uglify": "^0.5.0",
|
| 17 |
+
"grunt-contrib-watch": "^0.6.1",
|
| 18 |
+
"grunt-csscomb": "~2.0.1",
|
| 19 |
+
"grunt-jsbeautifier": "^0.2.7",
|
| 20 |
+
"grunt-jsvalidate": "^0.2.2",
|
| 21 |
+
"grunt-phplint": "0.0.5",
|
| 22 |
+
"grunt-styledocco": "^0.1.4",
|
| 23 |
+
"grunt-wp-i18n": "^0.5.3",
|
| 24 |
+
"load-grunt-tasks": "^3.3.0"
|
| 25 |
+
},
|
| 26 |
+
"plugin": {
|
| 27 |
+
"name": "Genesis Simple Share",
|
| 28 |
+
"uri": "https://github.com/copyblogger/genesis-simple-share",
|
| 29 |
+
"description": "A simple sharing plugin using the Share script.",
|
| 30 |
+
"author": "StudioPress",
|
| 31 |
+
"authoruri": "http://www.studiopress.com/",
|
| 32 |
+
"version": "1.0.5",
|
| 33 |
+
"license": "GPL-2.0+",
|
| 34 |
+
"licenseuri": "http://www.gnu.org/licenses/gpl-2.0.html",
|
| 35 |
+
"textdomain": "genesis-simple-share"
|
| 36 |
+
}
|
| 37 |
+
}
|
plugin.php
CHANGED
|
@@ -1,19 +1,22 @@
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
Description: A simple sharing plugin using the Share script.
|
| 6 |
-
Version: 1.0.3
|
| 7 |
-
Author: copyblogger
|
| 8 |
-
Author URI: http://www.copyblogger.com
|
| 9 |
-
Text Domain: genesis-simple-share
|
| 10 |
-
Domain Path /languages/
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
*/
|
| 13 |
|
| 14 |
-
|
| 15 |
-
if ( !defined( 'ABSPATH' ) ) {
|
| 16 |
-
die(
|
| 17 |
}
|
| 18 |
|
| 19 |
define( 'GENESIS_SIMPLE_SHARE_LIB', dirname( __FILE__ ) . '/lib/' );
|
|
@@ -29,16 +32,16 @@ add_action( 'genesis_init', 'genesis_simple_share_init', 99 );
|
|
| 29 |
*/
|
| 30 |
function genesis_simple_share_init() {
|
| 31 |
|
| 32 |
-
|
| 33 |
load_plugin_textdomain( 'genesis-simple-share', false, basename( dirname( __FILE__ ) ) . '/languages/' );
|
| 34 |
-
|
| 35 |
-
if( is_admin() && class_exists( 'Genesis_Admin_Boxes' ) ) {
|
| 36 |
require_once( GENESIS_SIMPLE_SHARE_LIB . 'admin.php' );
|
| 37 |
require_once( GENESIS_SIMPLE_SHARE_LIB . 'post-meta.php' );
|
| 38 |
}
|
| 39 |
else
|
| 40 |
require_once( GENESIS_SIMPLE_SHARE_LIB . 'front-end.php' );
|
| 41 |
-
|
| 42 |
//require_once( GENESIS_SIMPLE_SHArE_LIB . 'functions.php' );
|
| 43 |
|
| 44 |
}
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
+
Plugin Name: Genesis Simple Share
|
| 4 |
+
Plugin URI:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
+
Description: A simple sharing plugin using the Share script.
|
| 7 |
+
|
| 8 |
+
Version: 1.0.5
|
| 9 |
+
|
| 10 |
+
Author: copyblogger
|
| 11 |
+
Author URI: http://www.copyblogger.com
|
| 12 |
+
|
| 13 |
+
Text Domain: genesis-simple-share
|
| 14 |
+
Domain Path /languages/
|
| 15 |
*/
|
| 16 |
|
| 17 |
+
//* Prevent direct access to the plugin
|
| 18 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
| 19 |
+
die( __( 'Sorry, you are not allowed to access this page directly.', 'genesis-simple-share' ) );
|
| 20 |
}
|
| 21 |
|
| 22 |
define( 'GENESIS_SIMPLE_SHARE_LIB', dirname( __FILE__ ) . '/lib/' );
|
| 32 |
*/
|
| 33 |
function genesis_simple_share_init() {
|
| 34 |
|
| 35 |
+
//* Load textdomain for translation
|
| 36 |
load_plugin_textdomain( 'genesis-simple-share', false, basename( dirname( __FILE__ ) ) . '/languages/' );
|
| 37 |
+
|
| 38 |
+
if ( is_admin() && class_exists( 'Genesis_Admin_Boxes' ) ) {
|
| 39 |
require_once( GENESIS_SIMPLE_SHARE_LIB . 'admin.php' );
|
| 40 |
require_once( GENESIS_SIMPLE_SHARE_LIB . 'post-meta.php' );
|
| 41 |
}
|
| 42 |
else
|
| 43 |
require_once( GENESIS_SIMPLE_SHARE_LIB . 'front-end.php' );
|
| 44 |
+
|
| 45 |
//require_once( GENESIS_SIMPLE_SHArE_LIB . 'functions.php' );
|
| 46 |
|
| 47 |
}
|
readme.txt
CHANGED
|
@@ -2,8 +2,8 @@
|
|
| 2 |
Contributors: nathanrice, studiopress, wpmuguru, nick_thegeek, bgardner
|
| 3 |
Tags: genesis, share, share buttons, facebook, twitter, pinterest, stumbleupon, linkedin, social
|
| 4 |
Requires at least: 3.7
|
| 5 |
-
Tested up to: 4.1
|
| 6 |
-
Stable tag: 1.0.
|
| 7 |
License: GPLv2 or later
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 9 |
|
|
@@ -31,6 +31,13 @@ https://github.com/copyblogger/genesis-simple-share/wiki/Usage-Tips
|
|
| 31 |
|
| 32 |
== Changelog ==
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
= 1.0.3 =
|
| 35 |
* Fix error resulting in double icon output
|
| 36 |
|
|
@@ -49,4 +56,4 @@ https://github.com/copyblogger/genesis-simple-share/wiki/Usage-Tips
|
|
| 49 |
* Fixes potential error where only first post in archive will show share buttons
|
| 50 |
|
| 51 |
= 1.0 =
|
| 52 |
-
Plugin was added to the WordPress.org repo. Users should update to ensure they have the latest code.
|
| 2 |
Contributors: nathanrice, studiopress, wpmuguru, nick_thegeek, bgardner
|
| 3 |
Tags: genesis, share, share buttons, facebook, twitter, pinterest, stumbleupon, linkedin, social
|
| 4 |
Requires at least: 3.7
|
| 5 |
+
Tested up to: 4.3.1
|
| 6 |
+
Stable tag: 1.0.5
|
| 7 |
License: GPLv2 or later
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 9 |
|
| 31 |
|
| 32 |
== Changelog ==
|
| 33 |
|
| 34 |
+
= 1.0.5 =
|
| 35 |
+
* Fixed: styling issues following removal of tweet count
|
| 36 |
+
|
| 37 |
+
= 1.0.4 =
|
| 38 |
+
* Include a force to show argument in icon output functions
|
| 39 |
+
* Disabled Twitter counter for now because twitter is removing the ability to get the counts after 10-2015.
|
| 40 |
+
|
| 41 |
= 1.0.3 =
|
| 42 |
* Fix error resulting in double icon output
|
| 43 |
|
| 56 |
* Fixes potential error where only first post in archive will show share buttons
|
| 57 |
|
| 58 |
= 1.0 =
|
| 59 |
+
Plugin was added to the WordPress.org repo. Users should update to ensure they have the latest code.
|
