Version Description
- Important release, Please upgrade immediately.
=
Download this release
Release Info
| Developer | hiddenpearls |
| Plugin | |
| Version | 1.8.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.7.11 to 1.8.0
- readme.txt +5 -2
- simple-social-buttons.php +128 -57
- ssb-admin.php +218 -67
readme.txt
CHANGED
|
@@ -4,7 +4,7 @@ Donate link: https://wpbrigade.com/
|
|
| 4 |
Tags: facebook, google, twitter, pinterest, plus one, like it, like, share, pin, pin it
|
| 5 |
Requires at least: 2.8
|
| 6 |
Tested up to: 4.8
|
| 7 |
-
Stable tag: 1.
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
|
@@ -111,12 +111,15 @@ Big thanks to:
|
|
| 111 |
|
| 112 |
== Upgrade Notice ==
|
| 113 |
|
| 114 |
-
= 1.
|
| 115 |
* Important release, Please upgrade immediately.
|
| 116 |
|
| 117 |
|
| 118 |
== Changelog ==
|
| 119 |
|
|
|
|
|
|
|
|
|
|
| 120 |
= 1.0 =
|
| 121 |
* First stable release.
|
| 122 |
|
| 4 |
Tags: facebook, google, twitter, pinterest, plus one, like it, like, share, pin, pin it
|
| 5 |
Requires at least: 2.8
|
| 6 |
Tested up to: 4.8
|
| 7 |
+
Stable tag: 1.8.0
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 111 |
|
| 112 |
== Upgrade Notice ==
|
| 113 |
|
| 114 |
+
= 1.8.0 =
|
| 115 |
* Important release, Please upgrade immediately.
|
| 116 |
|
| 117 |
|
| 118 |
== Changelog ==
|
| 119 |
|
| 120 |
+
= 1.8.0 =
|
| 121 |
+
* Styling and Code improvement.
|
| 122 |
+
|
| 123 |
= 1.0 =
|
| 124 |
* First stable release.
|
| 125 |
|
simple-social-buttons.php
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
* Plugin Name: Simple Social Buttons
|
| 5 |
* Plugin URI: http://www.WPBrigade.com/wordpress/plugins/simple-social-buttons/
|
| 6 |
* Description: Insert social buttons into posts and archives: Facebook "Like it", Google Plus One "+1", Twitter share and Pinterest.
|
| 7 |
-
* Version: 1.
|
| 8 |
* Author: WPBrigade
|
| 9 |
* Author URI: http://adnan.pk/
|
| 10 |
*/
|
|
@@ -39,7 +39,7 @@ class SimpleSocialButtonsPR {
|
|
| 39 |
var $pluginVersion = '1.7.11';
|
| 40 |
var $pluginPrefix = 'ssb_pr_';
|
| 41 |
var $hideCustomMetaKey = '_ssb_hide';
|
| 42 |
-
|
| 43 |
// plugin default settings
|
| 44 |
var $pluginDefaultSettings = array(
|
| 45 |
'googleplus' => '1',
|
|
@@ -56,7 +56,7 @@ class SimpleSocialButtonsPR {
|
|
| 56 |
|
| 57 |
// defined buttons
|
| 58 |
var $arrKnownButtons = array('fblike', 'googleplus', 'twitter', 'pinterest');
|
| 59 |
-
|
| 60 |
// an array to store current settings, to avoid passing them between functions
|
| 61 |
var $settings = array();
|
| 62 |
|
|
@@ -72,7 +72,7 @@ class SimpleSocialButtonsPR {
|
|
| 72 |
* Action hooks
|
| 73 |
*/
|
| 74 |
add_action( 'create_ssb', array(&$this, 'direct_display'), 10 , 1);
|
| 75 |
-
|
| 76 |
/**
|
| 77 |
* basic init
|
| 78 |
*/
|
|
@@ -83,10 +83,10 @@ class SimpleSocialButtonsPR {
|
|
| 83 |
|
| 84 |
// social JS + CSS data
|
| 85 |
add_action( 'wp_footer', array(&$this, 'include_social_js') );
|
| 86 |
-
if(!
|
| 87 |
add_action( 'wp_head', array(&$this, 'include_css') );
|
| 88 |
}
|
| 89 |
-
|
| 90 |
/**
|
| 91 |
* Filter hooks
|
| 92 |
*/
|
|
@@ -116,12 +116,12 @@ class SimpleSocialButtonsPR {
|
|
| 116 |
$lang = get_bloginfo('language');
|
| 117 |
$lang_g = strtolower(substr($lang, 0, 2));
|
| 118 |
$lang_fb = str_replace('-', '_', $lang);
|
| 119 |
-
|
| 120 |
// most common problem with incorrect WPLANG in /wp-config.php
|
| 121 |
if($lang_fb == "en" || empty($lang_fb)) {
|
| 122 |
$lang_fb = "en_US";
|
| 123 |
}
|
| 124 |
-
|
| 125 |
/**
|
| 126 |
* Disable loading of social network JS if disabled for specific post type
|
| 127 |
*
|
|
@@ -146,7 +146,7 @@ window.___gcfg = {lang: '<?php echo $lang_g; ?>'};
|
|
| 146 |
})();
|
| 147 |
<?php endif;?>
|
| 148 |
<?php if ((int)$this->settings['fblike'] != 0):?>
|
| 149 |
-
// facebook
|
| 150 |
(function(d, s, id) {
|
| 151 |
var js, fjs = d.getElementsByTagName(s)[0];
|
| 152 |
if (d.getElementById(id)) return;
|
|
@@ -156,7 +156,7 @@ window.___gcfg = {lang: '<?php echo $lang_g; ?>'};
|
|
| 156 |
}(document, 'script', 'facebook-jssdk'));
|
| 157 |
<?php endif;?>
|
| 158 |
<?php if ((int)$this->settings['twitter'] != 0):?>
|
| 159 |
-
// twitter
|
| 160 |
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
|
| 161 |
<?php endif;?>
|
| 162 |
// ]]>
|
|
@@ -183,6 +183,9 @@ window.___gcfg = {lang: '<?php echo $lang_g; ?>'};
|
|
| 183 |
div.ssb-button-twitter { width: 130px; }
|
| 184 |
div.ssb-button-pinterest { width: 100px; }
|
| 185 |
.fb-like iframe { max-width: none !important; }
|
|
|
|
|
|
|
|
|
|
| 186 |
</style>
|
| 187 |
<!-- End of Simple Social Buttons -->
|
| 188 |
|
|
@@ -236,7 +239,7 @@ window.___gcfg = {lang: '<?php echo $lang_g; ?>'};
|
|
| 236 |
}
|
| 237 |
|
| 238 |
|
| 239 |
-
/**
|
| 240 |
* Get settings from database
|
| 241 |
*/
|
| 242 |
public function get_settings() {
|
|
@@ -249,7 +252,7 @@ window.___gcfg = {lang: '<?php echo $lang_g; ?>'};
|
|
| 249 |
}
|
| 250 |
|
| 251 |
/**
|
| 252 |
-
* Update settings
|
| 253 |
*/
|
| 254 |
function update_settings( $newSettings = array() ) {
|
| 255 |
$return = false;
|
|
@@ -314,12 +317,12 @@ window.___gcfg = {lang: '<?php echo $lang_g; ?>'};
|
|
| 314 |
/**
|
| 315 |
* Insert the buttons to the content
|
| 316 |
*/
|
| 317 |
-
function insert_buttons($content) {
|
| 318 |
// Insert or not?
|
| 319 |
if(!$this->where_to_insert() ) {
|
| 320 |
return $content;
|
| 321 |
}
|
| 322 |
-
|
| 323 |
// creating order
|
| 324 |
$order = array();
|
| 325 |
foreach ($this->arrKnownButtons as $button_name) {
|
|
@@ -353,33 +356,33 @@ window.___gcfg = {lang: '<?php echo $lang_g; ?>'};
|
|
| 353 |
return $content;
|
| 354 |
|
| 355 |
}
|
| 356 |
-
|
| 357 |
function direct_display($order = null)
|
| 358 |
{
|
| 359 |
// Return false if hide SSB for this page/post is disabled
|
| 360 |
if (is_single() && array_shift(get_post_meta(get_the_ID(), $this->hideCustomMetaKey)) == 'true') return false;
|
| 361 |
-
|
| 362 |
// Display buttons and scripts
|
| 363 |
$buttons_code = $this->generate_buttons_code($order);
|
| 364 |
echo $buttons_code;
|
| 365 |
$this->include_social_js(true);
|
| 366 |
}
|
| 367 |
-
|
| 368 |
/**
|
| 369 |
* Generate buttons html code with specified order
|
| 370 |
-
*
|
| 371 |
* @param mixed $order - order of social buttons
|
| 372 |
*/
|
| 373 |
function generate_buttons_code($order = null)
|
| 374 |
-
{
|
| 375 |
foreach ($this->arrKnownButtons as $button_name) {
|
| 376 |
$defaultOrder[$button_name] = $this->pluginDefaultSettings[$button_name];
|
| 377 |
}
|
| 378 |
-
|
| 379 |
$order = wp_parse_args($order, $defaultOrder);
|
| 380 |
|
| 381 |
// define empty buttons code to use
|
| 382 |
-
$ssb_buttonscode = '';
|
| 383 |
|
| 384 |
// get post permalink and title
|
| 385 |
$permalink = get_permalink();
|
|
@@ -395,7 +398,7 @@ window.___gcfg = {lang: '<?php echo $lang_g; ?>'};
|
|
| 395 |
@asort($arrButtons);
|
| 396 |
|
| 397 |
$arrButtonsCode = array();
|
| 398 |
-
foreach($arrButtons as $button_name => $button_sort) {
|
| 399 |
switch($button_name) {
|
| 400 |
case 'googleplus':
|
| 401 |
$arrButtonsCode[] = '<div class="simplesocialbutton ssb-button-googleplus"><!-- Google Plus One--><div class="g-plusone" data-size="medium" data-href="'.$permalink.'"></div></div>';
|
|
@@ -407,19 +410,20 @@ window.___gcfg = {lang: '<?php echo $lang_g; ?>'};
|
|
| 407 |
$arrButtonsCode[] = '<div class="simplesocialbutton ssb-button-twitter"><!-- Twitter--><a href="https://twitter.com/share" class="twitter-share-button" data-text="'.$title.'" data-url="'.$permalink.'" ' . ((!empty($this->settings['twitterusername'])) ? 'data-via="'.$this->settings['twitterusername'].'" ' : '') . 'rel="nofollow"></a></div>';
|
| 408 |
break;
|
| 409 |
case 'pinterest':
|
|
|
|
| 410 |
$thumb_id = get_post_thumbnail_id($post->ID);
|
| 411 |
-
|
| 412 |
-
// Don't show 'Pin It' button, if post doesn't have thumbnail
|
| 413 |
if (empty($thumb_id)) break;
|
| 414 |
-
|
| 415 |
// Getting thumbnail url
|
| 416 |
$thumb = wp_get_attachment_image_src($thumb_id, 'thumbnail_size' );
|
| 417 |
$thumb_src = (isset($thumb[0])) ? $thumb[0] : null;
|
| 418 |
$thumb_alt = get_post_meta($thumb_id , '_wp_attachment_image_alt', true);
|
| 419 |
-
|
| 420 |
// if there isn't thumbnail alt, take a post title as a description
|
| 421 |
$description = (!empty($thumb_alt)) ? $thumb_alt : $title ;
|
| 422 |
-
|
| 423 |
$arrButtonsCode[] = '<div class="simplesocialbutton ssb-button-pinterest"><!-- Pinterest--><a href="http://pinterest.com/pin/create/button/?url='.urlencode($permalink).'&media='.urlencode($thumb_src).'&description='.urlencode($description).'" data-pin-do="buttonPin" data-pin-config="beside" rel="nofollow"><img border="0" src="<a href="//www.pinterest.com/pin/create/button/?url=http%3A%2F%2Fwww.flickr.com%2Fphotos%2Fkentbrew%2F6851755809%2F&media=http%3A%2F%2Ffarm8.staticflickr.com%2F7027%2F6851755809_df5b2051c9_z.jpg&description=Next%20stop%3A%20Pinterest" data-pin-do="buttonPin" data-pin-config="beside"><img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png" title="Pin It" /></a></div>';
|
| 424 |
break;
|
| 425 |
}
|
|
@@ -430,7 +434,7 @@ window.___gcfg = {lang: '<?php echo $lang_g; ?>'};
|
|
| 430 |
$ssb_buttonscode .= implode("\n", $arrButtonsCode) . "\n";
|
| 431 |
$ssb_buttonscode .= '</div>'."\n";
|
| 432 |
}
|
| 433 |
-
|
| 434 |
return $ssb_buttonscode;
|
| 435 |
}
|
| 436 |
} // end class
|
|
@@ -449,13 +453,15 @@ class SimpleSocialButtonsPR_Admin extends SimpleSocialButtonsPR {
|
|
| 449 |
add_action('admin_menu', array(&$this, 'admin_actions') );
|
| 450 |
add_action('add_meta_boxes', array(&$this, 'ssb_meta_box'));
|
| 451 |
add_action('save_post', array(&$this, 'ssb_save_meta'), 10, 2);
|
| 452 |
-
|
| 453 |
add_filter('plugin_action_links', array(&$this, 'plugin_action_links'), 10, 2 );
|
|
|
|
|
|
|
| 454 |
}
|
| 455 |
|
| 456 |
public function admin_actions() {
|
| 457 |
-
if (current_user_can('activate_plugins'))
|
| 458 |
-
add_options_page('Simple Social Buttons ', '
|
| 459 |
}
|
| 460 |
|
| 461 |
public function admin_page() {
|
|
@@ -480,59 +486,59 @@ class SimpleSocialButtonsPR_Admin extends SimpleSocialButtonsPR {
|
|
| 480 |
|
| 481 |
return $links;
|
| 482 |
}
|
| 483 |
-
|
| 484 |
/**
|
| 485 |
* Register meta box to hide/show SSB plugin on single post or page
|
| 486 |
*/
|
| 487 |
public function ssb_meta_box()
|
| 488 |
-
{
|
| 489 |
$postId = $_GET['post'];
|
| 490 |
$postType = get_post_type($postId);
|
| 491 |
-
|
| 492 |
if ($postType != 'page' && $postType != 'post') return false;
|
| 493 |
-
|
| 494 |
$currentSsbHide = get_post_custom_values($this->hideCustomMetaKey, $postId);
|
| 495 |
-
|
| 496 |
if ($currentSsbHide[0] == 'true') {
|
| 497 |
$checked = true;
|
| 498 |
} else {
|
| 499 |
-
$checked = false;
|
| 500 |
}
|
| 501 |
-
|
| 502 |
// Rendering meta box
|
| 503 |
if (!function_exists('add_meta_box')) include('includes/template.php');
|
| 504 |
add_meta_box('ssb_meta_box', __('SSB Settings', 'simplesocialbuttons'), array(&$this, 'render_ssb_meta_box'), $postType, 'side', 'default', array('type' => $postType, 'checked' => $checked));
|
| 505 |
}
|
| 506 |
-
|
| 507 |
/**
|
| 508 |
* Showing custom meta field
|
| 509 |
*/
|
| 510 |
public function render_ssb_meta_box($post, $metabox)
|
| 511 |
{
|
| 512 |
-
wp_nonce_field( plugin_basename( __FILE__ ), 'ssb_noncename' );
|
| 513 |
?>
|
| 514 |
|
| 515 |
<label for="<?php echo $this->hideCustomMetaKey;?>"><input type="checkbox" id="<?php echo $this->hideCustomMetaKey;?>" name="<?php echo $this->hideCustomMetaKey;?>" value="true" <?php if ($metabox['args']['checked']):?>checked="checked"<?php endif;?>/> <?php echo __('Hide Simple Social Buttons', 'simplesocialbuttons');?></label>
|
| 516 |
|
| 517 |
<?php
|
| 518 |
}
|
| 519 |
-
|
| 520 |
-
|
| 521 |
/**
|
| 522 |
* Saving custom meta value
|
| 523 |
*/
|
| 524 |
public function ssb_save_meta($post_id, $post)
|
| 525 |
-
{
|
| 526 |
$postId = (int)$post_id;
|
| 527 |
-
|
| 528 |
-
// Verify if this is an auto save routine.
|
| 529 |
-
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
| 530 |
return;
|
| 531 |
-
|
| 532 |
// Verify this came from the our screen and with proper authorization
|
| 533 |
if ( !wp_verify_nonce( $_POST['ssb_noncename'], plugin_basename( __FILE__ ) ) )
|
| 534 |
return;
|
| 535 |
-
|
| 536 |
// Check permissions
|
| 537 |
if ( 'page' == $_POST['post_type'] ) {
|
| 538 |
if ( !current_user_can( 'edit_page', $post_id ) )
|
|
@@ -541,13 +547,78 @@ class SimpleSocialButtonsPR_Admin extends SimpleSocialButtonsPR {
|
|
| 541 |
if ( !current_user_can( 'edit_post', $post_id ) )
|
| 542 |
return;
|
| 543 |
}
|
| 544 |
-
|
| 545 |
// Saving data
|
| 546 |
$newValue = (isset($_POST[$this->hideCustomMetaKey])) ? $_POST[$this->hideCustomMetaKey] : 'false';
|
| 547 |
-
|
| 548 |
update_post_meta($postId, $this->hideCustomMetaKey, $newValue);
|
| 549 |
}
|
| 550 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 551 |
|
| 552 |
} // end SimpleSocialButtonsPR_Admin
|
| 553 |
|
|
@@ -559,23 +630,23 @@ if(is_admin() ) {
|
|
| 559 |
|
| 560 |
/**
|
| 561 |
* Function to insert Simple Social Buttons directly in template.
|
| 562 |
-
*
|
| 563 |
* @param mixed $order - order of the buttons in array or string (parsed by wp_parse_args())
|
| 564 |
-
*
|
| 565 |
* @example 1 - use in template with default order
|
| 566 |
* get_ssb();
|
| 567 |
-
*
|
| 568 |
* @example 2 - use in template with specified order
|
| 569 |
* get_ssb('googleplus=3&fblike=2&twitter=1');
|
| 570 |
-
*
|
| 571 |
* @example 3 - hiding button by setting order to 0. By using code below googleplus button won't be displayed
|
| 572 |
* get_ssb('googleplus=0&fblike=1&twitter=2');
|
| 573 |
-
*
|
| 574 |
-
*
|
| 575 |
*/
|
| 576 |
function get_ssb($order = null)
|
| 577 |
{
|
| 578 |
do_action('create_ssb', $order);
|
| 579 |
}
|
| 580 |
|
| 581 |
-
?>
|
| 4 |
* Plugin Name: Simple Social Buttons
|
| 5 |
* Plugin URI: http://www.WPBrigade.com/wordpress/plugins/simple-social-buttons/
|
| 6 |
* Description: Insert social buttons into posts and archives: Facebook "Like it", Google Plus One "+1", Twitter share and Pinterest.
|
| 7 |
+
* Version: 1.8.0
|
| 8 |
* Author: WPBrigade
|
| 9 |
* Author URI: http://adnan.pk/
|
| 10 |
*/
|
| 39 |
var $pluginVersion = '1.7.11';
|
| 40 |
var $pluginPrefix = 'ssb_pr_';
|
| 41 |
var $hideCustomMetaKey = '_ssb_hide';
|
| 42 |
+
|
| 43 |
// plugin default settings
|
| 44 |
var $pluginDefaultSettings = array(
|
| 45 |
'googleplus' => '1',
|
| 56 |
|
| 57 |
// defined buttons
|
| 58 |
var $arrKnownButtons = array('fblike', 'googleplus', 'twitter', 'pinterest');
|
| 59 |
+
|
| 60 |
// an array to store current settings, to avoid passing them between functions
|
| 61 |
var $settings = array();
|
| 62 |
|
| 72 |
* Action hooks
|
| 73 |
*/
|
| 74 |
add_action( 'create_ssb', array(&$this, 'direct_display'), 10 , 1);
|
| 75 |
+
|
| 76 |
/**
|
| 77 |
* basic init
|
| 78 |
*/
|
| 83 |
|
| 84 |
// social JS + CSS data
|
| 85 |
add_action( 'wp_footer', array(&$this, 'include_social_js') );
|
| 86 |
+
if(!empty($this->settings['override_css'])) {
|
| 87 |
add_action( 'wp_head', array(&$this, 'include_css') );
|
| 88 |
}
|
| 89 |
+
|
| 90 |
/**
|
| 91 |
* Filter hooks
|
| 92 |
*/
|
| 116 |
$lang = get_bloginfo('language');
|
| 117 |
$lang_g = strtolower(substr($lang, 0, 2));
|
| 118 |
$lang_fb = str_replace('-', '_', $lang);
|
| 119 |
+
|
| 120 |
// most common problem with incorrect WPLANG in /wp-config.php
|
| 121 |
if($lang_fb == "en" || empty($lang_fb)) {
|
| 122 |
$lang_fb = "en_US";
|
| 123 |
}
|
| 124 |
+
|
| 125 |
/**
|
| 126 |
* Disable loading of social network JS if disabled for specific post type
|
| 127 |
*
|
| 146 |
})();
|
| 147 |
<?php endif;?>
|
| 148 |
<?php if ((int)$this->settings['fblike'] != 0):?>
|
| 149 |
+
// facebook
|
| 150 |
(function(d, s, id) {
|
| 151 |
var js, fjs = d.getElementsByTagName(s)[0];
|
| 152 |
if (d.getElementById(id)) return;
|
| 156 |
}(document, 'script', 'facebook-jssdk'));
|
| 157 |
<?php endif;?>
|
| 158 |
<?php if ((int)$this->settings['twitter'] != 0):?>
|
| 159 |
+
// twitter
|
| 160 |
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
|
| 161 |
<?php endif;?>
|
| 162 |
// ]]>
|
| 183 |
div.ssb-button-twitter { width: 130px; }
|
| 184 |
div.ssb-button-pinterest { width: 100px; }
|
| 185 |
.fb-like iframe { max-width: none !important; }
|
| 186 |
+
.simplesocialbuttons .simplesocialbutton { display: inline-block; vertical-align: top; width: auto; }
|
| 187 |
+
.simplesocialbuttons .simplesocialbutton iframe { margin: 0; }
|
| 188 |
+
.simplesocialbuttons .simplesocialbutton + .simplesocialbutton { margin-left: 20px; }
|
| 189 |
</style>
|
| 190 |
<!-- End of Simple Social Buttons -->
|
| 191 |
|
| 239 |
}
|
| 240 |
|
| 241 |
|
| 242 |
+
/**
|
| 243 |
* Get settings from database
|
| 244 |
*/
|
| 245 |
public function get_settings() {
|
| 252 |
}
|
| 253 |
|
| 254 |
/**
|
| 255 |
+
* Update settings
|
| 256 |
*/
|
| 257 |
function update_settings( $newSettings = array() ) {
|
| 258 |
$return = false;
|
| 317 |
/**
|
| 318 |
* Insert the buttons to the content
|
| 319 |
*/
|
| 320 |
+
function insert_buttons($content) {
|
| 321 |
// Insert or not?
|
| 322 |
if(!$this->where_to_insert() ) {
|
| 323 |
return $content;
|
| 324 |
}
|
| 325 |
+
|
| 326 |
// creating order
|
| 327 |
$order = array();
|
| 328 |
foreach ($this->arrKnownButtons as $button_name) {
|
| 356 |
return $content;
|
| 357 |
|
| 358 |
}
|
| 359 |
+
|
| 360 |
function direct_display($order = null)
|
| 361 |
{
|
| 362 |
// Return false if hide SSB for this page/post is disabled
|
| 363 |
if (is_single() && array_shift(get_post_meta(get_the_ID(), $this->hideCustomMetaKey)) == 'true') return false;
|
| 364 |
+
|
| 365 |
// Display buttons and scripts
|
| 366 |
$buttons_code = $this->generate_buttons_code($order);
|
| 367 |
echo $buttons_code;
|
| 368 |
$this->include_social_js(true);
|
| 369 |
}
|
| 370 |
+
|
| 371 |
/**
|
| 372 |
* Generate buttons html code with specified order
|
| 373 |
+
*
|
| 374 |
* @param mixed $order - order of social buttons
|
| 375 |
*/
|
| 376 |
function generate_buttons_code($order = null)
|
| 377 |
+
{
|
| 378 |
foreach ($this->arrKnownButtons as $button_name) {
|
| 379 |
$defaultOrder[$button_name] = $this->pluginDefaultSettings[$button_name];
|
| 380 |
}
|
| 381 |
+
|
| 382 |
$order = wp_parse_args($order, $defaultOrder);
|
| 383 |
|
| 384 |
// define empty buttons code to use
|
| 385 |
+
$ssb_buttonscode = '';
|
| 386 |
|
| 387 |
// get post permalink and title
|
| 388 |
$permalink = get_permalink();
|
| 398 |
@asort($arrButtons);
|
| 399 |
|
| 400 |
$arrButtonsCode = array();
|
| 401 |
+
foreach($arrButtons as $button_name => $button_sort) {
|
| 402 |
switch($button_name) {
|
| 403 |
case 'googleplus':
|
| 404 |
$arrButtonsCode[] = '<div class="simplesocialbutton ssb-button-googleplus"><!-- Google Plus One--><div class="g-plusone" data-size="medium" data-href="'.$permalink.'"></div></div>';
|
| 410 |
$arrButtonsCode[] = '<div class="simplesocialbutton ssb-button-twitter"><!-- Twitter--><a href="https://twitter.com/share" class="twitter-share-button" data-text="'.$title.'" data-url="'.$permalink.'" ' . ((!empty($this->settings['twitterusername'])) ? 'data-via="'.$this->settings['twitterusername'].'" ' : '') . 'rel="nofollow"></a></div>';
|
| 411 |
break;
|
| 412 |
case 'pinterest':
|
| 413 |
+
global $post;
|
| 414 |
$thumb_id = get_post_thumbnail_id($post->ID);
|
| 415 |
+
|
| 416 |
+
// Don't show 'Pin It' button, if post doesn't have thumbnail
|
| 417 |
if (empty($thumb_id)) break;
|
| 418 |
+
|
| 419 |
// Getting thumbnail url
|
| 420 |
$thumb = wp_get_attachment_image_src($thumb_id, 'thumbnail_size' );
|
| 421 |
$thumb_src = (isset($thumb[0])) ? $thumb[0] : null;
|
| 422 |
$thumb_alt = get_post_meta($thumb_id , '_wp_attachment_image_alt', true);
|
| 423 |
+
|
| 424 |
// if there isn't thumbnail alt, take a post title as a description
|
| 425 |
$description = (!empty($thumb_alt)) ? $thumb_alt : $title ;
|
| 426 |
+
|
| 427 |
$arrButtonsCode[] = '<div class="simplesocialbutton ssb-button-pinterest"><!-- Pinterest--><a href="http://pinterest.com/pin/create/button/?url='.urlencode($permalink).'&media='.urlencode($thumb_src).'&description='.urlencode($description).'" data-pin-do="buttonPin" data-pin-config="beside" rel="nofollow"><img border="0" src="<a href="//www.pinterest.com/pin/create/button/?url=http%3A%2F%2Fwww.flickr.com%2Fphotos%2Fkentbrew%2F6851755809%2F&media=http%3A%2F%2Ffarm8.staticflickr.com%2F7027%2F6851755809_df5b2051c9_z.jpg&description=Next%20stop%3A%20Pinterest" data-pin-do="buttonPin" data-pin-config="beside"><img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png" title="Pin It" /></a></div>';
|
| 428 |
break;
|
| 429 |
}
|
| 434 |
$ssb_buttonscode .= implode("\n", $arrButtonsCode) . "\n";
|
| 435 |
$ssb_buttonscode .= '</div>'."\n";
|
| 436 |
}
|
| 437 |
+
|
| 438 |
return $ssb_buttonscode;
|
| 439 |
}
|
| 440 |
} // end class
|
| 453 |
add_action('admin_menu', array(&$this, 'admin_actions') );
|
| 454 |
add_action('add_meta_boxes', array(&$this, 'ssb_meta_box'));
|
| 455 |
add_action('save_post', array(&$this, 'ssb_save_meta'), 10, 2);
|
| 456 |
+
|
| 457 |
add_filter('plugin_action_links', array(&$this, 'plugin_action_links'), 10, 2 );
|
| 458 |
+
|
| 459 |
+
add_action( 'wp_ajax_ssb_subscriber', array( $this, 'ssb_subscriber' ) );
|
| 460 |
}
|
| 461 |
|
| 462 |
public function admin_actions() {
|
| 463 |
+
if (current_user_can('activate_plugins'))
|
| 464 |
+
add_options_page('Simple Social Buttons ', 'Social Buttons ', "activate_plugins", 'simple-social-buttons', array(&$this, 'admin_page') );
|
| 465 |
}
|
| 466 |
|
| 467 |
public function admin_page() {
|
| 486 |
|
| 487 |
return $links;
|
| 488 |
}
|
| 489 |
+
|
| 490 |
/**
|
| 491 |
* Register meta box to hide/show SSB plugin on single post or page
|
| 492 |
*/
|
| 493 |
public function ssb_meta_box()
|
| 494 |
+
{
|
| 495 |
$postId = $_GET['post'];
|
| 496 |
$postType = get_post_type($postId);
|
| 497 |
+
|
| 498 |
if ($postType != 'page' && $postType != 'post') return false;
|
| 499 |
+
|
| 500 |
$currentSsbHide = get_post_custom_values($this->hideCustomMetaKey, $postId);
|
| 501 |
+
|
| 502 |
if ($currentSsbHide[0] == 'true') {
|
| 503 |
$checked = true;
|
| 504 |
} else {
|
| 505 |
+
$checked = false;
|
| 506 |
}
|
| 507 |
+
|
| 508 |
// Rendering meta box
|
| 509 |
if (!function_exists('add_meta_box')) include('includes/template.php');
|
| 510 |
add_meta_box('ssb_meta_box', __('SSB Settings', 'simplesocialbuttons'), array(&$this, 'render_ssb_meta_box'), $postType, 'side', 'default', array('type' => $postType, 'checked' => $checked));
|
| 511 |
}
|
| 512 |
+
|
| 513 |
/**
|
| 514 |
* Showing custom meta field
|
| 515 |
*/
|
| 516 |
public function render_ssb_meta_box($post, $metabox)
|
| 517 |
{
|
| 518 |
+
wp_nonce_field( plugin_basename( __FILE__ ), 'ssb_noncename' );
|
| 519 |
?>
|
| 520 |
|
| 521 |
<label for="<?php echo $this->hideCustomMetaKey;?>"><input type="checkbox" id="<?php echo $this->hideCustomMetaKey;?>" name="<?php echo $this->hideCustomMetaKey;?>" value="true" <?php if ($metabox['args']['checked']):?>checked="checked"<?php endif;?>/> <?php echo __('Hide Simple Social Buttons', 'simplesocialbuttons');?></label>
|
| 522 |
|
| 523 |
<?php
|
| 524 |
}
|
| 525 |
+
|
| 526 |
+
|
| 527 |
/**
|
| 528 |
* Saving custom meta value
|
| 529 |
*/
|
| 530 |
public function ssb_save_meta($post_id, $post)
|
| 531 |
+
{
|
| 532 |
$postId = (int)$post_id;
|
| 533 |
+
|
| 534 |
+
// Verify if this is an auto save routine.
|
| 535 |
+
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
| 536 |
return;
|
| 537 |
+
|
| 538 |
// Verify this came from the our screen and with proper authorization
|
| 539 |
if ( !wp_verify_nonce( $_POST['ssb_noncename'], plugin_basename( __FILE__ ) ) )
|
| 540 |
return;
|
| 541 |
+
|
| 542 |
// Check permissions
|
| 543 |
if ( 'page' == $_POST['post_type'] ) {
|
| 544 |
if ( !current_user_can( 'edit_page', $post_id ) )
|
| 547 |
if ( !current_user_can( 'edit_post', $post_id ) )
|
| 548 |
return;
|
| 549 |
}
|
| 550 |
+
|
| 551 |
// Saving data
|
| 552 |
$newValue = (isset($_POST[$this->hideCustomMetaKey])) ? $_POST[$this->hideCustomMetaKey] : 'false';
|
| 553 |
+
|
| 554 |
update_post_meta($postId, $this->hideCustomMetaKey, $newValue);
|
| 555 |
}
|
| 556 |
|
| 557 |
+
function ssb_subscriber() {
|
| 558 |
+
|
| 559 |
+
$email = sanitize_email( wp_unslash( $_POST['subscriber_mail'] ) );
|
| 560 |
+
$display_name = sanitize_text_field( wp_unslash( $_POST['name'] ) );
|
| 561 |
+
|
| 562 |
+
|
| 563 |
+
$data = array(
|
| 564 |
+
'email_address' => $email,
|
| 565 |
+
"status_if_new" => "pending",
|
| 566 |
+
// 'status' => 'pending', // "subscribed","unsubscribed","cleaned","pending"
|
| 567 |
+
'merge_fields' => array(
|
| 568 |
+
'FNAME' => $display_name
|
| 569 |
+
),
|
| 570 |
+
'interests' => array(
|
| 571 |
+
'7aec774503' => true, // add interest ? loginPress => d91a783713 || Related Posts Thumbnails => 1c85722a4b || Newsletter Subscribers => 3eefb18f62
|
| 572 |
+
)
|
| 573 |
+
);
|
| 574 |
+
|
| 575 |
+
|
| 576 |
+
$apiKey = '7f32f907a2e6ceeaf8a97fc00b962b2b-us15';
|
| 577 |
+
$listId = '30d28e0fc3';
|
| 578 |
+
|
| 579 |
+
$memberId = md5( strtolower( $data['email_address'] ) );
|
| 580 |
+
$dataCenter = substr( $apiKey , strpos( $apiKey,'-' ) + 1 );
|
| 581 |
+
|
| 582 |
+
|
| 583 |
+
$url = 'https://' . $dataCenter . '.api.mailchimp.com/3.0/lists/' . $listId .'/members/' . $memberId;
|
| 584 |
+
|
| 585 |
+
// 2d13665c08ff83f22de7cc7da216db12
|
| 586 |
+
$json = json_encode( $data );
|
| 587 |
+
|
| 588 |
+
$ch = curl_init( $url );
|
| 589 |
+
|
| 590 |
+
curl_setopt( $ch, CURLOPT_USERPWD, 'user:' . $apiKey );
|
| 591 |
+
curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json' ) );
|
| 592 |
+
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
|
| 593 |
+
curl_setopt( $ch, CURLOPT_TIMEOUT, 10 );
|
| 594 |
+
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'PUT' );
|
| 595 |
+
curl_setopt( $ch, CURLOPT_POST, true );
|
| 596 |
+
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
|
| 597 |
+
curl_setopt( $ch, CURLOPT_POSTFIELDS, $json );
|
| 598 |
+
|
| 599 |
+
curl_setopt( $ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)' );
|
| 600 |
+
|
| 601 |
+
$result = curl_exec( $ch );
|
| 602 |
+
|
| 603 |
+
if( $request_type == 'GET' ){
|
| 604 |
+
$result_array = json_decode ( $result , true );
|
| 605 |
+
$status = $result_array['status'];
|
| 606 |
+
return $status;
|
| 607 |
+
}
|
| 608 |
+
// var_dump($result);
|
| 609 |
+
// var_dump( curl_getinfo( $ch ) );
|
| 610 |
+
|
| 611 |
+
$httpCode = curl_getinfo( $ch, CURLINFO_HTTP_CODE );
|
| 612 |
+
|
| 613 |
+
curl_close( $ch );
|
| 614 |
+
if ( 200 == $httpCode ) {
|
| 615 |
+
echo "Thank you!";
|
| 616 |
+
} else {
|
| 617 |
+
echo "oops! Please try again later.";
|
| 618 |
+
}
|
| 619 |
+
wp_die();
|
| 620 |
+
}
|
| 621 |
+
|
| 622 |
|
| 623 |
} // end SimpleSocialButtonsPR_Admin
|
| 624 |
|
| 630 |
|
| 631 |
/**
|
| 632 |
* Function to insert Simple Social Buttons directly in template.
|
| 633 |
+
*
|
| 634 |
* @param mixed $order - order of the buttons in array or string (parsed by wp_parse_args())
|
| 635 |
+
*
|
| 636 |
* @example 1 - use in template with default order
|
| 637 |
* get_ssb();
|
| 638 |
+
*
|
| 639 |
* @example 2 - use in template with specified order
|
| 640 |
* get_ssb('googleplus=3&fblike=2&twitter=1');
|
| 641 |
+
*
|
| 642 |
* @example 3 - hiding button by setting order to 0. By using code below googleplus button won't be displayed
|
| 643 |
* get_ssb('googleplus=0&fblike=1&twitter=2');
|
| 644 |
+
*
|
| 645 |
+
*
|
| 646 |
*/
|
| 647 |
function get_ssb($order = null)
|
| 648 |
{
|
| 649 |
do_action('create_ssb', $order);
|
| 650 |
}
|
| 651 |
|
| 652 |
+
?>
|
ssb-admin.php
CHANGED
|
@@ -1,16 +1,97 @@
|
|
| 1 |
<div class="wrap">
|
| 2 |
|
| 3 |
<style type="text/css">
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
</style>
|
| 10 |
|
| 11 |
<h2>Simple Social Buttons - <?php _e('Settings'); ?>:</h2>
|
| 12 |
|
| 13 |
-
<p><?php _e('<strong>Simple Social Buttons</strong> by <strong>
|
| 14 |
|
| 15 |
<?php
|
| 16 |
|
|
@@ -22,31 +103,31 @@ if(strtolower(@$_POST['hiddenconfirm']) == 'y') {
|
|
| 22 |
*/
|
| 23 |
|
| 24 |
$updateSettings = array(
|
| 25 |
-
'googleplus'
|
| 26 |
-
'fblike'
|
| 27 |
-
'twitter'
|
| 28 |
-
'pinterest'
|
| 29 |
-
|
| 30 |
-
'beforepost'
|
| 31 |
-
'afterpost'
|
| 32 |
-
'beforepage'
|
| 33 |
-
'afterpage'
|
| 34 |
-
'beforearchive' => $_POST['ssb_beforearchive'],
|
| 35 |
-
'afterarchive'
|
| 36 |
-
|
| 37 |
-
'showfront'
|
| 38 |
-
'showcategory'
|
| 39 |
-
'showarchive'
|
| 40 |
-
'showtag'
|
| 41 |
-
|
| 42 |
-
'override_css'
|
| 43 |
-
|
| 44 |
-
'twitterusername' => str_replace(array("@", " "), "", $_POST['ssb_twitterusername']),
|
| 45 |
);
|
| 46 |
|
| 47 |
$this->update_settings( $updateSettings );
|
| 48 |
|
| 49 |
-
}
|
| 50 |
|
| 51 |
/**
|
| 52 |
* HACK: Use one big array instead of a bunchload of single options
|
|
@@ -63,13 +144,13 @@ extract( $settings, EXTR_PREFIX_ALL, 'ssb' );
|
|
| 63 |
?>
|
| 64 |
|
| 65 |
|
| 66 |
-
<div class="postbox-container
|
| 67 |
<div id="poststuff">
|
| 68 |
<form name="ssb_form" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
|
| 69 |
|
| 70 |
<div class="postbox">
|
| 71 |
-
<h3><?php _e('Select buttons', 'simplesocialbuttons'); ?></h3>
|
| 72 |
<div class="inside">
|
|
|
|
| 73 |
<h4><?php _e('Select social media buttons:', 'simplesocialbuttons'); ?></h4>
|
| 74 |
|
| 75 |
|
|
@@ -115,7 +196,7 @@ extract( $settings, EXTR_PREFIX_ALL, 'ssb' );
|
|
| 115 |
</select>
|
| 116 |
<label for="ssb_twitter"><?php _e('Twitter share', 'simplesocialbuttons'); ?></label></p>
|
| 117 |
<!-- /twitter -->
|
| 118 |
-
|
| 119 |
<!-- pinterest -->
|
| 120 |
<p><select name="ssb_pinterest" id="ssb_pinterest">
|
| 121 |
<option value=""<?php if(empty($ssb_pinterest) != false) {
|
|
@@ -136,8 +217,8 @@ extract( $settings, EXTR_PREFIX_ALL, 'ssb' );
|
|
| 136 |
</div>
|
| 137 |
|
| 138 |
<div class="postbox">
|
| 139 |
-
<h3><?php _e('Single posts - display settings', 'simplesocialbuttons'); ?></h3>
|
| 140 |
<div class="inside">
|
|
|
|
| 141 |
<h4><?php _e('Place buttons on single post:', 'simplesocialbuttons'); ?></h4>
|
| 142 |
<p><input type="checkbox" name="ssb_beforepost" id="ssb_beforepost" value="1" <?php if(!empty($ssb_beforepost)) { ?>checked="checked"<?php } ?> /> <label for="ssb_beforepost"><?php _e('Before the content', 'simplesocialbuttons'); ?></label></p>
|
| 143 |
<p><input type="checkbox" name="ssb_afterpost" id="ssb_afterpost" value="1" <?php if(!empty($ssb_afterpost)) { ?>checked="checked"<?php } ?> /> <label for="ssb_afterpost"><?php _e('After the content', 'simplesocialbuttons'); ?></label></p>
|
|
@@ -145,8 +226,8 @@ extract( $settings, EXTR_PREFIX_ALL, 'ssb' );
|
|
| 145 |
</div>
|
| 146 |
|
| 147 |
<div class="postbox">
|
| 148 |
-
<h3><?php _e('Single pages - display settings', 'simplesocialbuttons'); ?></h3>
|
| 149 |
<div class="inside">
|
|
|
|
| 150 |
<h4><?php _e('Place buttons on single pages:', 'simplesocialbuttons'); ?></h4>
|
| 151 |
<p><input type="checkbox" name="ssb_beforepage" id="ssb_beforepage" value="1" <?php if(!empty($ssb_beforepage)) { ?>checked="checked"<?php } ?> /> <label for="ssb_beforepage"><?php _e('Before the page content', 'simplesocialbuttons'); ?></label></p>
|
| 152 |
<p><input type="checkbox" name="ssb_afterpage" id="ssb_afterpage" value="1" <?php if(!empty($ssb_afterpage)) { ?>checked="checked"<?php } ?> /> <label for="ssb_afterpage"><?php _e('After the page content', 'simplesocialbuttons'); ?></label></p>
|
|
@@ -154,8 +235,8 @@ extract( $settings, EXTR_PREFIX_ALL, 'ssb' );
|
|
| 154 |
</div>
|
| 155 |
|
| 156 |
<div class="postbox">
|
| 157 |
-
<h3><?php _e('Archives - display settings', 'simplesocialbuttons'); ?></h3>
|
| 158 |
<div class="inside">
|
|
|
|
| 159 |
<h4><?php _e('Select additional places to display buttons:', 'simplesocialbuttons'); ?></h4>
|
| 160 |
<p><input type="checkbox" name="ssb_showfront" id="ssb_showfront" value="1" <?php if(!empty($ssb_showfront)) { ?>checked="checked"<?php } ?> /> <label for="ssb_showfront"><?php _e('Show at frontpage', 'simplesocialbuttons'); ?></label></p>
|
| 161 |
<p><input type="checkbox" name="ssb_showcategory" id="ssb_showcategory" value="1" <?php if(!empty($ssb_showcategory)) { ?>checked="checked"<?php } ?> /> <label for="ssb_showcategory"><?php _e('Show at category pages', 'simplesocialbuttons'); ?></label></p>
|
|
@@ -167,10 +248,10 @@ extract( $settings, EXTR_PREFIX_ALL, 'ssb' );
|
|
| 167 |
<p><input type="checkbox" name="ssb_afterarchive" id="ssb_afterarchive" value="1" <?php if(!empty($ssb_afterarchive)) { ?>checked="checked"<?php } ?> /> <label for="ssb_afterarchive"><?php _e('After the content', 'simplesocialbuttons'); ?></label></p>
|
| 168 |
</div>
|
| 169 |
</div>
|
| 170 |
-
|
| 171 |
<div class="postbox">
|
| 172 |
-
<h3><?php _e('Additional features'); ?></h3>
|
| 173 |
<div class="inside">
|
|
|
|
| 174 |
<p><label for="ssb_twitterusername"><?php _e('Twitter @username', 'simplesocialbuttons'); ?>: <input type="text" name="ssb_twitterusername" id="ssb_twitterusername" value="<?php echo (isset($ssb_twitterusername)) ? $ssb_twitterusername : "";?>" /></label></p>
|
| 175 |
</div>
|
| 176 |
</div>
|
|
@@ -184,42 +265,112 @@ extract( $settings, EXTR_PREFIX_ALL, 'ssb' );
|
|
| 184 |
</div>
|
| 185 |
</div>
|
| 186 |
|
| 187 |
-
<div class="postbox-container
|
| 188 |
<div id="poststuff">
|
| 189 |
-
<div class="postbox">
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
</
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
|
|
|
|
|
|
| 206 |
</div>
|
| 207 |
|
| 208 |
-
<div class="postbox">
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
<li
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
<li
|
| 219 |
-
|
| 220 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 221 |
</div>
|
| 222 |
|
| 223 |
</div>
|
| 224 |
</div>
|
| 225 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
<div class="wrap">
|
| 2 |
|
| 3 |
<style type="text/css">
|
| 4 |
+
div.inside ul li {
|
| 5 |
+
line-height: 16px;
|
| 6 |
+
list-style-type: square;
|
| 7 |
+
margin-left: 15px;
|
| 8 |
+
}
|
| 9 |
+
.ssb_right_sidebar{
|
| 10 |
+
|
| 11 |
+
width: 255px;
|
| 12 |
+
float: right;
|
| 13 |
+
min-width: inherit;
|
| 14 |
+
box-sizing: border-box;
|
| 15 |
+
}
|
| 16 |
+
.ssb_right_sidebar #poststuff {
|
| 17 |
+
width: 255px;
|
| 18 |
+
float: right;
|
| 19 |
+
min-width: inherit;
|
| 20 |
+
box-sizing: border-box;
|
| 21 |
+
max-width: 100%;
|
| 22 |
+
min-width: 100%;
|
| 23 |
+
}
|
| 24 |
+
.ssb_right_sidebar .ssb_social_links_wrapper{
|
| 25 |
+
padding: 10px;
|
| 26 |
+
min-width: 100%;
|
| 27 |
+
box-sizing: border-box;
|
| 28 |
+
}
|
| 29 |
+
.ssb_right_sidebar .ssb_social_links li a {
|
| 30 |
+
width: 100%;
|
| 31 |
+
display: block;
|
| 32 |
+
position: relative;
|
| 33 |
+
}
|
| 34 |
+
.ssb_right_sidebar .ssb_social_links .dashicons {
|
| 35 |
+
position: absolute;
|
| 36 |
+
right: 10px;
|
| 37 |
+
margin-top: 3px;
|
| 38 |
+
}
|
| 39 |
+
.ssb_social_links_wrapper .postbox{
|
| 40 |
+
min-width: 100%;
|
| 41 |
+
border:0;
|
| 42 |
+
}
|
| 43 |
+
.ssb_right_sidebar .ssb_social_links li .twitter .dashicons {
|
| 44 |
+
color: #45b0e3;
|
| 45 |
+
}
|
| 46 |
+
.ssb_right_sidebar .ssb_social_links li .facebook .dashicons {
|
| 47 |
+
color: #3b5998;
|
| 48 |
+
}
|
| 49 |
+
.ssb_right_sidebar .ssb_social_links li .wordpress .dashicons {
|
| 50 |
+
color: #21759b;
|
| 51 |
+
}
|
| 52 |
+
.ssb_right_sidebar .plugins_lists li {
|
| 53 |
+
padding-bottom: 12px;
|
| 54 |
+
line-height: 1.4;
|
| 55 |
+
}
|
| 56 |
+
.ssb_right_sidebar #poststuff .stuffbox>h3,.ssb_right_sidebar #poststuff h2,.ssb_right_sidebar #poststuff h3.hndle{
|
| 57 |
+
border-bottom: 1px solid #ccc;
|
| 58 |
+
font-size: 1.3em;
|
| 59 |
+
padding: 10px;
|
| 60 |
+
}
|
| 61 |
+
.ssb_settings_container {
|
| 62 |
+
float: left;
|
| 63 |
+
width: calc(100% - 275px);
|
| 64 |
+
}
|
| 65 |
+
.ssb_settings_container .postbox .inside,.ssb_settings_container .stuffbox .inside{
|
| 66 |
+
padding: 12px;
|
| 67 |
+
box-sizing: border-box;
|
| 68 |
+
}
|
| 69 |
+
#ssb_subscribe_btn {
|
| 70 |
+
display: block;
|
| 71 |
+
margin: 20px auto 0;
|
| 72 |
+
}
|
| 73 |
+
.ssb_settings_container .postbox .inside h3{
|
| 74 |
+
margin: 0 -12px 10px;
|
| 75 |
+
padding: 0 12px 15px;
|
| 76 |
+
border-bottom: 1px solid #ccc;
|
| 77 |
+
}
|
| 78 |
+
.ssb_settings_container #poststuff{
|
| 79 |
+
min-width: 100%;
|
| 80 |
+
}
|
| 81 |
+
@media only screen and (max-width: 850px){
|
| 82 |
+
|
| 83 |
+
.ssb_settings_container{
|
| 84 |
+
width:100%;
|
| 85 |
+
}
|
| 86 |
+
.ssb_right_sidebar{
|
| 87 |
+
float: left;
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
</style>
|
| 91 |
|
| 92 |
<h2>Simple Social Buttons - <?php _e('Settings'); ?>:</h2>
|
| 93 |
|
| 94 |
+
<p><?php _e('<strong>Simple Social Buttons</strong> by <strong>WPBrigade</strong>. This plugin adds a social media buttons, such as: <strong>Google +1</strong>, <strong>Facebook Like it</strong>, <strong>Twitter share</strong> and <strong>Pinterest</strong>. The most flexible social buttons plugin ever.', 'simplesocialbuttons'); ?></p>
|
| 95 |
|
| 96 |
<?php
|
| 97 |
|
| 103 |
*/
|
| 104 |
|
| 105 |
$updateSettings = array(
|
| 106 |
+
'googleplus' => isset( $_POST['ssb_googleplus'] ) ? sanitize_text_field( wp_unslash( $_POST['ssb_googleplus'] ) ) : '',
|
| 107 |
+
'fblike' => isset( $_POST['ssb_fblike'] ) ? sanitize_text_field( wp_unslash( $_POST['ssb_fblike'] ) ) : '',
|
| 108 |
+
'twitter' => isset( $_POST['ssb_twitter'] ) ? sanitize_text_field( wp_unslash( $_POST['ssb_twitter'] ) ) : '',
|
| 109 |
+
'pinterest' => isset( $_POST['ssb_pinterest'] ) ? sanitize_text_field( wp_unslash( $_POST['ssb_pinterest'] ) ) : '',
|
| 110 |
+
|
| 111 |
+
'beforepost' => isset( $_POST['ssb_beforepost'] ) ? sanitize_text_field( wp_unslash( $_POST['ssb_beforepost'] ) ) : '',
|
| 112 |
+
'afterpost' => isset( $_POST['ssb_afterpost'] ) ? sanitize_text_field( wp_unslash( $_POST['ssb_afterpost'] ) ) : '',
|
| 113 |
+
'beforepage' => isset( $_POST['ssb_beforepage'] ) ? sanitize_text_field( wp_unslash( $_POST['ssb_beforepage'] ) ) : '',
|
| 114 |
+
'afterpage' => isset( $_POST['ssb_afterpage'] ) ? sanitize_text_field( wp_unslash( $_POST['ssb_afterpage'] ) ) : '',
|
| 115 |
+
'beforearchive' => isset( $_POST['ssb_beforearchive'] ) ? sanitize_text_field( wp_unslash( $_POST['ssb_beforearchive'] ) ) : '',
|
| 116 |
+
'afterarchive' => isset( $_POST['ssb_afterarchive'] ) ? sanitize_text_field( wp_unslash( $_POST['ssb_afterarchive'] ) ) : '',
|
| 117 |
+
|
| 118 |
+
'showfront' => isset( $_POST['ssb_showfront'] ) ? sanitize_text_field( wp_unslash( $_POST['ssb_showfront'] ) ) : '',
|
| 119 |
+
'showcategory' => isset( $_POST['ssb_showcategory'] ) ? sanitize_text_field( wp_unslash( $_POST['ssb_showcategory'] ) ) : '',
|
| 120 |
+
'showarchive' => isset( $_POST['ssb_showarchive'] ) ? sanitize_text_field( wp_unslash( $_POST['ssb_showarchive'] ) ) : '',
|
| 121 |
+
'showtag' => isset( $_POST['ssb_showtag'] ) ? sanitize_text_field( wp_unslash( $_POST['ssb_showtag'] ) ) : '',
|
| 122 |
+
|
| 123 |
+
'override_css' => isset( $_POST['ssb_override_css'] ) ? sanitize_text_field( wp_unslash( $_POST['ssb_override_css'] ) ) : '',
|
| 124 |
+
|
| 125 |
+
'twitterusername' => isset( $_POST['ssb_twitterusername'] ) ? str_replace(array("@", " "), "", sanitize_text_field( wp_unslash( $_POST['ssb_twitterusername'] ) ) ) : '',
|
| 126 |
);
|
| 127 |
|
| 128 |
$this->update_settings( $updateSettings );
|
| 129 |
|
| 130 |
+
}
|
| 131 |
|
| 132 |
/**
|
| 133 |
* HACK: Use one big array instead of a bunchload of single options
|
| 144 |
?>
|
| 145 |
|
| 146 |
|
| 147 |
+
<div class="postbox-container ssb_settings_container">
|
| 148 |
<div id="poststuff">
|
| 149 |
<form name="ssb_form" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
|
| 150 |
|
| 151 |
<div class="postbox">
|
|
|
|
| 152 |
<div class="inside">
|
| 153 |
+
<h3><?php _e('Select buttons', 'simplesocialbuttons'); ?></h3>
|
| 154 |
<h4><?php _e('Select social media buttons:', 'simplesocialbuttons'); ?></h4>
|
| 155 |
|
| 156 |
|
| 196 |
</select>
|
| 197 |
<label for="ssb_twitter"><?php _e('Twitter share', 'simplesocialbuttons'); ?></label></p>
|
| 198 |
<!-- /twitter -->
|
| 199 |
+
|
| 200 |
<!-- pinterest -->
|
| 201 |
<p><select name="ssb_pinterest" id="ssb_pinterest">
|
| 202 |
<option value=""<?php if(empty($ssb_pinterest) != false) {
|
| 217 |
</div>
|
| 218 |
|
| 219 |
<div class="postbox">
|
|
|
|
| 220 |
<div class="inside">
|
| 221 |
+
<h3><?php _e('Single posts - display settings', 'simplesocialbuttons'); ?></h3>
|
| 222 |
<h4><?php _e('Place buttons on single post:', 'simplesocialbuttons'); ?></h4>
|
| 223 |
<p><input type="checkbox" name="ssb_beforepost" id="ssb_beforepost" value="1" <?php if(!empty($ssb_beforepost)) { ?>checked="checked"<?php } ?> /> <label for="ssb_beforepost"><?php _e('Before the content', 'simplesocialbuttons'); ?></label></p>
|
| 224 |
<p><input type="checkbox" name="ssb_afterpost" id="ssb_afterpost" value="1" <?php if(!empty($ssb_afterpost)) { ?>checked="checked"<?php } ?> /> <label for="ssb_afterpost"><?php _e('After the content', 'simplesocialbuttons'); ?></label></p>
|
| 226 |
</div>
|
| 227 |
|
| 228 |
<div class="postbox">
|
|
|
|
| 229 |
<div class="inside">
|
| 230 |
+
<h3><?php _e('Single pages - display settings', 'simplesocialbuttons'); ?></h3>
|
| 231 |
<h4><?php _e('Place buttons on single pages:', 'simplesocialbuttons'); ?></h4>
|
| 232 |
<p><input type="checkbox" name="ssb_beforepage" id="ssb_beforepage" value="1" <?php if(!empty($ssb_beforepage)) { ?>checked="checked"<?php } ?> /> <label for="ssb_beforepage"><?php _e('Before the page content', 'simplesocialbuttons'); ?></label></p>
|
| 233 |
<p><input type="checkbox" name="ssb_afterpage" id="ssb_afterpage" value="1" <?php if(!empty($ssb_afterpage)) { ?>checked="checked"<?php } ?> /> <label for="ssb_afterpage"><?php _e('After the page content', 'simplesocialbuttons'); ?></label></p>
|
| 235 |
</div>
|
| 236 |
|
| 237 |
<div class="postbox">
|
|
|
|
| 238 |
<div class="inside">
|
| 239 |
+
<h3><?php _e('Archives - display settings', 'simplesocialbuttons'); ?></h3>
|
| 240 |
<h4><?php _e('Select additional places to display buttons:', 'simplesocialbuttons'); ?></h4>
|
| 241 |
<p><input type="checkbox" name="ssb_showfront" id="ssb_showfront" value="1" <?php if(!empty($ssb_showfront)) { ?>checked="checked"<?php } ?> /> <label for="ssb_showfront"><?php _e('Show at frontpage', 'simplesocialbuttons'); ?></label></p>
|
| 242 |
<p><input type="checkbox" name="ssb_showcategory" id="ssb_showcategory" value="1" <?php if(!empty($ssb_showcategory)) { ?>checked="checked"<?php } ?> /> <label for="ssb_showcategory"><?php _e('Show at category pages', 'simplesocialbuttons'); ?></label></p>
|
| 248 |
<p><input type="checkbox" name="ssb_afterarchive" id="ssb_afterarchive" value="1" <?php if(!empty($ssb_afterarchive)) { ?>checked="checked"<?php } ?> /> <label for="ssb_afterarchive"><?php _e('After the content', 'simplesocialbuttons'); ?></label></p>
|
| 249 |
</div>
|
| 250 |
</div>
|
| 251 |
+
|
| 252 |
<div class="postbox">
|
|
|
|
| 253 |
<div class="inside">
|
| 254 |
+
<h3><?php _e('Additional features'); ?></h3>
|
| 255 |
<p><label for="ssb_twitterusername"><?php _e('Twitter @username', 'simplesocialbuttons'); ?>: <input type="text" name="ssb_twitterusername" id="ssb_twitterusername" value="<?php echo (isset($ssb_twitterusername)) ? $ssb_twitterusername : "";?>" /></label></p>
|
| 256 |
</div>
|
| 257 |
</div>
|
| 265 |
</div>
|
| 266 |
</div>
|
| 267 |
|
| 268 |
+
<div class="postbox-container ssb_right_sidebar">
|
| 269 |
<div id="poststuff">
|
| 270 |
+
<div class="postbox ssb_social_links_wrapper">
|
| 271 |
+
<div class="sidebar postbox">
|
| 272 |
+
<h2>Spread the Word</h2>
|
| 273 |
+
<ul class="ssb_social_links">
|
| 274 |
+
<li>
|
| 275 |
+
<a href="http://twitter.com/share?text=This is Best Related Social Share for WordPress&url=https://wordpress.org/plugins/simple-social-buttons/" data-count="none" class="button twitter" target="_blank" title="Post to Twitter Now">Share on Twitter<span class="dashicons dashicons-twitter"></span></a>
|
| 276 |
+
</li>
|
| 277 |
+
|
| 278 |
+
<li>
|
| 279 |
+
<a href="https://www.facebook.com/sharer/sharer.php?u=https://wordpress.org/plugins/simple-social-buttons/" class="button facebook" target="_blank" title="Share with your facebook friends about this awesome plugin.">Share on Facebook<span class="dashicons dashicons-facebook"></span>
|
| 280 |
+
</a>
|
| 281 |
+
</li>
|
| 282 |
+
|
| 283 |
+
<li>
|
| 284 |
+
<a href="https://wordpress.org/plugins/simple-social-buttons/?filter=5" class="button wordpress" target="_blank" title="Rate on Wordpress.org">Rate on Wordpress.org<span class="dashicons dashicons-wordpress"></span>
|
| 285 |
+
</a>
|
| 286 |
+
</li>
|
| 287 |
+
</ul>
|
| 288 |
+
</div>
|
| 289 |
</div>
|
| 290 |
|
| 291 |
+
<div class="postbox ssb_social_links_wrapper">
|
| 292 |
+
<div class="sidebar postbox">
|
| 293 |
+
|
| 294 |
+
<h2>Subscribe Newsletter</h2>
|
| 295 |
+
<ul>
|
| 296 |
+
<li>
|
| 297 |
+
<label for="">Email</label>
|
| 298 |
+
<input type="email" name="subscriber_mail" value="<?php echo get_option( 'admin_email' ) ?>" id="ssb_subscribe_mail">
|
| 299 |
+
<p class="ssb_subscribe_warning"></p>
|
| 300 |
+
</li>
|
| 301 |
+
<li>
|
| 302 |
+
<label for="">Name</label>
|
| 303 |
+
<input type="text" name="subscriber_name" id="ssb_subscribe_name" value="<?php echo wp_get_current_user()->display_name ?>">
|
| 304 |
+
</li>
|
| 305 |
+
<li>
|
| 306 |
+
<input type="submit" value="Subscribe Now" class="button button-primary button-big" id="ssb_subscribe_btn">
|
| 307 |
+
<img src="<?php echo admin_url( 'images/spinner.gif' ) ?>" class="ssb_subscribe_loader" style="display:none">
|
| 308 |
+
</li>
|
| 309 |
+
<li>
|
| 310 |
+
<p class="ssb_return_message"></p>
|
| 311 |
+
</li>
|
| 312 |
+
</ul>
|
| 313 |
+
</div>
|
| 314 |
+
</div>
|
| 315 |
+
|
| 316 |
+
<div class="postbox ssb_social_links_wrapper">
|
| 317 |
+
<div class="sidebar postbox">
|
| 318 |
+
<h2>Recommended Plugins</h2>
|
| 319 |
+
<!-- <p>Following are the plugins highly recommend by Team WPBrigade.</p> -->
|
| 320 |
+
<ul class="plugins_lists">
|
| 321 |
+
<li>
|
| 322 |
+
<a href="https://wpbrigade.com/wordpress/plugins/loginpress-pro/?utm_source=related-posts-lite&utm_medium=sidebar&utm_campaign=pro-upgrade" data-count="none" target="_blank" title="Post to Twitter Now">LoginPress - Login Customizer</a>
|
| 323 |
+
</li>
|
| 324 |
+
|
| 325 |
+
<li>
|
| 326 |
+
<a href="https://analytify.io/ref/73/?utm_source=related-posts-lite&utm_medium=sidebar&utm_campaign=pro-upgrade" target="_blank" title="Share with your facebook friends about this awesome plugin.">Google Analytics by Analytify
|
| 327 |
+
</a>
|
| 328 |
+
</li>
|
| 329 |
+
|
| 330 |
+
<li>
|
| 331 |
+
<a href="http://wpbrigade.com/recommend/maintenance-mode" target="_blank" title="Under Construction & Maintenance mode">Under Construction & Maintenance mode
|
| 332 |
+
</a>
|
| 333 |
+
</li>
|
| 334 |
+
</ul>
|
| 335 |
+
</div>
|
| 336 |
</div>
|
| 337 |
|
| 338 |
</div>
|
| 339 |
</div>
|
| 340 |
+
</div>
|
| 341 |
+
|
| 342 |
+
<script type="text/javascript">
|
| 343 |
+
jQuery(document).ready(function($) {
|
| 344 |
+
|
| 345 |
+
$('#ssb_subscribe_btn').on('click', function(event) {
|
| 346 |
+
event.preventDefault();
|
| 347 |
+
|
| 348 |
+
var subscriber_mail = $('#ssb_subscribe_mail').val();
|
| 349 |
+
var name = $('#ssb_subscribe_name').val();
|
| 350 |
+
if (!subscriber_mail) {
|
| 351 |
+
$('.ssb_subscribe_warning').html('Please Enter Email');
|
| 352 |
+
return;
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
+
$.ajax({
|
| 356 |
+
url: ajaxurl,
|
| 357 |
+
type: 'POST',
|
| 358 |
+
data: {
|
| 359 |
+
subscriber_mail : subscriber_mail,
|
| 360 |
+
action : 'ssb_subscriber',
|
| 361 |
+
name : name
|
| 362 |
+
},
|
| 363 |
+
beforeSend : function() {
|
| 364 |
+
$('.ssb_subscribe_loader').show();
|
| 365 |
+
$('#ssb_subscribe_btn').attr('disabled', 'disabled');
|
| 366 |
+
}
|
| 367 |
+
})
|
| 368 |
+
.done(function(res) {
|
| 369 |
+
$('.ssb_return_message').html(res);
|
| 370 |
+
$('.ssb_subscribe_loader').hide();
|
| 371 |
+
});
|
| 372 |
+
|
| 373 |
+
});
|
| 374 |
+
|
| 375 |
+
});
|
| 376 |
+
</script>
|
