Commit 0f6b53d1 authored by lechuck's avatar lechuck Committed by lucha

[auto] Plugin: simple-share-buttons-adder 6.1.5

parent 0229ff5d
......@@ -70,11 +70,16 @@ function ssba_menu() {
// query the db for current ssba settings
$arrSettings = get_ssba_settings();
// check if not updated to current version
if ($arrSettings['ssba_version'] != SSBA_VERSION) {
// run the upgrade function
upgrade_ssba($arrSettings);
// get the current version
$version = get_option('ssba_version');
// there was a version set
if ($version !== false) {
// check if not updated to current version
if ($version < SSBA_VERSION) {
// run the upgrade function
upgrade_ssba($arrSettings, $version);
}
}
}
......@@ -96,69 +101,81 @@ function ssba_settings() {
parse_str($ssbaPost, $ssbaPost);
// if the nonce doesn't check out...
if ( ! isset($ssbaPost['ssba_save_nonce']) || ! wp_verify_nonce($ssbaPost['ssba_save_nonce'], 'ssba_save_settings'))
{
if ( ! isset($ssbaPost['ssba_save_nonce']) || ! wp_verify_nonce($ssbaPost['ssba_save_nonce'], 'ssba_save_settings')) {
die('There was no nonce provided, or the one provided did not verify.');
}
// update existing ssba settings
update_option('ssba_image_set', $ssbaPost['ssba_image_set']);
update_option('ssba_size', $ssbaPost['ssba_size']);
update_option('ssba_pages', (isset($ssbaPost['ssba_pages']) ? $ssbaPost['ssba_pages'] : NULL));
update_option('ssba_posts', (isset($ssbaPost['ssba_posts']) ? $ssbaPost['ssba_posts'] : NULL));
update_option('ssba_cats_archs', (isset($ssbaPost['ssba_cats_archs']) ? $ssbaPost['ssba_cats_archs'] : NULL));
update_option('ssba_homepage', (isset($ssbaPost['ssba_homepage']) ? $ssbaPost['ssba_homepage'] : NULL));
update_option('ssba_excerpts', (isset($ssbaPost['ssba_excerpts']) ? $ssbaPost['ssba_excerpts'] : NULL));
update_option('ssba_align', (isset($ssbaPost['ssba_align']) ? $ssbaPost['ssba_align'] : NULL));
update_option('ssba_padding', $ssbaPost['ssba_padding']);
update_option('ssba_before_or_after', $ssbaPost['ssba_before_or_after']);
update_option('ssba_additional_css', $ssbaPost['ssba_additional_css']);
update_option('ssba_custom_styles', $ssbaPost['ssba_custom_styles']);
update_option('ssba_custom_styles_enabled', $ssbaPost['ssba_custom_styles_enabled']);
update_option('ssba_email_message', stripslashes_deep($ssbaPost['ssba_email_message']));
update_option('ssba_twitter_text', stripslashes_deep($ssbaPost['ssba_twitter_text']));
update_option('ssba_buffer_text', stripslashes_deep($ssbaPost['ssba_buffer_text']));
update_option('ssba_flattr_user_id', stripslashes_deep($ssbaPost['ssba_flattr_user_id']));
update_option('ssba_flattr_url', stripslashes_deep($ssbaPost['ssba_flattr_url']));
update_option('ssba_share_new_window', (isset($ssbaPost['ssba_share_new_window']) ? $ssbaPost['ssba_share_new_window'] : NULL));
update_option('ssba_link_to_ssb', (isset($ssbaPost['ssba_link_to_ssb']) ? $ssbaPost['ssba_link_to_ssb'] : NULL));
update_option('ssba_show_share_count', (isset($ssbaPost['ssba_show_share_count']) ? $ssbaPost['ssba_show_share_count'] : NULL));
update_option('ssba_share_count_style', $ssbaPost['ssba_share_count_style']);
update_option('ssba_share_count_css', $ssbaPost['ssba_share_count_css']);
update_option('ssba_share_count_once', (isset($ssbaPost['ssba_share_count_once']) ? $ssbaPost['ssba_share_count_once'] : NULL));
update_option('ssba_widget_text', $ssbaPost['ssba_widget_text']);
update_option('ssba_rel_nofollow', (isset($ssbaPost['ssba_rel_nofollow']) ? $ssbaPost['ssba_rel_nofollow'] : NULL));
update_option('ssba_default_pinterest', (isset($ssbaPost['ssba_default_pinterest']) ? $ssbaPost['ssba_default_pinterest'] : NULL));
update_option('ssba_pinterest_featured', (isset($ssbaPost['ssba_pinterest_featured']) ? $ssbaPost['ssba_pinterest_featured'] : NULL));
update_option('ssba_content_priority', (isset($ssbaPost['ssba_content_priority']) ? $ssbaPost['ssba_content_priority'] : NULL));
// share container
update_option('ssba_div_padding', $ssbaPost['ssba_div_padding']);
update_option('ssba_div_rounded_corners', (isset($ssbaPost['ssba_div_rounded_corners']) ? $ssbaPost['ssba_div_rounded_corners'] : NULL));
update_option('ssba_border_width', $ssbaPost['ssba_border_width']);
update_option('ssba_div_border', $ssbaPost['ssba_div_border']);
update_option('ssba_div_background', $ssbaPost['ssba_div_background']);
// text
update_option('ssba_share_text', stripslashes_deep($ssbaPost['ssba_share_text']));
update_option('ssba_text_placement', $ssbaPost['ssba_text_placement']);
update_option('ssba_font_family', $ssbaPost['ssba_font_family']);
update_option('ssba_font_color', $ssbaPost['ssba_font_color']);
update_option('ssba_font_size', $ssbaPost['ssba_font_size']);
update_option('ssba_font_weight', $ssbaPost['ssba_font_weight']);
// include
update_option('ssba_selected_buttons', $ssbaPost['ssba_selected_buttons']);
// prepare array of buttons
// prepare array
$arrOptions = array(
'ssba_image_set' => $ssbaPost['ssba_image_set'],
'ssba_size' => $ssbaPost['ssba_size'],
'ssba_pages' => (isset($ssbaPost['ssba_pages']) ? $ssbaPost['ssba_pages'] : NULL),
'ssba_posts' => (isset($ssbaPost['ssba_posts']) ? $ssbaPost['ssba_posts'] : NULL),
'ssba_cats_archs' => (isset($ssbaPost['ssba_cats_archs']) ? $ssbaPost['ssba_cats_archs'] : NULL),
'ssba_homepage' => (isset($ssbaPost['ssba_homepage']) ? $ssbaPost['ssba_homepage'] : NULL),
'ssba_excerpts' => (isset($ssbaPost['ssba_excerpts']) ? $ssbaPost['ssba_excerpts'] : NULL),
'ssba_align' => (isset($ssbaPost['ssba_align']) ? $ssbaPost['ssba_align'] : NULL),
'ssba_padding' => $ssbaPost['ssba_padding'],
'ssba_before_or_after' => $ssbaPost['ssba_before_or_after'],
'ssba_additional_css' => $ssbaPost['ssba_additional_css'],
'ssba_custom_styles' => $ssbaPost['ssba_custom_styles'],
'ssba_custom_styles_enabled' => $ssbaPost['ssba_custom_styles_enabled'],
'ssba_email_message' => stripslashes_deep($ssbaPost['ssba_email_message']),
'ssba_twitter_text' => stripslashes_deep($ssbaPost['ssba_twitter_text']),
'ssba_buffer_text' => stripslashes_deep($ssbaPost['ssba_buffer_text']),
'ssba_flattr_user_id' => stripslashes_deep($ssbaPost['ssba_flattr_user_id']),
'ssba_flattr_url' => stripslashes_deep($ssbaPost['ssba_flattr_url']),
'ssba_share_new_window' => (isset($ssbaPost['ssba_share_new_window']) ? $ssbaPost['ssba_share_new_window'] : NULL),
'ssba_link_to_ssb' => (isset($ssbaPost['ssba_link_to_ssb']) ? $ssbaPost['ssba_link_to_ssb'] : NULL),
'ssba_show_share_count' => (isset($ssbaPost['ssba_show_share_count']) ? $ssbaPost['ssba_show_share_count'] : NULL),
'ssba_share_count_style' => $ssbaPost['ssba_share_count_style'],
'ssba_share_count_css' => $ssbaPost['ssba_share_count_css'],
'ssba_share_count_once' => (isset($ssbaPost['ssba_share_count_once']) ? $ssbaPost['ssba_share_count_once'] : NULL),
'ssba_widget_text' => $ssbaPost['ssba_widget_text'],
'ssba_rel_nofollow' => (isset($ssbaPost['ssba_rel_nofollow']) ? $ssbaPost['ssba_rel_nofollow'] : NULL),
'ssba_default_pinterest' => (isset($ssbaPost['ssba_default_pinterest']) ? $ssbaPost['ssba_default_pinterest'] : NULL),
'ssba_pinterest_featured' => (isset($ssbaPost['ssba_pinterest_featured']) ? $ssbaPost['ssba_pinterest_featured'] : NULL),
'ssba_content_priority' => (isset($ssbaPost['ssba_content_priority']) ? $ssbaPost['ssba_content_priority'] : NULL),
// share container
'ssba_div_padding' => $ssbaPost['ssba_div_padding'],
'ssba_div_rounded_corners' => (isset($ssbaPost['ssba_div_rounded_corners']) ? $ssbaPost['ssba_div_rounded_corners'] : NULL),
'ssba_border_width' => $ssbaPost['ssba_border_width'],
'ssba_div_border' => $ssbaPost['ssba_div_border'],
'ssba_div_background' => $ssbaPost['ssba_div_background'],
// text
'ssba_share_text' => stripslashes_deep($ssbaPost['ssba_share_text']),
'ssba_text_placement' => $ssbaPost['ssba_text_placement'],
'ssba_font_family' => $ssbaPost['ssba_font_family'],
'ssba_font_color' => $ssbaPost['ssba_font_color'],
'ssba_font_size' => $ssbaPost['ssba_font_size'],
'ssba_font_weight' => $ssbaPost['ssba_font_weight'],
// included buttons
'ssba_selected_buttons' => $ssbaPost['ssba_selected_buttons'],
// sharedcount
'sharedcount_enabled' => $ssbaPost['sharedcount_enabled'],
'sharedcount_api_key' => $ssbaPost['sharedcount_api_key'],
'sharedcount_plan' => $ssbaPost['sharedcount_plan'],
// newsharecounts
'twitter_newsharecounts' => $ssbaPost['twitter_newsharecounts'],
);
// prepare array of buttons
$arrButtons = json_decode(get_option('ssba_buttons'), true);
// loop through each button
foreach ($arrButtons as $button => $arrButton) {
// update the option for the button
update_option('ssba_custom_'.$button, $ssbaPost['ssba_custom_'.$button]);
// add custom button to array of options
$arrOptions['ssba_custom_'.$button] = $ssbaPost['ssba_custom_'.$button];
}
// save the settings
ssba_update_options($arrOptions);
// return success
return true;
}
......
......@@ -611,6 +611,71 @@ function ssba_admin_panel($arrSettings) {
);
$htmlShareButtonsForm .= $ssbpForm->ssbp_input($opts);
// newsharecounts.com enable
$opts = array(
'form_group' => false,
'type' => 'checkbox',
'name' => 'twitter_newsharecounts',
'label' => 'newsharecounts.com Counts for Twitter',
'tooltip' => 'Switch on to enable the use of the newsharecounts.com API for Twitter share counts',
'value' => 'Y',
'checked' => ($arrSettings['twitter_newsharecounts'] == 'Y' ? 'checked' : null),
);
$htmlShareButtonsForm .= $ssbpForm->ssbp_input($opts);
// info
$htmlShareButtonsForm .= '<p>You shall need to follow the instructions here before enabling this feature - <a target="_blank" href="http://newsharecounts.com/">newsharecounts.com</a>';
// open sharedcount well
$htmlShareButtonsForm .= '<div class="well">';
// sharedcount heading
$htmlShareButtonsForm .= '<h3>sharedcount.com</h3>';
$htmlShareButtonsForm .= '<p>Only necessary if you are experiencing issues with Facebook share counts. <a href="https://admin.sharedcount.com/admin/signup.php" target="_blank">Signup for your free account here</a>.</p>';
// sharedcount enable
$opts = array(
'form_group' => false,
'type' => 'checkbox',
'name' => 'sharedcount_enabled',
'label' => 'Enable sharedcount.com API',
'tooltip' => 'Enable if you wish to enable the use of the sharedcount.com API',
'value' => 'Y',
'checked' => ($arrSettings['sharedcount_enabled'] == 'Y' ? 'checked' : null),
);
$htmlShareButtonsForm .= $ssbpForm->ssbp_input($opts);
// sharedcount plan
$opts = array(
'form_group' => false,
'type' => 'select',
'name' => 'sharedcount_plan',
'label' => 'sharedcount.com plan',
'tooltip' => 'Select your sharedcount.com plan',
'selected' => $arrSettings['sharedcount_plan'],
'options' => array(
'Free' => 'free',
'Plus' => 'plus',
'Business' => 'business',
),
);
$htmlShareButtonsForm .= $ssbpForm->ssbp_input($opts);
// sharedcount api key
$opts = array(
'form_group' => false,
'type' => 'text',
'placeholder' => '9b17c12712c691491ef95f46c51ce3917118fdf9',
'name' => 'sharedcount_api_key',
'label' => 'sharedcount.com API Key',
'tooltip' => 'Add some text included in an email when people share that way',
'value' => $arrSettings['sharedcount_api_key'],
);
$htmlShareButtonsForm .= $ssbpForm->ssbp_input($opts);
// close well
$htmlShareButtonsForm .= '</div>';
// close col
$htmlShareButtonsForm .= '</div>';
......@@ -897,15 +962,13 @@ function ssba_admin_panel($arrSettings) {
// get an html formatted of currently selected and ordered buttons
function getSelectedSSBA($strSelectedSSBA) {
//variables
$htmlSelectedList = '';
// variables
$htmlSelectedList = '';
$arrSelectedSSBA = '';
// prepare array of buttons
$arrButtons = json_decode(get_option('ssba_buttons'), true);
// prepare array of buttons
$arrButtons = json_decode(get_option('ssba_buttons'), true);
// if there are some selected buttons
// if there are some selected buttons
if ($strSelectedSSBA != '') {
// explode saved include list and add to a new array
......@@ -918,7 +981,7 @@ function getSelectedSSBA($strSelectedSSBA) {
foreach ($arrSelectedSSBA as $strSelected) {
// add a list item for each selected option
$htmlSelectedList .= '<li class="ssbp-option-item" id="'.$strSelected.'"><a href="javascript:;" class="ssbp-btn ssbp-'.$strSelected.'"></a></li>';
$htmlSelectedList .= '<li class="ssbp-option-item" id="'.$strSelected.'"><a title="'.$arrButtons[$strSelected]["full_name"].'" href="javascript:;" class="ssbp-btn ssbp-'.$strSelected.'"></a></li>';
}
}
}
......@@ -931,7 +994,6 @@ function getAvailableSSBA($strSelectedSSBA)
{
// variables
$htmlAvailableList = '';
$arrSelectedSSBA = '';
// prepare array of buttons
$arrButtons = json_decode(get_option('ssba_buttons'), true);
......@@ -949,7 +1011,7 @@ function getAvailableSSBA($strSelectedSSBA)
foreach($arrAvailableSSBA as $strAvailable)
{
// add a list item for each available option
$htmlAvailableList .= '<li class="ssbp-option-item" id="'.$strAvailable.'"><a href="javascript:;" class="ssbp-btn ssbp-'.$strAvailable.'"></a></li>';
$htmlAvailableList .= '<li class="ssbp-option-item" id="'.$strAvailable.'"><a title="'.$arrButtons[$strAvailable]["full_name"].'" href="javascript:;" class="ssbp-btn ssbp-'.$strAvailable.'"></a></li>';
}
}
......
......@@ -25,12 +25,10 @@ function show_share_buttons($content, $booShortCode = FALSE, $atts = '') {
// variables
$htmlContent = $content;
$htmlShareButtons = '';
$strIsWhatFunction = '';
$pattern = get_shortcode_regex();
// ssba_hide shortcode is in the post content and instance is not called by shortcode ssba
if (preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches )
if (isset($post->post_content) && preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches )
&& array_key_exists( 2, $matches )
&& in_array('ssba_hide', $matches[2])
&& $booShortCode == FALSE) {
......@@ -281,8 +279,8 @@ function ssba_facebook($arrSettings, $urlCurrentPage, $strPageTitle, $booShowSha
// if show share count is set to Y
if ($arrSettings['ssba_show_share_count'] == 'Y' && $booShowShareCount == true) {
$htmlShareButtons .= '<span class="ssba_sharecount">' . getFacebookShareCount($urlCurrentPage) . '</span>';
// get and add facebook share count
$htmlShareButtons .= '<span class="ssba_sharecount">' . getFacebookShareCount($urlCurrentPage, $arrSettings) . '</span>';
}
// return share buttons
......@@ -290,19 +288,36 @@ function ssba_facebook($arrSettings, $urlCurrentPage, $strPageTitle, $booShowSha
}
// get facebook share count
function getFacebookShareCount($urlCurrentPage) {
// get results from facebook
$htmlFacebookShareDetails = wp_remote_get('http://graph.facebook.com/'.$urlCurrentPage, array('timeout' => 6));
function getFacebookShareCount($urlCurrentPage, $arrSettings)
{
// if sharedcount.com is enabled
if ($arrSettings['sharedcount_enabled']) {
// request from sharedcount.com
$sharedcount = wp_remote_get('https://'.$arrSettings['sharedcount_plan'].'.sharedcount.com/url?url='.$urlCurrentPage.'&apikey='.$arrSettings['sharedcount_api_key'], array('timeout' => 6));
// if no error
if (is_wp_error($sharedcount)) {
return 0;
}
// if no error
if (is_wp_error($htmlFacebookShareDetails)) {
return 0;
}
// decode and return count
$sharedcount = json_decode($sharedcount['body'], true);
$sharedcount = (isset($sharedcount['Facebook']['share_count']) ? $sharedcount['Facebook']['share_count'] : 0);
return ($sharedcount) ? ssba_format_number($sharedcount) : '0';
} else {
// get results from facebook
$htmlFacebookShareDetails = wp_remote_get('http://graph.facebook.com/'.$urlCurrentPage, array('timeout' => 6));
// decode and return count
$arrFacebookShareDetails = json_decode($htmlFacebookShareDetails['body'], true);
$intFacebookShareCount = (isset($arrFacebookShareDetails['shares']) ? $arrFacebookShareDetails['shares'] : 0);
return ($intFacebookShareCount) ? ssba_format_number($intFacebookShareCount) : '0';
// if no error
if (is_wp_error($htmlFacebookShareDetails)) {
return 0;
}
// decode and return count
$arrFacebookShareDetails = json_decode($htmlFacebookShareDetails['body'], true);
$intFacebookShareCount = (isset($arrFacebookShareDetails['shares']) ? $arrFacebookShareDetails['shares'] : 0);
return ($intFacebookShareCount) ? ssba_format_number($intFacebookShareCount) : '0';
}
}
// get twitter button
......@@ -333,8 +348,10 @@ function ssba_twitter($arrSettings, $urlCurrentPage, $strPageTitle, $booShowShar
// if show share count is set to Y
if ($arrSettings['ssba_show_share_count'] == 'Y' && $booShowShareCount == true) {
$htmlShareButtons .= '<span class="ssba_sharecount">' . getTwitterShareCount($urlCurrentPage) . '</span>';
// newsharedcount needs to be enabled
if ($arrSettings['twitter_newsharecounts'] == 'Y') {
$htmlShareButtons .= '<span class="ssba_sharecount">' . ssba_twitter_count($urlCurrentPage) . '</span>';
}
}
// return share buttons
......@@ -342,19 +359,22 @@ function ssba_twitter($arrSettings, $urlCurrentPage, $strPageTitle, $booShowShar
}
// get twitter share count
function getTwitterShareCount($urlCurrentPage) {
// get results from twitter and return the number of shares
$htmlTwitterShareDetails = wp_remote_get('http://urls.api.twitter.com/1/urls/count.json?url='.$urlCurrentPage, array('timeout' => 6));
function ssba_twitter_count($urlCurrentPage)
{
// get results from newsharecounts and return the number of shares
$result = wp_remote_get('http://public.newsharecounts.com/count.json?url=' . $urlCurrentPage, array('timeout' => 6));
// if error
if (is_wp_error($htmlTwitterShareDetails)) {
// check there was an error
if (is_wp_error($result)) {
return 0;
}
// get and decode count
$arrTwitterShareDetails = json_decode($htmlTwitterShareDetails['body'], true);
$intTwitterShareCount = $arrTwitterShareDetails['count'];
return ($intTwitterShareCount) ? ssba_format_number($intTwitterShareCount) : '0';
// decode data
$result = json_decode($result['body'], true);
$count = (isset($result['count']) ? $result['count'] : 0);
// return
return ssba_format_number($count);
}
// get google+ button
......@@ -780,23 +800,8 @@ function ssba_buffer($arrSettings, $urlCurrentPage, $strPageTitle, $booShowShare
// get tumblr button
function ssba_tumblr($arrSettings, $urlCurrentPage, $strPageTitle, $booShowShareCount) {
// check if http:// is included
if (preg_match('[http://]', $urlCurrentPage)) {
// remove http:// from URL
$urlCurrentPage = str_replace('http://', '', $urlCurrentPage);
} else if (preg_match('[https://]', $urlCurrentPage)) { // check if https:// is included
// remove http:// from URL
$urlCurrentPage = str_replace('https://', '', $urlCurrentPage);
}
// strip http:// or https:// from URL (tumblr doesn't work with this set)
$urlCurrentPage = str_replace("http://", '', $urlCurrentPage);
// tumblr share link
$htmlShareButtons = '<a data-site="tumblr" class="ssba_tumblr_share" href="http://www.tumblr.com/share/link?url=' . $urlCurrentPage . '&amp;name=' . $strPageTitle . '" ' . ($arrSettings['ssba_share_new_window'] == 'Y' ? ' target="_blank" ' : NULL) . ($arrSettings['ssba_rel_nofollow'] == 'Y' ? ' rel="nofollow" ' : NULL) . '>';
$htmlShareButtons = '<a data-site="tumblr" class="ssba_tumblr_share" href="http://www.tumblr.com/share/link?url=' . $urlCurrentPage . '" ' . ($arrSettings['ssba_share_new_window'] == 'Y' ? ' target="_blank" ' : NULL) . ($arrSettings['ssba_rel_nofollow'] == 'Y' ? ' rel="nofollow" ' : NULL) . '>';
// if image set is not custom
if ($arrSettings['ssba_image_set'] != 'custom') {
......@@ -815,10 +820,36 @@ function ssba_tumblr($arrSettings, $urlCurrentPage, $strPageTitle, $booShowShare
// close href
$htmlShareButtons .= '</a>';
// if show share count is set to Y
if ($arrSettings['ssba_show_share_count'] == 'Y' && $booShowShareCount == true) {
$htmlShareButtons .= '<span class="ssba_sharecount">' . getTumblrShareCount($urlCurrentPage) . '</span>';
}
// return share buttons
return $htmlShareButtons;
}
// get tumblr share count
function getTumblrShareCount($urlCurrentPage)
{
// get results from tumblr and return the number of shares
$result = wp_remote_get('http://api.tumblr.com/v2/share/stats?url=' . $urlCurrentPage, array('timeout' => 6));
// check there was an error
if (is_wp_error($result)) {
// return
return 0;
}
// decode data
$array = json_decode($result['body'], true);
$count = (isset($array['response']['note_count']) ? $array['response']['note_count'] : 0);
// return
return ($count) ? $count : '0';
}
// get print button
function ssba_print($arrSettings, $urlCurrentPage, $strPageTitle, $booShowShareCount) {
......@@ -896,10 +927,36 @@ function ssba_yummly($arrSettings, $urlCurrentPage, $strPageTitle, $booShowShare
// close href
$htmlShareButtons .= '</a>';
// if show share count is set to Y
if ($arrSettings['ssba_show_share_count'] == 'Y' && $booShowShareCount == true) {
$htmlShareButtons .= '<span class="ssba_sharecount">' . getYummlyShareCount($urlCurrentPage) . '</span>';
}
// return share buttons
return $htmlShareButtons;
}
// get yummly share count
function getYummlyShareCount($urlCurrentPage)
{
// get results from yummly and return the number of shares
$result = wp_remote_get('http://www.yummly.com/services/yum-count?url=' . $urlCurrentPage, array('timeout' => 6));
// check there was an error
if (is_wp_error($result)) {
// return
return 0;
}
// decode data
$array = json_decode($result['body'], true);
$count = (isset($array['count']) ? $array['count'] : 0);
// return
return ($count) ? $count : '0';
}
// register shortcode [ssba] to show [ssba_hide]
add_shortcode( 'ssba', 'ssba_buttons' );
add_shortcode( 'ssba_hide', 'ssba_hide' );
<?php
defined('ABSPATH') or die('No direct access permitted');
// run the activation function upon acitvation of the plugin
register_activation_hook( __FILE__,'ssba_activate');
// register deactivation hook
register_uninstall_hook(__FILE__,'ssba_uninstall');
// activate ssba function
function ssba_activate() {
// insert default options for ssba
add_option('ssba_version', SSBA_VERSION);
add_option('ssba_image_set', 'somacro');
add_option('ssba_size', '35');
add_option('ssba_pages', '');
add_option('ssba_posts', '');
add_option('ssba_cats_archs', '');
add_option('ssba_homepage', '');
add_option('ssba_excerpts', '');
add_option('ssba_align', 'left');
add_option('ssba_padding', '6');
add_option('ssba_before_or_after', 'after');
add_option('ssba_additional_css', '');
add_option('ssba_custom_styles', '');
add_option('ssba_custom_styles_enabled','');
add_option('ssba_email_message', '');
add_option('ssba_twitter_text', '');