AddToAny Share Buttons - Version 1.7.46

Version Description

  • In addition to requiring the manage_options user capability in Settings, require the unfiltered_html user capability for changing the Sharing Header, Additional JavaScript, and Additional CSS fields
    • Note: In WordPress Multisite, only Super Admins have the unfiltered_html capability
Download this release

Release Info

Developer micropat
Plugin Icon 128x128 AddToAny Share Buttons
Version 1.7.46
Comparing to
See all releases

Code changes from version 1.7.45 to 1.7.46

Files changed (3) hide show
  1. README.txt +5 -1
  2. add-to-any.php +1 -1
  3. addtoany.admin.php +23 -9
README.txt CHANGED
@@ -4,7 +4,7 @@ Tags: buttons, share, icons, social media, share buttons, sharing, share button,
4
  Requires at least: 3.7
5
  Tested up to: 5.8
6
  Requires PHP: 5.6
7
- Stable tag: 1.7.45
8
 
9
  Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, WhatsApp, Pinterest, Reddit, many more, and follow icons too.
10
 
@@ -346,6 +346,10 @@ Upload (or move) the `add-to-any` plugin directory into the `/wp-content/mu-plug
346
 
347
  == Changelog ==
348
 
 
 
 
 
349
  = 1.7.45 =
350
  * Add Tumblr share count option
351
  * Remove Facebook share count option because Facebook no longer provides public API access to share counts
4
  Requires at least: 3.7
5
  Tested up to: 5.8
6
  Requires PHP: 5.6
7
+ Stable tag: 1.7.46
8
 
9
  Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, WhatsApp, Pinterest, Reddit, many more, and follow icons too.
10
 
346
 
347
  == Changelog ==
348
 
349
+ = 1.7.46 =
350
+ * In addition to requiring the `manage_options` user capability in Settings, require the `unfiltered_html` user capability for changing the Sharing Header, Additional JavaScript, and Additional CSS fields
351
+ * Note: In WordPress Multisite, only Super Admins have the `unfiltered_html` capability
352
+
353
  = 1.7.45 =
354
  * Add Tumblr share count option
355
  * Remove Facebook share count option because Facebook no longer provides public API access to share counts
add-to-any.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: AddToAny Share Buttons
4
  * Plugin URI: https://www.addtoany.com/
5
  * Description: Share buttons for your pages including AddToAny's universal sharing button, Facebook, Twitter, LinkedIn, Pinterest, WhatsApp and many more.
6
- * Version: 1.7.45
7
  * Author: AddToAny
8
  * Author URI: https://www.addtoany.com/
9
  * Text Domain: add-to-any
3
  * Plugin Name: AddToAny Share Buttons
4
  * Plugin URI: https://www.addtoany.com/
5
  * Description: Share buttons for your pages including AddToAny's universal sharing button, Facebook, Twitter, LinkedIn, Pinterest, WhatsApp and many more.
6
+ * Version: 1.7.46
7
  * Author: AddToAny
8
  * Author URI: https://www.addtoany.com/
9
  * Text Domain: add-to-any
addtoany.admin.php CHANGED
@@ -181,7 +181,13 @@ function _a2a_position_in_content( $options, $option_box = false ) {
181
 
182
  function _a2a_selected_attr( $value, $option_name, $options ) {
183
  if ( ! empty( $options[ $option_name ] ) && $value === $options[ $option_name ] ) {
184
- echo ' selected="selected"';
 
 
 
 
 
 
185
  }
186
  }
187
 
@@ -346,9 +352,9 @@ function A2A_SHARE_SAVE_options_page() {
346
  $new_options['button'] = ( isset( $_POST['A2A_SHARE_SAVE_button'] ) ) ? $_POST['A2A_SHARE_SAVE_button'] : '';
347
  $new_options['button_custom'] = ( isset( $_POST['A2A_SHARE_SAVE_button_custom'] ) ) ? $_POST['A2A_SHARE_SAVE_button_custom'] : '';
348
  $new_options['button_show_count'] = ( isset( $_POST['A2A_SHARE_SAVE_button_show_count'] ) && $_POST['A2A_SHARE_SAVE_button_show_count'] == '1' ) ? '1' : '-1';
349
- $new_options['header'] = ( isset( $_POST['A2A_SHARE_SAVE_header'] ) ) ? $_POST['A2A_SHARE_SAVE_header'] : '';
350
- $new_options['additional_js_variables'] = ( isset( $_POST['A2A_SHARE_SAVE_additional_js_variables'] ) ) ? trim( $_POST['A2A_SHARE_SAVE_additional_js_variables'] ) : '';
351
- $new_options['additional_css'] = ( isset( $_POST['A2A_SHARE_SAVE_additional_css'] ) ) ? trim( $_POST['A2A_SHARE_SAVE_additional_css'] ) : '';
352
  $new_options['custom_icons'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons'] ) && $_POST['A2A_SHARE_SAVE_custom_icons'] == 'url' ) ? 'url' : '-1';
353
  $new_options['custom_icons_url'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons_url'] ) ) ? trailingslashit( $_POST['A2A_SHARE_SAVE_custom_icons_url'] ) : '';
354
  $new_options['custom_icons_type'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons_type'] ) ) ? $_POST['A2A_SHARE_SAVE_custom_icons_type'] : 'png';
@@ -566,7 +572,7 @@ function A2A_SHARE_SAVE_options_page() {
566
  <th scope="row"><?php _e('Sharing Header', 'add-to-any'); ?></th>
567
  <td><fieldset id="addtoany_extra_section_sharing_header" class="addtoany_extra_section<?php if ( ! empty( $options['header'] ) ) echo ' addtoany_show_extra'; ?>" role="region">
568
  <label>
569
- <input name="A2A_SHARE_SAVE_header" type="text" class="code" placeholder="<?php esc_attr_e( 'Share this:' ); ?>" size="50" value="<?php if ( isset( $options['header'] ) ) echo esc_attr( $options['header'] ); ?>" />
570
  </label>
571
  </fieldset></td>
572
  </tr>
@@ -666,7 +672,7 @@ function A2A_SHARE_SAVE_options_page() {
666
  <?php _e("Advanced users should explore AddToAny's <a href=\"https://www.addtoany.com/buttons/customize/wordpress\" target=\"_blank\">additional options</a>.", 'add-to-any'); ?></p>
667
  </label>
668
  <p>
669
- <textarea name="A2A_SHARE_SAVE_additional_js_variables" id="A2A_SHARE_SAVE_additional_js_variables" class="code" style="width: 98%; font-size: 12px;" rows="6" cols="50"><?php if ( isset( $options['additional_js_variables'] ) ) echo esc_textarea( $options['additional_js_variables'] ); ?></textarea>
670
  </p>
671
  </fieldset></td>
672
  </tr>
@@ -678,7 +684,7 @@ function A2A_SHARE_SAVE_options_page() {
678
  <?php _e("Advanced users should explore AddToAny's <a href=\"https://www.addtoany.com/buttons/customize/wordpress\" target=\"_blank\">additional options</a>.", 'add-to-any'); ?></p>
679
  </label>
680
  <p>
681
- <textarea name="A2A_SHARE_SAVE_additional_css" id="A2A_SHARE_SAVE_additional_css" class="code" style="width: 98%; font-size: 12px;" rows="6" cols="50"><?php if ( isset( $options['additional_css'] ) ) echo esc_textarea( $options['additional_css'] ); ?></textarea>
682
  </p>
683
  </fieldset></td>
684
  </tr>
@@ -1307,6 +1313,8 @@ function addtoany_admin_scripts( $current_admin_page ) {
1307
 
1308
  // If current screen is the default tab and WordPress >= 4.9
1309
  if ( empty( $_GET['action'] ) && function_exists( 'wp_enqueue_code_editor' ) ) {
 
 
1310
  // Additional JavaScript editor.
1311
  // Enqueue code editor and settings for manipulating JavaScript.
1312
  $settings = wp_enqueue_code_editor( array(
@@ -1317,7 +1325,10 @@ function addtoany_admin_scripts( $current_admin_page ) {
1317
  'undef' => false,
1318
  'unused' => false,
1319
  ),
1320
- 'codemirror' => array( 'lineNumbers' => false ),
 
 
 
1321
  ) );
1322
 
1323
  // If user hasn't disabled CodeMirror.
@@ -1334,7 +1345,10 @@ function addtoany_admin_scripts( $current_admin_page ) {
1334
  // Enqueue code editor and settings for manipulating CSS.
1335
  $settings = wp_enqueue_code_editor( array(
1336
  'type' => 'text/css',
1337
- 'codemirror' => array( 'lineNumbers' => false ),
 
 
 
1338
  ) );
1339
 
1340
  wp_add_inline_script(
181
 
182
  function _a2a_selected_attr( $value, $option_name, $options ) {
183
  if ( ! empty( $options[ $option_name ] ) && $value === $options[ $option_name ] ) {
184
+ echo ' selected';
185
+ }
186
+ }
187
+
188
+ function _a2a_disabled_attr() {
189
+ if ( ! current_user_can( 'unfiltered_html' ) ) {
190
+ echo ' disabled';
191
  }
192
  }
193
 
352
  $new_options['button'] = ( isset( $_POST['A2A_SHARE_SAVE_button'] ) ) ? $_POST['A2A_SHARE_SAVE_button'] : '';
353
  $new_options['button_custom'] = ( isset( $_POST['A2A_SHARE_SAVE_button_custom'] ) ) ? $_POST['A2A_SHARE_SAVE_button_custom'] : '';
354
  $new_options['button_show_count'] = ( isset( $_POST['A2A_SHARE_SAVE_button_show_count'] ) && $_POST['A2A_SHARE_SAVE_button_show_count'] == '1' ) ? '1' : '-1';
355
+ $new_options['header'] = ( isset( $_POST['A2A_SHARE_SAVE_header'] ) && current_user_can( 'unfiltered_html' ) ) ? $_POST['A2A_SHARE_SAVE_header'] : '';
356
+ $new_options['additional_js_variables'] = ( isset( $_POST['A2A_SHARE_SAVE_additional_js_variables'] ) && current_user_can( 'unfiltered_html' ) ) ? trim( $_POST['A2A_SHARE_SAVE_additional_js_variables'] ) : '';
357
+ $new_options['additional_css'] = ( isset( $_POST['A2A_SHARE_SAVE_additional_css'] ) && current_user_can( 'unfiltered_html' ) ) ? trim( $_POST['A2A_SHARE_SAVE_additional_css'] ) : '';
358
  $new_options['custom_icons'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons'] ) && $_POST['A2A_SHARE_SAVE_custom_icons'] == 'url' ) ? 'url' : '-1';
359
  $new_options['custom_icons_url'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons_url'] ) ) ? trailingslashit( $_POST['A2A_SHARE_SAVE_custom_icons_url'] ) : '';
360
  $new_options['custom_icons_type'] = ( isset( $_POST['A2A_SHARE_SAVE_custom_icons_type'] ) ) ? $_POST['A2A_SHARE_SAVE_custom_icons_type'] : 'png';
572
  <th scope="row"><?php _e('Sharing Header', 'add-to-any'); ?></th>
573
  <td><fieldset id="addtoany_extra_section_sharing_header" class="addtoany_extra_section<?php if ( ! empty( $options['header'] ) ) echo ' addtoany_show_extra'; ?>" role="region">
574
  <label>
575
+ <input name="A2A_SHARE_SAVE_header" type="text" class="code" placeholder="<?php esc_attr_e( 'Share this:' ); ?>" size="50" value="<?php if ( isset( $options['header'] ) ) echo esc_attr( $options['header'] ); ?>"<?php _a2a_disabled_attr(); ?>>
576
  </label>
577
  </fieldset></td>
578
  </tr>
672
  <?php _e("Advanced users should explore AddToAny's <a href=\"https://www.addtoany.com/buttons/customize/wordpress\" target=\"_blank\">additional options</a>.", 'add-to-any'); ?></p>
673
  </label>
674
  <p>
675
+ <textarea name="A2A_SHARE_SAVE_additional_js_variables" id="A2A_SHARE_SAVE_additional_js_variables" class="code" style="width: 98%; font-size: 12px;" rows="6" cols="50"<?php _a2a_disabled_attr(); ?>><?php if ( isset( $options['additional_js_variables'] ) ) echo esc_textarea( $options['additional_js_variables'] ); ?></textarea>
676
  </p>
677
  </fieldset></td>
678
  </tr>
684
  <?php _e("Advanced users should explore AddToAny's <a href=\"https://www.addtoany.com/buttons/customize/wordpress\" target=\"_blank\">additional options</a>.", 'add-to-any'); ?></p>
685
  </label>
686
  <p>
687
+ <textarea name="A2A_SHARE_SAVE_additional_css" id="A2A_SHARE_SAVE_additional_css" class="code" style="width: 98%; font-size: 12px;" rows="6" cols="50"<?php _a2a_disabled_attr(); ?>><?php if ( isset( $options['additional_css'] ) ) echo esc_textarea( $options['additional_css'] ); ?></textarea>
688
  </p>
689
  </fieldset></td>
690
  </tr>
1313
 
1314
  // If current screen is the default tab and WordPress >= 4.9
1315
  if ( empty( $_GET['action'] ) && function_exists( 'wp_enqueue_code_editor' ) ) {
1316
+ $readyOnly = current_user_can( 'unfiltered_html' ) ? false : 'nocursor';
1317
+
1318
  // Additional JavaScript editor.
1319
  // Enqueue code editor and settings for manipulating JavaScript.
1320
  $settings = wp_enqueue_code_editor( array(
1325
  'undef' => false,
1326
  'unused' => false,
1327
  ),
1328
+ 'codemirror' => array(
1329
+ 'lineNumbers' => false,
1330
+ 'readOnly' => $readyOnly,
1331
+ ),
1332
  ) );
1333
 
1334
  // If user hasn't disabled CodeMirror.
1345
  // Enqueue code editor and settings for manipulating CSS.
1346
  $settings = wp_enqueue_code_editor( array(
1347
  'type' => 'text/css',
1348
+ 'codemirror' => array(
1349
+ 'lineNumbers' => false,
1350
+ 'readOnly' => $readyOnly,
1351
+ ),
1352
  ) );
1353
 
1354
  wp_add_inline_script(