Version Description
- Fix: Improve sanitization on input values and escape output values. Fixes a low severity Authenticated Stored Cross-Site Scripting (XSS) vulnerability
Download this release
Release Info
Developer | ReneHermi |
Plugin | Social Media Share Buttons | MashShare |
Version | 3.8.4 |
Comparing to | |
See all releases |
Code changes from version 3.8.3 to 3.8.4
- includes/admin/add-ons.php +1 -1
- includes/admin/settings/register-settings.php +89 -229
- includes/template-functions.php +12 -50
- mashshare.php +2 -2
- readme.txt +8 -2
includes/admin/add-ons.php
CHANGED
@@ -48,7 +48,7 @@ function mashsb_add_ons_get_feed() {
|
|
48 |
if ( ! is_wp_error( $feed ) ) {
|
49 |
if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) {
|
50 |
$cache = wp_remote_retrieve_body( $feed );
|
51 |
-
set_transient( 'mashshare_add_ons_feed', $cache,
|
52 |
}
|
53 |
} else {
|
54 |
$cache = '<div class="error"><p>' . __( 'There was an error retrieving the Mashshare addon list from the server. Please try again later.', 'mashsb' ) . '
|
48 |
if ( ! is_wp_error( $feed ) ) {
|
49 |
if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) {
|
50 |
$cache = wp_remote_retrieve_body( $feed );
|
51 |
+
set_transient( 'mashshare_add_ons_feed', $cache, 86400 );
|
52 |
}
|
53 |
} else {
|
54 |
$cache = '<div class="error"><p>' . __( 'There was an error retrieving the Mashshare addon list from the server. Please try again later.', 'mashsb' ) . '
|
includes/admin/settings/register-settings.php
CHANGED
@@ -124,11 +124,9 @@ function mashsb_get_registered_settings() {
|
|
124 |
'mashsb_sharemethod' => array(
|
125 |
'id' => 'mashsb_sharemethod',
|
126 |
'name' => __( 'Share Count', 'mashsb' ),
|
127 |
-
//'desc' => __( '- <i>MashEngine</i> collects shares by direct request to social networks.<br><br><i>SharedCount.com</i> is a third party service free for up to 500 daily requests. It collects shares for Facebook, Pinterest, Stumbleupon. (For GDPR compliance you should select the sharedcount.com service.)<br><br>Twitter count is aggreagated via <a href="https://twitcount.com" target="_blank" rel="external nofollow">https://twitcount.com</a>. You must sign up with your Twitter account for this free service to get the twitter share count. Visit the site http://twitcount.com, fill in your website domain and click on <i>Sign up</i>. <br><br><strong>Note: You need <a href="https://mashshare.net/downloads/mashshare-social-networks-addon/" target="_blank">MashShare Social Network Add-On</a> for enabling Twitter count.</strong>', 'mashsb' ),
|
128 |
'desc' => __( '- <i>SharedCount.com</i> is a third party service free for up to 500 daily requests. It collects shares for Facebook.<br><br>Twitter count is aggreagated via <a href="https://opensharecount.com" target="_blank" rel="external nofollow">https://opensharecount.com</a>. You must sign up with your Twitter account for this free service to get the twitter share count. Visit the site https://opensharecount.com, fill in your website domain and click on <i>Sign up</i>. <br><br><strong>Note: You need <a href="https://mashshare.net/downloads/mashshare-social-networks-addon/" target="_blank">MashShare Social Network Add-On</a> for enabling Twitter count.</strong>', 'mashsb' ),
|
129 |
'type' => 'select',
|
130 |
'options' => array(
|
131 |
-
//'mashengine' => 'MashEngine',
|
132 |
'sharedcount' => 'Sharedcount.com'
|
133 |
)
|
134 |
),
|
@@ -139,14 +137,6 @@ function mashsb_get_registered_settings() {
|
|
139 |
'type' => 'text',
|
140 |
'size' => 'medium'
|
141 |
),
|
142 |
-
// 'mashsharer_sharecount_domain' => array(
|
143 |
-
// 'id' => 'mashsharer_sharecount_domain',
|
144 |
-
// 'name' => __( 'Sharedcount.com endpint', 'mashsb' ),
|
145 |
-
// 'desc' => __( 'The SharedCount Domain your API key is configured to query. For example, free.sharedcount.com. This may update automatically if configured incorrectly.', 'mashsb' ),
|
146 |
-
// 'type' => 'text',
|
147 |
-
// 'size' => 'medium',
|
148 |
-
// 'std' => 'https://api.sharedcount.com'
|
149 |
-
// ),
|
150 |
'caching_method' => array(
|
151 |
'id' => 'caching_method',
|
152 |
'name' => __( 'Caching Method', 'mashsb' ),
|
@@ -171,7 +161,6 @@ function mashsb_get_registered_settings() {
|
|
171 |
'type' => 'select',
|
172 |
'options' => array(
|
173 |
'shares' => 'Shares',
|
174 |
-
//'likes' => 'Likes', not used any longer
|
175 |
'total' => 'Shares + Comments'
|
176 |
)
|
177 |
),
|
@@ -262,13 +251,6 @@ function mashsb_get_registered_settings() {
|
|
262 |
'desc' => '',
|
263 |
'type' => 'header'
|
264 |
),
|
265 |
-
// array(
|
266 |
-
// 'id' => 'fb_access_token_new',
|
267 |
-
// 'name' => __( 'Facebook User Access Token', 'mashsb' ),
|
268 |
-
// 'desc' => sprintf( __( 'Optional: Use this to make up to 200 calls per hour to facebook api. <a href="%s" target="_blank">Read here</a> how to get the access token. If your access token is not working just leave this field empty. Shares are still counted.', 'mashsb' ), 'http://docs.mashshare.net/article/132-how-to-create-a-facebook-access-token' ),
|
269 |
-
// 'type' => 'fboauth',
|
270 |
-
// 'size' => 'large'
|
271 |
-
// ),
|
272 |
array(
|
273 |
'id' => 'fb_publisher_url',
|
274 |
'name' => __( 'Facebook page url', 'mashsb' ),
|
@@ -276,20 +258,6 @@ function mashsb_get_registered_settings() {
|
|
276 |
'type' => 'text',
|
277 |
'size' => 'large'
|
278 |
),
|
279 |
-
// array(
|
280 |
-
// 'id' => 'fb_app_id',
|
281 |
-
// 'name' => __( 'Facebook App ID', 'mashsb' ),
|
282 |
-
// 'desc' => sprintf( __( 'Optional and not needed for basic share buttons. But required by some MashShare Add-Ons. <a href="%1s" target="_blank">Create a App ID now</a>.', 'mashsb' ), 'https://developers.facebook.com/docs/apps/register' ),
|
283 |
-
// 'type' => 'text',
|
284 |
-
// 'size' => 'medium'
|
285 |
-
// ),
|
286 |
-
// array(
|
287 |
-
// 'id' => 'fb_app_secret',
|
288 |
-
// 'name' => __( 'Facebook App Secret', 'mashsb' ),
|
289 |
-
// 'desc' => sprintf( __( 'Required for getting accurate facebook share numbers. Where do i find the facebook APP Secret?', 'mashsb' ), 'https://developers.facebook.com/docs/apps/register' ),
|
290 |
-
// 'type' => 'text',
|
291 |
-
// 'size' => 'medium'
|
292 |
-
// ),
|
293 |
'mashsharer_hashtag' => array(
|
294 |
'id' => 'mashsharer_hashtag',
|
295 |
'name' => __( 'Twitter Username', 'mashsb' ),
|
@@ -325,40 +293,6 @@ So the MashShare open graph data will be containing the same social meta data th
|
|
325 |
'type' => 'networks',
|
326 |
'options' => mashsb_get_networks_list()
|
327 |
),
|
328 |
-
/*'networks' => array(
|
329 |
-
'id' => 'networks',
|
330 |
-
'name' => '<strong>' . __( 'Services', 'mashsb' ) . '</strong>',
|
331 |
-
'desc' => __( 'Drag and drop the Share Buttons to sort them and specify which ones should be enabled. <br>If you enable more networks than "Large Buttons", the plus sign is automatically added <br>to the last visible large share buttons', 'mashsb' ),
|
332 |
-
'type' => 'networks',
|
333 |
-
'options' => mashsb_get_networks_list()
|
334 |
-
),*/
|
335 |
-
/*'services_header' => array(
|
336 |
-
'id' => 'services_header',
|
337 |
-
'name' => __( 'Social Networks', 'mashsb' ),
|
338 |
-
'desc' => '',
|
339 |
-
'type' => 'header'
|
340 |
-
),*/
|
341 |
-
/*'visible_services' => array(
|
342 |
-
'id' => 'visible_services',
|
343 |
-
'name' => __( 'Large Share Buttons', 'mashsb' ),
|
344 |
-
'desc' => __( 'Specify how many services and social networks are visible before the "Plus" Button is shown. These buttons turn into large prominent buttons.', 'mashsb' ),
|
345 |
-
'type' => 'select',
|
346 |
-
'options' => numberServices()
|
347 |
-
),*/
|
348 |
-
|
349 |
-
// array(
|
350 |
-
// 'id' => 'shorturl_type',
|
351 |
-
// 'name' => __( 'Enable on', 'mashsb' ),
|
352 |
-
// 'desc' => __( 'You can choose multiple networks where short url\'s should be used.', 'mashsb' ),
|
353 |
-
// 'type' => 'multiselect',
|
354 |
-
// 'placeholder' => 'Select the networks',
|
355 |
-
// 'options' => array(
|
356 |
-
// 'twitter' => 'Twitter',
|
357 |
-
// 'facebook' => 'Facebook',
|
358 |
-
// 'default' => 'All Networks'
|
359 |
-
// ),
|
360 |
-
// 'std' => 'All networks'
|
361 |
-
// ),
|
362 |
'style_header' => array(
|
363 |
'id' => 'style_header',
|
364 |
'name' => '<strong>' . __( 'Visual', 'mashsb' ) . '</strong>',
|
@@ -492,12 +426,6 @@ So the MashShare open graph data will be containing the same social meta data th
|
|
492 |
'desc' => __( 'Buttons Text labels and social icons will be aligned in center of the buttons', 'mashsb' ),
|
493 |
'type' => 'checkbox'
|
494 |
),
|
495 |
-
/*'image_share' => array(
|
496 |
-
'id' => 'image_share',
|
497 |
-
'name' => __( 'Share buttons on image hover', 'mashsb' ),
|
498 |
-
'desc' => __( '', 'mashsb' ),
|
499 |
-
'type' => 'checkbox'
|
500 |
-
),*/
|
501 |
'subscribe_behavior' => array(
|
502 |
'id' => 'subscribe_behavior',
|
503 |
'name' => __( 'Subscribe Button', 'mashsb' ),
|
@@ -632,13 +560,6 @@ So the MashShare open graph data will be containing the same social meta data th
|
|
632 |
'type' => 'text',
|
633 |
'size' => 'large'
|
634 |
),
|
635 |
-
// array(
|
636 |
-
// 'id' => 'google_app_id',
|
637 |
-
// 'name' => __( 'Google API Key (goo.gl)', 'mashsb' ),
|
638 |
-
// 'desc' => sprintf(__( 'If you like to use goo.gl shortener get a free Google API key <a href="%s" target="_blank">here</a>. This turn urls into a format: http://goo.gl/cXnjsh. ' . mashsb_check_google_apikey(), 'mashsb' ),'https://console.developers.google.com/'),
|
639 |
-
// 'type' => 'text',
|
640 |
-
// 'size' => 'large'
|
641 |
-
// ),
|
642 |
array(
|
643 |
'id' => 'mashsu_methods',
|
644 |
'name' => __( 'Shorturl method', 'mashsb' ),
|
@@ -746,13 +667,13 @@ function mashsb_settings_sanitize( $input = array() ) {
|
|
746 |
// Get the setting type (checkbox, select, etc)
|
747 |
$type = isset( $settings[$tab][$key]['type'] ) ? $settings[$tab][$key]['type'] : false;
|
748 |
|
|
|
|
|
|
|
749 |
if( $type ) {
|
750 |
// Field type specific filter
|
751 |
$input[$key] = apply_filters( 'mashsb_settings_sanitize_' . $type, $value, $key );
|
752 |
}
|
753 |
-
|
754 |
-
// General filter
|
755 |
-
$input[$key] = apply_filters( 'mashsb_settings_sanitize', $value, $key );
|
756 |
}
|
757 |
|
758 |
// Loop through the whitelist and unset any that are empty for the tab being saved
|
@@ -783,13 +704,27 @@ function mashsb_settings_sanitize( $input = array() ) {
|
|
783 |
*
|
784 |
* @since 1.8
|
785 |
* @param array $input The field value
|
786 |
-
* @return string $input
|
787 |
*/
|
788 |
function mashsb_sanitize_text_field( $input ) {
|
789 |
-
|
|
|
790 |
}
|
791 |
add_filter( 'mashsb_settings_sanitize_text', 'mashsb_sanitize_text_field' );
|
792 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
793 |
/**
|
794 |
* Retrieve settings tabs
|
795 |
*
|
@@ -821,8 +756,6 @@ function mashsb_get_settings_tabs() {
|
|
821 |
if (false === mashsb_hide_addons()){
|
822 |
$tabs['addons'] = __( 'Get More Add-Ons', 'mashsb' );
|
823 |
}
|
824 |
-
|
825 |
-
//$tabs['misc'] = __( 'Misc', 'mashsb' );
|
826 |
|
827 |
return apply_filters( 'mashsb_settings_tabs', $tabs );
|
828 |
}
|
@@ -856,7 +789,6 @@ function mashsb_get_expiretimes() {
|
|
856 |
* @return array Defined social networks
|
857 |
*/
|
858 |
function mashsb_get_networks_list() {
|
859 |
-
|
860 |
$networks = get_option( 'mashsb_networks' );
|
861 |
return apply_filters( 'mashsb_get_networks_list', $networks );
|
862 |
}
|
@@ -902,8 +834,8 @@ function mashsb_checkbox_callback( $args ) {
|
|
902 |
|
903 |
$checked = isset( $mashsb_options[$args['id']] ) ? checked( 1, $mashsb_options[$args['id']], false ) : '';
|
904 |
$html = '<div class="mashsb-admin-onoffswitch">';
|
905 |
-
$html .= '<input type="checkbox" class="mashsb-admin-onoffswitch-checkbox" id="mashsb_settings[' . $args['id'] . ']" name="mashsb_settings[' . $args['id'] . ']" value="1" ' . $checked . '/>';
|
906 |
-
$html .= '<label class="mashsb-admin-onoffswitch-label" for="mashsb_settings[' . $args['id'] . ']">'
|
907 |
. '<span class="mashsb-admin-onoffswitch-inner"></span>'
|
908 |
. '<span class="mashsb-admin-onoffswitch-switch"></span>'
|
909 |
. '</label>';
|
@@ -932,10 +864,10 @@ function mashsb_multicheck_callback( $args ) {
|
|
932 |
} else {
|
933 |
$enabled = NULL;
|
934 |
}
|
935 |
-
echo '<input name="mashsb_settings[' . $args['id'] . '][' . $key . ']" id="mashsb_settings[' . $args['id'] . '][' . $key . ']" type="checkbox" value="' . $option . '" ' . checked( $option, $enabled, false ) . '/> ';
|
936 |
-
echo '<label for="mashsb_settings[' . $args['id'] . '][' . $key . ']">' . $option . '</label><br/>';
|
937 |
endforeach;
|
938 |
-
echo '<p class="description mashsb_hidden">' . $args['desc'] . '</p>';
|
939 |
}
|
940 |
}
|
941 |
|
@@ -960,11 +892,11 @@ function mashsb_radio_callback( $args ) {
|
|
960 |
elseif( isset( $args['std'] ) && $args['std'] == $key && !isset( $mashsb_options[$args['id']] ) )
|
961 |
$checked = true;
|
962 |
|
963 |
-
echo '<input name="mashsb_settings[' . $args['id'] . ']"" id="mashsb_settings[' . $args['id'] . '][' . $key . ']" type="radio" value="' . $key . '" ' . checked( true, $checked, false ) . '/> ';
|
964 |
-
echo '<label for="mashsb_settings[' . $args['id'] . '][' . $key . ']">' . $option . '</label><br/>';
|
965 |
endforeach;
|
966 |
|
967 |
-
echo '<p class="description mashsb_hidden">' . $args['desc'] . '</p>';
|
968 |
}
|
969 |
|
970 |
/**
|
@@ -986,8 +918,8 @@ function mashsb_text_callback( $args ) {
|
|
986 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
987 |
|
988 |
$size = ( isset( $args['size'] ) && !is_null( $args['size'] ) ) ? $args['size'] : 'regular';
|
989 |
-
$html = '<input type="text" class="' . $size . '-text" id="mashsb_settings[' . $args['id'] . ']" name="mashsb_settings[' . $args['id'] . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
|
990 |
-
$html .= '<label class="mashsb_hidden" class="mashsb_hidden" for="mashsb_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
991 |
|
992 |
echo $html;
|
993 |
}
|
@@ -1014,8 +946,8 @@ function mashsb_number_callback( $args ) {
|
|
1014 |
$min = isset( $args['min'] ) ? $args['min'] : 0;
|
1015 |
$step = isset( $args['step'] ) ? $args['step'] : 1;
|
1016 |
|
1017 |
-
$size = ( isset( $args['size'] ) && !is_null( $args['size'] ) ) ? $args['size'] : 'regular';
|
1018 |
-
$html = '<input type="number" step="' . esc_attr( $step ) . '" max="' . esc_attr( $max ) . '" min="' . esc_attr( $min ) . '" class="' . $size . '-text" id="mashsb_settings[' . $args['id'] . ']" name="mashsb_settings[' . $args['id'] . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
|
1019 |
$html .= '<label class="mashsb_hidden" for="mashsb_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
1020 |
|
1021 |
echo $html;
|
@@ -1039,37 +971,12 @@ function mashsb_textarea_callback( $args ) {
|
|
1039 |
else
|
1040 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1041 |
|
1042 |
-
$size = ( isset( $args['size'] ) && !is_null( $args['size'] ) ) ? $args['size'] : '40';
|
1043 |
-
$html = '<textarea class="large-text mashsb-textarea" cols="50" rows="' . $size . '" id="mashsb_settings[' . $args['id'] . ']" name="mashsb_settings[' . $args['id'] . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
|
1044 |
-
$html .= '<label class="mashsb_hidden" for="mashsb_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
1045 |
|
1046 |
echo $html;
|
1047 |
}
|
1048 |
-
/**
|
1049 |
-
* Custom CSS Callback
|
1050 |
-
*
|
1051 |
-
* Renders textarea fields.
|
1052 |
-
*
|
1053 |
-
* @since 1.0
|
1054 |
-
* @param array $args Arguments passed by the setting
|
1055 |
-
* @global $mashsb_options Array of all the MASHSB Options
|
1056 |
-
* @deprecated 3.3.6
|
1057 |
-
* @return void
|
1058 |
-
*/
|
1059 |
-
//function mashsb_customcss_callback( $args ) {
|
1060 |
-
// global $mashsb_options;
|
1061 |
-
//
|
1062 |
-
// if( isset( $mashsb_options[$args['id']] ) )
|
1063 |
-
// $value = $mashsb_options[$args['id']];
|
1064 |
-
// else
|
1065 |
-
// $value = isset( $args['std'] ) ? $args['std'] : '';
|
1066 |
-
//
|
1067 |
-
// $size = ( isset( $args['size'] ) && !is_null( $args['size'] ) ) ? $args['size'] : '40';
|
1068 |
-
// $html = '<textarea class="large-text mashsb-textarea" cols="50" rows="' . $size . '" id="mashsb_settings[' . $args['id'] . ']" name="mashsb_settings[' . $args['id'] . ']">' . esc_textarea( $value ) . '</textarea>';
|
1069 |
-
// $html .= '<label class="mashsb_hidden" for="mashsb_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
1070 |
-
//
|
1071 |
-
// echo $html;
|
1072 |
-
//}
|
1073 |
|
1074 |
/**
|
1075 |
* Password Callback
|
@@ -1089,9 +996,9 @@ function mashsb_password_callback( $args ) {
|
|
1089 |
else
|
1090 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1091 |
|
1092 |
-
$size = ( isset( $args['size'] ) && !is_null( $args['size'] ) ) ? $args['size'] : 'regular';
|
1093 |
-
$html = '<input type="password" class="' . $size . '-text" id="mashsb_settings[' . $args['id'] . ']" name="mashsb_settings[' . $args['id'] . ']" value="' . esc_attr( $value ) . '"/>';
|
1094 |
-
$html .= '<label for="mashsb_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
1095 |
|
1096 |
echo $html;
|
1097 |
}
|
@@ -1123,19 +1030,19 @@ function mashsb_select_callback( $args ) {
|
|
1123 |
global $mashsb_options;
|
1124 |
|
1125 |
if( isset( $mashsb_options[$args['id']] ) )
|
1126 |
-
$value = $mashsb_options[$args['id']];
|
1127 |
else
|
1128 |
-
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1129 |
|
1130 |
-
$html = '<select id="mashsb_settings[' . $args['id'] . ']" name="mashsb_settings[' . $args['id'] . ']"/>';
|
1131 |
|
1132 |
foreach ( $args['options'] as $option => $name ) :
|
1133 |
$selected = selected( $option, $value, false );
|
1134 |
-
$html .= '<option value="' . $option . '" ' . $selected . '>' . $name . '</option>';
|
1135 |
endforeach;
|
1136 |
|
1137 |
$html .= '</select>';
|
1138 |
-
$html .= '<label class="mashsb_hidden" for="mashsb_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
1139 |
|
1140 |
echo $html;
|
1141 |
}
|
@@ -1154,13 +1061,13 @@ function mashsb_multiselect_callback( $args = array() ) {
|
|
1154 |
$selected = isset($mashsb_options[$args['id']]) ? $mashsb_options[$args['id']] : '';
|
1155 |
$checked = '';
|
1156 |
|
1157 |
-
$html = '<select name="mashsb_settings[' . $args['id'] . '][]" data-placeholder="" style="width:350px;" multiple tabindex="4" class="mashsb-select mashsb-chosen-select">';
|
1158 |
$i = 0;
|
1159 |
foreach ( $args['options'] as $key => $value ) :
|
1160 |
if( is_array($selected)){
|
1161 |
$checked = selected( true, in_array( $key, $selected ), false );
|
1162 |
}
|
1163 |
-
$html .= '<option value="' . $key . '" ' . $checked . '>' . $value . '</option>';
|
1164 |
endforeach;
|
1165 |
$html .= '</select>';
|
1166 |
echo $html;
|
@@ -1188,10 +1095,10 @@ function mashsb_color_select_callback( $args ) {
|
|
1188 |
else
|
1189 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1190 |
|
1191 |
-
$html = '<strong>#:</strong><input type="text" style="max-width:80px;border:1px solid #' . esc_attr( stripslashes( $value ) ) . ';border-right:20px solid #' . esc_attr( stripslashes( $value ) ) . ';" id="mashsb_settings[' . $args['id'] . ']" class="medium-text ' . $args['id'] . ' mashsb-color-box" name="mashsb_settings[' . $args['id'] . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
|
1192 |
|
1193 |
$html .= '</select>';
|
1194 |
-
$html .= '<label class="mashsb_hidden" for="mashsb_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
1195 |
|
1196 |
echo $html;
|
1197 |
}
|
@@ -1218,10 +1125,10 @@ function mashsb_rich_editor_callback( $args ) {
|
|
1218 |
wp_editor( stripslashes( $value ), 'mashsb_settings_' . $args['id'], array('textarea_name' => 'mashsb_settings[' . $args['id'] . ']', 'textarea_rows' => $args['textarea_rows']) );
|
1219 |
$html = ob_get_clean();
|
1220 |
} else {
|
1221 |
-
$html = '<textarea class="large-text mashsb-richeditor" rows="10" id="mashsb_settings[' . $args['id'] . ']" name="mashsb_settings[' . $args['id'] . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
|
1222 |
}
|
1223 |
|
1224 |
-
$html .= '<br/><label class="mashsb_hidden" for="mashsb_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
1225 |
|
1226 |
echo $html;
|
1227 |
}
|
@@ -1244,10 +1151,10 @@ function mashsb_upload_callback( $args ) {
|
|
1244 |
else
|
1245 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1246 |
|
1247 |
-
$size = ( isset( $args['size'] ) && !is_null( $args['size'] ) ) ? $args['size'] : 'regular';
|
1248 |
-
$html = '<input type="text" class="' . $size . '-text mashsb_upload_field" id="mashsb_settings[' . $args['id'] . ']" name="mashsb_settings[' . $args['id'] . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
|
1249 |
$html .= '<span> <input type="button" class="mashsb_settings_upload_button button-secondary" value="' . __( 'Upload File', 'mashsb' ) . '"/></span>';
|
1250 |
-
$html .= '<label class="mashsb_hidden" for="mashsb_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
1251 |
|
1252 |
echo $html;
|
1253 |
}
|
@@ -1273,49 +1180,12 @@ function mashsb_color_callback( $args ) {
|
|
1273 |
|
1274 |
$default = isset( $args['std'] ) ? $args['std'] : '';
|
1275 |
|
1276 |
-
$
|
1277 |
-
$html
|
1278 |
-
$html .= '<label class="mashsb_hidden" for="mashsb_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
1279 |
|
1280 |
echo $html;
|
1281 |
}
|
1282 |
|
1283 |
-
/**
|
1284 |
-
* Registers the license field callback for Software Licensing
|
1285 |
-
*
|
1286 |
-
* @since 1.5
|
1287 |
-
* @param array $args Arguments passed by the setting
|
1288 |
-
* @global $mashsb_options Array of all the MASHSB Options
|
1289 |
-
* @return void
|
1290 |
-
*/
|
1291 |
-
//if( !function_exists( 'mashsb_license_key_callback' ) ) {
|
1292 |
-
//
|
1293 |
-
// function mashsb_license_key_callback( $args ) {
|
1294 |
-
// global $mashsb_options;
|
1295 |
-
//
|
1296 |
-
// if( isset( $mashsb_options[$args['id']] ) )
|
1297 |
-
// $value = $mashsb_options[$args['id']];
|
1298 |
-
// else
|
1299 |
-
// $value = isset( $args['std'] ) ? $args['std'] : '';
|
1300 |
-
//
|
1301 |
-
// $size = ( isset( $args['size'] ) && !is_null( $args['size'] ) ) ? $args['size'] : 'regular';
|
1302 |
-
// $html = '<input type="text" class="' . $size . '-text" id="mashsb_settings[' . $args['id'] . ']" name="mashsb_settings[' . $args['id'] . ']" value="' . esc_attr( $value ) . '"/>';
|
1303 |
-
//
|
1304 |
-
// if( 'valid' == get_option( $args['options']['is_valid_license_option'] ) ) {
|
1305 |
-
// $html .= '<input type="submit" class="button-secondary" name="' . $args['id'] . '_deactivate" value="' . __( 'Deactivate License', 'mashsb' ) . '"/>';
|
1306 |
-
// $html .= '<span style="font-weight:bold;color:green;"> License key activated! </span> <p style="color:green;font-size:13px;"> You´ll get updates for this Add-On automatically!</p>';
|
1307 |
-
// } else {
|
1308 |
-
// $html .= '<span style="color:red;"> License key not activated!</span style=""><p style="font-size:13px;font-weight:bold;">You´ll get no important security and feature updates for this Add-On!</p>';
|
1309 |
-
// }
|
1310 |
-
// $html .= '<label for="mashsb_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
1311 |
-
//
|
1312 |
-
// wp_nonce_field( $args['id'] . '-nonce', $args['id'] . '-nonce' );
|
1313 |
-
//
|
1314 |
-
// echo $html;
|
1315 |
-
// }
|
1316 |
-
//
|
1317 |
-
//}
|
1318 |
-
|
1319 |
/**
|
1320 |
* Registers the license field callback for MashShare Add-Ons
|
1321 |
*
|
@@ -1333,7 +1203,6 @@ if ( ! function_exists( 'mashsb_license_key_callback' ) ) {
|
|
1333 |
$messages = array();
|
1334 |
$license = get_option( $args['options']['is_valid_license_option'] );
|
1335 |
|
1336 |
-
|
1337 |
if( isset( $mashsb_options[$args['id']] ) ) {
|
1338 |
$value = $mashsb_options[$args['id']];
|
1339 |
} else {
|
@@ -1455,19 +1324,19 @@ if ( ! function_exists( 'mashsb_license_key_callback' ) ) {
|
|
1455 |
$license_status = null;
|
1456 |
}
|
1457 |
|
1458 |
-
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
|
1459 |
$html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="mashsb_settings[' . mashsb_sanitize_key( $args['id'] ) . ']" name="mashsb_settings[' . mashsb_sanitize_key( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>';
|
1460 |
|
1461 |
if ( ( is_object( $license ) && 'valid' == $license->license ) || 'valid' == $license ) {
|
1462 |
-
$html .= '<input type="submit" class="button-secondary" name="' . $args['id'] . '_deactivate" value="' . __( 'Deactivate License', 'mashsb' ) . '"/>';
|
1463 |
}
|
1464 |
|
1465 |
-
$html .= '<label for="mashsb_settings[' . mashsb_sanitize_key( $args['id'] ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
|
1466 |
|
1467 |
if ( ! empty( $messages ) ) {
|
1468 |
foreach( $messages as $message ) {
|
1469 |
|
1470 |
-
$html .= '<div class="mashsb-license-data mashsb-license-' . $class . '">';
|
1471 |
$html .= '<p>' . $message . '</p>';
|
1472 |
$html .= '</div>';
|
1473 |
|
@@ -1477,7 +1346,7 @@ if ( ! function_exists( 'mashsb_license_key_callback' ) ) {
|
|
1477 |
wp_nonce_field( mashsb_sanitize_key( $args['id'] ) . '-nonce', mashsb_sanitize_key( $args['id'] ) . '-nonce' );
|
1478 |
|
1479 |
if ( isset( $license_status ) ) {
|
1480 |
-
echo '<div class="' . $license_status . '">' . $html . '</div>';
|
1481 |
} else {
|
1482 |
echo '<div class="mashsb-license-null">' . $html . '</div>';
|
1483 |
}
|
@@ -1496,7 +1365,9 @@ if ( ! function_exists( 'mashsb_license_key_callback' ) ) {
|
|
1496 |
*/
|
1497 |
function mashsb_networks_callback( $args ) {
|
1498 |
global $mashsb_options;
|
1499 |
-
/*
|
|
|
|
|
1500 |
|
1501 |
array(
|
1502 |
0 => array (
|
@@ -1519,7 +1390,7 @@ function mashsb_networks_callback( $args ) {
|
|
1519 |
|
1520 |
ob_start();
|
1521 |
?>
|
1522 |
-
<p class="mashsb_description"><?php echo $args['desc']; ?></p>
|
1523 |
<table id="mashsb_network_list" class="wp-list-table fixed posts">
|
1524 |
<thead>
|
1525 |
<tr>
|
@@ -1538,25 +1409,25 @@ function mashsb_networks_callback( $args ) {
|
|
1538 |
$enabled = NULL;
|
1539 |
}
|
1540 |
if( isset( $mashsb_options[$args['id']][$key]['name'] ) ) {
|
1541 |
-
$name = $mashsb_options[$args['id']][$key]['name'];
|
1542 |
} else {
|
1543 |
$name = NULL;
|
1544 |
}
|
1545 |
|
1546 |
if ($option === 'Flipboard'){ // Darn you multi color flipboard svg icon.
|
1547 |
-
echo '<td class="mashicon-' . strtolower( $option ) . '"><div class="icon"><span class="mash-path1"></span><span class="mash-path2"></span><span class="mash-path3"></span><span class="mash-path4"></span></div><span class="text">' . $option . '</span></td>';
|
1548 |
} else {
|
1549 |
-
echo '<td class="mashicon-' . strtolower( $option ) . '"><span class="icon"></span><span class="text">' . $option . '</span></td>';
|
1550 |
}
|
1551 |
-
echo '<td><input type="hidden" name="mashsb_settings[' . $args['id'] . '][' . $key . '][id]" id="mashsb_settings[' . $args['id'] . '][' . $key . '][id]" value="' . strtolower( $option ) . '">';
|
1552 |
echo '<div class="mashsb-admin-onoffswitch">';
|
1553 |
-
echo '<input name="mashsb_settings[' . $args['id'] . '][' . $key . '][status]" class="mashsb-admin-onoffswitch-checkbox" id="mashsb_settings[' . $args['id'] . '][' . $key . '][status]" type="checkbox" value="1" ' . checked( 1, $enabled, false ) . '/>';
|
1554 |
-
echo '<label class="mashsb-admin-onoffswitch-label" for="mashsb_settings[' . $args['id'] . '][' . $key . '][status]">'
|
1555 |
. '<span class="mashsb-admin-onoffswitch-inner"></span>'
|
1556 |
. '<span class="mashsb-admin-onoffswitch-switch"></span>'
|
1557 |
. '</label>';
|
1558 |
echo '</div>';
|
1559 |
-
echo '<td><input type="text" class="medium-text" id="mashsb_settings[' . $args['id'] . '][' . $key . '][name]" name="mashsb_settings[' . $args['id'] . '][' . $key . '][name]" value="' . $name . '"/>';
|
1560 |
echo '</tr>';
|
1561 |
endforeach;
|
1562 |
}
|
@@ -1590,16 +1461,16 @@ function mashsb_upload_image_callback( $args ) {
|
|
1590 |
global $mashsb_options;
|
1591 |
|
1592 |
if( isset( $mashsb_options[$args['id']] ) )
|
1593 |
-
$value = $mashsb_options[$args['id']];
|
1594 |
else
|
1595 |
-
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1596 |
|
1597 |
-
$size = ( isset( $args['size'] ) && !is_null( $args['size'] ) ) ? $args['size'] : 'regular';
|
1598 |
-
$html = '<input type="text" class="' . $size . '-text ' . $args['id'] . '" id="mashsb_settings[' . $args['id'] . ']" name="mashsb_settings[' . $args['id'] . ']" value="' . esc_attr( $value ) . '"/>';
|
1599 |
|
1600 |
-
$html .= '<input type="submit" class="button-secondary mashsb_upload_image" name="' . $args['id'] . '_upload" value="' . __( 'Select Image', 'mashsb' ) . '"/>';
|
1601 |
|
1602 |
-
$html .= '<label class="mashsb_hidden" for="mashsb_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
1603 |
|
1604 |
echo $html;
|
1605 |
}
|
@@ -1620,19 +1491,19 @@ function mashsb_posttypes_callback( $args ) {
|
|
1620 |
global $mashsb_options;
|
1621 |
$posttypes = get_post_types();
|
1622 |
|
1623 |
-
//if ( ! empty( $args['options'] ) ) {
|
1624 |
if( !empty( $posttypes ) ) {
|
1625 |
-
//foreach( $args['options'] as $key => $option ):
|
1626 |
foreach ( $posttypes as $key => $option ):
|
1627 |
if( isset( $mashsb_options[$args['id']][$key] ) ) {
|
1628 |
-
$enabled = $option;
|
1629 |
} else {
|
1630 |
$enabled = NULL;
|
1631 |
}
|
1632 |
-
|
|
|
|
|
1633 |
echo '<label for="mashsb_settings[' . $args['id'] . '][' . $key . ']">' . $option . '</label><br/>';
|
1634 |
endforeach;
|
1635 |
-
echo '<p class="description mashsb_hidden">' . $args['desc'] . '</p>';
|
1636 |
}
|
1637 |
}
|
1638 |
|
@@ -1648,8 +1519,6 @@ function mashsb_posttypes_callback( $args ) {
|
|
1648 |
*/
|
1649 |
|
1650 |
function mashsb_note_callback( $args ) {
|
1651 |
-
global $mashsb_options;
|
1652 |
-
//$html = !empty($args['desc']) ? $args['desc'] : '';
|
1653 |
$html = '';
|
1654 |
echo $html;
|
1655 |
}
|
@@ -1667,14 +1536,14 @@ function mashsb_add_content_callback( $args ) {
|
|
1667 |
|
1668 |
$html = '<div id="mashtabcontainer" class="tabcontent_container"><ul class="mashtabs" style="width:99%;max-width:500px;">';
|
1669 |
foreach ( $args['options'] as $option => $name ) :
|
1670 |
-
$html .= '<li class="mashtab" style="float:left;margin-right:4px;"><a href="#' . $name['id'] . '">' . $name['name'] . '</a></li>';
|
1671 |
endforeach;
|
1672 |
$html .= '</ul>';
|
1673 |
$html .= '<div class="mashtab-container">';
|
1674 |
foreach ( $args['options'] as $option => $name ) :
|
1675 |
-
$value = isset( $mashsb_options[$name['id']] ) ? $mashsb_options[$name['id']] : '';
|
1676 |
-
$textarea = '<textarea class="large-text mashsb-textarea" cols="50" rows="15" id="mashsb_settings[' . $name['id'] . ']" name="mashsb_settings[' . $name['id'] . ']">' .
|
1677 |
-
$html .= '<div id="' . $name['id'] . '" style="max-width:500px;"><span style="padding-top:60px;display:block;">' . $name['desc'] . '</span><br>' . $textarea . '</div>';
|
1678 |
endforeach;
|
1679 |
$html .= '</div>';
|
1680 |
$html .= '</div>';
|
@@ -1894,9 +1763,9 @@ function mashsb_fboauth_callback( $args ) {
|
|
1894 |
|
1895 |
$button_label = __('Verify Access Token', 'mashsb');
|
1896 |
|
1897 |
-
$html = '<a href="#" id="mashsb_verify_fbtoken" class="button button-primary">'
|
1898 |
-
$html .= ' <input type="text" class="medium-text" style="width:333px;" id="mashsb_settings[' . $args['id'] . ']" name="mashsb_settings[' . $args['id'] . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
|
1899 |
-
$html .= ' <input type="hidden" class="medium-text" id="mashsb_settings[expire_' . $args['id'] . ']" name="mashsb_settings[expire_' . $args['id'] . ']" value="' . esc_attr( stripslashes( $expire ) ) . '"/>';
|
1900 |
$html .= '<div class="token_status">'
|
1901 |
. '<span id="mashsb_expire_token_status"></span>'
|
1902 |
. '<span id="mashsb_token_notice"></span>'
|
@@ -1927,20 +1796,11 @@ function mashsb_ratelimit_callback() {
|
|
1927 |
$sharecount = $shares->getAllCounts();
|
1928 |
|
1929 |
|
1930 |
-
// Test open facebook api endpoint
|
1931 |
-
/*$url = 'http://graph.facebook.com/?id=http://www.google.com';
|
1932 |
-
$curl_handle = curl_init();
|
1933 |
-
curl_setopt( $curl_handle, CURLOPT_URL, $url );
|
1934 |
-
curl_setopt( $curl_handle, CURLOPT_CONNECTTIMEOUT, 2 );
|
1935 |
-
curl_setopt( $curl_handle, CURLOPT_RETURNTRANSFER, 1 );
|
1936 |
-
$buffer = curl_exec( $curl_handle );
|
1937 |
-
curl_close( $curl_handle );
|
1938 |
-
*/
|
1939 |
echo '<div style="min-width:500px;"><strong>Test sharedcount.com integration <br><br>Results for google.com: </strong></div>';
|
1940 |
if( !isset($sharecount->total) || empty( $sharecount->total ) ) {
|
1941 |
print "Can not get share count. Make sure sharedcount api key is correct.<p>";
|
1942 |
} else {
|
1943 |
-
print '<div style="max-width:200px;">' . $sharecount->total . ' total shares</div>';
|
1944 |
}
|
1945 |
|
1946 |
if(empty($mashsb_options['fb_access_token_new'])){
|
@@ -1959,7 +1819,7 @@ function mashsb_ratelimit_callback() {
|
|
1959 |
if( empty( $buffer ) ) {
|
1960 |
print "Nothing returned from url.<p>";
|
1961 |
} else {
|
1962 |
-
print '<div style="max-width:200px;">' . $buffer . '</div>';
|
1963 |
}
|
1964 |
|
1965 |
|
124 |
'mashsb_sharemethod' => array(
|
125 |
'id' => 'mashsb_sharemethod',
|
126 |
'name' => __( 'Share Count', 'mashsb' ),
|
|
|
127 |
'desc' => __( '- <i>SharedCount.com</i> is a third party service free for up to 500 daily requests. It collects shares for Facebook.<br><br>Twitter count is aggreagated via <a href="https://opensharecount.com" target="_blank" rel="external nofollow">https://opensharecount.com</a>. You must sign up with your Twitter account for this free service to get the twitter share count. Visit the site https://opensharecount.com, fill in your website domain and click on <i>Sign up</i>. <br><br><strong>Note: You need <a href="https://mashshare.net/downloads/mashshare-social-networks-addon/" target="_blank">MashShare Social Network Add-On</a> for enabling Twitter count.</strong>', 'mashsb' ),
|
128 |
'type' => 'select',
|
129 |
'options' => array(
|
|
|
130 |
'sharedcount' => 'Sharedcount.com'
|
131 |
)
|
132 |
),
|
137 |
'type' => 'text',
|
138 |
'size' => 'medium'
|
139 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
'caching_method' => array(
|
141 |
'id' => 'caching_method',
|
142 |
'name' => __( 'Caching Method', 'mashsb' ),
|
161 |
'type' => 'select',
|
162 |
'options' => array(
|
163 |
'shares' => 'Shares',
|
|
|
164 |
'total' => 'Shares + Comments'
|
165 |
)
|
166 |
),
|
251 |
'desc' => '',
|
252 |
'type' => 'header'
|
253 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
array(
|
255 |
'id' => 'fb_publisher_url',
|
256 |
'name' => __( 'Facebook page url', 'mashsb' ),
|
258 |
'type' => 'text',
|
259 |
'size' => 'large'
|
260 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
'mashsharer_hashtag' => array(
|
262 |
'id' => 'mashsharer_hashtag',
|
263 |
'name' => __( 'Twitter Username', 'mashsb' ),
|
293 |
'type' => 'networks',
|
294 |
'options' => mashsb_get_networks_list()
|
295 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
'style_header' => array(
|
297 |
'id' => 'style_header',
|
298 |
'name' => '<strong>' . __( 'Visual', 'mashsb' ) . '</strong>',
|
426 |
'desc' => __( 'Buttons Text labels and social icons will be aligned in center of the buttons', 'mashsb' ),
|
427 |
'type' => 'checkbox'
|
428 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
429 |
'subscribe_behavior' => array(
|
430 |
'id' => 'subscribe_behavior',
|
431 |
'name' => __( 'Subscribe Button', 'mashsb' ),
|
560 |
'type' => 'text',
|
561 |
'size' => 'large'
|
562 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
563 |
array(
|
564 |
'id' => 'mashsu_methods',
|
565 |
'name' => __( 'Shorturl method', 'mashsb' ),
|
667 |
// Get the setting type (checkbox, select, etc)
|
668 |
$type = isset( $settings[$tab][$key]['type'] ) ? $settings[$tab][$key]['type'] : false;
|
669 |
|
670 |
+
// General filter
|
671 |
+
$input[$key] = apply_filters( 'mashsb_settings_sanitize', $value, $key );
|
672 |
+
|
673 |
if( $type ) {
|
674 |
// Field type specific filter
|
675 |
$input[$key] = apply_filters( 'mashsb_settings_sanitize_' . $type, $value, $key );
|
676 |
}
|
|
|
|
|
|
|
677 |
}
|
678 |
|
679 |
// Loop through the whitelist and unset any that are empty for the tab being saved
|
704 |
*
|
705 |
* @since 1.8
|
706 |
* @param array $input The field value
|
707 |
+
* @return string $input Sanitized value
|
708 |
*/
|
709 |
function mashsb_sanitize_text_field( $input ) {
|
710 |
+
$allowedTags = '<div><span><table><p><a><iframe><td><tr><table>';
|
711 |
+
return trim(strip_tags($input, $allowedTags));
|
712 |
}
|
713 |
add_filter( 'mashsb_settings_sanitize_text', 'mashsb_sanitize_text_field' );
|
714 |
|
715 |
+
/**
|
716 |
+
* Sanitize textarea fields
|
717 |
+
*
|
718 |
+
* @since 1.8
|
719 |
+
* @param array $input The field value
|
720 |
+
* @return string $input Sanitized value
|
721 |
+
*/
|
722 |
+
function mashsb_sanitize_textarea_field( $input ) {
|
723 |
+
$allowedTags = '<div><span><table><p><a><iframe><td><tr><table>';
|
724 |
+
return trim(strip_tags($input, $allowedTags));
|
725 |
+
}
|
726 |
+
add_filter( 'mashsb_settings_sanitize_textarea', 'mashsb_sanitize_textarea_field' );
|
727 |
+
|
728 |
/**
|
729 |
* Retrieve settings tabs
|
730 |
*
|
756 |
if (false === mashsb_hide_addons()){
|
757 |
$tabs['addons'] = __( 'Get More Add-Ons', 'mashsb' );
|
758 |
}
|
|
|
|
|
759 |
|
760 |
return apply_filters( 'mashsb_settings_tabs', $tabs );
|
761 |
}
|
789 |
* @return array Defined social networks
|
790 |
*/
|
791 |
function mashsb_get_networks_list() {
|
|
|
792 |
$networks = get_option( 'mashsb_networks' );
|
793 |
return apply_filters( 'mashsb_get_networks_list', $networks );
|
794 |
}
|
834 |
|
835 |
$checked = isset( $mashsb_options[$args['id']] ) ? checked( 1, $mashsb_options[$args['id']], false ) : '';
|
836 |
$html = '<div class="mashsb-admin-onoffswitch">';
|
837 |
+
$html .= '<input type="checkbox" class="mashsb-admin-onoffswitch-checkbox" id="mashsb_settings[' . esc_attr($args['id']) . ']" name="mashsb_settings[' . esc_attr($args['id']) . ']" value="1" ' . esc_attr($checked) . '/>';
|
838 |
+
$html .= '<label class="mashsb-admin-onoffswitch-label" for="mashsb_settings[' . esc_attr($args['id']) . ']">'
|
839 |
. '<span class="mashsb-admin-onoffswitch-inner"></span>'
|
840 |
. '<span class="mashsb-admin-onoffswitch-switch"></span>'
|
841 |
. '</label>';
|
864 |
} else {
|
865 |
$enabled = NULL;
|
866 |
}
|
867 |
+
echo '<input name="mashsb_settings[' . esc_attr($args['id']) . '][' . esc_attr($key) . ']" id="mashsb_settings[' . esc_attr($args['id']) . '][' . esc_attr($key) . ']" type="checkbox" value="' . esc_html($option) . '" ' . checked( $option, $enabled, false ) . '/> ';
|
868 |
+
echo '<label for="mashsb_settings[' . esc_attr($args['id']) . '][' . esc_attr($key) . ']">' . esc_html($option) . '</label><br/>';
|
869 |
endforeach;
|
870 |
+
echo '<p class="description mashsb_hidden">' . esc_html($args['desc']) . '</p>';
|
871 |
}
|
872 |
}
|
873 |
|
892 |
elseif( isset( $args['std'] ) && $args['std'] == $key && !isset( $mashsb_options[$args['id']] ) )
|
893 |
$checked = true;
|
894 |
|
895 |
+
echo '<input name="mashsb_settings[' . esc_attr($args['id']) . ']"" id="mashsb_settings[' . esc_attr($args['id']) . '][' . esc_attr($key) . ']" type="radio" value="' . esc_attr($key) . '" ' . checked( true, $checked, false ) . '/> ';
|
896 |
+
echo '<label for="mashsb_settings[' . esc_attr($args['id']) . '][' . esc_attr($key) . ']">' . $option . '</label><br/>';
|
897 |
endforeach;
|
898 |
|
899 |
+
echo '<p class="description mashsb_hidden">' . esc_html($args['desc']) . '</p>';
|
900 |
}
|
901 |
|
902 |
/**
|
918 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
919 |
|
920 |
$size = ( isset( $args['size'] ) && !is_null( $args['size'] ) ) ? $args['size'] : 'regular';
|
921 |
+
$html = '<input type="text" class="' . esc_attr($size) . '-text" id="mashsb_settings[' . esc_attr($args['id']) . ']" name="mashsb_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
|
922 |
+
$html .= '<label class="mashsb_hidden" class="mashsb_hidden" for="mashsb_settings[' . esc_attr($args['id']) . ']"> ' . esc_html($args['desc']) . '</label>';
|
923 |
|
924 |
echo $html;
|
925 |
}
|
946 |
$min = isset( $args['min'] ) ? $args['min'] : 0;
|
947 |
$step = isset( $args['step'] ) ? $args['step'] : 1;
|
948 |
|
949 |
+
$size = ( isset( $args['size'] ) && !is_null( $args['size'] ) ) ? esc_attr($args['size']) : 'regular';
|
950 |
+
$html = '<input type="number" step="' . esc_attr( $step ) . '" max="' . esc_attr( $max ) . '" min="' . esc_attr( $min ) . '" class="' . $size . '-text" id="mashsb_settings[' . esc_attr($args['id']) . ']" name="mashsb_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
|
951 |
$html .= '<label class="mashsb_hidden" for="mashsb_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
952 |
|
953 |
echo $html;
|
971 |
else
|
972 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
973 |
|
974 |
+
$size = ( isset( $args['size'] ) && !is_null( $args['size'] ) ) ? esc_attr($args['size']) : '40';
|
975 |
+
$html = '<textarea class="large-text mashsb-textarea" cols="50" rows="' . $size . '" id="mashsb_settings[' . esc_attr($args['id']) . ']" name="mashsb_settings[' . esc_attr($args['id']) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
|
976 |
+
$html .= '<label class="mashsb_hidden" for="mashsb_settings[' . esc_attr($args['id']) . ']"> ' . esc_html($args['desc']) . '</label>';
|
977 |
|
978 |
echo $html;
|
979 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
980 |
|
981 |
/**
|
982 |
* Password Callback
|
996 |
else
|
997 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
998 |
|
999 |
+
$size = ( isset( $args['size'] ) && !is_null( $args['size'] ) ) ? esc_attr($args['size']) : 'regular';
|
1000 |
+
$html = '<input type="password" class="' . $size . '-text" id="mashsb_settings[' . esc_attr($args['id']) . ']" name="mashsb_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr( $value ) . '"/>';
|
1001 |
+
$html .= '<label for="mashsb_settings[' . esc_attr($args['id']) . ']"> ' . esc_html($args['desc']) . '</label>';
|
1002 |
|
1003 |
echo $html;
|
1004 |
}
|
1030 |
global $mashsb_options;
|
1031 |
|
1032 |
if( isset( $mashsb_options[$args['id']] ) )
|
1033 |
+
$value = esc_attr($mashsb_options[$args['id']]);
|
1034 |
else
|
1035 |
+
$value = isset( $args['std'] ) ? esc_attr($args['std']) : '';
|
1036 |
|
1037 |
+
$html = '<select id="mashsb_settings[' . esc_attr($args['id']) . ']" name="mashsb_settings[' . esc_attr($args['id']) . ']"/>';
|
1038 |
|
1039 |
foreach ( $args['options'] as $option => $name ) :
|
1040 |
$selected = selected( $option, $value, false );
|
1041 |
+
$html .= '<option value="' . esc_attr($option) . '" ' . esc_attr($selected) . '>' . esc_html($name) . '</option>';
|
1042 |
endforeach;
|
1043 |
|
1044 |
$html .= '</select>';
|
1045 |
+
$html .= '<label class="mashsb_hidden" for="mashsb_settings[' . esc_attr($args['id']) . ']"> ' . esc_html($args['desc']) . '</label>';
|
1046 |
|
1047 |
echo $html;
|
1048 |
}
|
1061 |
$selected = isset($mashsb_options[$args['id']]) ? $mashsb_options[$args['id']] : '';
|
1062 |
$checked = '';
|
1063 |
|
1064 |
+
$html = '<select name="mashsb_settings[' . esc_attr($args['id']) . '][]" data-placeholder="" style="width:350px;" multiple tabindex="4" class="mashsb-select mashsb-chosen-select">';
|
1065 |
$i = 0;
|
1066 |
foreach ( $args['options'] as $key => $value ) :
|
1067 |
if( is_array($selected)){
|
1068 |
$checked = selected( true, in_array( $key, $selected ), false );
|
1069 |
}
|
1070 |
+
$html .= '<option value="' . esc_attr($key) . '" ' . esc_attr($checked) . '>' . esc_attr($value) . '</option>';
|
1071 |
endforeach;
|
1072 |
$html .= '</select>';
|
1073 |
echo $html;
|
1095 |
else
|
1096 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1097 |
|
1098 |
+
$html = '<strong>#:</strong><input type="text" style="max-width:80px;border:1px solid #' . esc_attr( stripslashes( $value ) ) . ';border-right:20px solid #' . esc_attr( stripslashes( $value ) ) . ';" id="mashsb_settings[' . esc_attr($args['id']) . ']" class="medium-text ' . esc_attr($args['id']) . ' mashsb-color-box" name="mashsb_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
|
1099 |
|
1100 |
$html .= '</select>';
|
1101 |
+
$html .= '<label class="mashsb_hidden" for="mashsb_settings[' . esc_attr($args['id']) . ']"> ' . esc_attr($args['desc']) . '</label>';
|
1102 |
|
1103 |
echo $html;
|
1104 |
}
|
1125 |
wp_editor( stripslashes( $value ), 'mashsb_settings_' . $args['id'], array('textarea_name' => 'mashsb_settings[' . $args['id'] . ']', 'textarea_rows' => $args['textarea_rows']) );
|
1126 |
$html = ob_get_clean();
|
1127 |
} else {
|
1128 |
+
$html = '<textarea class="large-text mashsb-richeditor" rows="10" id="mashsb_settings[' . esc_attr($args['id']) . ']" name="mashsb_settings[' . esc_attr($args['id']) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
|
1129 |
}
|
1130 |
|
1131 |
+
$html .= '<br/><label class="mashsb_hidden" for="mashsb_settings[' . esc_attr($args['id']) . ']"> ' . esc_attr($args['desc']) . '</label>';
|
1132 |
|
1133 |
echo $html;
|
1134 |
}
|
1151 |
else
|
1152 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1153 |
|
1154 |
+
$size = ( isset( $args['size'] ) && !is_null( $args['size'] ) ) ? esc_attr($args['size']) : 'regular';
|
1155 |
+
$html = '<input type="text" class="' . $size . '-text mashsb_upload_field" id="mashsb_settings[' . esc_attr($args['id']) . ']" name="mashsb_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
|
1156 |
$html .= '<span> <input type="button" class="mashsb_settings_upload_button button-secondary" value="' . __( 'Upload File', 'mashsb' ) . '"/></span>';
|
1157 |
+
$html .= '<label class="mashsb_hidden" for="mashsb_settings[' . esc_attr($args['id']) . ']"> ' . esc_attr($args['desc']) . '</label>';
|
1158 |
|
1159 |
echo $html;
|
1160 |
}
|
1180 |
|
1181 |
$default = isset( $args['std'] ) ? $args['std'] : '';
|
1182 |
|
1183 |
+
$html = '<input type="text" class="mashsb-color-picker" id="mashsb_settings[' . esc_attr($args['id']) . ']" name="mashsb_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $default ) . '" />';
|
1184 |
+
$html .= '<label class="mashsb_hidden" for="mashsb_settings[' . esc_attr($args['id']) . ']"> ' . esc_attr($args['desc']) . '</label>';
|
|
|
1185 |
|
1186 |
echo $html;
|
1187 |
}
|
1188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1189 |
/**
|
1190 |
* Registers the license field callback for MashShare Add-Ons
|
1191 |
*
|
1203 |
$messages = array();
|
1204 |
$license = get_option( $args['options']['is_valid_license_option'] );
|
1205 |
|
|
|
1206 |
if( isset( $mashsb_options[$args['id']] ) ) {
|
1207 |
$value = $mashsb_options[$args['id']];
|
1208 |
} else {
|
1324 |
$license_status = null;
|
1325 |
}
|
1326 |
|
1327 |
+
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? esc_attr($args['size']) : 'regular';
|
1328 |
$html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="mashsb_settings[' . mashsb_sanitize_key( $args['id'] ) . ']" name="mashsb_settings[' . mashsb_sanitize_key( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>';
|
1329 |
|
1330 |
if ( ( is_object( $license ) && 'valid' == $license->license ) || 'valid' == $license ) {
|
1331 |
+
$html .= '<input type="submit" class="button-secondary" name="' . esc_attr($args['id']) . '_deactivate" value="' . __( 'Deactivate License', 'mashsb' ) . '"/>';
|
1332 |
}
|
1333 |
|
1334 |
+
$html .= '<label for="mashsb_settings[' . mashsb_sanitize_key( esc_attr($args['id']) ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
|
1335 |
|
1336 |
if ( ! empty( $messages ) ) {
|
1337 |
foreach( $messages as $message ) {
|
1338 |
|
1339 |
+
$html .= '<div class="mashsb-license-data mashsb-license-' . esc_attr($class) . '">';
|
1340 |
$html .= '<p>' . $message . '</p>';
|
1341 |
$html .= '</div>';
|
1342 |
|
1346 |
wp_nonce_field( mashsb_sanitize_key( $args['id'] ) . '-nonce', mashsb_sanitize_key( $args['id'] ) . '-nonce' );
|
1347 |
|
1348 |
if ( isset( $license_status ) ) {
|
1349 |
+
echo '<div class="' . esc_attr($license_status) . '">' . $html . '</div>';
|
1350 |
} else {
|
1351 |
echo '<div class="mashsb-license-null">' . $html . '</div>';
|
1352 |
}
|
1365 |
*/
|
1366 |
function mashsb_networks_callback( $args ) {
|
1367 |
global $mashsb_options;
|
1368 |
+
/* Sample
|
1369 |
+
|
1370 |
+
Array in $mashsb_option['networks'] is build like this
|
1371 |
|
1372 |
array(
|
1373 |
0 => array (
|
1390 |
|
1391 |
ob_start();
|
1392 |
?>
|
1393 |
+
<p class="mashsb_description"><?php echo wp_kses_post($args['desc']); ?></p>
|
1394 |
<table id="mashsb_network_list" class="wp-list-table fixed posts">
|
1395 |
<thead>
|
1396 |
<tr>
|
1409 |
$enabled = NULL;
|
1410 |
}
|
1411 |
if( isset( $mashsb_options[$args['id']][$key]['name'] ) ) {
|
1412 |
+
$name = esc_attr($mashsb_options[$args['id']][$key]['name']);
|
1413 |
} else {
|
1414 |
$name = NULL;
|
1415 |
}
|
1416 |
|
1417 |
if ($option === 'Flipboard'){ // Darn you multi color flipboard svg icon.
|
1418 |
+
echo '<td class="mashicon-' . strtolower( esc_attr($option) ) . '"><div class="icon"><span class="mash-path1"></span><span class="mash-path2"></span><span class="mash-path3"></span><span class="mash-path4"></span></div><span class="text">' . esc_attr($option) . '</span></td>';
|
1419 |
} else {
|
1420 |
+
echo '<td class="mashicon-' . strtolower( esc_attr($option) ) . '"><span class="icon"></span><span class="text">' . esc_attr($option) . '</span></td>';
|
1421 |
}
|
1422 |
+
echo '<td><input type="hidden" name="mashsb_settings[' . esc_attr($args['id']) . '][' . esc_attr($key) . '][id]" id="mashsb_settings[' . esc_attr($args['id']) . '][' . esc_attr($key) . '][id]" value="' . strtolower( esc_attr($option) ) . '">';
|
1423 |
echo '<div class="mashsb-admin-onoffswitch">';
|
1424 |
+
echo '<input name="mashsb_settings[' . esc_attr($args['id']) . '][' . esc_attr($key) . '][status]" class="mashsb-admin-onoffswitch-checkbox" id="mashsb_settings[' . esc_attr($args['id']) . '][' . esc_attr($key) . '][status]" type="checkbox" value="1" ' . checked( 1, $enabled, false ) . '/>';
|
1425 |
+
echo '<label class="mashsb-admin-onoffswitch-label" for="mashsb_settings[' . esc_attr($args['id']) . '][' . esc_attr($key) . '][status]">'
|
1426 |
. '<span class="mashsb-admin-onoffswitch-inner"></span>'
|
1427 |
. '<span class="mashsb-admin-onoffswitch-switch"></span>'
|
1428 |
. '</label>';
|
1429 |
echo '</div>';
|
1430 |
+
echo '<td><input type="text" class="medium-text" id="mashsb_settings[' . esc_attr($args['id']) . '][' . esc_attr($key) . '][name]" name="mashsb_settings[' . esc_attr($args['id']) . '][' . esc_attr($key) . '][name]" value="' . esc_attr($name) . '"/>';
|
1431 |
echo '</tr>';
|
1432 |
endforeach;
|
1433 |
}
|
1461 |
global $mashsb_options;
|
1462 |
|
1463 |
if( isset( $mashsb_options[$args['id']] ) )
|
1464 |
+
$value = esc_attr($mashsb_options[$args['id']]);
|
1465 |
else
|
1466 |
+
$value = isset( $args['std'] ) ? esc_attr($args['std']) : '';
|
1467 |
|
1468 |
+
$size = ( isset( $args['size'] ) && !is_null( $args['size'] ) ) ? esc_attr($args['size']) : 'regular';
|
1469 |
+
$html = '<input type="text" class="' . $size . '-text ' . esc_attr($args['id']) . '" id="mashsb_settings[' . esc_attr($args['id']) . ']" name="mashsb_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr( $value ) . '"/>';
|
1470 |
|
1471 |
+
$html .= '<input type="submit" class="button-secondary mashsb_upload_image" name="' . esc_attr($args['id']) . '_upload" value="' . __( 'Select Image', 'mashsb' ) . '"/>';
|
1472 |
|
1473 |
+
$html .= '<label class="mashsb_hidden" for="mashsb_settings[' . esc_attr($args['id']) . ']"> ' . esc_attr($args['desc']) . '</label>';
|
1474 |
|
1475 |
echo $html;
|
1476 |
}
|
1491 |
global $mashsb_options;
|
1492 |
$posttypes = get_post_types();
|
1493 |
|
|
|
1494 |
if( !empty( $posttypes ) ) {
|
|
|
1495 |
foreach ( $posttypes as $key => $option ):
|
1496 |
if( isset( $mashsb_options[$args['id']][$key] ) ) {
|
1497 |
+
$enabled = esc_attr($option);
|
1498 |
} else {
|
1499 |
$enabled = NULL;
|
1500 |
}
|
1501 |
+
$key = esc_attr($key);
|
1502 |
+
$option = esc_attr($option);
|
1503 |
+
echo '<input name="mashsb_settings[' . esc_attr($args['id']) . '][' . $key . ']" id="mashsb_settings[' . $args['id'] . '][' . $key . ']" type="checkbox" value="' . $option . '" ' . checked( $option, $enabled, false ) . '/> ';
|
1504 |
echo '<label for="mashsb_settings[' . $args['id'] . '][' . $key . ']">' . $option . '</label><br/>';
|
1505 |
endforeach;
|
1506 |
+
echo '<p class="description mashsb_hidden">' . esc_attr($args['desc']) . '</p>';
|
1507 |
}
|
1508 |
}
|
1509 |
|
1519 |
*/
|
1520 |
|
1521 |
function mashsb_note_callback( $args ) {
|
|
|
|
|
1522 |
$html = '';
|
1523 |
echo $html;
|
1524 |
}
|
1536 |
|
1537 |
$html = '<div id="mashtabcontainer" class="tabcontent_container"><ul class="mashtabs" style="width:99%;max-width:500px;">';
|
1538 |
foreach ( $args['options'] as $option => $name ) :
|
1539 |
+
$html .= '<li class="mashtab" style="float:left;margin-right:4px;"><a href="#' . esc_attr($name['id']) . '">' . esc_html($name['name']) . '</a></li>';
|
1540 |
endforeach;
|
1541 |
$html .= '</ul>';
|
1542 |
$html .= '<div class="mashtab-container">';
|
1543 |
foreach ( $args['options'] as $option => $name ) :
|
1544 |
+
$value = isset( $mashsb_options[$name['id']] ) ? esc_attr($mashsb_options[$name['id']]) : '';
|
1545 |
+
$textarea = '<textarea class="large-text mashsb-textarea" cols="50" rows="15" id="mashsb_settings[' . esc_attr($name['id']) . ']" name="mashsb_settings[' . esc_attr($name['id']) . ']">' . wp_kses_post( $value ) . '</textarea>';
|
1546 |
+
$html .= '<div id="' . esc_attr($name['id']) . '" style="max-width:500px;"><span style="padding-top:60px;display:block;">' . wp_kses_post($name['desc']) . '</span><br>' . $textarea . '</div>';
|
1547 |
endforeach;
|
1548 |
$html .= '</div>';
|
1549 |
$html .= '</div>';
|
1763 |
|
1764 |
$button_label = __('Verify Access Token', 'mashsb');
|
1765 |
|
1766 |
+
$html = '<a href="#" id="mashsb_verify_fbtoken" class="button button-primary">'.esc_attr($button_label).'</a>';
|
1767 |
+
$html .= ' <input type="text" class="medium-text" style="width:333px;" id="mashsb_settings[' . esc_attr($args['id']) . ']" name="mashsb_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
|
1768 |
+
$html .= ' <input type="hidden" class="medium-text" id="mashsb_settings[expire_' . esc_attr($args['id']) . ']" name="mashsb_settings[expire_' . esc_attr($args['id']) . ']" value="' . esc_attr( stripslashes( $expire ) ) . '"/>';
|
1769 |
$html .= '<div class="token_status">'
|
1770 |
. '<span id="mashsb_expire_token_status"></span>'
|
1771 |
. '<span id="mashsb_token_notice"></span>'
|
1796 |
$sharecount = $shares->getAllCounts();
|
1797 |
|
1798 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1799 |
echo '<div style="min-width:500px;"><strong>Test sharedcount.com integration <br><br>Results for google.com: </strong></div>';
|
1800 |
if( !isset($sharecount->total) || empty( $sharecount->total ) ) {
|
1801 |
print "Can not get share count. Make sure sharedcount api key is correct.<p>";
|
1802 |
} else {
|
1803 |
+
print '<div style="max-width:200px;">' . esc_html($sharecount->total) . ' total shares</div>';
|
1804 |
}
|
1805 |
|
1806 |
if(empty($mashsb_options['fb_access_token_new'])){
|
1819 |
if( empty( $buffer ) ) {
|
1820 |
print "Nothing returned from url.<p>";
|
1821 |
} else {
|
1822 |
+
print '<div style="max-width:200px;">' . esc_html($buffer) . '</div>';
|
1823 |
}
|
1824 |
|
1825 |
|
includes/template-functions.php
CHANGED
@@ -129,11 +129,6 @@ function mashsbGetNonPostShares($url)
|
|
129 |
// Get any existing copy of our transient data and fill the cache
|
130 |
if (mashsb_force_cache_refresh()) {
|
131 |
|
132 |
-
// Its request limited
|
133 |
-
/* if (mashsb_is_req_limited()) {
|
134 |
-
mashsbGetShareCountFromTransient($url_clean);
|
135 |
-
}*/
|
136 |
-
|
137 |
// Regenerate the data and save the transient
|
138 |
// Get the share Object
|
139 |
$mashsbSharesObj = mashsbGetShareObj($url_clean);
|
@@ -194,8 +189,6 @@ function mashsbIsPostTypeAllowed()
|
|
194 |
* @param string url of the page the share count is collected for
|
195 |
* @returns int
|
196 |
*/
|
197 |
-
|
198 |
-
|
199 |
function getSharedcount($url)
|
200 |
{
|
201 |
global $mashsb_options, $post, $mashsb_sharecount, $mashsb_debug; // todo test a global share count var if it reduces the amount of requests
|
@@ -212,7 +205,6 @@ function getSharedcount($url)
|
|
212 |
* - deprecated: admin pages (we need to remove this for themes which are using a bad infinite scroll implementation where is_admin() is always true)
|
213 |
*/
|
214 |
|
215 |
-
|
216 |
if (is_preview()) {
|
217 |
return 0;
|
218 |
}
|
@@ -230,17 +222,13 @@ function getSharedcount($url)
|
|
230 |
return $mashsb_sharecount[$url] + getFakecount();
|
231 |
}
|
232 |
|
233 |
-
|
234 |
// Remove mashsb-refresh query parameter
|
235 |
$url = mashsb_sanitize_url($url);
|
236 |
|
237 |
-
|
238 |
/*
|
239 |
* Return share count on non singular pages when url is defined
|
240 |
Possible: Category, blog list pages, non singular() pages. This store the shares in transients with mashsbGetNonPostShares();
|
241 |
*/
|
242 |
-
|
243 |
-
|
244 |
if (!empty($url) && is_null($post)) {
|
245 |
$mashsb_debug[] = '$url or $post is empty. Return share count with mashsbGetNonPostShares';
|
246 |
return apply_filters('filter_get_sharedcount', mashsbGetNonPostShares($url));
|
@@ -253,12 +241,6 @@ function getSharedcount($url)
|
|
253 |
|
254 |
$mashsb_debug[] = 'Force Cache Refresh for page type singular()';
|
255 |
|
256 |
-
// Its request limited
|
257 |
-
/* if (mashsb_is_req_limited()) {
|
258 |
-
$mashsb_debug[] = 'Rate limit reached: Return Share from custom meta field.';
|
259 |
-
return (int)get_post_meta($post->ID, 'mashsb_shares', true) + getFakecount();
|
260 |
-
}*/
|
261 |
-
|
262 |
// free some memory
|
263 |
unset ($mashsb_sharecount[$url]);
|
264 |
|
@@ -344,7 +326,7 @@ function mashsb_cleanShortcode($code, $content)
|
|
344 |
global $shortcode_tags;
|
345 |
$stack = $shortcode_tags;
|
346 |
$shortcode_tags = array($code => 1);
|
347 |
-
$content = strip_shortcodes($content);
|
348 |
$shortcode_tags = $stack;
|
349 |
|
350 |
return do_shortcode($content);
|
@@ -359,6 +341,10 @@ function mashsb_cleanShortcode($code, $content)
|
|
359 |
|
360 |
function roundshares($totalshares)
|
361 |
{
|
|
|
|
|
|
|
|
|
362 |
if ($totalshares > 1000000) {
|
363 |
$totalshares = round($totalshares / 1000000, 1) . 'M';
|
364 |
} elseif ($totalshares > 1000) {
|
@@ -402,7 +388,7 @@ function onOffSwitch2($size = false)
|
|
402 |
global $mashsb_options;
|
403 |
|
404 |
// Get class names for buttons size
|
405 |
-
$class_size = isset($mashsb_options['buttons_size']) ? ' ' . $mashsb_options['buttons_size'] : '';
|
406 |
|
407 |
// Override size with shortcode argument
|
408 |
$class_size = $size ? ' mash-' . $size : $class_size;
|
@@ -494,10 +480,7 @@ function mashsb_getNetworks($is_shortcode = false, $services = 0)
|
|
494 |
}
|
495 |
|
496 |
// Get class names for buttons size
|
497 |
-
$class_size = isset($mashsb_options['buttons_size']) ? ' ' . $mashsb_options['buttons_size'] : '';
|
498 |
-
|
499 |
-
// Override size with shortcode argument
|
500 |
-
//$class_size = $size ? ' mash-'.$size : $class_size;
|
501 |
|
502 |
// Get class names for buttons margin
|
503 |
$class_margin = isset($mashsb_options['button_margin']) ? '' : ' mash-nomargin';
|
@@ -546,11 +529,6 @@ function mashsb_getNetworks($is_shortcode = false, $services = 0)
|
|
546 |
}
|
547 |
|
548 |
|
549 |
-
// Use custom networks if available and override default networks
|
550 |
-
//$enablednetworks = $networks ? $networks : $enablednetworks;
|
551 |
-
|
552 |
-
//var_dump($enablednetworks);
|
553 |
-
|
554 |
// Start Primary Buttons
|
555 |
|
556 |
if (!empty($enablednetworks)) {
|
@@ -559,12 +537,10 @@ function mashsb_getNetworks($is_shortcode = false, $services = 0)
|
|
559 |
if ($maxcounter !== 'all' && $maxcounter < count($enablednetworks)) { // $maxcounter + 1 for correct comparision with count()
|
560 |
if ($startcounter == $maxcounter) {
|
561 |
$onoffswitch = onOffSwitch(); // Start More Button
|
562 |
-
//$startsecondaryshares = '</div>'; // End Primary Buttons
|
563 |
$visibility = mashsb_is_amp_page() ? '' : 'display:none;';
|
564 |
$startsecondaryshares .= '<div class="secondary-shares" style="' . $visibility . '">'; // Start secondary-shares
|
565 |
} else {
|
566 |
$onoffswitch = '';
|
567 |
-
$onoffswitch2 = '';
|
568 |
$startsecondaryshares = '';
|
569 |
}
|
570 |
if ($startcounter === (count($enablednetworks))) {
|
@@ -614,7 +590,6 @@ function mashsb_getNetworks($is_shortcode = false, $services = 0)
|
|
614 |
|
615 |
function mashsb_getNetworksShortcode($is_shortcode = false, $services = 0, $networks = false, $size = false, $icons = false)
|
616 |
{
|
617 |
-
//global $mashsb_options, $mashsb_custom_url, $enablednetworks, $mashsb_twitter_url;
|
618 |
global $mashsb_options, $mashsb_custom_url, $mashsb_twitter_url;
|
619 |
|
620 |
|
@@ -627,7 +602,7 @@ function mashsb_getNetworksShortcode($is_shortcode = false, $services = 0, $netw
|
|
627 |
}
|
628 |
|
629 |
// Get class names for buttons size
|
630 |
-
$class_size = isset($mashsb_options['buttons_size']) ? ' ' . $mashsb_options['buttons_size'] : '';
|
631 |
|
632 |
// Override size with shortcode argument
|
633 |
$class_size = $size ? ' mash-' . $size : $class_size;
|
@@ -643,8 +618,6 @@ function mashsb_getNetworksShortcode($is_shortcode = false, $services = 0, $netw
|
|
643 |
|
644 |
$class_icons = $icons ? ' mashsb-pure-icons' : '';
|
645 |
|
646 |
-
//$style = $fullwidth ? '' : 'style="min-width:0;flex:none;-webkit-flex:none;"';
|
647 |
-
|
648 |
$output = '';
|
649 |
$startsecondaryshares = '';
|
650 |
$endsecondaryshares = '';
|
@@ -696,11 +669,9 @@ function mashsb_getNetworksShortcode($is_shortcode = false, $services = 0, $netw
|
|
696 |
if ($maxcounter !== 'all' && $maxcounter < count($enablednetworks)) { // $maxcounter + 1 for correct comparision with count()
|
697 |
if ($startcounter == $maxcounter) {
|
698 |
$onoffswitch = onOffSwitch($size); // Start More Button
|
699 |
-
//$startsecondaryshares = '</div>'; // End Primary Buttons
|
700 |
$startsecondaryshares .= '<div class="secondary-shares" style="display:none;">'; // Start secondary-shares
|
701 |
} else {
|
702 |
$onoffswitch = '';
|
703 |
-
$onoffswitch2 = '';
|
704 |
$startsecondaryshares = '';
|
705 |
}
|
706 |
if ($startcounter === (count($enablednetworks))) {
|
@@ -717,8 +688,6 @@ function mashsb_getNetworksShortcode($is_shortcode = false, $services = 0, $netw
|
|
717 |
$name = !$icons ? ucfirst($enablednetworks[$key]['id']) : ''; // Use the id as share label. Capitalize it!
|
718 |
}
|
719 |
|
720 |
-
//$enablednetworks[$key]['id'] == 'whatsapp' ? $display = 'style="display:none;"' : $display = ''; // Whatsapp button is made visible via js when opened on mobile devices
|
721 |
-
|
722 |
// Lets use the data attribute to prevent that pininit.js is overwriting our pinterest button - PR: https://secure.helpscout.net/conversation/257066283/954/?folderId=924740
|
723 |
if ('pinterest' === $enablednetworks[$key]['id'] && !mashsb_is_amp_page()) {
|
724 |
$output .= '<a class="mashicon-' . $enablednetworks[$key]['id'] . $class_size . $class_margin . $class_center . $class_style . $class_icons . '" href="#" data-mashsb-url="' . arrNetworks($enablednetworks[$key]['id'], $is_shortcode) . '" target="_blank" rel="nofollow"><span class="icon"></span><span class="text">' . $name . '</span></a>';
|
@@ -789,7 +758,7 @@ function mashsb_render_sharecounts($customurl = '', $align = 'left', $size = fal
|
|
789 |
}
|
790 |
|
791 |
$url = empty($customurl) ? mashsb_get_url() : $customurl;
|
792 |
-
$sharetitle = isset($mashsb_options['sharecount_title']) ? $mashsb_options['sharecount_title'] : __('SHARES', 'mashsb');
|
793 |
|
794 |
$shares = getSharedcount($url);
|
795 |
$sharecount = isset($mashsb_options['mashsharer_round']) ? roundshares($shares) : $shares;
|
@@ -800,15 +769,15 @@ function mashsb_render_sharecounts($customurl = '', $align = 'left', $size = fal
|
|
800 |
}
|
801 |
|
802 |
// Get class names for buttons size
|
803 |
-
$class_size = isset($mashsb_options['buttons_size']) ? ' ' . $mashsb_options['buttons_size'] : '';
|
804 |
|
805 |
// Override size with shortcode argument
|
806 |
-
$class_size = $size ? ' mash-' . $size : $class_size;
|
807 |
|
808 |
// No inline style if it's amp
|
809 |
$style = !mashsb_is_amp_page() ? 'style="float:' . $align . ';"' : '';
|
810 |
|
811 |
-
$html = '<div class="mashsb-count' . $class_size . '" ' . $style . '><div class="counts mashsbcount">' . $sharecount . '</div><span class="mashsb-sharetext">' . $sharetitle . '</span></div>';
|
812 |
return apply_filters('mashsb_share_count', $html);
|
813 |
}
|
814 |
|
@@ -859,10 +828,6 @@ function mashshareShortcodeShow($args)
|
|
859 |
$networks = $new;
|
860 |
}
|
861 |
|
862 |
-
//var_dump( $new );
|
863 |
-
|
864 |
-
// Define custom url var to share
|
865 |
-
//$mashsb_custom_url = empty( $url ) ? mashsb_get_url() : $url;
|
866 |
// The global available custom url to share
|
867 |
$mashsb_custom_url = !empty($url) ? $url : '';
|
868 |
// local url
|
@@ -1061,7 +1026,6 @@ function mashshare_filter_content($content)
|
|
1061 |
|
1062 |
function mashshare()
|
1063 |
{
|
1064 |
-
//global $atts;
|
1065 |
echo mashshareShow();
|
1066 |
}
|
1067 |
|
@@ -1072,7 +1036,6 @@ function mashshare()
|
|
1072 |
|
1073 |
function mashsharer()
|
1074 |
{
|
1075 |
-
//global $atts;
|
1076 |
echo mashshareShow();
|
1077 |
}
|
1078 |
|
@@ -1153,7 +1116,6 @@ add_action('mashsb_get_excerpt_by_id', 'mashsb_get_excerpt_by_id');
|
|
1153 |
function mashsb_get_fake_factor()
|
1154 |
{
|
1155 |
// str_word_count is not working for hebraic and arabic languages
|
1156 |
-
//$wordcount = str_word_count(the_title_attribute('echo=0')); //Gets title to be used as a basis for the count
|
1157 |
$wordcount = count(explode(' ', the_title_attribute('echo=0')));
|
1158 |
$factor = $wordcount / 10;
|
1159 |
return apply_filters('mashsb_fake_factor', $factor);
|
129 |
// Get any existing copy of our transient data and fill the cache
|
130 |
if (mashsb_force_cache_refresh()) {
|
131 |
|
|
|
|
|
|
|
|
|
|
|
132 |
// Regenerate the data and save the transient
|
133 |
// Get the share Object
|
134 |
$mashsbSharesObj = mashsbGetShareObj($url_clean);
|
189 |
* @param string url of the page the share count is collected for
|
190 |
* @returns int
|
191 |
*/
|
|
|
|
|
192 |
function getSharedcount($url)
|
193 |
{
|
194 |
global $mashsb_options, $post, $mashsb_sharecount, $mashsb_debug; // todo test a global share count var if it reduces the amount of requests
|
205 |
* - deprecated: admin pages (we need to remove this for themes which are using a bad infinite scroll implementation where is_admin() is always true)
|
206 |
*/
|
207 |
|
|
|
208 |
if (is_preview()) {
|
209 |
return 0;
|
210 |
}
|
222 |
return $mashsb_sharecount[$url] + getFakecount();
|
223 |
}
|
224 |
|
|
|
225 |
// Remove mashsb-refresh query parameter
|
226 |
$url = mashsb_sanitize_url($url);
|
227 |
|
|
|
228 |
/*
|
229 |
* Return share count on non singular pages when url is defined
|
230 |
Possible: Category, blog list pages, non singular() pages. This store the shares in transients with mashsbGetNonPostShares();
|
231 |
*/
|
|
|
|
|
232 |
if (!empty($url) && is_null($post)) {
|
233 |
$mashsb_debug[] = '$url or $post is empty. Return share count with mashsbGetNonPostShares';
|
234 |
return apply_filters('filter_get_sharedcount', mashsbGetNonPostShares($url));
|
241 |
|
242 |
$mashsb_debug[] = 'Force Cache Refresh for page type singular()';
|
243 |
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
// free some memory
|
245 |
unset ($mashsb_sharecount[$url]);
|
246 |
|
326 |
global $shortcode_tags;
|
327 |
$stack = $shortcode_tags;
|
328 |
$shortcode_tags = array($code => 1);
|
329 |
+
$content = strip_shortcodes(wp_kses_post($content));
|
330 |
$shortcode_tags = $stack;
|
331 |
|
332 |
return do_shortcode($content);
|
341 |
|
342 |
function roundshares($totalshares)
|
343 |
{
|
344 |
+
if (!is_numeric($totalshares)){
|
345 |
+
return '0';
|
346 |
+
}
|
347 |
+
|
348 |
if ($totalshares > 1000000) {
|
349 |
$totalshares = round($totalshares / 1000000, 1) . 'M';
|
350 |
} elseif ($totalshares > 1000) {
|
388 |
global $mashsb_options;
|
389 |
|
390 |
// Get class names for buttons size
|
391 |
+
$class_size = isset($mashsb_options['buttons_size']) ? ' ' . esc_attr($mashsb_options['buttons_size']) : '';
|
392 |
|
393 |
// Override size with shortcode argument
|
394 |
$class_size = $size ? ' mash-' . $size : $class_size;
|
480 |
}
|
481 |
|
482 |
// Get class names for buttons size
|
483 |
+
$class_size = isset($mashsb_options['buttons_size']) ? ' ' . esc_attr($mashsb_options['buttons_size']) : '';
|
|
|
|
|
|
|
484 |
|
485 |
// Get class names for buttons margin
|
486 |
$class_margin = isset($mashsb_options['button_margin']) ? '' : ' mash-nomargin';
|
529 |
}
|
530 |
|
531 |
|
|
|
|
|
|
|
|
|
|
|
532 |
// Start Primary Buttons
|
533 |
|
534 |
if (!empty($enablednetworks)) {
|
537 |
if ($maxcounter !== 'all' && $maxcounter < count($enablednetworks)) { // $maxcounter + 1 for correct comparision with count()
|
538 |
if ($startcounter == $maxcounter) {
|
539 |
$onoffswitch = onOffSwitch(); // Start More Button
|
|
|
540 |
$visibility = mashsb_is_amp_page() ? '' : 'display:none;';
|
541 |
$startsecondaryshares .= '<div class="secondary-shares" style="' . $visibility . '">'; // Start secondary-shares
|
542 |
} else {
|
543 |
$onoffswitch = '';
|
|
|
544 |
$startsecondaryshares = '';
|
545 |
}
|
546 |
if ($startcounter === (count($enablednetworks))) {
|
590 |
|
591 |
function mashsb_getNetworksShortcode($is_shortcode = false, $services = 0, $networks = false, $size = false, $icons = false)
|
592 |
{
|
|
|
593 |
global $mashsb_options, $mashsb_custom_url, $mashsb_twitter_url;
|
594 |
|
595 |
|
602 |
}
|
603 |
|
604 |
// Get class names for buttons size
|
605 |
+
$class_size = isset($mashsb_options['buttons_size']) ? ' ' . esc_attr($mashsb_options['buttons_size']) : '';
|
606 |
|
607 |
// Override size with shortcode argument
|
608 |
$class_size = $size ? ' mash-' . $size : $class_size;
|
618 |
|
619 |
$class_icons = $icons ? ' mashsb-pure-icons' : '';
|
620 |
|
|
|
|
|
621 |
$output = '';
|
622 |
$startsecondaryshares = '';
|
623 |
$endsecondaryshares = '';
|
669 |
if ($maxcounter !== 'all' && $maxcounter < count($enablednetworks)) { // $maxcounter + 1 for correct comparision with count()
|
670 |
if ($startcounter == $maxcounter) {
|
671 |
$onoffswitch = onOffSwitch($size); // Start More Button
|
|
|
672 |
$startsecondaryshares .= '<div class="secondary-shares" style="display:none;">'; // Start secondary-shares
|
673 |
} else {
|
674 |
$onoffswitch = '';
|
|
|
675 |
$startsecondaryshares = '';
|
676 |
}
|
677 |
if ($startcounter === (count($enablednetworks))) {
|
688 |
$name = !$icons ? ucfirst($enablednetworks[$key]['id']) : ''; // Use the id as share label. Capitalize it!
|
689 |
}
|
690 |
|
|
|
|
|
691 |
// Lets use the data attribute to prevent that pininit.js is overwriting our pinterest button - PR: https://secure.helpscout.net/conversation/257066283/954/?folderId=924740
|
692 |
if ('pinterest' === $enablednetworks[$key]['id'] && !mashsb_is_amp_page()) {
|
693 |
$output .= '<a class="mashicon-' . $enablednetworks[$key]['id'] . $class_size . $class_margin . $class_center . $class_style . $class_icons . '" href="#" data-mashsb-url="' . arrNetworks($enablednetworks[$key]['id'], $is_shortcode) . '" target="_blank" rel="nofollow"><span class="icon"></span><span class="text">' . $name . '</span></a>';
|
758 |
}
|
759 |
|
760 |
$url = empty($customurl) ? mashsb_get_url() : $customurl;
|
761 |
+
$sharetitle = isset($mashsb_options['sharecount_title']) ? wp_kses_post($mashsb_options['sharecount_title']) : __('SHARES', 'mashsb');
|
762 |
|
763 |
$shares = getSharedcount($url);
|
764 |
$sharecount = isset($mashsb_options['mashsharer_round']) ? roundshares($shares) : $shares;
|
769 |
}
|
770 |
|
771 |
// Get class names for buttons size
|
772 |
+
$class_size = isset($mashsb_options['buttons_size']) ? ' ' . esc_attr($mashsb_options['buttons_size']) : '';
|
773 |
|
774 |
// Override size with shortcode argument
|
775 |
+
$class_size = $size ? ' mash-' . esc_attr($size) : $class_size;
|
776 |
|
777 |
// No inline style if it's amp
|
778 |
$style = !mashsb_is_amp_page() ? 'style="float:' . $align . ';"' : '';
|
779 |
|
780 |
+
$html = '<div class="mashsb-count' . $class_size . '" ' . esc_attr($style) . '><div class="counts mashsbcount">' . esc_html($sharecount) . '</div><span class="mashsb-sharetext">' . esc_html($sharetitle) . '</span></div>';
|
781 |
return apply_filters('mashsb_share_count', $html);
|
782 |
}
|
783 |
|
828 |
$networks = $new;
|
829 |
}
|
830 |
|
|
|
|
|
|
|
|
|
831 |
// The global available custom url to share
|
832 |
$mashsb_custom_url = !empty($url) ? $url : '';
|
833 |
// local url
|
1026 |
|
1027 |
function mashshare()
|
1028 |
{
|
|
|
1029 |
echo mashshareShow();
|
1030 |
}
|
1031 |
|
1036 |
|
1037 |
function mashsharer()
|
1038 |
{
|
|
|
1039 |
echo mashshareShow();
|
1040 |
}
|
1041 |
|
1116 |
function mashsb_get_fake_factor()
|
1117 |
{
|
1118 |
// str_word_count is not working for hebraic and arabic languages
|
|
|
1119 |
$wordcount = count(explode(' ', the_title_attribute('echo=0')));
|
1120 |
$factor = $wordcount / 10;
|
1121 |
return apply_filters('mashsb_fake_factor', $factor);
|
mashshare.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* Description: Mashshare is a Share functionality inspired by the the great website Mashable for Facebook and Twitter. More networks available.
|
7 |
* Author: René Hermenau
|
8 |
* Author URI: https://www.mashshare.net
|
9 |
-
* Version: 3.8.
|
10 |
* Text Domain: mashsb
|
11 |
* Domain Path: /languages
|
12 |
|
@@ -35,7 +35,7 @@ if( !defined( 'ABSPATH' ) )
|
|
35 |
|
36 |
// Plugin version
|
37 |
if( !defined( 'MASHSB_VERSION' ) ) {
|
38 |
-
define( 'MASHSB_VERSION', '3.8.
|
39 |
}
|
40 |
|
41 |
// Debug mode
|
6 |
* Description: Mashshare is a Share functionality inspired by the the great website Mashable for Facebook and Twitter. More networks available.
|
7 |
* Author: René Hermenau
|
8 |
* Author URI: https://www.mashshare.net
|
9 |
+
* Version: 3.8.4
|
10 |
* Text Domain: mashsb
|
11 |
* Domain Path: /languages
|
12 |
|
35 |
|
36 |
// Plugin version
|
37 |
if( !defined( 'MASHSB_VERSION' ) ) {
|
38 |
+
define( 'MASHSB_VERSION', '3.8.4' );
|
39 |
}
|
40 |
|
41 |
// Debug mode
|
readme.txt
CHANGED
@@ -9,7 +9,7 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
|
9 |
Tags: Share buttons, Social Sharing, social media, Facebook, Twitter, Subscribe, social share buttons
|
10 |
Requires at least: 3.6+
|
11 |
Tested up to: 6.0
|
12 |
-
Stable tag: 3.8.
|
13 |
Requires PHP: 5.6
|
14 |
|
15 |
Social Media Share Buttons for Twitter, Facebook, and other social networks. Highly customizable Social Media ecosystem
|
@@ -249,8 +249,11 @@ Read here more about this: http://docs.mashshare.net/article/10-facebook-is-show
|
|
249 |
|
250 |
== Changelog ==
|
251 |
|
|
|
|
|
|
|
252 |
= 3.8.3 =
|
253 |
-
* Fix:
|
254 |
|
255 |
= 3.8.2 =
|
256 |
* New: Compatible up to WordPress 6.0.1
|
@@ -328,6 +331,9 @@ https://www.mashshare.net/changelog/
|
|
328 |
|
329 |
== Upgrade Notice ==
|
330 |
|
|
|
|
|
|
|
331 |
= 3.8.3 =
|
332 |
* Fix: Undefined warning on php 8.1
|
333 |
|
9 |
Tags: Share buttons, Social Sharing, social media, Facebook, Twitter, Subscribe, social share buttons
|
10 |
Requires at least: 3.6+
|
11 |
Tested up to: 6.0
|
12 |
+
Stable tag: 3.8.4
|
13 |
Requires PHP: 5.6
|
14 |
|
15 |
Social Media Share Buttons for Twitter, Facebook, and other social networks. Highly customizable Social Media ecosystem
|
249 |
|
250 |
== Changelog ==
|
251 |
|
252 |
+
= 3.8.4 =
|
253 |
+
* Fix: Improve sanitization on input values and escape output values. Fixes a low severity Authenticated Stored Cross-Site Scripting (XSS) vulnerability
|
254 |
+
|
255 |
= 3.8.3 =
|
256 |
+
* Fix: Do sanitization on input values. Fix a low severity Authenticated Stored Cross-Site Scripting (XSS) vulnerability
|
257 |
|
258 |
= 3.8.2 =
|
259 |
* New: Compatible up to WordPress 6.0.1
|
331 |
|
332 |
== Upgrade Notice ==
|
333 |
|
334 |
+
= 3.8.4 =
|
335 |
+
* Fix: Do better sanitization on input and output values. Fix a low severity Authenticated Stored Cross-Site Scripting (XSS) vulnerability that can only be exploited by authenticated damin users
|
336 |
+
|
337 |
= 3.8.3 =
|
338 |
* Fix: Undefined warning on php 8.1
|
339 |
|