Social Media Share Buttons | MashShare - Version 3.8.5

Version Description

  • Fix: Add missing sanitization and escaping of input and output values to prevent possible XSS attempts.
Download this release

Release Info

Developer ReneHermi
Plugin Icon 128x128 Social Media Share Buttons | MashShare
Version 3.8.5
Comparing to
See all releases

Code changes from version 3.8.4 to 3.8.5

CONTRIBUTING.md CHANGED
@@ -1,4 +1,4 @@
1
- #Contribute To Mashshare
2
 
3
  Community made patches, localisations, bug reports and contributions are always welcome.
4
 
@@ -24,11 +24,11 @@ __Please Note:__ GitHub is for bug reports and contributions only - if you have
24
 
25
  ## Code Documentation
26
 
27
- * We ensure that every Mashshare function is documented well and follows the standards set by phpDoc
28
  * An example function can be found [here](https://gist.github.com/rene-hermenau/8d3d7ee0633ee2f64b4b)
29
  * Please make sure that every function is documented so that when we update our API Documentation it will complete
30
  * If you're adding/editing a function in a class, make sure to add `@access {private|public|protected}`
31
- * Finally, please use tabs and not spaces. The tab indent size should be 4 for all Mashshare code.
32
 
33
  At this point you're waiting on us to merge your pull request. We'll review all pull requests, and make suggestions and changes if necessary.
34
 
1
+ #Contribute To MashShare
2
 
3
  Community made patches, localisations, bug reports and contributions are always welcome.
4
 
24
 
25
  ## Code Documentation
26
 
27
+ * We ensure that every MashShare function is documented well and follows the standards set by phpDoc
28
  * An example function can be found [here](https://gist.github.com/rene-hermenau/8d3d7ee0633ee2f64b4b)
29
  * Please make sure that every function is documented so that when we update our API Documentation it will complete
30
  * If you're adding/editing a function in a class, make sure to add `@access {private|public|protected}`
31
+ * Finally, please use tabs and not spaces. The tab indent size should be 4 for all MashShare code.
32
 
33
  At this point you're waiting on us to merge your pull request. We'll review all pull requests, and make suggestions and changes if necessary.
34
 
README.md CHANGED
@@ -5,21 +5,19 @@
5
  ![Total Downloads](https://img.shields.io/wordpress/plugin/dt/mashsharer.svg?maxAge=2592000)
6
  ![Plugin Rating](https://img.shields.io/wordpress/plugin/r/mashsharer.svg?maxAge=2592000)
7
  ![WordPress Compatibility](https://img.shields.io/wordpress/v/mashsharer.svg?maxAge=2592000)
8
- [![Build Status](https://img.shields.io/travis/mashshare/MashShare/master.svg?maxAge=3600)](https://travis-ci.org/mashshare/MashShare.svg?branch=master)
9
- [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/mashshare/MashShare/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/mashshare/MashShare/?branch=master)
10
  [![License](https://img.shields.io/badge/license-GPL--2.0%2B-red.svg)](https://github.com/mashshare/MashShare/blob/master/license.txt)
11
 
12
- ### Welcome to the Mashshare GitHub Repository
13
 
14
  Social sharing optimization is essential for every website that aims to be succesfull regarding traffic and social interaction.
15
  Mashshare aspires to give you all the necessary tools for best possible sharing interaction out of your content from one source. It´s not only a set of big prominent fast loading share buttons, it optimizes your content in the background with open graph tags and optimizes all your contest in the best way to get the maximum amount of shares.
16
 
17
- More information can be found at [mashshare.net](https://www.mashshare.net/).
18
 
19
  ## Note ##
20
 
21
  This is the latest developer version of MashShare.
22
- if you just want to use MashShare install the productive version which you get at [wordpress.org](http://wordpress.org/plugins/mashsharer/)
23
 
24
  ## Installation ##
25
 
5
  ![Total Downloads](https://img.shields.io/wordpress/plugin/dt/mashsharer.svg?maxAge=2592000)
6
  ![Plugin Rating](https://img.shields.io/wordpress/plugin/r/mashsharer.svg?maxAge=2592000)
7
  ![WordPress Compatibility](https://img.shields.io/wordpress/v/mashsharer.svg?maxAge=2592000)
 
 
8
  [![License](https://img.shields.io/badge/license-GPL--2.0%2B-red.svg)](https://github.com/mashshare/MashShare/blob/master/license.txt)
9
 
10
+ ### Welcome to the MashShare GitHub Repository
11
 
12
  Social sharing optimization is essential for every website that aims to be succesfull regarding traffic and social interaction.
13
  Mashshare aspires to give you all the necessary tools for best possible sharing interaction out of your content from one source. It´s not only a set of big prominent fast loading share buttons, it optimizes your content in the background with open graph tags and optimizes all your contest in the best way to get the maximum amount of shares.
14
 
15
+ More information can be found on [mashshare.net](https://www.mashshare.net/).
16
 
17
  ## Note ##
18
 
19
  This is the latest developer version of MashShare.
20
+ if you just want to use MashShare install the productive version which you get on [wordpress.org](http://wordpress.org/plugins/mashsharer/)
21
 
22
  ## Installation ##
23
 
includes/MASHSB_SL_Plugin_Updater.php CHANGED
@@ -175,14 +175,14 @@ class MASHSB_SL_Plugin_Updater {
175
 
176
  if ( empty( $version_info->download_link ) ) {
177
  printf(
178
- __( 'There is a new version of %1$s available. <a target="_blank" rel="" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd' ),
179
  esc_html( $version_info->name ),
180
  esc_url( $changelog_link ),
181
  esc_html( $version_info->new_version )
182
  );
183
  } else {
184
  printf(
185
- __( 'There is a new version of %1$s available. <a target="_blank" rel="" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd' ),
186
  esc_html( $version_info->name ),
187
  esc_url( $changelog_link ),
188
  esc_html( $version_info->new_version ),
@@ -322,7 +322,7 @@ class MASHSB_SL_Plugin_Updater {
322
  }
323
 
324
  if( ! current_user_can( 'update_plugins' ) ) {
325
- wp_die( __( 'You do not have permission to install plugin updates', 'edd' ), __( 'Error', 'edd' ), array( 'response' => 403 ) );
326
  }
327
 
328
  $response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) );
175
 
176
  if ( empty( $version_info->download_link ) ) {
177
  printf(
178
+ wp_kses_post(__( 'There is a new version of %1$s available. <a target="_blank" rel="" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd' )),
179
  esc_html( $version_info->name ),
180
  esc_url( $changelog_link ),
181
  esc_html( $version_info->new_version )
182
  );
183
  } else {
184
  printf(
185
+ wp_kses_post(__( 'There is a new version of %1$s available. <a target="_blank" rel="" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd' )),
186
  esc_html( $version_info->name ),
187
  esc_url( $changelog_link ),
188
  esc_html( $version_info->new_version ),
322
  }
323
 
324
  if( ! current_user_can( 'update_plugins' ) ) {
325
+ wp_die( esc_html(__( 'You do not have permission to install plugin updates', 'edd' )), esc_html(__( 'Error', 'edd' )), array( 'response' => 403 ) );
326
  }
327
 
328
  $response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) );
includes/admin/add-ons.php CHANGED
@@ -24,36 +24,101 @@ function mashsb_add_ons_page() {
24
  ob_start(); ?>
25
  <div class="wrap" id="mashsb-add-ons">
26
  <h2>
27
- <?php _e( 'Add Ons for Mashshare', 'mashsb' ); ?>
28
- &nbsp;&mdash;&nbsp;<a href="https://www.mashshare.net" class="button-primary" title="<?php _e( 'Visit Website', 'mashsb' ); ?>" target="_blank" rel="noopener"><?php _e( 'See Details', 'mashsb' ); ?></a>
29
  </h2>
30
- <p><?php _e( 'These add-ons extend the functionality of MashShare.', 'mashsb' ); ?></p>
31
- <?php echo mashsb_add_ons_get_feed(); ?>
32
  </div>
33
  <?php
34
  echo ob_get_clean();
35
  }
36
 
37
  /**
38
- * Add-ons Get Feed
39
- *
40
- * Gets the add-ons page feed.
41
- *
42
- * @since 1.1.8
43
- * @return void
44
  */
45
- function mashsb_add_ons_get_feed() {
46
- if ( false === ( $cache = get_transient( 'mashshare_add_ons_feed' ) ) ) {
47
- $feed = wp_remote_get( 'https://www.mashshare.net/?feed=addons', array( 'sslverify' => false ) );
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' ) . '
55
- <br>Visit instead the Mashshare Addon Website <a href="https://www.mashshare.net" class="button-primary" title="Mashshare Add ons" target="_blank" rel="noopener"> Get Add-Ons </a></div>';
56
- }
57
- }
58
- return $cache;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  }
24
  ob_start(); ?>
25
  <div class="wrap" id="mashsb-add-ons">
26
  <h2>
27
+ <?php esc_html_e( 'Add-Ons for MashShare', 'mashsb' ); ?>
28
+ &nbsp;&mdash;&nbsp;<a href="https://www.mashshare.net" class="button-primary" title="<?php esc_html_e( 'Visit Website', 'mashsb' ); ?>" target="_blank" rel="noopener"><?php esc_html_e( 'See Details', 'mashsb' ); ?></a>
29
  </h2>
30
+ <p><?php esc_html_e( 'These add-ons extend the functionality of MashShare.', 'mashsb' ); ?></p>
31
+ <?php echo mashsbGetAddOns(); ?>
32
  </div>
33
  <?php
34
  echo ob_get_clean();
35
  }
36
 
37
  /**
38
+ * @return string
 
 
 
 
 
39
  */
40
+ function mashsbGetAddOns(){
41
+ return <<< EOT
42
+ <div class="mashshare-addons">
43
+ <h3 class="mashshare-addons-title">Add more social networks</h3>
44
+ <a title="MashShare Networks Add-On" href="https://www.mashshare.net/downloads/mashshare-social-networks-addon/?ref=1" target="_blank"><img class="alignnone wp-image-107 size-full" src="https://www.mashshare.net/wp-content/uploads/2014/03/mash-networks-e1404756641988.png" alt="MashShare More Networks" width="300" height="200" /></a>Extend MashShare: Whatsapp, Pinterest, Digg, Linkedin, Reddit, Stumbleupon, Vk,Print, Delicious, Buffer, Weibo, Pocket, Xing, Tumblr …<a class="button-secondary" title="MashShare Networks Add-On" href="https://www.mashshare.net/downloads/mashshare-social-networks-addon/?ref=1" target="_blank">Get this Add On</a>
45
+ </div>
46
+
47
+ <div class="mashshare-addons">
48
+ <h3 class="mashshare-addons-title">VideoPost Popup</h3>
49
+ <a title="VideoPost Popup Add-On" href="https://www.mashshare.net/downloads/videopost-popup/?ref=1" target="_blank"><img class="alignnone wp-image-107 size-full" src="https://www.mashshare.net/wp-content/uploads/edd/2015/03/videopost1.png" alt="VideoPost Popup" width="300" height="200" /></a>Share and Like Add-On for Facebook and Twitter which shows an Popup after end of YouTube Video play or read of a story. <a class="button-secondary" title="MashShare Networks Add-On" href="https://www.mashshare.net/downloads/videopost-popup/?ref=1" target="_blank">Get this Add On</a>
50
+
51
+ </div>
52
+ <div class="mashshare-addons">
53
+ <h3 class="mashshare-addons-title">Floating Sidebar</h3>
54
+ <a title="Select and Share Popup Add-On" href="https://www.mashshare.net/downloads/floating-sidebar/?ref=1" target="_blank"><img class="alignnone wp-image-107 size-full" src="https://www.mashshare.net/wp-content/uploads/edd/2016/01/floating.png" alt="Floating Sidebar" width="300" height="200" /></a>Grow your social traffic with this beautiful and powerful sidebar Add-on.<a class="button-secondary" title="MashShare Networks Add-On" href="https://www.mashshare.net/downloads/floating-sidebar/?ref=1" target="_blank">Get this Add On</a>
55
+
56
+ </div>
57
+ <div class="mashshare-addons">
58
+ <h3 class="mashshare-addons-title">Sticky ShareBar</h3>
59
+ <a title="MashShare Networks Add-On" href="https://www.mashshare.net/downloads/sticky-sharebar/?ref=1" target="_blank"><img class="alignnone wp-image-107 size-full" src="https://www.mashshare.net/wp-content/uploads/edd/2014/10/sharebar.png" alt="Sticky ShareBar" width="300" height="200" /></a>
60
+ Full responsive all time visible ShareBar on top or bottom of your page which slides down after scrolling.<a class="button-secondary" title="Sticky ShareBar" href="https://www.mashshare.net/downloads/sticky-sharebar/?ref=1" target="_blank">Get this Add On</a>
61
+
62
+ </div>
63
+ <div class="mashshare-addons">
64
+ <h3 class="mashshare-addons-title">Click To Tweet</h3>
65
+ <a title="MashShare Networks Add-On" href="https://www.mashshare.net/downloads/click-to-tweet/?ref=1" target="_blank"><img class="alignnone wp-image-107 size-full" src="https://www.mashshare.net/wp-content/uploads/edd/2016/09/product-image-click-to-tweet-300x200.png" alt="Sticky ShareBar" width="300" height="200" /></a>
66
+ Create beautiful twitter quotes that drive traffic to your site. Use any text from your post editor and create a twitter quote in seconds.<a class="button-secondary" title="Sticky ShareBar" href="https://www.mashshare.net/downloads/click-to-tweet/?ref=1" target="_blank">Get this Add On</a>
67
+
68
+ </div>
69
+ <div class="mashshare-addons">
70
+ <h3 class="mashshare-addons-title">Realtime Pageview Counter</h3>
71
+ <a title="MashShare Networks Add-On" href="https://www.mashshare.net/downloads/mashshare-pageviews/" target="_blank"><img class="alignnone wp-image-6713 size-medium" src="https://www.mashshare.net/wp-content/uploads/edd/2014/10/pageviews-300x187.png" alt="Pageviews Realtime Counter" width="300" height="187" />
72
+ </a>Realtime Pageview Counter - Increase user interaction and interest with this ajax based Pageview Counter.<a class="button-secondary" title="Pageview Counter" href="https://www.mashshare.net/downloads/mashshare-pageviews/?ref=1" target="_blank">Get this Add On</a>
73
+
74
+ </div>
75
+ <div class="mashshare-addons">
76
+ <h3 class="mashshare-addons-title">Sticky Facebook LikeBar</h3>
77
+ <a title="MashShare Networks Add-On" href="https://www.mashshare.net/downloads/facebook-like-bar?ref=1" target="_blank"><img class="alignnone wp-image-107 size-full" src="https://www.mashshare.net/wp-content/uploads/edd/2015/01/fblike.png" alt="MashShare Sticky facebook like bar" width="300" height="200" /></a>
78
+ A highly customizable, full responsive and mobile optimized sticky Like-Bar. <a class="button-secondary" title="MashShare Like-Bar" href="https://www.mashshare.net/downloads/facebook-like-bar?ref=1" target="_blank">Get this Add On</a>
79
+
80
+ </div>
81
+ <div class="mashshare-addons">
82
+ <h3 class="mashshare-addons-title">Select and Share</h3>
83
+ <a title="Select and Share Popup Add-On" href="https://www.mashshare.net/downloads/select-and-share/?ref=1" target="_blank"><img class="alignnone wp-image-107 size-full" src="https://www.mashshare.net/wp-content/uploads/edd/2015/10/select-and-share.png" alt="VideoPost Popup" width="300" height="200" /></a>Share any text selection via twitter, facebook and mail. Increase sharing of your valuable content. <a class="button-secondary" title="MashShare Networks Add-On" href="https://www.mashshare.net/downloads/select-and-share/?ref=1" target="_blank">Get this Add On</a>
84
+
85
+ </div>
86
+ <div class="mashshare-addons">
87
+ <h3 class="mashshare-addons-title">Google Analytics Integration</h3>
88
+ <a title="Google Analytics Integration" href="https://www.mashshare.net/downloads/google-analytics-integration/" target="_blank"><img class="alignnone wp-image-4273 size-full" src="https://www.mashshare.net/wp-content/uploads/edd/2014/09/google-analytics.png" alt="" width="320" height="200" />
89
+ </a>Track and count clicks on all Share Buttons within your Google Analytics account in realtime. <a title="Google Analytics Integration" class="button-secondary" href="https://www.mashshare.net/downloads/google-analytics-integration/" target="_blank">Get this Add On</a>
90
+
91
+ </div>
92
+ <div class="mashshare-addons">
93
+ <h3 class="mashshare-addons-title">Add responsive style</h3>
94
+ <a href="https://www.mashshare.net/downloads/mashshare-responsive/?ref=1" target="_blank"><img class="alignnone wp-image-494 size-full" src="https://www.mashshare.net/wp-content/uploads/2014/03/mashshare-responsive.png" alt="mashshare-responsive" width="320" height="200" /></a>
95
+ Add responsive style to MashShare. <a class="button-secondary" title="MashShare responsive Add-On" href="https://www.mashshare.net/downloads/mashshare-responsive/?ref=1" target="_blank">Get this Add On</a>
96
+
97
+ </div>
98
+ <div class="mashshare-addons">
99
+ <h3 class="mashshare-addons-title">ShortURLs Integration</h3>
100
+ <a href="https://www.mashshare.net/downloads/shorturls-integration/" target="_blank"><img class="alignnone wp-image-5207 size-medium" src="https://www.mashshare.net/wp-content/uploads/edd/2014/10/shorturls-300x187.png" alt="shorturls" width="300" height="187" /></a>
101
+ Add shortURLs for Twitter. <a class="button-secondary" title="MashShare Shorturls Add-On" href="https://www.mashshare.net/downloads/shorturls-integration/?ref=1" target="_blank">Get this Add On</a>
102
+
103
+ </div>
104
+ <div class="mashshare-addons">
105
+ <h3 class="mashshare-addons-title">Like Pop-Up after Share</h3>
106
+ <a href="https://www.mashshare.net/downloads/mashshare-likeaftershare/?ref=1" target="_blank"><img class="alignnone wp-image-107 size-full" src="https://www.mashshare.net/wp-content/uploads/edd/2014/08/likeaftershare1.jpg" alt="mash-networks" width="300" height="200" /></a>
107
+ Share a post and get a Facebook Like Pop-Up overlay. <a class="button-secondary" title="MashShare LikeAfterShare Add-On" href="https://www.mashshare.net/downloads/mashshare-likeaftershare/?ref=1" target="_blank">Get this Add On</a>
108
+
109
+ </div>
110
+ <div class="mashshare-addons">
111
+ <h3 class="mashshare-addons-title">Performance Widget</h3>
112
+ <a title="MashShare Performance Widget Add-On" href="https://www.mashshare.net/downloads/performance-widget?ref=1" target="_blank"><img class="alignnone wp-image-107 size-full" src="https://www.mashshare.net/wp-content/uploads/edd/2015/07/performance.png" alt="MashShare Performance Widget Add-On" width="300" height="200" /></a>
113
+ Shares, comments and real time reads at a glance. Give your website a great visual social impact. <a class="button-secondary" title="MashShare Performance Widget Add-On" href="https://www.mashshare.net/downloads/performance-widget?ref=1" target="_blank">Get this Add On</a>
114
+
115
+ </div>
116
+ <div class="mashshare-addons">
117
+ <h3 class="mashshare-addons-title">MashShare Open Graph</h3>
118
+ <a href="https://www.mashshare.net/downloads/mashshare-open-graph/" target="_blank"><img class="alignnone wp-image-4472 size-full" src="https://www.mashshare.net/wp-content/uploads/edd/2014/09/open-graph.png" alt="" width="320" height="200" /></a>
119
+ Share your content in the best possible way. Social sharing optimization with Open Graph implementation.
120
+ <a class="button-secondary" title="MashShare Open Graph" href="https://www.mashshare.net/downloads/mashshare-open-graph/" target="_blank">Get this Add On</a>
121
+
122
+ </div>
123
+ EOT;
124
  }
includes/admin/admin-actions.php CHANGED
@@ -20,11 +20,11 @@ if ( ! defined( 'ABSPATH' ) ) exit;
20
  * @return void
21
  */
22
  function mashsb_process_actions() {
23
- if ( isset( $_POST['mashsb-action'] ) ) {
24
  do_action( 'mashsb_' . $_POST['mashsb-action'], $_POST );
25
  }
26
 
27
- if ( isset( $_GET['mashsb-action'] ) ) {
28
  do_action( 'mashsb_' . $_GET['mashsb-action'], $_GET );
29
  }
30
  }
@@ -36,11 +36,9 @@ add_action( 'admin_init', 'mashsb_process_actions' );
36
  * @global array $mashsb_options
37
  */
38
  function mashsb_save_order(){
39
- global $mashsb_options;
40
- // Get all settings
41
-
42
  $current_list = get_option('mashsb_networks');
43
- $new_order = $_POST['mashsb_list'];
44
  $new_list = array();
45
 
46
  /* First write the sort order */
20
  * @return void
21
  */
22
  function mashsb_process_actions() {
23
+ if ( !empty( $_POST['mashsb-action'] ) ) {
24
  do_action( 'mashsb_' . $_POST['mashsb-action'], $_POST );
25
  }
26
 
27
+ if ( !empty( $_GET['mashsb-action'] ) ) {
28
  do_action( 'mashsb_' . $_GET['mashsb-action'], $_GET );
29
  }
30
  }
36
  * @global array $mashsb_options
37
  */
38
  function mashsb_save_order(){
39
+
 
 
40
  $current_list = get_option('mashsb_networks');
41
+ $new_order = (array)$_POST['mashsb_list'];
42
  $new_list = array();
43
 
44
  /* First write the sort order */
includes/admin/admin-notices.php CHANGED
@@ -48,76 +48,67 @@ function mashsb_admin_messages() {
48
  }
49
 
50
  mashsb_show_update_notice_gdpr();
51
-
52
- //mashsb_show_new_fb_api();
53
-
54
  // Cache warning
55
  if( mashsb_is_deactivated_cache() ) {
56
  echo '<div class="error">';
57
- echo '<p>' . sprintf(__('Attention: The Mashshare Cache is deactivated. <a href="%s">Activate it</a> or share count requests to social networks will be rate limited.', 'mashsb'), admin_url() . 'admin.php?page=mashsb-settings#mashsb_settingsdebug_header') . '</p>';
58
  echo '</div>';
59
  }
60
  // Cache warning
61
  if( mashsb_is_deleted_cache() ) {
62
  echo '<div class="error">';
63
- echo '<p>' . sprintf(__('Attention: The Mashshare Cache is permanetely purged. <a href="%s">Fix this</a> or share count requests to social networks will be rate limited.', 'mashsb'), admin_url() . 'admin.php?page=mashsb-settings#mashsb_settingsdebug_header') . '</p>';
64
  echo '</div>';
65
  }
66
-
67
- //mashsb_update_notice_101();
68
-
69
  if( mashsb_is_admin_page() && !mashsb_curl_installed() ) {
70
  echo '<div class="error">';
71
- echo '<p>' . sprintf(__('MashShare needs the PHP extension cURL and curl_multi_init() which is not installed on your server. Please <a href="%s" target="_blank" rel="noopener">install and activate</a> it to be able to collect share count of your posts.', 'mashsb'), 'https://www.google.com/search?btnG=1&pws=0&q=enable+curl+on+php') . '</p>';
72
  echo '</div>';
73
  }
74
 
75
  // notice no Networks enabled
76
  if( mashsb_is_admin_page() && !mashsb_check_active_networks() ) {
77
  echo '<div class="error">';
78
- echo '<p>' . sprintf( __( 'No Social Networks enabled. Go to <a href="%s"> Mashshare->Settings->Social Networks</a> and enable at least one Social Network.', 'mashsb' ), admin_url( 'admin.php?page=mashsb-settings&tab=networks#mashsb_settingsservices_header' ) ) . '</p>';
79
  echo '</div>';
80
  }
81
  // Share bar add-on notice
82
  if( mashsb_is_admin_page() && mashsb_incorrect_sharebar_version() ) {
83
  echo '<div class="error">';
84
- echo '<p>' . sprintf( __( 'Your Sharebar Add-On version is not using new short url mechanism of MashShare 3.X. Please <a href="%s" target="blank"> update the Sharebar Add-On</a> to at least version 1.2.5. if you want to make sure that twitter short urls will not stop working in one of the next updates. This requires a valid license of the Sharebar Add-On', 'mashsb' ), 'https://www.mashshare.net/downloads/sticky-sharebar/?utm_source=insideplugin&utm_medium=userwebsite&utm_content=update_sharebar&utm_campaign=freeplugin' ) . '</p>';
85
  echo '</div>';
86
  }
87
  // Floating Sidebar add-on notice
88
  if( mashsb_is_admin_page() && mashsb_incorrect_sidebar_version() ) {
89
  echo '<div class="error">';
90
- echo '<p>' . sprintf( __( 'Your Floating Sidebar Add-On version is not using new short url mechanism of MashShare 3.X. Please <a href="%s" target="blank"> update the Floating Sidebar Add-On</a> to at least version 1.2.6. if you want to make sure that twitter short urls will not stop working in one of the next updates. This requires a valid license of the Floating Sidebar Add-On', 'mashsb' ), 'https://www.mashshare.net/downloads/floating-sidebar/?utm_source=insideplugin&utm_medium=userwebsite&utm_content=update_sharebar&utm_campaign=freeplugin' ) . '</p>';
91
  echo '</div>';
92
  }
93
- // Check google API key
94
- // if( mashsb_is_admin_page() && ( mashsb_check_google_apikey() && isset( $mashsb_options['mashsu_methods'] ) && $mashsb_options['mashsu_methods'] === 'google' ) ) {
95
- // echo '<div class="error">';
96
- // echo '<p>' . sprintf( __( 'Google API key is invalid. Go to <a href="%s"><i>Mashshare->Settings->Short URL Integration</i></a> and check the Google API key.', 'mashsb' ), admin_url( 'admin.php?page=mashsb-settings#mashsb_settingsshorturl_header' ) ) . '</p>';
97
- // echo '</div>';
98
- // }
99
  // Check Bitly API key
100
  if( mashsb_is_admin_page() && (false === mashsb_check_bitly_apikey() && isset( $mashsb_options['mashsu_methods'] ) && $mashsb_options['mashsu_methods'] === 'bitly' ) ) {
101
  echo '<div class="error">';
102
- echo '<p>' . sprintf( __( 'Bitly Access Token is invalid or bitly.com endpoint can not be reached. Go to <a href="%s"><i>Mashshare->Settings->Short URL Integration</i></a> and check the Bitly API key.', 'mashsb' ), admin_url( 'admin.php?page=mashsb-settings#mashsb_settingsshorturl_header' ) ) . '</p>';
103
  echo '</div>';
104
  }
105
  // Notice MashShare Open Graph Add-On installed and activated
106
  if( class_exists( 'MashshareOpenGraph' ) ) {
107
  echo '<div class="error">';
108
- echo '<p>' . sprintf( __( '<strong>Important:</strong> Deactivate the MashShare Open Graph Add-On. It is not longer needed and having it activated leads to duplicate open graph tags on your site. Go to <a href="%s"> Plugin Settings</a> ', 'mashsb' ), admin_url( 'plugins.php' ) ) . '</p>';
109
  echo '</div>';
110
  }
111
  // Notice MashShare ShortURL Add-On installed and activated
112
  if( class_exists( 'MashshareShorturls' ) ) {
113
  echo '<div class="error">';
114
- echo '<p>' . sprintf( __( '<strong>Important:</strong> Deactivate the MashShare Shorturls Add-On. It is not longer needed and already built in MashShare. Deactivate it from <a href="%s"> Plugin Settings</a> ', 'mashsb' ), admin_url( 'plugins.php' ) ) . '</p>';
115
  echo '</div>';
116
  }
117
  // Share count is deactivated when permalinks are not used
118
  if( mashsb_is_admin_page() && !mashsb_is_enabled_permalinks() ) {
119
  echo '<div class="error">';
120
- echo '<p>' . sprintf( __( '<strong>No Share Count aggregation possible!</strong> <a href="%s">Permalinks</a> must be enabled to count shares. Share count is deactivated until you have changed this.', 'mashsb' ), admin_url( 'options-permalink.php' ) ) . '</p>';
121
  echo '</div>';
122
  }
123
 
@@ -126,7 +117,7 @@ function mashsb_admin_messages() {
126
  switch ( $_GET['mashsb-message'] ) {
127
  case 'settings-imported' :
128
  echo '<div class="updated">';
129
- echo '<p>' . __( 'The settings have been imported', 'mashsb' ) . '</p>';
130
  echo '</div>';
131
  break;
132
  }
@@ -175,8 +166,6 @@ function mashsb_admin_messages() {
175
  </script>
176
  ';
177
  }
178
- // Disabled since 2.4.7
179
- //mashsb_update_notices();
180
  }
181
  add_action( 'admin_notices', 'mashsb_admin_messages' );
182
 
@@ -217,77 +206,21 @@ function mashsb_incorrect_sidebar_version() {
217
  */
218
 
219
  function mashsb_hide_update_notice() {
220
- if( !empty( $_POST['action'] ) && $_POST['action'] === 'mashsb_hide_notice' && !empty( $_POST['id'] ) ) {
221
- //echo $_POST['action'] . '_' . $_POST['id'];
 
 
 
 
 
 
222
  update_option( 'mashsb_update_notice_' . $_POST['id'], 'no' );
223
- $result = array('success');
224
- echo json_encode( $result );
225
  exit;
226
  }
227
  }
228
-
229
  add_action( 'wp_ajax_mashsb_hide_notice', 'mashsb_hide_update_notice' );
230
 
231
- /**
232
- * Return update notice 101
233
- * @since 3.2.0
234
- */
235
- function mashsb_update_notice_101() {
236
-
237
- if( !mashsb_is_admin_page() ) {
238
- return false;
239
- }
240
-
241
- $notice_id = '101'; //unique id of our notice
242
- $message = sprintf(__( 'Admin notices are pain but read this one or you will miss how to fix your facebook share counts in MashShare: <p><strong style="font-weight:bold;">Go to <a href="%1s">Settings->Networks</a> and request your access token via facebook login - That\'s all. '
243
- . '<a href="#" id="mashsb_notice_101_resp"> Whats also new? </a> </strong>'
244
- . '<div style="display:none;" id="mashsb_notice_101_more">'
245
- . '<ul style="font-weight:600;">'
246
- . '<li>- Full Width Responsive Buttons (Enable them from <a href="%2s">Visual Setting</a>)<li>'
247
- . '<li>- Most Shared Posts Widget incl. Thumbnails</li>'
248
- . '<li>- Cumulate Http(s) Shares - Move your site to ssl without loosing shares</li>'
249
- . '</div>'
250
- , 'mashsb' ),
251
- admin_url() . 'admin.php?page=mashsb-settings#mashsb_settingsservices_header',
252
- admin_url() . 'admin.php?page=mashsb-settings#mashsb_settingsstyle_header'
253
- );
254
-
255
- if( get_option( 'mashsb_update_notice_' . $notice_id ) === 'yes' ) {
256
-
257
- // admin notice after updating Mashshare
258
- echo '<div class="mashsb_update_notice_'. $notice_id .' update-nag">' . $message .
259
- '<p><a href="javascript:void(0);" class="mashsb_hide_'. $notice_id .'" title="I got it" style="text-decoration:none;">- Ok, Do Not Show Again</a></a>'
260
- . '</div>'
261
- . '<script>
262
- jQuery( document ).ready(function( $ ) {
263
- jQuery(\'.mashsb_hide_'. $notice_id .'\').click(function(){
264
- var data={
265
- \'action\':\'mashsb_hide_notice\',
266
- \'id\':\'101\',
267
- }
268
- jQuery.ajax({
269
- url: "' . admin_url( 'admin-ajax.php' ) . '",
270
- type: "post",
271
- data: data,
272
- dataType: "json",
273
- async: !0,
274
- success: function(e) {
275
- if (e=="success") {
276
- jQuery(\'.mashsb_update_notice_'. $notice_id .'\').hide();
277
- }
278
- }
279
- });
280
- })
281
- jQuery(\'#mashsb_notice_101_resp\').click(function(e){
282
- e.preventDefault();
283
- jQuery(\'#mashsb_notice_101_more\').show()
284
- });
285
-
286
- });
287
- </script>';
288
- }
289
- }
290
-
291
  /* Hide the rating div
292
  *
293
  * @subpackage Admin/Notices
@@ -304,7 +237,6 @@ function mashsb_HideRatingDiv() {
304
  echo json_encode( array("success") );
305
  exit;
306
  }
307
-
308
  add_action( 'wp_ajax_hideRating', 'mashsb_HideRatingDiv' );
309
 
310
  /**
@@ -326,13 +258,13 @@ function mashsb_admin_addons_notices() {
326
  */
327
  function mashsb_dismiss_notices() {
328
 
329
- $notice = isset( $_GET['mashsb_notice'] ) ? $_GET['mashsb_notice'] : false;
330
  if( !$notice )
331
- return; // No notice, so get out of here
332
 
333
  update_user_meta( get_current_user_id(), '_mashsb_' . $notice . '_dismissed', 1 );
334
 
335
- wp_redirect( esc_url( remove_query_arg( array('mashsb_action', 'mashsb_notice') ) ) );
336
  exit;
337
  }
338
 
@@ -442,11 +374,11 @@ function mashsb_show_update_notice_gdpr() {
442
  }
443
 
444
  // admin notice after updating Mashshare
445
- echo '<div class="mashsb-notice-gdpr mashsb_update_notice_gdpr update-nag" style="background-color: #00abed;color: white;padding: 20px;margin-top: 20px;border: 3px solid white;width:80%;">' . $message .
446
  '<p><a href="'.admin_url().'admin.php?page=mashsb-settings&mashsb-action=hide_gdpr_notice" class="mashsb_hide_gdpr" title="I got it" style="text-decoration:none;color:white;text-decoration:none;">I understand! Close this message</a></a>'.
447
  '</div>';
448
-
449
-
450
  }
451
 
452
  /**
48
  }
49
 
50
  mashsb_show_update_notice_gdpr();
51
+
 
 
52
  // Cache warning
53
  if( mashsb_is_deactivated_cache() ) {
54
  echo '<div class="error">';
55
+ echo '<p>' . wp_kses_post(sprintf(__('Attention: The Mashshare Cache is deactivated. <a href="%s">Activate it</a> or share count requests to social networks will be rate limited.', 'mashsb'), admin_url() . 'admin.php?page=mashsb-settings#mashsb_settingsdebug_header') ). '</p>';
56
  echo '</div>';
57
  }
58
  // Cache warning
59
  if( mashsb_is_deleted_cache() ) {
60
  echo '<div class="error">';
61
+ echo '<p>' . wp_kses_post(sprintf(__('Attention: The Mashshare Cache is permanetely purged. <a href="%s">Fix this</a> or share count requests to social networks will be rate limited.', 'mashsb'), admin_url() . 'admin.php?page=mashsb-settings#mashsb_settingsdebug_header')) . '</p>';
62
  echo '</div>';
63
  }
64
+
 
 
65
  if( mashsb_is_admin_page() && !mashsb_curl_installed() ) {
66
  echo '<div class="error">';
67
+ echo '<p>' . wp_kses_post(sprintf(__('MashShare needs the PHP extension cURL and curl_multi_init() which is not installed on your server. Please <a href="%s" target="_blank" rel="noopener">install and activate</a> it to be able to collect share count of your posts.', 'mashsb'), 'https://www.google.com/search?btnG=1&pws=0&q=enable+curl+on+php')) . '</p>';
68
  echo '</div>';
69
  }
70
 
71
  // notice no Networks enabled
72
  if( mashsb_is_admin_page() && !mashsb_check_active_networks() ) {
73
  echo '<div class="error">';
74
+ echo '<p>' . wp_kses_post(sprintf( __( 'No Social Networks enabled. Go to <a href="%s"> Mashshare->Settings->Social Networks</a> and enable at least one Social Network.', 'mashsb' ), admin_url( 'admin.php?page=mashsb-settings&tab=networks#mashsb_settingsservices_header' ) )) . '</p>';
75
  echo '</div>';
76
  }
77
  // Share bar add-on notice
78
  if( mashsb_is_admin_page() && mashsb_incorrect_sharebar_version() ) {
79
  echo '<div class="error">';
80
+ echo '<p>' . wp_kses_post(sprintf( __( 'Your Sharebar Add-On version is not using new short url mechanism of MashShare 3.X. Please <a href="%s" target="blank"> update the Sharebar Add-On</a> to at least version 1.2.5. if you want to make sure that twitter short urls will not stop working in one of the next updates. This requires a valid license of the Sharebar Add-On', 'mashsb' ), 'https://www.mashshare.net/downloads/sticky-sharebar/?utm_source=insideplugin&utm_medium=userwebsite&utm_content=update_sharebar&utm_campaign=freeplugin' )) . '</p>';
81
  echo '</div>';
82
  }
83
  // Floating Sidebar add-on notice
84
  if( mashsb_is_admin_page() && mashsb_incorrect_sidebar_version() ) {
85
  echo '<div class="error">';
86
+ echo '<p>' . wp_kses_post(sprintf( __( 'Your Floating Sidebar Add-On version is not using new short url mechanism of MashShare 3.X. Please <a href="%s" target="blank"> update the Floating Sidebar Add-On</a> to at least version 1.2.6. if you want to make sure that twitter short urls will not stop working in one of the next updates. This requires a valid license of the Floating Sidebar Add-On', 'mashsb' ), 'https://www.mashshare.net/downloads/floating-sidebar/?utm_source=insideplugin&utm_medium=userwebsite&utm_content=update_sharebar&utm_campaign=freeplugin' ) ). '</p>';
87
  echo '</div>';
88
  }
89
+
 
 
 
 
 
90
  // Check Bitly API key
91
  if( mashsb_is_admin_page() && (false === mashsb_check_bitly_apikey() && isset( $mashsb_options['mashsu_methods'] ) && $mashsb_options['mashsu_methods'] === 'bitly' ) ) {
92
  echo '<div class="error">';
93
+ echo '<p>' . wp_kses_post(sprintf( __( 'Bitly Access Token is invalid or bitly.com endpoint can not be reached. Go to <a href="%s"><i>Mashshare->Settings->Short URL Integration</i></a> and check the Bitly API key.', 'mashsb' ), admin_url( 'admin.php?page=mashsb-settings#mashsb_settingsshorturl_header' ) )) . '</p>';
94
  echo '</div>';
95
  }
96
  // Notice MashShare Open Graph Add-On installed and activated
97
  if( class_exists( 'MashshareOpenGraph' ) ) {
98
  echo '<div class="error">';
99
+ echo '<p>' . wp_kses_post(sprintf( __( '<strong>Important:</strong> Deactivate the MashShare Open Graph Add-On. It is not longer needed and having it activated leads to duplicate open graph tags on your site. Go to <a href="%s"> Plugin Settings</a> ', 'mashsb' ), admin_url( 'plugins.php' ) )) . '</p>';
100
  echo '</div>';
101
  }
102
  // Notice MashShare ShortURL Add-On installed and activated
103
  if( class_exists( 'MashshareShorturls' ) ) {
104
  echo '<div class="error">';
105
+ echo '<p>' . wp_kses_post(sprintf( __( '<strong>Important:</strong> Deactivate the MashShare Shorturls Add-On. It is not longer needed and already built in MashShare. Deactivate it from <a href="%s"> Plugin Settings</a> ', 'mashsb' ), admin_url( 'plugins.php' ) )) . '</p>';
106
  echo '</div>';
107
  }
108
  // Share count is deactivated when permalinks are not used
109
  if( mashsb_is_admin_page() && !mashsb_is_enabled_permalinks() ) {
110
  echo '<div class="error">';
111
+ echo '<p>' . wp_kses_post(sprintf( __( '<strong>No Share Count aggregation possible!</strong> <a href="%s">Permalinks</a> must be enabled to count shares. Share count is deactivated until you have changed this.', 'mashsb' ), admin_url( 'options-permalink.php' ) )) . '</p>';
112
  echo '</div>';
113
  }
114
 
117
  switch ( $_GET['mashsb-message'] ) {
118
  case 'settings-imported' :
119
  echo '<div class="updated">';
120
+ echo '<p>' . esc_html(__( 'The settings have been imported', 'mashsb' )) . '</p>';
121
  echo '</div>';
122
  break;
123
  }
166
  </script>
167
  ';
168
  }
 
 
169
  }
170
  add_action( 'admin_notices', 'mashsb_admin_messages' );
171
 
206
  */
207
 
208
  function mashsb_hide_update_notice() {
209
+
210
+ $postId = intval($_POST['id'] );
211
+
212
+ if (!$postId || empty($_POST['action'])) {
213
+ return;
214
+ }
215
+
216
+ if( $_POST['action'] === 'mashsb_hide_notice' ) {
217
  update_option( 'mashsb_update_notice_' . $_POST['id'], 'no' );
218
+ echo json_encode( array('success') );
 
219
  exit;
220
  }
221
  }
 
222
  add_action( 'wp_ajax_mashsb_hide_notice', 'mashsb_hide_update_notice' );
223
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
  /* Hide the rating div
225
  *
226
  * @subpackage Admin/Notices
237
  echo json_encode( array("success") );
238
  exit;
239
  }
 
240
  add_action( 'wp_ajax_hideRating', 'mashsb_HideRatingDiv' );
241
 
242
  /**
258
  */
259
  function mashsb_dismiss_notices() {
260
 
261
+ $notice = isset( $_GET['mashsb_notice'] ) ? esc_attr($_GET['mashsb_notice']) : false;
262
  if( !$notice )
263
+ return;
264
 
265
  update_user_meta( get_current_user_id(), '_mashsb_' . $notice . '_dismissed', 1 );
266
 
267
+ wp_save_redirect( esc_url( remove_query_arg( array('mashsb_action', 'mashsb_notice') ) ) );
268
  exit;
269
  }
270
 
374
  }
375
 
376
  // admin notice after updating Mashshare
377
+ $html = '<div class="mashsb-notice-gdpr mashsb_update_notice_gdpr update-nag" style="background-color: #00abed;color: white;padding: 20px;margin-top: 20px;border: 3px solid white;width:80%;">' . $message .
378
  '<p><a href="'.admin_url().'admin.php?page=mashsb-settings&mashsb-action=hide_gdpr_notice" class="mashsb_hide_gdpr" title="I got it" style="text-decoration:none;color:white;text-decoration:none;">I understand! Close this message</a></a>'.
379
  '</div>';
380
+
381
+ echo wp_kses_post($html);
382
  }
383
 
384
  /**
includes/admin/admin-pages.php CHANGED
@@ -51,9 +51,7 @@ function mashsb_is_admin_page() {
51
  return false;
52
  }
53
 
54
- global $mashsb_parent_page, $pagenow, $typenow, $mashsb_settings_page, $mashsb_add_ons_page, $mashsb_tools_page, $mashsb_quickstart;
55
-
56
- if( 'mashsb-settings' == $currentpage || 'mashsb-addons' == $currentpage || 'mashsb-tools' == $currentpage || 'mashsb-getting-started' == $currentpage || 'mashsb-credits' == $currentpage || 'mashsb-about' == $currentpage ) {
57
  return true;
58
  }
59
  }
51
  return false;
52
  }
53
 
54
+ if( 'mashsb-settings' == $currentpage || 'mashsb-addons' == $currentpage || 'mashsb-tools' == $currentpage || 'mashsb-getting-started' == $currentpage || 'mashsb-about' == $currentpage ) {
 
 
55
  return true;
56
  }
57
  }
includes/admin/settings/display-settings.php CHANGED
@@ -21,7 +21,6 @@ if( !defined( 'ABSPATH' ) )
21
  */
22
 
23
  function getTabHeader( $page, $section ) {
24
- global $mashsb_options;
25
  global $wp_settings_fields;
26
 
27
  if( !isset( $wp_settings_fields[$page][$section] ) )
@@ -32,7 +31,7 @@ function getTabHeader( $page, $section ) {
32
  $sanitizedID = str_replace( '[', '', $field['id'] );
33
  $sanitizedID = str_replace( ']', '', $sanitizedID );
34
  if( strpos( $field['callback'], 'header' ) !== false ) {
35
- echo '<li class="mashsb-tabs" id="' . $sanitizedID . '-nav"><a href="#' . $sanitizedID . '">' . $field['title'] . '</a></li>';
36
  }
37
  }
38
  echo '</ul>';
@@ -83,22 +82,21 @@ function mashsb_do_settings_fields( $page, $section ) {
83
 
84
  // Check if header has been created previously
85
  if( strpos( $field['callback'], 'header' ) !== false && $firstHeader === false ) {
86
- echo '<div id="' . $sanitizedID . '">';
87
  echo '<table class="form-table"><tbody>';
88
  $firstHeader = true;
89
  } elseif( strpos( $field['callback'], 'header' ) !== false && $firstHeader === true ) {
90
  // Header has been created previously so we have to close the first opened div
91
- echo '</table></div><div id="' . $sanitizedID . '">';
92
  echo '<table class="form-table"><tbody>';
93
  }
94
- //if( (!empty( $field['args']['label_for'] ) || empty( $field['args']['desc'] )) ) {
95
  if( strpos( $field['callback'], 'header' ) !== false ){
96
  // Do not return header_callback Its only needed for creating the navigation entries
97
  }
98
  // The headline
99
  else if( strpos( $field['callback'], 'headline' ) !== false ) {
100
  echo '<tr class="row"><th class="row th">';
101
- echo '<div class="col-title"><h2>' . $field['title'] . '</h2></div>';
102
  echo '</th>';
103
  echo '<td>';
104
  call_user_func( $field['callback'], $field['args'] );
@@ -107,11 +105,11 @@ function mashsb_do_settings_fields( $page, $section ) {
107
  // The Settings
108
  } else {
109
  echo '<tr class="row"><th class="row th">';
110
- echo '<div class="col-title">' . $field['title'];
111
  // Do not show the helper text when its empty
112
  if (!empty($field['args']['desc']) ){
113
  echo '<a class="mashsb-helper" href="#"></a>';
114
- echo '<div class="mashsb-message">' . $field['args']['desc'] . '</div>';
115
  }
116
  echo '</div>';
117
  echo '</th>';
@@ -144,7 +142,7 @@ function mashsb_options_page() {
144
  ob_start();
145
  ?>
146
  <div class="mashsb_admin">
147
- <span class="mashsharelogo"> <?php echo __( 'MashShare ', 'mashsb' ); ?></span><span class="mashsb-version"><?php echo MASHSB_VERSION; ?></span>
148
  <div class="about-text" style="clear:both;">
149
  <ul id="mash-social-admin-head">
150
  <?php echo mashsb_share_buttons(); ?>
@@ -163,21 +161,20 @@ function mashsb_options_page() {
163
 
164
  $active = $active_tab == $tab_id ? ' nav-tab-active' : '';
165
 
166
- echo '<a href="' . esc_url( $tab_url ) . '" title="' . esc_attr( $tab_name ) . '" class="nav-tab' . $active . '">';
167
  echo esc_html( $tab_name );
168
  echo '</a>';
169
  }
170
  ?>
171
  </h2>
172
  <div id="mashsb_container" class="mashsb_container">
173
- <?php getTabHeader( 'mashsb_settings_' . $active_tab, 'mashsb_settings_' . $active_tab ); ?>
174
  <div class="mashsb-panel-container"> <!-- new //-->
175
  <form method="post" action="options.php">
176
  <?php
177
  settings_fields( 'mashsb_settings' );
178
- mashsb_do_settings_fields( 'mashsb_settings_' . $active_tab, 'mashsb_settings_' . $active_tab );
179
  ?>
180
- <!--</table>-->
181
 
182
  <?php
183
  // do not show save button on add-on page
@@ -195,8 +192,7 @@ function mashsb_options_page() {
195
  }
196
  ?>
197
  </div> <!-- #sidebar-->
198
- <?php echo mashsb_get_debug_settings(); ?>
199
-
200
  </div><!-- .mashsb_admin -->
201
  <?php
202
  echo ob_get_clean();
21
  */
22
 
23
  function getTabHeader( $page, $section ) {
 
24
  global $wp_settings_fields;
25
 
26
  if( !isset( $wp_settings_fields[$page][$section] ) )
31
  $sanitizedID = str_replace( '[', '', $field['id'] );
32
  $sanitizedID = str_replace( ']', '', $sanitizedID );
33
  if( strpos( $field['callback'], 'header' ) !== false ) {
34
+ echo '<li class="mashsb-tabs" id="' . esc_attr($sanitizedID) . '-nav"><a href="#' . esc_attr($sanitizedID) . '">' . wp_kses_post($field['title']) . '</a></li>';
35
  }
36
  }
37
  echo '</ul>';
82
 
83
  // Check if header has been created previously
84
  if( strpos( $field['callback'], 'header' ) !== false && $firstHeader === false ) {
85
+ echo '<div id="' . esc_attr($sanitizedID) . '">';
86
  echo '<table class="form-table"><tbody>';
87
  $firstHeader = true;
88
  } elseif( strpos( $field['callback'], 'header' ) !== false && $firstHeader === true ) {
89
  // Header has been created previously so we have to close the first opened div
90
+ echo '</table></div><div id="' . esc_attr($sanitizedID) . '">';
91
  echo '<table class="form-table"><tbody>';
92
  }
 
93
  if( strpos( $field['callback'], 'header' ) !== false ){
94
  // Do not return header_callback Its only needed for creating the navigation entries
95
  }
96
  // The headline
97
  else if( strpos( $field['callback'], 'headline' ) !== false ) {
98
  echo '<tr class="row"><th class="row th">';
99
+ echo '<div class="col-title"><h2>' . esc_html($field['title']) . '</h2></div>';
100
  echo '</th>';
101
  echo '<td>';
102
  call_user_func( $field['callback'], $field['args'] );
105
  // The Settings
106
  } else {
107
  echo '<tr class="row"><th class="row th">';
108
+ echo '<div class="col-title">' . esc_html($field['title']);
109
  // Do not show the helper text when its empty
110
  if (!empty($field['args']['desc']) ){
111
  echo '<a class="mashsb-helper" href="#"></a>';
112
+ echo '<div class="mashsb-message">' . esc_html($field['args']['desc']) . '</div>';
113
  }
114
  echo '</div>';
115
  echo '</th>';
142
  ob_start();
143
  ?>
144
  <div class="mashsb_admin">
145
+ <span class="mashsharelogo"> <?php echo esc_html(__( 'MashShare ', 'mashsb' )); ?></span><span class="mashsb-version"><?php echo esc_html(MASHSB_VERSION); ?></span>
146
  <div class="about-text" style="clear:both;">
147
  <ul id="mash-social-admin-head">
148
  <?php echo mashsb_share_buttons(); ?>
161
 
162
  $active = $active_tab == $tab_id ? ' nav-tab-active' : '';
163
 
164
+ echo '<a href="' . esc_url( $tab_url ) . '" title="' . esc_attr( $tab_name ) . '" class="nav-tab' . esc_attr($active) . '">';
165
  echo esc_html( $tab_name );
166
  echo '</a>';
167
  }
168
  ?>
169
  </h2>
170
  <div id="mashsb_container" class="mashsb_container">
171
+ <?php getTabHeader( 'mashsb_settings_' . esc_attr($active_tab), 'mashsb_settings_' . esc_attr($active_tab) ); ?>
172
  <div class="mashsb-panel-container"> <!-- new //-->
173
  <form method="post" action="options.php">
174
  <?php
175
  settings_fields( 'mashsb_settings' );
176
+ mashsb_do_settings_fields( 'mashsb_settings_' . esc_attr($active_tab), 'mashsb_settings_' . esc_attr($active_tab) );
177
  ?>
 
178
 
179
  <?php
180
  // do not show save button on add-on page
192
  }
193
  ?>
194
  </div> <!-- #sidebar-->
195
+ <?php echo mashsb_get_debug_settings(); ?>
 
196
  </div><!-- .mashsb_admin -->
197
  <?php
198
  echo ob_get_clean();
includes/admin/settings/register-settings.php CHANGED
@@ -832,7 +832,7 @@ function mashsb_header_callback( $args ) {
832
  function mashsb_checkbox_callback( $args ) {
833
  global $mashsb_options;
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']) . ']">'
@@ -864,7 +864,7 @@ function mashsb_multicheck_callback( $args ) {
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 ) . '/>&nbsp;';
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>';
@@ -892,8 +892,8 @@ function mashsb_radio_callback( $args ) {
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 ) . '/>&nbsp;';
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>';
@@ -947,8 +947,8 @@ function mashsb_number_callback( $args ) {
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;
954
  }
@@ -1013,7 +1013,7 @@ function mashsb_password_callback( $args ) {
1013
  * @return void
1014
  */
1015
  function mashsb_missing_callback( $args ) {
1016
- printf( __( 'The callback function used for the <strong>%s</strong> setting is missing.', 'mashsb' ), $args['id'] );
1017
  }
1018
 
1019
  /**
@@ -1152,8 +1152,8 @@ function mashsb_upload_callback( $args ) {
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>&nbsp;<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;
@@ -1222,7 +1222,7 @@ if ( ! function_exists( 'mashsb_license_key_callback' ) ) {
1222
  $messages[] = sprintf(
1223
  __( 'Your license key expired on %s. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>.', 'mashsb' ),
1224
  date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1225
- 'https://www.mashshare.net/checkout/?edd_license_key=' . $value . '&utm_campaign=notice&utm_source=license_tab&utm_medium=admin&utm_content=license-expired'
1226
  );
1227
 
1228
  $license_status = 'mashsb-license-' . $class . '-notice';
@@ -1337,7 +1337,7 @@ if ( ! function_exists( 'mashsb_license_key_callback' ) ) {
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
 
1343
  }
@@ -1394,22 +1394,22 @@ function mashsb_networks_callback( $args ) {
1394
  <table id="mashsb_network_list" class="wp-list-table fixed posts">
1395
  <thead>
1396
  <tr>
1397
- <th scope="col" class='mashsb-network-col' style="padding: 2px 0px 10px 0px"><?php _e( 'Social Network', 'mashsb' ); ?></th>
1398
- <th scope="col" class='mashsb-status-col' style="padding: 2px 0px 10px 10px"><?php _e( 'Status', 'mashsb' ); ?></th>
1399
- <th scope="col" class='mashsb-label-col' style="padding: 2px 0px 10px 10px"><?php _e( 'Custom Label', 'mashsb' ); ?></th>
1400
  </tr>
1401
  </thead>
1402
  <?php
1403
  if( !empty( $args['options'] ) ) {
1404
  foreach ( $args['options'] as $key => $option ):
1405
- echo '<tr id="mashsb_list_' . $key . '" class="mashsb_list_item">';
1406
  if( isset( $mashsb_options[$args['id']][$key]['status'] ) ) {
1407
  $enabled = 1;
1408
  } else {
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
  }
@@ -1421,7 +1421,7 @@ function mashsb_networks_callback( $args ) {
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>'
@@ -1461,7 +1461,7 @@ function mashsb_upload_image_callback( $args ) {
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
 
@@ -1494,14 +1494,12 @@ function mashsb_posttypes_callback( $args ) {
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 ) . '/>&nbsp;';
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
  }
@@ -1636,7 +1634,7 @@ function mashsb_delete_cache_objects() {
1636
  function mashsb_cache_status() {
1637
  global $mashsb_options;
1638
  if( isset( $mashsb_options['disable_cache'] ) ) {
1639
- return ' <strong style="color:red;">' . __( 'Transient Cache disabled! Enable it for performance increase.', 'mashsb' ) . '</strong> ';
1640
  }
1641
  }
1642
 
@@ -1675,9 +1673,8 @@ function mashsb_is_deleted_cache() {
1675
  */
1676
 
1677
  function mashsb_log_permissions() {
1678
- global $mashsb_options;
1679
  if( !MASHSB()->logger->checkDir() ) {
1680
- return '<br><strong style="color:red;">' . __( 'Log file directory not writable! Set FTP permission to 755 or 777 for /wp-content/plugins/mashsharer/logs/', 'mashsb' ) . '</strong> <br> Read here more about <a href="http://codex.wordpress.org/Changing_File_Permissions" target="_blank">file permissions</a> ';
1681
  }
1682
  }
1683
 
832
  function mashsb_checkbox_callback( $args ) {
833
  global $mashsb_options;
834
 
835
+ $checked = isset( $mashsb_options[$args['id']] ) ? checked( 1, esc_attr($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']) . ']">'
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) . '" ' . esc_attr(checked( $option, $enabled, false )) . '/>&nbsp;';
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>';
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) . '" ' . esc_attr(checked( true, $checked, false )) . '/>&nbsp;';
896
+ echo '<label for="mashsb_settings[' . esc_attr($args['id']) . '][' . esc_attr($key) . ']">' . esc_attr($option) . '</label><br/>';
897
  endforeach;
898
 
899
  echo '<p class="description mashsb_hidden">' . esc_html($args['desc']) . '</p>';
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="' . esc_attr($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[' . esc_attr($args['id']) . ']"> ' . esc_html($args['desc']) . '</label>';
952
 
953
  echo $html;
954
  }
1013
  * @return void
1014
  */
1015
  function mashsb_missing_callback( $args ) {
1016
+ echo wp_kses_post(sprintf( __( 'The callback function used for the <strong>%s</strong> setting is missing.', 'mashsb' ), esc_attr($args['id'] )));
1017
  }
1018
 
1019
  /**
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="' . esc_attr($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>&nbsp;<input type="button" class="mashsb_settings_upload_button button-secondary" value="' . esc_html(__( '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;
1222
  $messages[] = sprintf(
1223
  __( 'Your license key expired on %s. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>.', 'mashsb' ),
1224
  date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1225
+ 'https://www.mashshare.net/checkout/?edd_license_key=' . esc_attr($value) . '&utm_campaign=notice&utm_source=license_tab&utm_medium=admin&utm_content=license-expired'
1226
  );
1227
 
1228
  $license_status = 'mashsb-license-' . $class . '-notice';
1337
  foreach( $messages as $message ) {
1338
 
1339
  $html .= '<div class="mashsb-license-data mashsb-license-' . esc_attr($class) . '">';
1340
+ $html .= '<p>' . wp_kses_post($message) . '</p>';
1341
  $html .= '</div>';
1342
 
1343
  }
1394
  <table id="mashsb_network_list" class="wp-list-table fixed posts">
1395
  <thead>
1396
  <tr>
1397
+ <th scope="col" class='mashsb-network-col' style="padding: 2px 0px 10px 0px"><?php esc_html_e( 'Social Network', 'mashsb' ); ?></th>
1398
+ <th scope="col" class='mashsb-status-col' style="padding: 2px 0px 10px 10px"><?php esc_html_e( 'Status', 'mashsb' ); ?></th>
1399
+ <th scope="col" class='mashsb-label-col' style="padding: 2px 0px 10px 10px"><?php esc_html_e( 'Custom Label', 'mashsb' ); ?></th>
1400
  </tr>
1401
  </thead>
1402
  <?php
1403
  if( !empty( $args['options'] ) ) {
1404
  foreach ( $args['options'] as $key => $option ):
1405
+ echo '<tr id="mashsb_list_' . esc_attr($key) . '" class="mashsb_list_item">';
1406
  if( isset( $mashsb_options[$args['id']][$key]['status'] ) ) {
1407
  $enabled = 1;
1408
  } else {
1409
  $enabled = NULL;
1410
  }
1411
  if( isset( $mashsb_options[$args['id']][$key]['name'] ) ) {
1412
+ $name = $mashsb_options[$args['id']][$key]['name'];
1413
  } else {
1414
  $name = NULL;
1415
  }
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" ' . esc_attr(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>'
1461
  global $mashsb_options;
1462
 
1463
  if( isset( $mashsb_options[$args['id']] ) )
1464
+ $value = $mashsb_options[$args['id']];
1465
  else
1466
  $value = isset( $args['std'] ) ? esc_attr($args['std']) : '';
1467
 
1494
  if( !empty( $posttypes ) ) {
1495
  foreach ( $posttypes as $key => $option ):
1496
  if( isset( $mashsb_options[$args['id']][$key] ) ) {
1497
+ $enabled = $option;
1498
  } else {
1499
  $enabled = NULL;
1500
  }
1501
+ 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_attr($option) . '" ' . esc_attr(checked( $option, $enabled, false )) . '/>&nbsp;';
1502
+ echo '<label for="mashsb_settings[' . esc_attr($args['id']) . '][' . esc_attr($key) . ']">' . esc_attr($option) . '</label><br/>';
 
 
1503
  endforeach;
1504
  echo '<p class="description mashsb_hidden">' . esc_attr($args['desc']) . '</p>';
1505
  }
1634
  function mashsb_cache_status() {
1635
  global $mashsb_options;
1636
  if( isset( $mashsb_options['disable_cache'] ) ) {
1637
+ return ' <strong style="color:red;">' . esc_html(__( 'Transient Cache disabled! Enable it for performance increase.', 'mashsb' )) . '</strong> ';
1638
  }
1639
  }
1640
 
1673
  */
1674
 
1675
  function mashsb_log_permissions() {
 
1676
  if( !MASHSB()->logger->checkDir() ) {
1677
+ return '<br><strong style="color:red;">' . esc_html(__( 'Log file directory not writable! Set FTP permission to 755 or 777 for /wp-content/plugins/mashsharer/logs/', 'mashsb' )) . '</strong> <br> Read here more about <a href="http://codex.wordpress.org/Changing_File_Permissions" target="_blank">file permissions</a> ';
1678
  }
1679
  }
1680
 
includes/admin/settings/user-profiles.php CHANGED
@@ -38,14 +38,30 @@ function mashsb_render_user_profiles( $user ) {
38
  /**
39
  * Save user profile
40
  *
41
- * @param type $user_id
42
  * @return boolean
43
  */
44
  function mashsb_save_user_profiles( $user_id ) {
45
 
46
- if( !current_user_can( 'edit_user', $user_id ) )
47
- return false;
48
 
49
- update_user_meta( $user_id, 'mashsb_twitter_handle', $_POST['mashsb_twitter_handle'] );
50
- update_user_meta( $user_id, 'mashsb_fb_author_url', $_POST['mashsb_fb_author_url'] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  }
38
  /**
39
  * Save user profile
40
  *
41
+ * @param int $user_id
42
  * @return boolean
43
  */
44
  function mashsb_save_user_profiles( $user_id ) {
45
 
46
+ $userId = intval($user_id);
 
47
 
48
+ if (!$userId){
49
+ return false;
50
+ }
51
+
52
+ if( !current_user_can( 'edit_user', $user_id ) ){
53
+ return false;
54
+ }
55
+
56
+ if (empty($_POST['mashsb_twitter_handle'])) {
57
+ return false;
58
+ }
59
+
60
+ update_user_meta( $user_id, 'mashsb_twitter_handle', sanitize_text_field(wp_unslash($_POST['mashsb_twitter_handle'])) );
61
+
62
+ if (empty($_POST['mashsb_fb_author_url'])) {
63
+ return false;
64
+ }
65
+
66
+ update_user_meta( $user_id, 'mashsb_fb_author_url', sanitize_text_field(wp_unslash($_POST['mashsb_fb_author_url'])) );
67
  }
includes/admin/tools.php CHANGED
@@ -40,14 +40,14 @@ function mashsb_tools_page() {
40
  ), $tab_url );
41
 
42
  $active = $active_tab == $tab_id ? ' nav-tab-active' : '';
43
- echo '<a href="' . esc_url( $tab_url ) . '" title="' . esc_attr( $tab_name ) . '" class="nav-tab' . $active . '">' . esc_html( $tab_name ) . '</a>';
44
 
45
  }
46
  ?>
47
  </h2>
48
  <div class="metabox-holder">
49
  <?php
50
- do_action( 'mashsb_tools_tab_' . $active_tab );
51
  ?>
52
  </div><!-- .metabox-holder -->
53
  </div><!-- .wrap -->
@@ -64,8 +64,8 @@ function mashsb_tools_page() {
64
  function mashsb_get_tools_tabs() {
65
 
66
  $tabs = array();
67
- $tabs['import_export'] = __( 'Import/Export', 'mashsb' );
68
- $tabs['system_info'] = __( 'System Info', 'mashsb' );
69
 
70
  return apply_filters( 'mashsb_tools_tabs', $tabs );
71
  }
@@ -87,32 +87,32 @@ function mashsb_tools_import_export_display() {
87
  do_action( 'mashsb_tools_import_export_before' );
88
  ?>
89
  <div class="postbox">
90
- <h3><span><?php _e( 'Export Settings', 'mashsb' ); ?></span></h3>
91
  <div class="inside">
92
- <p><?php _e( 'Export the Mashshare settings for this site as a .json file. This allows you to easily import the configuration into another site.', 'mashsb' ); ?></p>
93
 
94
- <form method="post" action="<?php echo admin_url( 'admin.php?page=mashsb-tools&tab=import_export' ); ?>">
95
  <p><input type="hidden" name="mashsb-action" value="export_settings" /></p>
96
  <p>
97
  <?php wp_nonce_field( 'mashsb_export_nonce', 'mashsb_export_nonce' ); ?>
98
- <?php submit_button( __( 'Export', 'mashsb' ), 'primary', 'submit', false ); ?>
99
  </p>
100
  </form>
101
  </div><!-- .inside -->
102
  </div><!-- .postbox -->
103
 
104
  <div class="postbox">
105
- <h3><span><?php _e( 'Import Settings', 'mashsb' ); ?></span></h3>
106
  <div class="inside">
107
- <p><?php _e( 'Import the Mashshare settings from a .json file. This file can be obtained by exporting the settings on another site using the form above.', 'mashsb' ); ?></p>
108
- <form method="post" enctype="multipart/form-data" action="<?php echo admin_url( 'admin.php?page=mashsb-tools&tab=import_export' ); ?>">
109
  <p>
110
  <input type="file" name="import_file"/>
111
  </p>
112
  <p>
113
  <input type="hidden" name="mashsb-action" value="import_settings" />
114
  <?php wp_nonce_field( 'mashsb_import_nonce', 'mashsb_import_nonce' ); ?>
115
- <?php submit_button( __( 'Import', 'mashsb' ), 'secondary', 'submit', false ); ?>
116
  </p>
117
  </form>
118
  </div><!-- .inside -->
@@ -148,12 +148,10 @@ function mashsb_tools_import_export_process_export() {
148
  if( ! current_user_can( 'manage_options' ) )
149
  return;
150
 
151
- $settings = array();
152
- $settings = get_option( 'mashsb_settings' );
153
 
154
  ignore_user_abort( true );
155
 
156
- //if ( ! mashsb_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) )
157
  if ( ! mashsb_is_func_disabled( 'set_time_limit' ) )
158
  set_time_limit( 0 );
159
 
@@ -215,13 +213,13 @@ function mashsb_tools_import_export_process_import() {
215
  return;
216
 
217
  if( mashsb_get_file_extension( $_FILES['import_file']['name'] ) != 'json' ) {
218
- wp_die( __( 'Please upload a valid .json file', 'mashsb' ) );
219
  }
220
 
221
  $import_file = $_FILES['import_file']['tmp_name'];
222
 
223
  if( empty( $import_file ) ) {
224
- wp_die( __( 'Please upload a file to import', 'mashsb' ) );
225
  }
226
 
227
  // Retrieve the settings from the file and convert the json object to an array
@@ -251,10 +249,6 @@ function mashsb_tools_sysinfo_display() {
251
  ?>
252
  <form action="<?php echo esc_url( admin_url( 'admin.php?page=mashsb-tools&tab=system_info' ) ); ?>" method="post" dir="ltr">
253
  <textarea readonly="readonly" onclick="this.focus(); this.select()" id="system-info-textarea" name="mashsb-sysinfo" title="To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac)."><?php echo mashsb_tools_sysinfo_get(); ?></textarea>
254
- <p class="submit">
255
- <input type="hidden" name="mashsb-action" value="download_sysinfo" />
256
- <?php submit_button( 'Download System Info File', 'primary', 'mashsb-download-sysinfo', false ); ?>
257
- </p>
258
  </form>
259
  <?php
260
  }
@@ -271,7 +265,7 @@ add_action( 'mashsb_tools_tab_system_info', 'mashsb_tools_sysinfo_display' );
271
  * @return string $return A string containing the info to output
272
  */
273
  function mashsb_tools_sysinfo_get() {
274
- global $wpdb, $mashsb_options;
275
 
276
  if( !class_exists( 'Browser' ) )
277
  require_once MASHSB_PLUGIN_DIR . 'includes/libraries/browser.php';
@@ -407,7 +401,7 @@ function mashsb_tools_sysinfo_get() {
407
  $return .= "\n" . '-- Webserver Configuration' . "\n\n";
408
  $return .= 'PHP Version: ' . PHP_VERSION . "\n";
409
  $return .= 'MySQL Version: ' . $wpdb->db_version() . "\n";
410
- $return .= 'Webserver Info: ' . $_SERVER['SERVER_SOFTWARE'] . "\n";
411
 
412
  $return = apply_filters( 'mashsb_sysinfo_after_webserver_config', $return );
413
 
@@ -436,25 +430,3 @@ function mashsb_tools_sysinfo_get() {
436
 
437
  return $return;
438
  }
439
-
440
-
441
- /**
442
- * Generates a System Info download file
443
- *
444
- * @since 2.0
445
- * @return void
446
- */
447
- function mashsb_tools_sysinfo_download() {
448
-
449
- if( ! current_user_can( 'update_plugins' ) )
450
- return;
451
-
452
- nocache_headers();
453
-
454
- header( 'Content-Type: text/plain' );
455
- header( 'Content-Disposition: attachment; filename="mashsb-system-info.txt"' );
456
-
457
- echo wp_strip_all_tags( $_POST['mashsb-sysinfo'] );
458
- wp_die();
459
- }
460
- add_action( 'mashsb_download_sysinfo', 'mashsb_tools_sysinfo_download' );
40
  ), $tab_url );
41
 
42
  $active = $active_tab == $tab_id ? ' nav-tab-active' : '';
43
+ echo '<a href="' . esc_url( $tab_url ) . '" title="' . esc_attr( $tab_name ) . '" class="nav-tab' . esc_attr($active) . '">' . wp_kses_post( $tab_name ) . '</a>';
44
 
45
  }
46
  ?>
47
  </h2>
48
  <div class="metabox-holder">
49
  <?php
50
+ do_action( 'mashsb_tools_tab_' . esc_attr($active_tab) );
51
  ?>
52
  </div><!-- .metabox-holder -->
53
  </div><!-- .wrap -->
64
  function mashsb_get_tools_tabs() {
65
 
66
  $tabs = array();
67
+ $tabs['import_export'] = esc_html__( 'Import/Export', 'mashsb' );
68
+ $tabs['system_info'] = esc_html__( 'System Info', 'mashsb' );
69
 
70
  return apply_filters( 'mashsb_tools_tabs', $tabs );
71
  }
87
  do_action( 'mashsb_tools_import_export_before' );
88
  ?>
89
  <div class="postbox">
90
+ <h3><span><?php esc_html_e( 'Export Settings', 'mashsb' ); ?></span></h3>
91
  <div class="inside">
92
+ <p><?php esc_html_e( 'Export the MashShare settings for this site as a .json file. This allows you to easily import the configuration into another site.', 'mashsb' ); ?></p>
93
 
94
+ <form method="post" action="<?php echo esc_url(admin_url( 'admin.php?page=mashsb-tools&tab=import_export' )); ?>">
95
  <p><input type="hidden" name="mashsb-action" value="export_settings" /></p>
96
  <p>
97
  <?php wp_nonce_field( 'mashsb_export_nonce', 'mashsb_export_nonce' ); ?>
98
+ <?php echo submit_button( esc_html__( 'Export', 'mashsb' ), 'primary', 'submit', false ); ?>
99
  </p>
100
  </form>
101
  </div><!-- .inside -->
102
  </div><!-- .postbox -->
103
 
104
  <div class="postbox">
105
+ <h3><span><?php esc_html_e( 'Import Settings', 'mashsb' ); ?></span></h3>
106
  <div class="inside">
107
+ <p><?php esc_html_e( 'Import the MashShare settings from a .json file. This file can be obtained by exporting the settings on another site using the form above.', 'mashsb' ); ?></p>
108
+ <form method="post" enctype="multipart/form-data" action="<?php echo esc_url(admin_url( 'admin.php?page=mashsb-tools&tab=import_export' )); ?>">
109
  <p>
110
  <input type="file" name="import_file"/>
111
  </p>
112
  <p>
113
  <input type="hidden" name="mashsb-action" value="import_settings" />
114
  <?php wp_nonce_field( 'mashsb_import_nonce', 'mashsb_import_nonce' ); ?>
115
+ <?php echo submit_button( esc_html__( 'Import', 'mashsb' ), 'secondary', 'submit', false ); ?>
116
  </p>
117
  </form>
118
  </div><!-- .inside -->
148
  if( ! current_user_can( 'manage_options' ) )
149
  return;
150
 
151
+ $settings = get_option( 'mashsb_settings', array() );
 
152
 
153
  ignore_user_abort( true );
154
 
 
155
  if ( ! mashsb_is_func_disabled( 'set_time_limit' ) )
156
  set_time_limit( 0 );
157
 
213
  return;
214
 
215
  if( mashsb_get_file_extension( $_FILES['import_file']['name'] ) != 'json' ) {
216
+ wp_die( esc_html__( 'Please upload a valid .json file', 'mashsb' ) );
217
  }
218
 
219
  $import_file = $_FILES['import_file']['tmp_name'];
220
 
221
  if( empty( $import_file ) ) {
222
+ wp_die( esc_html__( 'Please upload a file to import', 'mashsb' ) );
223
  }
224
 
225
  // Retrieve the settings from the file and convert the json object to an array
249
  ?>
250
  <form action="<?php echo esc_url( admin_url( 'admin.php?page=mashsb-tools&tab=system_info' ) ); ?>" method="post" dir="ltr">
251
  <textarea readonly="readonly" onclick="this.focus(); this.select()" id="system-info-textarea" name="mashsb-sysinfo" title="To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac)."><?php echo mashsb_tools_sysinfo_get(); ?></textarea>
 
 
 
 
252
  </form>
253
  <?php
254
  }
265
  * @return string $return A string containing the info to output
266
  */
267
  function mashsb_tools_sysinfo_get() {
268
+ global $wpdb;
269
 
270
  if( !class_exists( 'Browser' ) )
271
  require_once MASHSB_PLUGIN_DIR . 'includes/libraries/browser.php';
401
  $return .= "\n" . '-- Webserver Configuration' . "\n\n";
402
  $return .= 'PHP Version: ' . PHP_VERSION . "\n";
403
  $return .= 'MySQL Version: ' . $wpdb->db_version() . "\n";
404
+ $return .= 'Webserver Info: ' . esc_html($_SERVER['SERVER_SOFTWARE']) . "\n";
405
 
406
  $return = apply_filters( 'mashsb_sysinfo_after_webserver_config', $return );
407
 
430
 
431
  return $return;
432
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/admin/tracking.php CHANGED
@@ -7,18 +7,20 @@
7
  * @copyright Copyright (c) 2015, Rene Hermenau
8
  * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
  * @since 2.5.1
10
- */
11
 
12
  // Exit if accessed directly
13
- if ( !defined( 'ABSPATH' ) ) exit;
 
 
14
 
15
 
16
  /**
17
  * Usage tracking
18
  *
19
  * @access public
20
- * @since 2.5.1
21
  * @return void
 
22
  */
23
  class MASHSB_Tracking {
24
 
@@ -37,7 +39,7 @@ class MASHSB_Tracking {
37
  public function __construct() {
38
 
39
  //$this->schedule_send();
40
- add_action( 'init', array( $this, 'schedule_send' ) );
41
 
42
  add_action( 'mashsb_settings_general_sanitize', array( $this, 'check_for_settings_optin' ) );
43
  add_action( 'mashsb_opt_into_tracking', array( $this, 'check_for_optin' ) );
@@ -54,6 +56,7 @@ class MASHSB_Tracking {
54
  */
55
  private function tracking_allowed() {
56
  $allow_tracking = mashsb_get_option( 'allow_tracking', false );
 
57
  return $allow_tracking;
58
  }
59
 
@@ -70,13 +73,13 @@ class MASHSB_Tracking {
70
  // Retrieve current theme info
71
  $theme_data = wp_get_theme();
72
  $theme = $theme_data->Name . ' ' . $theme_data->Version;
73
-
74
- $data['url'] = home_url();
75
- $data['theme'] = $theme;
76
- $data['email'] = get_bloginfo( 'admin_email' );
77
 
78
  // Retrieve current plugin information
79
- if( ! function_exists( 'get_plugins' ) ) {
80
  include ABSPATH . '/wp-admin/includes/plugin.php';
81
  }
82
 
@@ -92,7 +95,7 @@ class MASHSB_Tracking {
92
 
93
  $data['active_plugins'] = $active_plugins;
94
  $data['inactive_plugins'] = $plugins;
95
- $data['post_count'] = wp_count_posts( 'post' )->publish;
96
 
97
  $this->data = $data;
98
  }
@@ -105,23 +108,25 @@ class MASHSB_Tracking {
105
  */
106
  public function send_checkin( $override = false ) {
107
 
108
- if( ! $this->tracking_allowed() && ! $override )
109
  return;
 
110
 
111
  // Send a maximum of once per week
112
  $last_send = $this->get_last_send();
113
- if( $last_send && $last_send > strtotime( '-1 week' ) )
114
  return;
 
115
 
116
  $this->setup_data();
117
-
118
-
119
- $url = 'https://www.mashshare.net/?mashsb_action=checkin';
120
- if (MASHSB_DEBUG){
121
- $url = 'http://src.wordpress-develop.dev/?mashsb_action=checkin'; // only for debugging
122
- }
123
-
124
- $request = wp_remote_post( $url, array(
125
  'method' => 'POST',
126
  'timeout' => 20,
127
  'redirection' => 5,
@@ -132,12 +137,11 @@ class MASHSB_Tracking {
132
  ) );
133
 
134
 
135
-
136
- if (!MASHSB_DEBUG){
137
- update_option( 'mashsb_tracking_last_send', time() );
138
- }
139
-
140
- $data = $this->data;
141
  }
142
 
143
  /**
@@ -151,7 +155,7 @@ class MASHSB_Tracking {
151
  public function check_for_settings_optin( $input ) {
152
  // Send an intial check in on settings save
153
 
154
- if( isset( $input['allow_tracking'] ) ) {
155
  $this->send_checkin( true );
156
  }
157
 
@@ -171,13 +175,15 @@ class MASHSB_Tracking {
171
 
172
  $mashsb_options['allow_tracking'] = '1';
173
 
174
- if (!MASHSB_DEBUG)
175
- update_option( 'mashsb_settings', $mashsb_options );
 
176
 
177
  $this->send_checkin( true );
178
-
179
- if (!MASHSB_DEBUG)
180
- update_option( 'mashsb_tracking_notice', '1' );
 
181
 
182
  }
183
 
@@ -190,15 +196,18 @@ class MASHSB_Tracking {
190
  public function check_for_optout( $data ) {
191
 
192
  global $mashsb_options;
193
- if( isset( $mashsb_options['allow_tracking'] ) ) {
194
  unset( $mashsb_options['allow_tracking'] );
195
- if (!MASHSB_DEBUG)
196
- update_option( 'mashsb_settings', $mashsb_options );
 
 
 
 
197
  }
198
- if (!MASHSB_DEBUG)
199
- update_option( 'mashsb_tracking_notice', '1' );
200
 
201
- wp_redirect( remove_query_arg( 'mashsb_action' ) ); exit;
 
202
 
203
  }
204
 
@@ -230,45 +239,57 @@ class MASHSB_Tracking {
230
  * @return void
231
  */
232
  public function admin_notice() {
233
-
234
- if (!current_user_can('update_plugins'))
235
- return;
 
236
 
237
  $hide_notice = get_option( 'mashsb_tracking_notice' );
238
 
239
- if( $hide_notice ) {
240
  return;
241
  }
242
 
243
- if( mashsb_get_option( 'allow_tracking', false ) ) {
244
  return;
245
  }
246
 
247
- if( ! current_user_can( 'manage_options' ) ) {
248
  return;
249
  }
250
 
251
- if(
252
- stristr( network_site_url( '/' ), '_dev' ) !== false ||
253
  stristr( network_site_url( '/' ), 'localhost' ) !== false ||
254
- stristr( network_site_url( '/' ), ':8888' ) !== false // This is common with MAMP on OS X
255
  ) {
256
- if (!MASHSB_DEBUG)
257
- update_option( 'mashsb_tracking_notice', '1' );
 
258
  } else {
259
  $optin_url = add_query_arg( 'mashsb_action', 'opt_into_tracking' );
260
  $optout_url = add_query_arg( 'mashsb_action', 'opt_out_of_tracking' );
261
 
262
  //$source = substr( md5( get_bloginfo( 'name' ) ), 0, 10 );
263
- $source = substr( md5( get_bloginfo( 'admin_email' ) ), 0, 10 );
264
  $extensions_url = 'https://www.mashshare.net/add-ons/?utm_source=' . $source . '&utm_medium=admin&utm_term=notice&utm_campaign=MASHSBUsageTracking';
265
  echo '<div class="updated"><p>';
266
- echo sprintf( __( 'Allow Mashshare to track plugin usage? Opt-in to tracking and our newsletter and immediately be emailed a <strong>20%% discount to the Mashshare shop</strong>, valid towards the <a href="%s" target="_blank">purchase of Add-Ons</a>. No sensitive data is tracked.', 'mashsb' ), $extensions_url );
267
- echo '&nbsp;<a href="' . esc_url( $optin_url ) . '" class="button-secondary">' . __( 'Allow', 'mashsb' ) . '</a>';
268
- echo '&nbsp;<a href="' . esc_url( $optout_url ) . '" class="button-secondary">' . __( 'Do not allow', 'mashsb' ) . '</a>';
 
 
 
 
 
 
 
 
 
 
 
269
  echo '</p></div>';
270
  }
271
  }
272
 
273
- }
274
- //$mashsb_tracking = new MASHSB_Tracking;
7
  * @copyright Copyright (c) 2015, Rene Hermenau
8
  * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
  * @since 2.5.1
10
+ */
11
 
12
  // Exit if accessed directly
13
+ if ( ! defined( 'ABSPATH' ) ) {
14
+ exit;
15
+ }
16
 
17
 
18
  /**
19
  * Usage tracking
20
  *
21
  * @access public
 
22
  * @return void
23
+ * @since 2.5.1
24
  */
25
  class MASHSB_Tracking {
26
 
39
  public function __construct() {
40
 
41
  //$this->schedule_send();
42
+ add_action( 'init', array( $this, 'schedule_send' ) );
43
 
44
  add_action( 'mashsb_settings_general_sanitize', array( $this, 'check_for_settings_optin' ) );
45
  add_action( 'mashsb_opt_into_tracking', array( $this, 'check_for_optin' ) );
56
  */
57
  private function tracking_allowed() {
58
  $allow_tracking = mashsb_get_option( 'allow_tracking', false );
59
+
60
  return $allow_tracking;
61
  }
62
 
73
  // Retrieve current theme info
74
  $theme_data = wp_get_theme();
75
  $theme = $theme_data->Name . ' ' . $theme_data->Version;
76
+
77
+ $data['url'] = home_url();
78
+ $data['theme'] = $theme;
79
+ $data['email'] = get_bloginfo( 'admin_email' );
80
 
81
  // Retrieve current plugin information
82
+ if ( ! function_exists( 'get_plugins' ) ) {
83
  include ABSPATH . '/wp-admin/includes/plugin.php';
84
  }
85
 
95
 
96
  $data['active_plugins'] = $active_plugins;
97
  $data['inactive_plugins'] = $plugins;
98
+ $data['post_count'] = wp_count_posts( 'post' )->publish;
99
 
100
  $this->data = $data;
101
  }
108
  */
109
  public function send_checkin( $override = false ) {
110
 
111
+ if ( ! $this->tracking_allowed() && ! $override ) {
112
  return;
113
+ }
114
 
115
  // Send a maximum of once per week
116
  $last_send = $this->get_last_send();
117
+ if ( $last_send && $last_send > strtotime( '-1 week' ) ) {
118
  return;
119
+ }
120
 
121
  $this->setup_data();
122
+
123
+
124
+ $url = 'https://www.mashshare.net/?mashsb_action=checkin';
125
+ if ( MASHSB_DEBUG ) {
126
+ $url = 'http://src.wordpress-develop.dev/?mashsb_action=checkin'; // only for debugging
127
+ }
128
+
129
+ $request = wp_remote_post( $url, array(
130
  'method' => 'POST',
131
  'timeout' => 20,
132
  'redirection' => 5,
137
  ) );
138
 
139
 
140
+ if ( ! MASHSB_DEBUG ) {
141
+ update_option( 'mashsb_tracking_last_send', time() );
142
+ }
143
+
144
+ $data = $this->data;
 
145
  }
146
 
147
  /**
155
  public function check_for_settings_optin( $input ) {
156
  // Send an intial check in on settings save
157
 
158
+ if ( isset( $input['allow_tracking'] ) ) {
159
  $this->send_checkin( true );
160
  }
161
 
175
 
176
  $mashsb_options['allow_tracking'] = '1';
177
 
178
+ if ( ! MASHSB_DEBUG ) {
179
+ update_option( 'mashsb_settings', $mashsb_options );
180
+ }
181
 
182
  $this->send_checkin( true );
183
+
184
+ if ( ! MASHSB_DEBUG ) {
185
+ update_option( 'mashsb_tracking_notice', '1' );
186
+ }
187
 
188
  }
189
 
196
  public function check_for_optout( $data ) {
197
 
198
  global $mashsb_options;
199
+ if ( isset( $mashsb_options['allow_tracking'] ) ) {
200
  unset( $mashsb_options['allow_tracking'] );
201
+ if ( ! MASHSB_DEBUG ) {
202
+ update_option( 'mashsb_settings', $mashsb_options );
203
+ }
204
+ }
205
+ if ( ! MASHSB_DEBUG ) {
206
+ update_option( 'mashsb_tracking_notice', '1' );
207
  }
 
 
208
 
209
+ wp_safe_redirect( remove_query_arg( 'mashsb_action' ) );
210
+ exit;
211
 
212
  }
213
 
239
  * @return void
240
  */
241
  public function admin_notice() {
242
+
243
+ if ( ! current_user_can( 'update_plugins' ) ) {
244
+ return;
245
+ }
246
 
247
  $hide_notice = get_option( 'mashsb_tracking_notice' );
248
 
249
+ if ( $hide_notice ) {
250
  return;
251
  }
252
 
253
+ if ( mashsb_get_option( 'allow_tracking', false ) ) {
254
  return;
255
  }
256
 
257
+ if ( ! current_user_can( 'manage_options' ) ) {
258
  return;
259
  }
260
 
261
+ if (
262
+ stristr( network_site_url( '/' ), '_dev' ) !== false ||
263
  stristr( network_site_url( '/' ), 'localhost' ) !== false ||
264
+ stristr( network_site_url( '/' ), ':8888' ) !== false // This is common with MAMP on OS X
265
  ) {
266
+ if ( ! MASHSB_DEBUG ) {
267
+ update_option( 'mashsb_tracking_notice', '1' );
268
+ }
269
  } else {
270
  $optin_url = add_query_arg( 'mashsb_action', 'opt_into_tracking' );
271
  $optout_url = add_query_arg( 'mashsb_action', 'opt_out_of_tracking' );
272
 
273
  //$source = substr( md5( get_bloginfo( 'name' ) ), 0, 10 );
274
+ $source = substr( md5( get_bloginfo( 'admin_email' ) ), 0, 10 );
275
  $extensions_url = 'https://www.mashshare.net/add-ons/?utm_source=' . $source . '&utm_medium=admin&utm_term=notice&utm_campaign=MASHSBUsageTracking';
276
  echo '<div class="updated"><p>';
277
+
278
+ $allowedHtml = array(
279
+ 'a' => array(
280
+ 'class' => array(),
281
+ 'href' => array(),
282
+ 'rel' => array(),
283
+ 'title' => array(),
284
+ 'target' => array(),
285
+ )
286
+ );
287
+
288
+ echo wp_kses(sprintf( __( 'Allow Mashshare to track plugin usage? Opt-in to tracking and our newsletter and immediately be emailed a <strong>20%% discount to the Mashshare shop</strong>, valid towards the <a href="%s" target="_blank">purchase of Add-Ons</a>. No sensitive data is tracked.', 'mashsb' ), $extensions_url ), $allowedHtml);
289
+ echo '&nbsp;<a href="' . esc_url( $optin_url ) . '" class="button-secondary">' . esc_html_e( 'Allow', 'mashsb' ) . '</a>';
290
+ echo '&nbsp;<a href="' . esc_url( $optout_url ) . '" class="button-secondary">' . esc_html_e( 'Do not allow', 'mashsb' ) . '</a>';
291
  echo '</p></div>';
292
  }
293
  }
294
 
295
+ }
 
includes/admin/views/deactivate-feedback.php CHANGED
@@ -1,15 +1,15 @@
1
  <?php
2
  $reasons = array(
3
- 1 => '<li><label><input type="radio" name="mashsb_disable_reason" value="temporary"/>' . __('It is only temporary', 'mashsb') . '</label></li>',
4
- 2 => '<li><label><input type="radio" name="mashsb_disable_reason" value="stopped showing social buttons"/>' . __('I stopped showing Social Buttons on my site', 'mashsb') . '</label></li>',
5
- 3 => '<li><label><input type="radio" name="mashsb_disable_reason" value="missing feature"/>' . __('I miss a feature', 'mashsb') . '</label></li>
6
  <li><input type="text" name="mashsb_disable_text[]" value="" placeholder="Please describe the feature"/></li>',
7
- 4 => '<li><label><input type="radio" name="mashsb_disable_reason" value="technical issue"/>' . __('Technical Issue', 'mashsb') . '</label></li>
8
  <li><textarea name="mashsb_disable_text[]" placeholder="' . __('Can we help? Please describe your problem', 'mashsb') . '"></textarea></li>',
9
- 5 => '<li><label><input type="radio" name="mashsb_disable_reason" value="other plugin"/>' . __('I switched to another plugin', 'mashsb') . '</label></li>
10
  <li><input type="text" name="mashsb_disable_text[]" value="" placeholder="Name of the plugin"/></li>',
11
- 6 => '<li><label><input type="radio" name="mashsb_disable_reason" value="other"/>' . __('Other reason', 'mashsb') . '</label></li>
12
- <li><textarea name="mashsb_disable_text[]" placeholder="' . __('Please specify, if possible', 'mashsb') . '"></textarea></li>',
13
  );
14
  shuffle($reasons);
15
  ?>
@@ -18,7 +18,7 @@ shuffle($reasons);
18
  <div id="mashsb-feedback-overlay" style="display: none;">
19
  <div id="mashsb-feedback-content">
20
  <form action="" method="post">
21
- <h3><strong><?php _e('If you have a moment, please let us know why you are deactivating:', 'mashsb'); ?></strong></h3>
22
  <ul>
23
  <?php
24
  foreach ($reasons as $reason){
@@ -27,11 +27,11 @@ shuffle($reasons);
27
  ?>
28
  </ul>
29
  <?php if ($email) : ?>
30
- <input type="hidden" name="mashsb_disable_from" value="<?php echo $email; ?>"/>
31
  <?php endif; ?>
32
- <input id="mashsb-feedback-submit" class="button button-primary" type="submit" name="mashsb_disable_submit" value="<?php _e('Submit & Deactivate', 'mashsb'); ?>"/>
33
- <a class="button"><?php _e('Only Deactivate', 'mashsb'); ?></a>
34
- <a class="mashsb-feedback-not-deactivate" href="#"><?php _e('Don\'t deactivate', 'mashsb'); ?></a>
35
  </form>
36
  </div>
37
  </div>
1
  <?php
2
  $reasons = array(
3
+ 1 => '<li><label><input type="radio" name="mashsb_disable_reason" value="temporary"/>' . esc_html__('It is only temporary', 'mashsb') . '</label></li>',
4
+ 2 => '<li><label><input type="radio" name="mashsb_disable_reason" value="stopped showing social buttons"/>' . esc_html__('I stopped showing Social Buttons on my site', 'mashsb') . '</label></li>',
5
+ 3 => '<li><label><input type="radio" name="mashsb_disable_reason" value="missing feature"/>' . esc_html__('I miss a feature', 'mashsb') . '</label></li>
6
  <li><input type="text" name="mashsb_disable_text[]" value="" placeholder="Please describe the feature"/></li>',
7
+ 4 => '<li><label><input type="radio" name="mashsb_disable_reason" value="technical issue"/>' . esc_html__('Technical Issue', 'mashsb') . '</label></li>
8
  <li><textarea name="mashsb_disable_text[]" placeholder="' . __('Can we help? Please describe your problem', 'mashsb') . '"></textarea></li>',
9
+ 5 => '<li><label><input type="radio" name="mashsb_disable_reason" value="other plugin"/>' . esc_html__('I switched to another plugin', 'mashsb') . '</label></li>
10
  <li><input type="text" name="mashsb_disable_text[]" value="" placeholder="Name of the plugin"/></li>',
11
+ 6 => '<li><label><input type="radio" name="mashsb_disable_reason" value="other"/>' . esc_html__('Other reason', 'mashsb') . '</label></li>
12
+ <li><textarea name="mashsb_disable_text[]" placeholder="' . esc_html__('Please specify, if possible', 'mashsb') . '"></textarea></li>',
13
  );
14
  shuffle($reasons);
15
  ?>
18
  <div id="mashsb-feedback-overlay" style="display: none;">
19
  <div id="mashsb-feedback-content">
20
  <form action="" method="post">
21
+ <h3><strong><?php esc_html_e('If you have a moment, please let us know why you are deactivating:', 'mashsb'); ?></strong></h3>
22
  <ul>
23
  <?php
24
  foreach ($reasons as $reason){
27
  ?>
28
  </ul>
29
  <?php if ($email) : ?>
30
+ <input type="hidden" name="mashsb_disable_from" value="<?php echo esc_html($email); ?>"/>
31
  <?php endif; ?>
32
+ <input id="mashsb-feedback-submit" class="button button-primary" type="submit" name="mashsb_disable_submit" value="<?php esc_html_e('Submit & Deactivate', 'mashsb'); ?>"/>
33
+ <a class="button"><?php esc_html_e('Only Deactivate', 'mashsb'); ?></a>
34
+ <a class="mashsb-feedback-not-deactivate" href="#"><?php esc_html_e('Don\'t deactivate', 'mashsb'); ?></a>
35
  </form>
36
  </div>
37
  </div>
includes/admin/welcome.php CHANGED
@@ -55,17 +55,6 @@ class MASHSB_Welcome {
55
  add_submenu_page(
56
  'mashsb-settings', __( 'Welcome to MashShare', 'mashsb' ), __( 'Welcome to MashShare', 'mashsb' ), $this->minimum_capability, 'mashsb-about', array($this, 'about_screen')
57
  );
58
-
59
- // Changelog Page
60
- $mashsb_about = add_submenu_page(
61
- 'mashsb-settings',__( 'MashShare Changelog', 'mashsb' ), __( 'MashShare Changelog', 'mashsb' ), $this->minimum_capability, 'mashsb-changelog', array($this, 'changelog_screen')
62
- );
63
-
64
-
65
- // Credits Page
66
- $mashsb_credits = add_submenu_page(
67
- 'mashsb-settings',__( 'The people that build MashShare', 'mashsb' ), __( 'The people that build MashShare', 'mashsb' ), $this->minimum_capability, 'mashsb-credits', array($this, 'credits_screen')
68
- );
69
  }
70
 
71
  /**
@@ -77,10 +66,8 @@ class MASHSB_Welcome {
77
  */
78
  public function admin_head() {
79
  remove_submenu_page( 'mashsb-settings', 'mashsb-about' );
80
- remove_submenu_page( 'mashsb-settings', 'mashsb-changelog' );
81
  remove_submenu_page( 'mashsb-settings', 'mashsb-getting-started' );
82
- remove_submenu_page( 'mashsb-settings', 'mashsb-credits' );
83
-
84
  if ( !mashsb_is_admin_page() ){
85
  return false;
86
  }
@@ -122,7 +109,6 @@ class MASHSB_Welcome {
122
  * @return void
123
  */
124
  public function getting_started_screen() {
125
- global $mashsb_redirect;
126
  ?>
127
  <div class="wrap mashsb-about-wrap">
128
  <?php
@@ -131,21 +117,21 @@ class MASHSB_Welcome {
131
  $this->tabs();
132
  ?>
133
  <?php if (isset($_GET['redirect'])) {?>
134
- <p class="about-description mashsb-notice" style="background-color:#00abed;color:white;padding:20px;margin-top:20px;border:3px solid white;"><?php _e( '<strong>Facebook</strong> and <strong>Twitter Share Buttons</strong> have been enabled on all your posts! <br>Use the instructions on this page to customize MashShare.<br><br></strong>MashShare uses sharedcount.com to collect shares.
135
- <br>Register for sharedcount.com on <a href="'.admin_url().'admin.php?page=mashsb-settings" style="color:white;">MashShare > Settings > Sharecount</a>', 'mashsb' ); ?></p>
136
  <?php } ?>
137
  <div class="changelog clear">
138
- <h1><?php _e( 'Create Your First Social Sharing Button', 'mashsb' ); ?></h1>
139
  <div class="mash-feature-section">
140
  <div class="mash-feature-section-media">
141
- <img style="display:none;" src="<?php echo MASHSB_PLUGIN_URL . 'assets/images/screenshots/social-networks-settings.png'; ?>" class="mashsb-welcome-screenshots"/>
142
  </div>
143
  <div class="mash-feature-section-content">
144
- <h4>Step 1: Go to <a href="<?php echo admin_url( 'admin.php?page=mashsb-settings#mashsb_settingsservices_header' ) ?>" target="blank"><?php _e( 'Settings &rarr; Networks', 'mashsb' ); ?></a></h4>
145
- <p><?php _e( 'The Social Network menu is your general access point for activating the desired share buttons and for customizing the share button label', 'mashsb' ); ?></p>
146
- <h4>Step 2: Go to <a href="<?php echo admin_url( 'admin.php?page=mashsb-settings#mashsb_settingslocation_header' ) ?>" target="blank"><?php _e( 'Settings &rarr; Position', 'mashsb' ); ?></a></h4>
147
- <p><?php _e( 'Select the location and exact position of the share buttons within your content', 'mashsb' ); ?></p>
148
- <h4><?php _e('You are done! Easy, isn\'t it?', 'mashsb'); ?></h4>
149
  <p></p>
150
 
151
  </div>
@@ -153,54 +139,62 @@ class MASHSB_Welcome {
153
  </div>
154
 
155
  <div class="changelog clear">
156
- <h1><?php _e( 'Create Most Shared Posts Widget', 'mashsb' ); ?></h1>
157
  <div class="mash-feature-section">
158
  <div class="mash-feature-section-content">
159
- <h4>Go to <a href="<?php echo admin_url( 'widgets.php' ) ?>" target="blank"><?php _e( 'Appearance &rarr; Widgets', 'mashsb' ); ?></a></h4>
160
-
161
- <p><?php _e( 'Drag and drop the widget labeled "<i>MashShare - Most Shared Posts</i>" into the desired widget location and save it.', 'mashsb' ); ?></p>
162
- <img style="display:none;" src="<?php echo MASHSB_PLUGIN_URL . 'assets/images/screenshots/most-shared-posts.png'; ?>"/>
163
-
164
  </div>
165
  </div>
166
  </div>
167
 
168
  <div class="changelog clear">
169
- <h1><?php _e( 'Content Shortcodes', 'mashsb' ); ?></h1>
170
  <div class="mash-feature-section">
171
  <div class="mash-feature-section-media">
172
- <img style="display:none;" src="<?php echo MASHSB_PLUGIN_URL . 'assets/images/screenshots/shortcodes.png'; ?>"/>
173
  </div>
174
  <div class="mash-feature-section-content">
175
  <p>
176
- <?php _e( 'Add Share buttons manually with using shortcode <i style="font-weight:bold;">[mashshare]</i>.', 'mashsb' ); ?>
177
  </p>
178
- <?php _e( 'Paste the shortcode in content of your posts or pages with the post editor at the place you want the share buttons appear', 'mashsb' ); ?>
179
  <p>
180
- <?php echo sprintf(__( 'There are several parameters you can use for the shortcode. Get a <a href="%s" target="blank">list of all available shortcode parameters</a>', 'mashsb'), 'http://docs.mashshare.net/article/67-shortcodes'); ?><br>
 
 
 
 
 
 
 
 
 
 
181
  </p>
182
  </div>
183
  </div>
184
  </div>
185
  <div class="changelog clear">
186
- <h1><?php _e( 'PHP Template Shortcode', 'mashsb' ); ?></h1>
187
  <div class="mash-feature-section">
188
  <div class="mash-feature-section-media">
189
  </div>
190
  <div class="mash-feature-section-content">
191
  <p>
192
- <?php _e( 'Add MashShare directly into your theme template files with using the PHP code<br> <pre><i style="font-weight:bold;">&lt;?php do_shortcode(\'[mashshare]\'); ?&gt;</i></pre>', 'mashsb' ); ?>
193
  </p>
194
  </div>
195
  </div>
196
  </div>
197
 
198
  <div class="changelog clear">
199
- <h1><?php _e( 'Need Help?', 'mashsb' ); ?></h1>
200
  <div class="mash-feature-section two-col">
201
  <div>
202
- <h4><?php _e( 'Great Support', 'mashsb' ); ?></h4>
203
- <p><?php _e( 'We do our best to provide the best support we can. If you encounter a problem or have a question, simply <a href="https://www.mashshare.net/contact-developer/" target="blank">open a ticket</a>.', 'mashsb' ); ?></p>
204
  <ul id="mash-social-admin-head">
205
  <?php echo mashsb_share_buttons(); ?>
206
  </ul>
@@ -223,10 +217,9 @@ class MASHSB_Welcome {
223
  list( $display_version ) = explode( '-', MASHSB_VERSION );
224
  ?>
225
  <div id="mashsb-header">
226
- <!--<img class="mashsb-badge" src="<?php //echo . 'assets/images/mashsb-logo.svg'; ?>" alt="<?php //_e( 'MashShare', 'mashsb' ); ?>" / >//-->
227
- <h1><?php printf( __( 'Welcome to MashShare %s', 'mashsb' ), $display_version ); ?></h1>
228
  <h1 class="about-text">
229
- <?php _e( 'Congrats for Choosing MashShare<br>MashShare has been Activated And is Ready to Increase Your Social Media Traffic!', 'mashsb' ); ?>
230
  </h1>
231
  </div>
232
  <?php
@@ -250,67 +243,72 @@ class MASHSB_Welcome {
250
  <div class="changelog">
251
  <div class="mash-feature-section">
252
  <div class="mash-feature-section-content">
253
- <!--
254
- <h1><?php //_e( 'Use Facebook Connect to Skyrocket Share Count', 'mashsb' ); ?></h1>
255
- <p><?php //_e( 'MashShare is the first Social Media plugin that uses the brandnew Facebook Connect Integration to bypass the regular facebook API limit which has been introduced recently. <p>It allows you up to 200 API calls per hour to the facebook server. This is more than enough for even huge traffic sites as MashShare is caching all share counts internally. <p>We are convinced that other social media plugins are going to copy our solution soon... and we will be proud of it;) <p> Your site becomes immediately better than the rest because you are the one whose website is running with full social sharing power. Other sites share count still stucks and are delayed and they do not know it;)', 'mashsb' ); ?></p>
256
- <img src="<?php //echo MASHSB_PLUGIN_URL . 'assets/images/screenshots/oauth.png'; ?>"/>
257
- //-->
258
  <p></p>
259
- <h1><?php _e( 'A New Beautiful Sharing Widget', 'mashsb' ); ?></h1>
260
- <p><?php _e( 'We have heard your wishes so the new widget contains the long requested post thumbnail and a beautiful css which gives your side bar sharing super power.', 'mashsb' ); ?></p>
261
- <img src="<?php echo MASHSB_PLUGIN_URL . 'assets/images/screenshots/widget.png'; ?>"/>
262
  <p></p>
263
- <h1><?php _e( 'Better Customization Options', 'mashsb' ); ?></h1>
264
- <p><?php _e( 'Select from 3 ready to use sizes to make sure that MashShare is looking great on your site. No matter if you prefer small, medium or large buttons.', 'mashsb' ); ?></p>
265
- <img src="<?php echo MASHSB_PLUGIN_URL . 'assets/images/screenshots/different_sizes.gif'; ?>"/>
266
  <p></p>
267
- <h1><?php _e( 'Asyncronous Share Count Aggregation', 'mashsb' ); ?></h1>
268
- <p><?php _e( 'With MashShare you get our biggest performance update. Use the new <i>Async Cache Refresh</i> method and your share counts will be aggregated only after page loading and never while page loads. This is a huge performance update.', 'mashsb' ); ?></p>
269
- <img src="<?php echo MASHSB_PLUGIN_URL . 'assets/images/screenshots/async_cache_refresh.png'; ?>"/>
270
  <p></p>
271
- <h1><?php _e( 'Open Graph and Twitter Card Integration', 'mashsb' ); ?></h1>
272
- <p><?php _e( 'Use open graph and twitter card to specify the content you like to share. If you are using Yoast, MashShare will use the Yoast open graph data instead and extend it with custom data to get the maximum out of your valuable content.', 'mashsb' ); ?></p>
273
  <p></p>
274
 
275
- <img src="<?php echo MASHSB_PLUGIN_URL . 'assets/images/screenshots/social_sharing_settings.png'; ?>"/>
276
  <p></p>
277
- <h1><?php _e( 'Great Responsive Buttons', 'mashsb' ); ?></h1>
278
- <p><?php _e( 'MashShare arrives you with excellent responsive support. So the buttons look great on mobile and desktop devices. If you want more customization options for mobile devices you can purchase the responsive Add-On', 'mashsb' ); ?></p>
279
  <p></p>
280
- <h1><?php _e( 'Share Count Dashboard', 'mashsb' ); ?></h1>
281
- <p><?php _e( 'See the shares of your posts at a glance on the admin posts listing:', 'mashsb' ); ?></p>
282
  <p></p>
283
- <img alt="Share count dashboard" title="Share count dashboard" src="<?php echo MASHSB_PLUGIN_URL . 'assets/images/screenshots/dashboard.png'; ?>"/>
284
  <p></p>
285
- <h1><?php _e( 'A much cleaner user interface', 'mashsb' ); ?></h1>
286
- <p><?php _e( 'We spent a lot of time to make useful first time settings and improved the user interface for an easier experience.', 'mashsb' ); ?></p>
287
  <p></p>
288
  </div>
289
  </div>
290
  </div>
291
-
292
-
293
  <div class="changelog">
294
- <h1><?php _e( 'Additional Updates', 'mashsb' ); ?></h1>
295
  <div class="mash-feature-section three-col">
296
  <div class="col">
297
- <h4><?php _e( 'Developer Friendly', 'mashsb' ); ?></h4>
298
- <p><?php echo sprintf(__( 'Are you a theme developer and want to use MashShare as your build in share count aggregator? Read the <a href="%s" target="blank">developer instructions.</a>', 'mashsb' ), 'https://docs.mashshare.net/category/38-sample-functions'); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
299
  </div>
300
  <div class="col">
301
- <h4><?php _e( 'Check Open Graph Settings', 'mashsb' ); ?></h4>
302
- <p><?php _e( 'Use the <i>Validate Open Graph Data</i> button and check if the open graph data on your site is working as expected or conflicts with other open graph data.', 'mashsb' ); ?></p>
303
  </div>
304
  <div class="col">
305
- <h4><?php _e( 'Use Yoast SEO Title', 'mashsb' ); ?></h4>
306
- <p><?php _e( 'MashShare will use the YOAST SEO title if it is defined.', 'mashsb' ); ?></p>
307
  </div>
308
  </div>
309
  </div>
310
 
311
  <div class="return-to-dashboard">
312
- <a href="<?php echo esc_url( admin_url( add_query_arg( array('page' => 'mashsb-settings&tab=visual#mashsb_settingslocation_header'), 'edit.php' ) ) ); ?>"><?php _e( 'Go to MashShare Settings', 'mashsb' ); ?></a> &middot;
313
- <a href="<?php echo esc_url( admin_url( add_query_arg( array('page' => 'mashsb-changelog'), 'admin.php' ) ) ); ?>"><?php _e( 'View the Full Changelog', 'mashsb' ); ?></a>
314
  <ul id="mash-social-admin-head">
315
  <?php echo mashsb_share_buttons(); ?>
316
  </ul>
@@ -333,13 +331,10 @@ class MASHSB_Welcome {
333
  ?>
334
  <h1 class="nav-tab-wrapper">
335
  <a class="nav-tab <?php echo $selected == 'mashsb-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array('page' => 'mashsb-about'), 'admin.php' ) ) ); ?>">
336
- <?php _e( "What's New", 'mashsb' ); ?>
337
  </a>
338
  <a class="nav-tab <?php echo $selected == 'mashsb-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array('page' => 'mashsb-getting-started'), 'admin.php' ) ) ); ?>">
339
- <?php _e( 'Getting Started', 'mashsb' ); ?>
340
- </a>
341
- <a class="nav-tab <?php echo $selected == 'mashsb-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array('page' => 'mashsb-credits'), 'admin.php' ) ) ); ?>">
342
- <?php _e( 'Credits', 'mashsb' ); ?>
343
  </a>
344
  </h1>
345
  <?php
@@ -360,10 +355,10 @@ class MASHSB_Welcome {
360
  $this->welcome_message();
361
  $this->tabs();
362
  ?>
363
- <h1 class="about-description"><?php _e( 'Mashshare is created by developers all over the world who aim to provide the #1 ecosystem for growing social media traffic through WordPress.', 'mashsb' ); ?></h1>
364
 
365
  <?php echo $this->contributors(); ?>
366
- <p class="small"><?php echo sprintf(__(' If you want to be credited here participate on the development and make your pull request on <a href="%s" target="_blank">github</a>',' mashsb'), 'https://github.com/mashshare/Mashshare')?></p>
367
  <ul id="mash-social-admin-head">
368
  <?php echo mashsb_share_buttons(); ?>
369
  </ul>
@@ -386,13 +381,26 @@ class MASHSB_Welcome {
386
 
387
  $contributor_list = '<ul class="wp-people-group">';
388
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
389
  foreach ( $contributors as $contributor ) {
390
  $contributor_list .= '<li class="wp-person">';
391
- $contributor_list .= sprintf( '<a href="%s" style="margin-right:8px;" title="%s">', esc_url( 'https://github.com/' . $contributor->login ), esc_html( sprintf( __( 'View %s', 'mashsb' ), $contributor->login ) )
392
- );
393
- $contributor_list .= sprintf( '<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url( $contributor->avatar_url ), esc_html( $contributor->login ) );
394
  $contributor_list .= '</a>';
395
- $contributor_list .= sprintf( '<a class="web" href="%s">%s</a>', esc_url( 'https://github.com/' . $contributor->login ), esc_html( $contributor->login ) );
396
  $contributor_list .= '</a>';
397
  $contributor_list .= '</li>';
398
  }
@@ -460,36 +468,6 @@ class MASHSB_Welcome {
460
  return $readme;
461
  }
462
 
463
- /**
464
- * Render Changelog Screen
465
- *
466
- * @access public
467
- * @since 2.0.3
468
- * @return void
469
- */
470
- public function changelog_screen() {
471
- ?>
472
- <div class="wrap mashsb-about-wrap">
473
- <?php
474
- // load welcome message and content tabs
475
- $this->welcome_message();
476
- $this->tabs();
477
- ?>
478
- <div class="changelog">
479
- <h4><?php _e( 'Full Changelog', 'mashsb' ); ?></h4>
480
-
481
- <div class="mash-feature-section">
482
- <?php echo $this->parse_readme(); ?>
483
- </div>
484
- </div>
485
-
486
- <div class="return-to-dashboard">
487
- <a href="<?php echo esc_url( admin_url( add_query_arg( array('page' => 'mashsb-settings&tab=visual#mashsb_settingslocation_header'), 'edit.php' ) ) ); ?>"><?php _e( 'Go to MashShare Settings', 'mashsb' ); ?></a>
488
- </div>
489
- </div>
490
- <?php
491
- }
492
-
493
  /**
494
  * Sends user to the Settings page on first activation of MASHSB as well as each
495
  * time MASHSB is upgraded to a new version
55
  add_submenu_page(
56
  'mashsb-settings', __( 'Welcome to MashShare', 'mashsb' ), __( 'Welcome to MashShare', 'mashsb' ), $this->minimum_capability, 'mashsb-about', array($this, 'about_screen')
57
  );
 
 
 
 
 
 
 
 
 
 
 
58
  }
59
 
60
  /**
66
  */
67
  public function admin_head() {
68
  remove_submenu_page( 'mashsb-settings', 'mashsb-about' );
 
69
  remove_submenu_page( 'mashsb-settings', 'mashsb-getting-started' );
70
+
 
71
  if ( !mashsb_is_admin_page() ){
72
  return false;
73
  }
109
  * @return void
110
  */
111
  public function getting_started_screen() {
 
112
  ?>
113
  <div class="wrap mashsb-about-wrap">
114
  <?php
117
  $this->tabs();
118
  ?>
119
  <?php if (isset($_GET['redirect'])) {?>
120
+ <p class="about-description mashsb-notice" style="background-color:#00abed;color:white;padding:20px;margin-top:20px;border:3px solid white;"><?php echo wp_kses_post (__( '<strong>Facebook</strong> and <strong>Twitter Share Buttons</strong> have been enabled on all your posts! <br>Use the instructions on this page to customize MashShare.<br><br></strong>MashShare uses sharedcount.com to collect shares.
121
+ <br>Register for sharedcount.com on <a href="'.admin_url().'admin.php?page=mashsb-settings" style="color:white;">MashShare > Settings > Sharecount</a>', 'mashsb' )); ?></p>
122
  <?php } ?>
123
  <div class="changelog clear">
124
+ <h1><?php esc_html_e( 'Create Your First Social Sharing Button', 'mashsb' ); ?></h1>
125
  <div class="mash-feature-section">
126
  <div class="mash-feature-section-media">
127
+ <img style="display:none;" src="<?php echo esc_url(MASHSB_PLUGIN_URL) . 'assets/images/screenshots/social-networks-settings.png'; ?>" class="mashsb-welcome-screenshots"/>
128
  </div>
129
  <div class="mash-feature-section-content">
130
+ <h3>Step 1: Go to <a href="<?php echo esc_url(admin_url( 'admin.php?page=mashsb-settings#mashsb_settingsservices_header' )); ?>" target="blank"><?php esc_html_e( 'Settings &rarr; Networks', 'mashsb' ); ?></a></h3>
131
+ <p><?php esc_html_e( 'The Social Network menu is your general access point for activating the desired share buttons and for customizing the share button label', 'mashsb' ); ?></p>
132
+ <h3>Step 2: Go to <a href="<?php echo esc_url(admin_url( 'admin.php?page=mashsb-settings#mashsb_settingslocation_header' )); ?>" target="blank"><?php esc_html_e( 'Settings &rarr; Position', 'mashsb' ); ?></a></h3>
133
+ <p><?php esc_html_e( 'Select the location and exact position of the share buttons within your content', 'mashsb' ); ?></p>
134
+ <p><?php esc_html_e('You are done! Easy, isn\'t it?', 'mashsb'); ?></p>
135
  <p></p>
136
 
137
  </div>
139
  </div>
140
 
141
  <div class="changelog clear">
142
+ <h1><?php esc_html_e( 'Create Most Shared Posts Widget', 'mashsb' ); ?></h1>
143
  <div class="mash-feature-section">
144
  <div class="mash-feature-section-content">
145
+ <h3>Go to <a href="<?php echo esc_url(admin_url( 'widgets.php' )); ?>" target="blank"><?php esc_html_e( 'Appearance &rarr; Widgets', 'mashsb' ); ?></a></h3>
146
+ <p><?php echo wp_kses_post(__( 'Drag and drop the widget labeled "<i>MashShare - Most Shared Posts</i>" into the desired widget location and save it.', 'mashsb' )); ?></p>
147
+ <img style="display:none;" src="<?php echo esc_url(MASHSB_PLUGIN_URL) . 'assets/images/screenshots/most-shared-posts.png'; ?>"/>
 
 
148
  </div>
149
  </div>
150
  </div>
151
 
152
  <div class="changelog clear">
153
+ <h1><?php esc_html_e( 'Content Shortcodes', 'mashsb' ); ?></h1>
154
  <div class="mash-feature-section">
155
  <div class="mash-feature-section-media">
156
+ <img style="display:none;" src="<?php echo esc_url(MASHSB_PLUGIN_URL) . 'assets/images/screenshots/shortcodes.png'; ?>"/>
157
  </div>
158
  <div class="mash-feature-section-content">
159
  <p>
160
+ <?php echo wp_kses_post(__( 'Add Share buttons manually with using shortcode <i style="font-weight:bold;">[mashshare]</i>.', 'mashsb' )); ?>
161
  </p>
162
+ <?php esc_html_e( 'Paste the shortcode in content of your posts or pages with the post editor at the place you want the share buttons appear', 'mashsb' ); ?>
163
  <p>
164
+ <?php
165
+ $allowedHtml = array(
166
+ 'a' => array(
167
+ 'class' => array(),
168
+ 'href' => array(),
169
+ 'rel' => array(),
170
+ 'title' => array(),
171
+ 'target' => array(),
172
+ )
173
+ );
174
+ echo wp_kses(sprintf(__( 'There are several parameters you can use for the shortcode. Get a <a href="%s" target="blank">list of all available shortcode parameters</a>', 'mashsb'), 'http://docs.mashshare.net/article/67-shortcodes'), $allowedHtml); ?><br>
175
  </p>
176
  </div>
177
  </div>
178
  </div>
179
  <div class="changelog clear">
180
+ <h1><?php esc_html_e( 'PHP Template Shortcode', 'mashsb' ); ?></h1>
181
  <div class="mash-feature-section">
182
  <div class="mash-feature-section-media">
183
  </div>
184
  <div class="mash-feature-section-content">
185
  <p>
186
+ <?php echo wp_kses_post(__( 'Add MashShare directly into your theme template files with using the PHP code<br> <pre><i style="font-weight:bold;">&lt;?php do_shortcode(\'[mashshare]\'); ?&gt;</i></pre>', 'mashsb' )); ?>
187
  </p>
188
  </div>
189
  </div>
190
  </div>
191
 
192
  <div class="changelog clear">
193
+ <h1><?php esc_html_e( 'Need Help?', 'mashsb' ); ?></h1>
194
  <div class="mash-feature-section two-col">
195
  <div>
196
+ <h3><?php esc_html_e( 'Great Support', 'mashsb' ); ?></h3>
197
+ <p><?php echo wp_kses_post(__( 'If you encounter a problem or have any question, please <a href="https://www.mashshare.net/contact-developer/" target="blank">open a ticket</a>.', 'mashsb' )); ?></p>
198
  <ul id="mash-social-admin-head">
199
  <?php echo mashsb_share_buttons(); ?>
200
  </ul>
217
  list( $display_version ) = explode( '-', MASHSB_VERSION );
218
  ?>
219
  <div id="mashsb-header">
220
+ <h1><?php echo esc_html(sprintf( __( 'Welcome to MashShare %s', 'mashsb' ), $display_version )); ?></h1>
 
221
  <h1 class="about-text">
222
+ <?php echo wp_kses_post(__( 'Congrats for Choosing MashShare<br>MashShare is Active and Ready to Boost Your Social Media Traffic!', 'mashsb' )); ?>
223
  </h1>
224
  </div>
225
  <?php
243
  <div class="changelog">
244
  <div class="mash-feature-section">
245
  <div class="mash-feature-section-content">
 
 
 
 
 
246
  <p></p>
247
+ <h1><?php esc_html_e( 'A New Beautiful Sharing Widget', 'mashsb' ); ?></h1>
248
+ <p><?php esc_html_e( 'We have heard your wishes so the new widget contains the long requested post thumbnail and a beautiful css which gives your side bar sharing super power.', 'mashsb' ); ?></p>
249
+ <img src="<?php echo esc_url(MASHSB_PLUGIN_URL) . 'assets/images/screenshots/widget.png'; ?>"/>
250
  <p></p>
251
+ <h1><?php esc_html_e( 'Better Customization Options', 'mashsb' ); ?></h1>
252
+ <p><?php esc_html_e( 'Select from 3 ready to use sizes to make sure that MashShare is looking great on your site. No matter if you prefer small, medium or large buttons.', 'mashsb' ); ?></p>
253
+ <img src="<?php echo esc_url(MASHSB_PLUGIN_URL) . 'assets/images/screenshots/different_sizes.gif'; ?>"/>
254
  <p></p>
255
+ <h1><?php esc_html_e( 'Asyncronous Share Count Aggregation', 'mashsb' ); ?></h1>
256
+ <p><?php echo wp_kses_post(__( 'With MashShare you get our biggest performance update. Use the new <i>Async Cache Refresh</i> method and your share counts will be aggregated only after page loading and never while page loads. This is a huge performance update.', 'mashsb' )); ?></p>
257
+ <img src="<?php echo esc_url(MASHSB_PLUGIN_URL) . 'assets/images/screenshots/async_cache_refresh.png'; ?>"/>
258
  <p></p>
259
+ <h1><?php esc_html_e( 'Open Graph and Twitter Card Integration', 'mashsb' ); ?></h1>
260
+ <p><?php esc_html_e( 'Use open graph and twitter card to specify the content you like to share. If you are using Yoast, MashShare will use the Yoast open graph data instead and extend it with custom data to get the maximum out of your valuable content.', 'mashsb' ); ?></p>
261
  <p></p>
262
 
263
+ <img src="<?php echo esc_url(MASHSB_PLUGIN_URL) . 'assets/images/screenshots/social_sharing_settings.png'; ?>"/>
264
  <p></p>
265
+ <h1><?php esc_html_e( 'Great Responsive Buttons', 'mashsb' ); ?></h1>
266
+ <p><?php esc_html_e( 'MashShare arrives you with excellent responsive support. So the buttons look great on mobile and desktop devices. If you want more customization options for mobile devices you can purchase the responsive Add-On', 'mashsb' ); ?></p>
267
  <p></p>
268
+ <h1><?php esc_html_e( 'Share Count Dashboard', 'mashsb' ); ?></h1>
269
+ <p><?php esc_html_e( 'See the shares of your posts at a glance on the admin posts listing:', 'mashsb' ); ?></p>
270
  <p></p>
271
+ <img alt="Share count dashboard" title="Share count dashboard" src="<?php echo esc_url(MASHSB_PLUGIN_URL) . 'assets/images/screenshots/dashboard.png'; ?>"/>
272
  <p></p>
273
+ <h1><?php esc_html_e( 'A much cleaner user interface', 'mashsb' ); ?></h1>
274
+ <p><?php esc_html_e( 'We spent a lot of time to make useful first time settings and improved the user interface for an easier experience.', 'mashsb' ); ?></p>
275
  <p></p>
276
  </div>
277
  </div>
278
  </div>
 
 
279
  <div class="changelog">
280
+ <h1><?php esc_html_e( 'Additional Updates', 'mashsb' ); ?></h1>
281
  <div class="mash-feature-section three-col">
282
  <div class="col">
283
+ <h3><?php esc_html_e( 'Developer Friendly', 'mashsb' ); ?></h3>
284
+ <p><?php
285
+
286
+ $allowedHtml = array(
287
+ 'a' => array(
288
+ 'class' => array(),
289
+ 'href' => array(),
290
+ 'rel' => array(),
291
+ 'title' => array(),
292
+ 'target' => array(),
293
+ )
294
+ );
295
+
296
+ echo wp_kses(sprintf(__( 'Are you a theme developer and want to use MashShare as your build in share count aggregator? Read the <a href="%s" target="blank">developer instructions.</a>', 'mashsb' ), 'https://docs.mashshare.net/category/38-sample-functions'), $allowedHtml); ?></p>
297
  </div>
298
  <div class="col">
299
+ <h3><?php esc_html_e( 'Check Open Graph Settings', 'mashsb' ); ?></h3>
300
+ <p><?php echo wp_kses_post(__( 'Use the <i>Validate Open Graph Data</i> button and check if the open graph data on your site is working as expected or conflicts with other open graph data.', 'mashsb' )); ?></p>
301
  </div>
302
  <div class="col">
303
+ <h3><?php esc_html_e( 'Use Yoast SEO Title', 'mashsb' ); ?></h3>
304
+ <p><?php esc_html_e( 'MashShare will use the YOAST SEO title if it is defined.', 'mashsb' ); ?></p>
305
  </div>
306
  </div>
307
  </div>
308
 
309
  <div class="return-to-dashboard">
310
+ <a href="<?php echo esc_url( admin_url( add_query_arg( array('page' => 'mashsb-settings&tab=visual#mashsb_settingslocation_header'), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Go to MashShare Settings', 'mashsb' ); ?></a> &middot;
311
+ <a href="<?php echo esc_url( admin_url( add_query_arg( array('page' => 'mashsb-changelog'), 'admin.php' ) ) ); ?>"><?php esc_html_e( 'View the Full Changelog', 'mashsb' ); ?></a>
312
  <ul id="mash-social-admin-head">
313
  <?php echo mashsb_share_buttons(); ?>
314
  </ul>
331
  ?>
332
  <h1 class="nav-tab-wrapper">
333
  <a class="nav-tab <?php echo $selected == 'mashsb-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array('page' => 'mashsb-about'), 'admin.php' ) ) ); ?>">
334
+ <?php esc_html_e( "What's New", 'mashsb' ); ?>
335
  </a>
336
  <a class="nav-tab <?php echo $selected == 'mashsb-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array('page' => 'mashsb-getting-started'), 'admin.php' ) ) ); ?>">
337
+ <?php esc_html_e( 'Getting Started', 'mashsb' ); ?>
 
 
 
338
  </a>
339
  </h1>
340
  <?php
355
  $this->welcome_message();
356
  $this->tabs();
357
  ?>
358
+ <h1 class="about-description"><?php esc_html_e( 'MashShare is created by developers all over the world who aim to provide the #1 ecosystem for growing social media traffic through WordPress.', 'mashsb' ); ?></h1>
359
 
360
  <?php echo $this->contributors(); ?>
361
+ <p class="small"><?php echo wp_kses_post(sprintf(__(' If you want to be credited here participate on the development and make your pull request on <a href="%s" target="_blank">github</a>',' mashsb'), 'https://github.com/mashshare/Mashshare')); ?></p>
362
  <ul id="mash-social-admin-head">
363
  <?php echo mashsb_share_buttons(); ?>
364
  </ul>
381
 
382
  $contributor_list = '<ul class="wp-people-group">';
383
 
384
+ $allowedHtml = array(
385
+ 'a' => array(
386
+ 'class' => array(),
387
+ 'href' => array(),
388
+ 'rel' => array(),
389
+ 'title' => array(),
390
+ 'target' => array(),
391
+ 'style' => array(),
392
+ 'width' => array(),
393
+ 'height' => array(),
394
+ 'alt' => array(),
395
+ )
396
+ );
397
+
398
  foreach ( $contributors as $contributor ) {
399
  $contributor_list .= '<li class="wp-person">';
400
+ $contributor_list .= wp_kses(sprintf( '<a href="%s" style="margin-right:8px;" title="%s">', esc_url( 'https://github.com/' . $contributor->login ), esc_html( sprintf( __( 'View %s', 'mashsb' ), $contributor->login ) ) ), $allowedHtml);
401
+ $contributor_list .= wp_kses(sprintf( '<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url( $contributor->avatar_url ), esc_html( $contributor->login ) ), $allowedHtml );
 
402
  $contributor_list .= '</a>';
403
+ $contributor_list .= wp_kses(sprintf( '<a class="web" href="%s">%s</a>', esc_url( 'https://github.com/' . $contributor->login ), esc_html( $contributor->login ) ), $allowedHtml);
404
  $contributor_list .= '</a>';
405
  $contributor_list .= '</li>';
406
  }
468
  return $readme;
469
  }
470
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
471
  /**
472
  * Sends user to the Settings page on first activation of MASHSB as well as each
473
  * time MASHSB is upgraded to a new version
includes/class-mashsb-license-handler.php CHANGED
@@ -193,10 +193,10 @@ class MASHSB_License {
193
  return;
194
  }
195
 
196
- echo '<p>' . sprintf(
197
  __( 'Enter your extension license keys here to receive updates for purchased extensions. If your license key has expired, please <a href="%s" target="_blank" title="License renewal FAQ">renew your license</a>.', 'mashsb' ),
198
  'https://www.mashshare.net/documentation/license-renewal/#How_do_I_renew_my_license'
199
- ) . '</p>';
200
 
201
  $has_ran = true;
202
 
@@ -299,7 +299,7 @@ class MASHSB_License {
299
 
300
  if( ! wp_verify_nonce( $_REQUEST[ $this->item_shortname . '_license_key-nonce'], $this->item_shortname . '_license_key-nonce' ) ) {
301
 
302
- wp_die( __( 'Nonce verification failed', 'mashsb' ), __( 'Error', 'mashsb' ), array( 'response' => 403 ) );
303
 
304
  }
305
 
@@ -342,7 +342,7 @@ class MASHSB_License {
342
  }
343
 
344
 
345
- /**
346
  * Check if license key is valid once per week
347
  *
348
  * @access public
@@ -415,10 +415,10 @@ class MASHSB_License {
415
 
416
  if( empty( $_GET['tab'] ) || 'licenses' !== $_GET['tab'] ) {
417
 
418
- $messages[] = sprintf(
419
  __( 'You have invalid or expired license keys for MashShare. Please go to the <a href="%s" title="Go to Licenses page">Licenses page</a> to correct this issue.', 'mashsb' ),
420
  admin_url( 'admin.php?page=mashsb-settings&tab=licenses' )
421
- );
422
 
423
  $showed_invalid_message = true;
424
 
@@ -455,7 +455,7 @@ class MASHSB_License {
455
 
456
  if( ( ! is_object( $license ) || 'valid' !== $license->license ) && empty( $showed_imissing_key_message[ $this->item_shortname ] ) ) {
457
 
458
- echo '&nbsp;<strong><a href="' . esc_url( admin_url( 'admin.php?page=mashsb-settings&tab=licenses' ) ) . '">' . __( 'Enter valid license key for automatic updates.', 'mashsb' ) . '</a></strong>';
459
  $showed_imissing_key_message[ $this->item_shortname ] = true;
460
  }
461
 
193
  return;
194
  }
195
 
196
+ echo '<p>' . esc_html(sprintf(
197
  __( 'Enter your extension license keys here to receive updates for purchased extensions. If your license key has expired, please <a href="%s" target="_blank" title="License renewal FAQ">renew your license</a>.', 'mashsb' ),
198
  'https://www.mashshare.net/documentation/license-renewal/#How_do_I_renew_my_license'
199
+ )) . '</p>';
200
 
201
  $has_ran = true;
202
 
299
 
300
  if( ! wp_verify_nonce( $_REQUEST[ $this->item_shortname . '_license_key-nonce'], $this->item_shortname . '_license_key-nonce' ) ) {
301
 
302
+ wp_die( esc_html__( 'Nonce verification failed', 'mashsb' ), esc_html__( 'Error', 'mashsb' ), array( 'response' => 403 ) );
303
 
304
  }
305
 
342
  }
343
 
344
 
345
+ /**
346
  * Check if license key is valid once per week
347
  *
348
  * @access public
415
 
416
  if( empty( $_GET['tab'] ) || 'licenses' !== $_GET['tab'] ) {
417
 
418
+ $messages[] = wp_kses_post(sprintf(
419
  __( 'You have invalid or expired license keys for MashShare. Please go to the <a href="%s" title="Go to Licenses page">Licenses page</a> to correct this issue.', 'mashsb' ),
420
  admin_url( 'admin.php?page=mashsb-settings&tab=licenses' )
421
+ ));
422
 
423
  $showed_invalid_message = true;
424
 
455
 
456
  if( ( ! is_object( $license ) || 'valid' !== $license->license ) && empty( $showed_imissing_key_message[ $this->item_shortname ] ) ) {
457
 
458
+ echo '&nbsp;<strong><a href="' . esc_url( admin_url( 'admin.php?page=mashsb-settings&tab=licenses' ) ) . '">' . esc_html__( 'Enter valid license key for automatic updates.', 'mashsb' ) . '</a></strong>';
459
  $showed_imissing_key_message[ $this->item_shortname ] = true;
460
  }
461
 
includes/class-mashsb-shared-posts-widget.php CHANGED
@@ -40,40 +40,40 @@ class mashsb_mostshared_posts_widget extends WP_Widget {
40
  ?>
41
 
42
  <p>
43
- <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Widget Title', 'mashsb' ); ?></label>
44
- <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" />
45
  </p>
46
 
47
  <p>
48
- <label for="<?php echo $this->get_field_id( 'count' ); ?>"><?php _e( 'How many posts to display?', 'mashsb' ); ?></label>
49
- <input class="widefat" id="<?php echo $this->get_field_id( 'count' ); ?>" name="<?php echo $this->get_field_name( 'count' ); ?>" type="number" value="<?php echo $count; ?>" min="0" />
50
  </p>
51
  <p>
52
- <label for="<?php echo $this->get_field_id( 'excerpt_length' ); ?>"><?php _e( 'How many characters for the excerpt? Use 0 for not showing!', 'mashsb' ); ?></label>
53
- <input class="widefat" id="<?php echo $this->get_field_id( 'excerpt_length' ); ?>" name="<?php echo $this->get_field_name( 'excerpt_length' ); ?>" type="number" value="<?php echo $excerpt_length; ?>" min="0" />
54
  </p>
55
  <p>
56
- <label for="<?php echo $this->get_field_id( 'title_length' ); ?>"><?php _e( 'How many characters for the title?', 'mashsb' ); ?></label>
57
- <input class="widefat" id="<?php echo $this->get_field_id( 'title_length' ); ?>" name="<?php echo $this->get_field_name( 'title_length' ); ?>" type="number" value="<?php echo $title_length; ?>" min="0" />
58
  </p>
59
  <p>
60
- <label for="<?php echo $this->get_field_id( 'image_size' ); ?>"><?php _e( 'Width of the image in px? Use 0 for not showing a thumbnail', 'mashsb' ); ?></label>
61
  <input class="widefat" id="<?php echo $this->get_field_id( 'image_size' ); ?>" name="<?php echo $this->get_field_name( 'image_size' ); ?>" type="number" value="<?php echo $image_size; ?>" min="0" />
62
  </p>
63
  <p>
64
- <label for="<?php echo $this->get_field_id( 'showShares' ); ?>"><?php _e( 'Show Shares? Say "No" when using fake shares!', 'mashsb' ); ?></label>
65
- <select class="widefat" id="<?php echo $this->get_field_id( 'showShares' ); ?>" name="<?php echo $this->get_field_name( 'showShares' ); ?>">
66
  <option value="true" <?php if( $showShares === 'true' ) echo 'selected'; ?>>Yes</option>
67
  <option value="false" <?php if( $showShares === 'false' ) echo 'selected'; ?>>No</option>
68
  </select>
69
  </p>
70
  <p>
71
- <label for="<?php echo $this->get_field_id( 'countLabel' ); ?>"><?php _e( 'Share Count Label', 'mashsb' ); ?></label>
72
- <input class="widefat" id="<?php echo $this->get_field_id( 'countLabel' ); ?>" name="<?php echo $this->get_field_name( 'countLabel' ); ?>" type="text" value="<?php echo $countLabel; ?>" />
73
  </p>
74
  <p>
75
- <label for="<?php echo $this->get_field_id( 'period' ); ?>"><?php _e( 'Time period and age of posts', 'mashsb' ); ?></label>
76
- <select class="widefat" id="<?php echo $this->get_field_id( 'period' ); ?>" name="<?php echo $this->get_field_name( 'period' ); ?>">
77
  <option value="7" <?php if( $period === '7' ) echo 'selected'; ?>>7 Days</option>
78
  <option value="7" <?php if( $period === '14' ) echo 'selected'; ?>>14 Days</option>
79
  <option value="30" <?php if( $period === '30' ) echo 'selected'; ?>>1 Month</option>
@@ -108,28 +108,27 @@ class mashsb_mostshared_posts_widget extends WP_Widget {
108
 
109
  // extract widget options
110
  extract( $args );
111
- $title = apply_filters( 'widget_title', $instance['title'] );
112
- $count = $instance['count'];
113
- $excerpt_length = !empty( $instance['excerpt_length']) ? esc_attr( $instance['excerpt_length'] ) : 0;
114
- $title_length = !empty( $instance['title_length']) ? esc_attr( $instance['title_length'] ) : 70;
115
- $image_size= !empty( $instance['image_size']) ? esc_attr( $instance['image_size'] ) : 0;
116
- $showShares = $instance['showShares'];
117
- $countLabel = $instance['countLabel'];
118
- $period = !empty($instance['period']) ? $instance['period'] : '7';
119
 
120
 
121
  echo '<!-- MashShare Most Popular Widget //-->';
122
  echo $before_widget;
123
  // Display the widget
124
- // Check if title is set
125
  if( $title ) {
126
- echo $before_title . $title . $after_title;
127
  }
128
 
129
 
130
  // Check if text is set
131
  $args = array(
132
- 'posts_per_page' => $count,
133
  'post_type' => 'post',
134
  'post_status' => 'publish',
135
  'meta_key' => 'mashsb_shares',
@@ -142,9 +141,7 @@ class mashsb_mostshared_posts_widget extends WP_Widget {
142
  ),
143
  ),
144
  );
145
- //$wpq = new WP_Query( $args );
146
  $wpq = $this->get_qry_from_cache($args);
147
- //var_dump($wpq);
148
  if( $wpq->have_posts() ) :
149
  echo '<ul class="mashsb-share-widget">';
150
  while ( $wpq->have_posts() ):
@@ -154,25 +151,25 @@ class mashsb_mostshared_posts_widget extends WP_Widget {
154
  $image_url = wp_get_attachment_url( get_post_thumbnail_id($postID) );
155
 
156
  if (!empty($image_url)){
157
- $css = 'background-image: url('.wp_get_attachment_url( get_post_thumbnail_id($postID) ).');background-size: cover;background-repeat: no-repeat;background-position: 50% 50%;width:'.$image_size.'px;height:' . $image_size . 'px;';
158
- $image = !empty($image_size) ? '<div class="mashsb-widget-img" style="' . $css . '"><a class="mashsb-widget-link" href="' . get_the_permalink() . '" style="display:block;width:'.$image_size.'px;height:' . $image_size.'px;">&nbsp</a></div>' : '';
159
 
160
  } else {
161
- $css = 'display:block;width:'.$image_size.'px;height:' . $image_size.'px;';
162
- $image = !empty($image_size) ? '<div class="mashsb-widget-img" style="' . $css . '"><a class="mashsb-widget-link" href="' . get_the_permalink() . '">&nbsp</a></div>' : '';
163
  }
164
 
165
 
166
- $title_result = '<div class="mashsb-widget-post-title"><a class="mashsb-widget-link" href="' . get_the_permalink() . '">' . $this->limit_title(get_the_title(), $title_length) . '</a></div>';
167
 
168
- $excerpt = !empty($excerpt_length) ? '<div class="mashsb-excerpt">' . $this->limit_excerpt(get_the_excerpt($postID), $excerpt_length) . '</div>' : '';
169
 
170
 
171
- if( $showShares === 'true' ):
172
- $shares = get_post_meta( $postID, 'mashsb_shares', true ) + getFakecount();
173
- echo '<li>' . $image . $title_result . $excerpt . ' <span class="mashicon-share">' . roundshares( $shares ) . ' ' . $countLabel . '</span></li>';
174
  else:
175
- echo '<li>' . $image . $title_result . $excerpt. '</li>';
176
  endif;
177
  endwhile;
178
  echo '</ul>';
@@ -185,9 +182,9 @@ class mashsb_mostshared_posts_widget extends WP_Widget {
185
  /**
186
  * Cut characters of the title
187
  *
188
- * @param type $string
189
- * @param type $int
190
- * @return type
191
  */
192
  private function limit_title($string, $int){
193
  if (empty($string) || !is_numeric( $int)){
@@ -199,9 +196,9 @@ class mashsb_mostshared_posts_widget extends WP_Widget {
199
  /**
200
  * Cut characters of the excerpt
201
  *
202
- * @param type $excerpt
203
- * @param type $int
204
- * @return type
205
  */
206
  private function limit_excerpt($excerpt, $int){
207
  if (empty($excerpt) || !is_numeric( $int)){
@@ -226,10 +223,8 @@ class mashsb_mostshared_posts_widget extends WP_Widget {
226
  if( false === ( $qry = get_transient( 'mashwidget_' . md5( json_encode( $args ) ) ) ) ) {
227
  $wpq = new WP_Query( $args );
228
  set_transient( 'mashwidget_' . md5( json_encode( $args ) ), $wpq, $expiration );
229
- //wp_die( var_dump($wpq));
230
- return $wpq;
231
  } else {
232
- //wp_die( var_dump($qry) );
233
  return $qry;
234
  }
235
  }
40
  ?>
41
 
42
  <p>
43
+ <label for="<?php echo esc_attr($this->get_field_id( 'title' )); ?>"><?php esc_html_e( 'Widget Title', 'mashsb' ); ?></label>
44
+ <input class="widefat" id="<?php echo esc_attr($this->get_field_id( 'title' )); ?>" name="<?php echo esc_html($this->get_field_name( 'title' )); ?>" type="text" value="<?php echo esc_html($title); ?>" />
45
  </p>
46
 
47
  <p>
48
+ <label for="<?php echo esc_attr($this->get_field_id( 'count' )); ?>"><?php esc_html_e( 'How many posts to display?', 'mashsb' ); ?></label>
49
+ <input class="widefat" id="<?php echo esc_attr($this->get_field_id( 'count' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'count' )); ?>" type="number" value="<?php echo intval($count); ?>" min="0" />
50
  </p>
51
  <p>
52
+ <label for="<?php echo esc_attr($this->get_field_id( 'excerpt_length' )); ?>"><?php esc_html_e( 'How many characters for the excerpt? Use 0 for not showing!', 'mashsb' ); ?></label>
53
+ <input class="widefat" id="<?php echo esc_attr($this->get_field_id( 'excerpt_length' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'excerpt_length' )); ?>" type="number" value="<?php echo intval($excerpt_length); ?>" min="0" />
54
  </p>
55
  <p>
56
+ <label for="<?php echo esc_attr($this->get_field_id( 'title_length' )); ?>"><?php esc_html_e( 'How many characters for the title?', 'mashsb' ); ?></label>
57
+ <input class="widefat" id="<?php echo esc_attr($this->get_field_id( 'title_length' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'title_length' )); ?>" type="number" value="<?php echo intval($title_length); ?>" min="0" />
58
  </p>
59
  <p>
60
+ <label for="<?php echo $this->get_field_id( 'image_size' ); ?>"><?php esc_html_e( 'Width of the image in px? Use 0 for not showing a thumbnail', 'mashsb' ); ?></label>
61
  <input class="widefat" id="<?php echo $this->get_field_id( 'image_size' ); ?>" name="<?php echo $this->get_field_name( 'image_size' ); ?>" type="number" value="<?php echo $image_size; ?>" min="0" />
62
  </p>
63
  <p>
64
+ <label for="<?php echo esc_attr($this->get_field_id( 'showShares' )); ?>"><?php esc_html_e( 'Show Shares? Say "No" when using fake shares!', 'mashsb' ); ?></label>
65
+ <select class="widefat" id="<?php echo esc_attr($this->get_field_id( 'showShares' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'showShares' )); ?>">
66
  <option value="true" <?php if( $showShares === 'true' ) echo 'selected'; ?>>Yes</option>
67
  <option value="false" <?php if( $showShares === 'false' ) echo 'selected'; ?>>No</option>
68
  </select>
69
  </p>
70
  <p>
71
+ <label for="<?php echo esc_attr($this->get_field_id( 'countLabel' )); ?>"><?php esc_html_e( 'Share Count Label', 'mashsb' ); ?></label>
72
+ <input class="widefat" id="<?php echo esc_attr($this->get_field_id( 'countLabel' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'countLabel' )); ?>" type="text" value="<?php echo esc_html($countLabel); ?>" />
73
  </p>
74
  <p>
75
+ <label for="<?php echo esc_attr($this->get_field_id( 'period' )); ?>"><?php esc_html_e( 'Time period and age of posts', 'mashsb' ); ?></label>
76
+ <select class="widefat" id="<?php echo esc_attr($this->get_field_id( 'period' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'period' )); ?>">
77
  <option value="7" <?php if( $period === '7' ) echo 'selected'; ?>>7 Days</option>
78
  <option value="7" <?php if( $period === '14' ) echo 'selected'; ?>>14 Days</option>
79
  <option value="30" <?php if( $period === '30' ) echo 'selected'; ?>>1 Month</option>
108
 
109
  // extract widget options
110
  extract( $args );
111
+ $title = apply_filters( 'widget_title', esc_html($instance['title']) );
112
+ $posts_per_page = intval($instance['count']);
113
+ $excerpt_length_escaped = !empty( $instance['excerpt_length']) ? esc_attr( $instance['excerpt_length'] ) : 0;
114
+ $title_length_escaped = !empty( $instance['title_length']) ? esc_attr( $instance['title_length'] ) : 70;
115
+ $image_size_escaped = !empty( $instance['image_size']) ? esc_attr( $instance['image_size'] ) : 0;
116
+ $isShowShares = $instance['showShares'];
117
+ $count_label_escaped = esc_html($instance['countLabel']);
118
+ $period = !empty($instance['period']) ? intval($instance['period']) : '7';
119
 
120
 
121
  echo '<!-- MashShare Most Popular Widget //-->';
122
  echo $before_widget;
123
  // Display the widget
 
124
  if( $title ) {
125
+ echo wp_kses_post($before_title . $title . $after_title);
126
  }
127
 
128
 
129
  // Check if text is set
130
  $args = array(
131
+ 'posts_per_page' => $posts_per_page,
132
  'post_type' => 'post',
133
  'post_status' => 'publish',
134
  'meta_key' => 'mashsb_shares',
141
  ),
142
  ),
143
  );
 
144
  $wpq = $this->get_qry_from_cache($args);
 
145
  if( $wpq->have_posts() ) :
146
  echo '<ul class="mashsb-share-widget">';
147
  while ( $wpq->have_posts() ):
151
  $image_url = wp_get_attachment_url( get_post_thumbnail_id($postID) );
152
 
153
  if (!empty($image_url)){
154
+ $css_escaped = 'background-image: url('.wp_get_attachment_url( get_post_thumbnail_id($postID) ).');background-size: cover;background-repeat: no-repeat;background-position: 50% 50%;width:'.$image_size_escaped.'px;height:' . $image_size_escaped . 'px;';
155
+ $image_escaped = !empty($image_size_escaped) ? '<div class="mashsb-widget-img" style="' . esc_attr($css_escaped) . '"><a class="mashsb-widget-link" href="' . get_the_permalink() . '" style="display:block;width:'.$image_size_escaped.'px;height:' . $image_size_escaped.'px;">&nbsp</a></div>' : '';
156
 
157
  } else {
158
+ $css_escaped = 'display:block;width:'.$image_size_escaped.'px;height:' . $image_size_escaped.'px;';
159
+ $image_escaped = !empty($image_size_escaped) ? '<div class="mashsb-widget-img" style="' . $css_escaped . '"><a class="mashsb-widget-link" href="' . get_the_permalink() . '">&nbsp</a></div>' : '';
160
  }
161
 
162
 
163
+ $title_output_escaped = '<div class="mashsb-widget-post-title"><a class="mashsb-widget-link" href="' . get_the_permalink() . '">' . esc_html($this->limit_title(get_the_title(), $title_length_escaped)) . '</a></div>';
164
 
165
+ $excerpt_escaped = !empty($excerpt_length_escaped) ? '<div class="mashsb-excerpt">' . esc_html($this->limit_excerpt(get_the_excerpt($postID), $excerpt_length_escaped)) . '</div>' : '';
166
 
167
 
168
+ if( $isShowShares === 'true' ):
169
+ $shares = intval(get_post_meta( $postID, 'mashsb_shares', true ) + getFakecount());
170
+ echo '<li>' . $image_escaped . $title_output_escaped . $excerpt_escaped . ' <span class="mashicon-share">' . roundshares( $shares ) . ' ' . $count_label_escaped . '</span></li>';
171
  else:
172
+ echo '<li>' . $image_escaped . $title_output_escaped . $excerpt_escaped. '</li>';
173
  endif;
174
  endwhile;
175
  echo '</ul>';
182
  /**
183
  * Cut characters of the title
184
  *
185
+ * @param string $string
186
+ * @param int $int
187
+ * @return string
188
  */
189
  private function limit_title($string, $int){
190
  if (empty($string) || !is_numeric( $int)){
196
  /**
197
  * Cut characters of the excerpt
198
  *
199
+ * @param string $excerpt
200
+ * @param int $int
201
+ * @return string
202
  */
203
  private function limit_excerpt($excerpt, $int){
204
  if (empty($excerpt) || !is_numeric( $int)){
223
  if( false === ( $qry = get_transient( 'mashwidget_' . md5( json_encode( $args ) ) ) ) ) {
224
  $wpq = new WP_Query( $args );
225
  set_transient( 'mashwidget_' . md5( json_encode( $args ) ), $wpq, $expiration );
226
+ return $wpq;
 
227
  } else {
 
228
  return $qry;
229
  }
230
  }
includes/debug/debug.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Output debug notices in footer
4
- * @global type $mashsb_options
5
  */
6
  function mashsbOutputDebug() {
7
  global $mashsb_options, $mashsb_debug;
@@ -14,8 +14,7 @@
14
  echo '<div class="mash-debug" style="display:block;z-index:250000;font-size:12px;text-align:center;">';
15
  echo 'MashShare Debug Mode.<br><br>';
16
  foreach ($mashsb_debug as $key => $value){
17
- //echo $key . ' ' . date( 'H:m:s.u', time()). ' ' . $value . '<br />';
18
- echo $value . '<br />';
19
  }
20
  echo '</div>';
21
  }
1
  <?php
2
  /**
3
  * Output debug notices in footer
4
+ * @global array $mashsb_options
5
  */
6
  function mashsbOutputDebug() {
7
  global $mashsb_options, $mashsb_debug;
14
  echo '<div class="mash-debug" style="display:block;z-index:250000;font-size:12px;text-align:center;">';
15
  echo 'MashShare Debug Mode.<br><br>';
16
  foreach ($mashsb_debug as $key => $value){
17
+ echo wp_kses_post($value) . '<br />';
 
18
  }
19
  echo '</div>';
20
  }
includes/header-meta-tags.php CHANGED
@@ -643,7 +643,6 @@ class MASHSB_HEADER_META_TAGS {
643
  * @return string HTML
644
  */
645
  public function render_header_meta() {
646
- //echo apply_filters( 'mashsb_meta_tags', $html );
647
  echo apply_filters( 'mashsb_opengraph_meta', $this->render_open_graph_meta() );
648
  echo apply_filters( 'mashsb_twittercard_meta', $this->render_twitter_card_meta() );
649
  }
643
  * @return string HTML
644
  */
645
  public function render_header_meta() {
 
646
  echo apply_filters( 'mashsb_opengraph_meta', $this->render_open_graph_meta() );
647
  echo apply_filters( 'mashsb_twittercard_meta', $this->render_twitter_card_meta() );
648
  }
includes/helper.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  * Echo string when debug mode is enabled
5
  *
6
- * @param type $string
7
  */
8
  function mashecho($string){
9
  if(MASHSB_DEBUG){
@@ -24,18 +24,11 @@ function mashsb_curl_installed(){
24
  return false;
25
  }
26
 
27
- /*function mashsb_is_amp_endpoint(){
28
- if ( function_exists( 'is_amp_endpoint' )){
29
- return is_amp_endpoint();
30
- }
31
- }*/
32
-
33
-
34
  /**
35
  * Remove http(s) on WP site info
36
  *
37
- * @param type $string
38
- * @return type
39
  */
40
  function mashsb_replace_http($string){
41
  if (empty($string)){
@@ -50,7 +43,6 @@ function mashsb_share_buttons(){
50
  $content = '<li><a class="mashicon-facebook" target="_blank" href="https://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.mashshare.net%2F&display=popup&ref=plugin&src=like&app_id=449277011881884"><span class="icon"></span><span class="text">Share it</span></a></li>'.
51
  '<li><a class="mashicon-twitter" target="_blank" href="https://twitter.com/intent/tweet?hashtags=mashshare%2C&original_referer=http%3A%2F%2Fsrc.wordpress-develop.dev%2Fwp-admin%2Fadmin.php%3Fpage%3Dmashsb-settings%26tab%3Dgeneral&ref_src=twsrc%5Etfw&related=mashshare&text=I%20use%20MashShare%20- incredible%20great%20social%20media%20tool%20on%20my%20site%20'. mashsb_replace_http(get_bloginfo('wpurl')).'&tw_p=tweetbutton&url=https%3A%2F%2Fwww.mashshare.net%2F"><span class="icon"></span><span class="text">Tweet #mashshare</span></a></li>' .
52
  '<li><a class="mashicon-twitter" target="_blank" href="https://twitter.com/intent/follow?original_referer=http%3A%2F%2Fsrc.wordpress-develop.dev%2Fwp-admin%2Fadmin.php%3Fpage%3Dmashsb-settings%26tab%3Dgeneral&ref_src=twsrc%5Etfw&region=follow_link&screen_name=mashshare&tw_p=followbutton"><span class="icon"></span><span class="text">Follow @mashshare</span></a></li>';
53
- //'<li><a class="mashicon-twitter" target="_blank" href="https://twitter.com/intent/follow?original_referer=http%3A%2F%2Fsrc.wordpress-develop.dev%2Fwp-admin%2Fadmin.php%3Fpage%3Dmashsb-settings%26tab%3Dgeneral&ref_src=twsrc%5Etfw&region=follow_link&screen_name=renehermenau&tw_p=followbutton"><span class="icon"></span><span class="text">Follow @renehermenau</span></a></li>';
54
  return $content;
55
  }
56
 
3
  /**
4
  * Echo string when debug mode is enabled
5
  *
6
+ * @param string $string
7
  */
8
  function mashecho($string){
9
  if(MASHSB_DEBUG){
24
  return false;
25
  }
26
 
 
 
 
 
 
 
 
27
  /**
28
  * Remove http(s) on WP site info
29
  *
30
+ * @param string $string
31
+ * @return string
32
  */
33
  function mashsb_replace_http($string){
34
  if (empty($string)){
43
  $content = '<li><a class="mashicon-facebook" target="_blank" href="https://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.mashshare.net%2F&display=popup&ref=plugin&src=like&app_id=449277011881884"><span class="icon"></span><span class="text">Share it</span></a></li>'.
44
  '<li><a class="mashicon-twitter" target="_blank" href="https://twitter.com/intent/tweet?hashtags=mashshare%2C&original_referer=http%3A%2F%2Fsrc.wordpress-develop.dev%2Fwp-admin%2Fadmin.php%3Fpage%3Dmashsb-settings%26tab%3Dgeneral&ref_src=twsrc%5Etfw&related=mashshare&text=I%20use%20MashShare%20- incredible%20great%20social%20media%20tool%20on%20my%20site%20'. mashsb_replace_http(get_bloginfo('wpurl')).'&tw_p=tweetbutton&url=https%3A%2F%2Fwww.mashshare.net%2F"><span class="icon"></span><span class="text">Tweet #mashshare</span></a></li>' .
45
  '<li><a class="mashicon-twitter" target="_blank" href="https://twitter.com/intent/follow?original_referer=http%3A%2F%2Fsrc.wordpress-develop.dev%2Fwp-admin%2Fadmin.php%3Fpage%3Dmashsb-settings%26tab%3Dgeneral&ref_src=twsrc%5Etfw&region=follow_link&screen_name=mashshare&tw_p=followbutton"><span class="icon"></span><span class="text">Follow @mashshare</span></a></li>';
 
46
  return $content;
47
  }
48
 
includes/libraries/browser.php CHANGED
@@ -246,7 +246,7 @@
246
  * Reset all properties
247
  */
248
  function reset() {
249
- $this->_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
250
  $this->_browser_name = $this->BROWSER_UNKNOWN;
251
  $this->_version = $this->VERSION_UNKNOWN;
252
  $this->_platform = $this->PLATFORM_UNKNOWN;
246
  * Reset all properties
247
  */
248
  function reset() {
249
+ $this->_agent = isset($_SERVER['HTTP_USER_AGENT']) ? esc_html($_SERVER['HTTP_USER_AGENT']) : "";
250
  $this->_browser_name = $this->BROWSER_UNKNOWN;
251
  $this->_version = $this->VERSION_UNKNOWN;
252
  $this->_platform = $this->PLATFORM_UNKNOWN;
includes/sharecount-functions.php CHANGED
@@ -127,29 +127,6 @@ function mashsb_rate_limit_exceeded(){
127
  return true;
128
  }
129
 
130
-
131
- /**
132
- * Make sure that requests do not exceed 1req / 60sec(5min)
133
- * @return boolean
134
- */
135
- /* function mashsb_is_req_limited() {
136
- // Disable this function!
137
- return false;
138
-
139
- global $mashsb_debug;
140
-
141
- $data_timeout = get_transient('mashsb_limit_req');
142
-
143
- if (false === $data_timeout || empty($data_timeout) ){
144
- set_transient('mashsb_limit_req', '1', 60);
145
- $mashsb_debug[] = 'Temp Rate Limit not exceeded';
146
- return false;
147
- }
148
- $mashsb_debug[] = 'Temp Rate Limit Exceeded';
149
- return true;
150
-
151
- }*/
152
-
153
  /**
154
  * Check if cache time is expired and post must be refreshed
155
  *
127
  return true;
128
  }
129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  /**
131
  * Check if cache time is expired and post must be refreshed
132
  *
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.4
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.4' );
39
  }
40
 
41
  // Debug mode
@@ -120,7 +120,7 @@ if( !class_exists( 'Mashshare' ) ) :
120
  */
121
  public function __clone() {
122
  // Cloning instances of the class is forbidden
123
- _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'MASHSB' ), '1.0' );
124
  }
125
 
126
  /**
@@ -132,7 +132,7 @@ if( !class_exists( 'Mashshare' ) ) :
132
  */
133
  public function __wakeup() {
134
  // Unserializing instances of the class is forbidden
135
- _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'MASHSB' ), '1.0' );
136
  }
137
 
138
  /**
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.5
10
  * Text Domain: mashsb
11
  * Domain Path: /languages
12
 
35
 
36
  // Plugin version
37
  if( !defined( 'MASHSB_VERSION' ) ) {
38
+ define( 'MASHSB_VERSION', '3.8.5' );
39
  }
40
 
41
  // Debug mode
120
  */
121
  public function __clone() {
122
  // Cloning instances of the class is forbidden
123
+ _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'MASHSB' ), '1.0' );
124
  }
125
 
126
  /**
132
  */
133
  public function __wakeup() {
134
  // Unserializing instances of the class is forbidden
135
+ _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'MASHSB' ), '1.0' );
136
  }
137
 
138
  /**
phpcs.xml.dist ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <ruleset name="MashShare Coding Standards">
3
+
4
+ <config name="installed_paths" value="vendor/phpcompatibility/php-compatibility" />
5
+
6
+ <exclude-pattern>/vendor/*</exclude-pattern>
7
+
8
+ <arg name="extensions" value="php"/>
9
+
10
+ <arg name="basepath" value="/"/>
11
+ <arg name="colors"/>
12
+ <arg name="parallel" value="8"/>
13
+ <arg value="sp"/>
14
+
15
+ <rule ref="Generic.ControlStructures.DisallowYodaConditions.Found">
16
+ <severity>3</severity>
17
+ <type>warning</type>
18
+ </rule>
19
+
20
+ <config name="testVersion" value="5.6-"/>
21
+ <rule ref="PHPCompatibility">
22
+ <include-pattern>*\.php$</include-pattern>
23
+ </rule>
24
+
25
+ <rule ref="./vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Security/EscapeOutputSniff.php">
26
+ <include-pattern>*\.php$</include-pattern>
27
+ </rule>
28
+
29
+ <rule ref="./vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Security/ValidatedSanitizedInputSniff.php">
30
+ <include-pattern>*\.php$</include-pattern>
31
+ </rule>
32
+
33
+ <rule ref="./vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Security/NonceVerificationSniff.php">
34
+ <include-pattern>*\.php$</include-pattern>
35
+ </rule>
36
+
37
+ <rule ref="./vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Security/SafeRedirectSniff.php">
38
+ <include-pattern>*\.php$</include-pattern>
39
+ </rule>
40
+
41
+ </ruleset>
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.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,6 +249,9 @@ Read here more about this: http://docs.mashshare.net/article/10-facebook-is-show
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
 
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.5
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.5 =
253
+ * Fix: Add missing sanitization and escaping of input and output values to prevent possible XSS attempts.
254
+
255
  = 3.8.4 =
256
  * Fix: Improve sanitization on input values and escape output values. Fixes a low severity Authenticated Stored Cross-Site Scripting (XSS) vulnerability
257
 
templates/sidebar.php CHANGED
@@ -14,42 +14,42 @@ $user = wp_get_current_user();
14
 
15
  <div id="mashsb-sidebar">
16
 
17
- <a class="mashsb-banner" target="_blank" rel="noopener" href="https://www.mashshare.net/pricing/?utm_source=insideplugin&utm_medium=userwebsite&utm_content=sidebar&utm_campaign=freeplugin"><img src="<?php echo MASHSB_PLUGIN_URL . 'assets/images/upgrade_to_pro.png'; ?>" width="300" height="250" alt="<?php _e( 'Increase your Shares and Social Traffic', 'mashsb' ); ?>" /></a>
18
 
19
- <form method="post" action="<?php echo $post; ?>" target="_blank" rel="noopener" class="subscribe block" style="display:none;">
20
- <h2><?php _e( 'Get More Traffic', 'mashsb' ); ?></h2>
21
 
22
  <?php $user = wp_get_current_user(); ?>
23
 
24
  <p class="interesting">
25
- <?php echo wptexturize( __( "Submit your name and email and we'll send you tips and tricks how to get more traffic by using MashShare", 'mashsb' ) ); ?>
26
  </p>
27
 
28
  <div class="field">
29
- <input type="email" name="email" value="<?php echo esc_attr( $user->user_email ); ?>" placeholder="<?php _e( 'Your Email', 'mashsb' ); ?>"/>
30
  </div>
31
 
32
  <div class="field">
33
- <input type="text" name="firstname" value="<?php echo esc_attr( trim( $user->user_firstname ) ); ?>" placeholder="<?php _e( 'First Name', 'mashsb' ); ?>"/>
34
  </div>
35
 
36
  <div class="field">
37
- <input type="text" name="lastname" value="<?php echo esc_attr( trim( $user->user_lastname ) ); ?>" placeholder="<?php _e( 'Last Name', 'mashsb' ); ?>"/>
38
  </div>
39
 
40
  <input type="hidden" name="campaigns[]" value="4" />
41
  <input type="hidden" name="source" value="8" />
42
 
43
  <div class="field submit-button">
44
- <input type="submit" class="button" value="<?php _e( 'Send me the free stuff', 'mashsb' ); ?>"/>
45
  </div>
46
 
47
  <p class="promise">
48
- <?php _e( 'Your email will not be used for anything else and you can unsubscribe with 1-click anytime.', 'mashsb' ); ?>
49
  </p>
50
- <p style="text-align: center;margin-top:25px;"><?php echo sprintf(__( '<a href="%s" target="_new" style="font-weight:bold;color:#00adff;border: 1px solid #00adff;padding:6px;">Visit Our Affiliate Program', 'mashsb'), 'https://www.mashshare.net/become-partner/?utm_source=mashsbadmin&utm_medium=website&utm_campaign=see_our_affiliate_program' ); ?></a></p>
51
-
52
 
 
53
  </form>
54
 
55
  <div class="block testimonial">
14
 
15
  <div id="mashsb-sidebar">
16
 
17
+ <a class="mashsb-banner" target="_blank" rel="noopener" href="https://www.mashshare.net/pricing/?utm_source=insideplugin&utm_medium=userwebsite&utm_content=sidebar&utm_campaign=freeplugin"><img src="<?php echo esc_url(MASHSB_PLUGIN_URL) . 'assets/images/upgrade_to_pro.png'; ?>" width="300" height="250" alt="<?php esc_html_e( 'Increase your Shares and Social Traffic', 'mashsb' ); ?>" /></a>
18
 
19
+ <form method="post" action="<?php echo esc_url($post); ?>" target="_blank" rel="noopener" class="subscribe block" style="display:none;">
20
+ <h2><?php esc_html_e( 'Get More Traffic', 'mashsb' ); ?></h2>
21
 
22
  <?php $user = wp_get_current_user(); ?>
23
 
24
  <p class="interesting">
25
+ <?php esc_html_e( __( "Submit your name and email and we'll send you tips and tricks how to get more traffic by using MashShare", 'mashsb' ) ); ?>
26
  </p>
27
 
28
  <div class="field">
29
+ <input type="email" name="email" value="<?php echo esc_attr( $user->user_email ); ?>" placeholder="<?php esc_html_e( 'Your Email', 'mashsb' ); ?>"/>
30
  </div>
31
 
32
  <div class="field">
33
+ <input type="text" name="firstname" value="<?php echo esc_attr( trim( $user->user_firstname ) ); ?>" placeholder="<?php esc_html_e( 'First Name', 'mashsb' ); ?>"/>
34
  </div>
35
 
36
  <div class="field">
37
+ <input type="text" name="lastname" value="<?php echo esc_attr( trim( $user->user_lastname ) ); ?>" placeholder="<?php esc_html_e( 'Last Name', 'mashsb' ); ?>"/>
38
  </div>
39
 
40
  <input type="hidden" name="campaigns[]" value="4" />
41
  <input type="hidden" name="source" value="8" />
42
 
43
  <div class="field submit-button">
44
+ <input type="submit" class="button" value="<?php esc_html_e( 'Send me the free stuff', 'mashsb' ); ?>"/>
45
  </div>
46
 
47
  <p class="promise">
48
+ <?php esc_html_e( 'Your email will not be used for anything else and you can unsubscribe with 1-click anytime.', 'mashsb' ); ?>
49
  </p>
50
+ <p style="text-align: center;margin-top:25px;"><?php echo wp_kses_post(sprintf(__( '<a href="%s" target="_new" style="font-weight:bold;color:#00adff;border: 1px solid #00adff;padding:6px;">Visit Our Affiliate Program', 'mashsb'), 'https://www.mashshare.net/become-partner/?utm_source=mashsbadmin&utm_medium=website&utm_campaign=see_our_affiliate_program' )); ?></a></p>
 
51
 
52
+
53
  </form>
54
 
55
  <div class="block testimonial">
templates/sidebar_mail.php CHANGED
@@ -14,40 +14,40 @@ $user = wp_get_current_user();
14
 
15
  <div id="mashsb-sidebar">
16
 
17
- <a class="mashsb-banner" target="_blank" rel="noopener" href="https://www.mashshare.net/pricing/?utm_source=insideplugin&utm_medium=userwebsite&utm_content=sidebar&utm_campaign=freeplugin"><img src="<?php echo MASHSB_PLUGIN_URL . 'assets/images/upgrade_to_pro.png'; ?>" width="300" height="250" alt="<?php _e( 'Increase your Shares and Social Traffic', 'mashsb' ); ?>" /></a>
18
 
19
- <form method="post" action="<?php echo $post; ?>" target="_blank" class="subscribe block">
20
- <h2><?php _e( 'Get 20% Off!', 'mashsb' ); ?></h2>
21
 
22
  <?php $user = wp_get_current_user(); ?>
23
 
24
  <p class="interesting">
25
- <?php echo wptexturize( __( "Submit your name and email and we'll send you a coupon for 20% off your upgrade to the pro version.", 'mashsb' ) ); ?>
26
  </p>
27
 
28
  <div class="field">
29
- <input type="email" name="email" value="<?php echo esc_attr( $user->user_email ); ?>" placeholder="<?php _e( 'Your Email', 'mashsb' ); ?>"/>
30
  </div>
31
 
32
  <div class="field">
33
- <input type="text" name="firstname" value="<?php echo esc_attr( trim( $user->user_firstname ) ); ?>" placeholder="<?php _e( 'First Name', 'mashsb' ); ?>"/>
34
  </div>
35
 
36
  <div class="field">
37
- <input type="text" name="lastname" value="<?php echo esc_attr( trim( $user->user_lastname ) ); ?>" placeholder="<?php _e( 'Last Name', 'mashsb' ); ?>"/>
38
  </div>
39
 
40
  <input type="hidden" name="campaigns[]" value="4" />
41
  <input type="hidden" name="source" value="8" />
42
 
43
  <div class="field submit-button">
44
- <input type="submit" class="button" value="<?php _e( 'Send me the coupon', 'mashsb' ); ?>"/>
45
  </div>
46
 
47
  <p class="promise">
48
- <?php _e( 'Your email will not be used for anything else and you can unsubscribe with 1-click anytime.', 'mashsb' ); ?>
49
  </p>
50
- <p style="text-align: center;margin-top:25px;"><?php echo sprintf(__( '<a href="%s" target="_new" style="font-weight:bold;color:#00adff;border: 1px solid #00adff;padding:6px;">Visit Our Affiliate Program', 'mashsb'), 'https://www.mashshare.net/become-partner/?utm_source=mashsbadmin&utm_medium=website&utm_campaign=see_our_affiliate_program' ); ?></a></p>
51
 
52
 
53
  </form>
14
 
15
  <div id="mashsb-sidebar">
16
 
17
+ <a class="mashsb-banner" target="_blank" rel="noopener" href="https://www.mashshare.net/pricing/?utm_source=insideplugin&utm_medium=userwebsite&utm_content=sidebar&utm_campaign=freeplugin"><img src="<?php echo esc_url(MASHSB_PLUGIN_URL . 'assets/images/upgrade_to_pro.png'); ?>" width="300" height="250" alt="<?php esc_html_e( 'Increase your Shares and Social Traffic', 'mashsb' ); ?>" /></a>
18
 
19
+ <form method="post" action="<?php echo esc_url($post); ?>" target="_blank" class="subscribe block">
20
+ <h2><?php esc_html_e( 'Get 20% Off!', 'mashsb' ); ?></h2>
21
 
22
  <?php $user = wp_get_current_user(); ?>
23
 
24
  <p class="interesting">
25
+ <?php esc_html_e( "Submit your name and email and we'll send you a coupon for 20% off your upgrade to the pro version.", 'mashsb' ); ?>
26
  </p>
27
 
28
  <div class="field">
29
+ <input type="email" name="email" value="<?php echo esc_attr( $user->user_email ); ?>" placeholder="<?php esc_html_e( 'Your Email', 'mashsb' ); ?>"/>
30
  </div>
31
 
32
  <div class="field">
33
+ <input type="text" name="firstname" value="<?php echo esc_attr( trim( $user->user_firstname ) ); ?>" placeholder="<?php esc_html_e( 'First Name', 'mashsb' ); ?>"/>
34
  </div>
35
 
36
  <div class="field">
37
+ <input type="text" name="lastname" value="<?php echo esc_attr( trim( $user->user_lastname ) ); ?>" placeholder="<?php esc_html_e( 'Last Name', 'mashsb' ); ?>"/>
38
  </div>
39
 
40
  <input type="hidden" name="campaigns[]" value="4" />
41
  <input type="hidden" name="source" value="8" />
42
 
43
  <div class="field submit-button">
44
+ <input type="submit" class="button" value="<?php esc_html_e( 'Send me the coupon', 'mashsb' ); ?>"/>
45
  </div>
46
 
47
  <p class="promise">
48
+ <?php esc_html_e( 'Your email will not be used for anything else and you can unsubscribe with 1-click anytime.', 'mashsb' ); ?>
49
  </p>
50
+ <p style="text-align: center;margin-top:25px;"><?php echo wp_kses_post(sprintf(__( '<a href="%s" target="_new" style="font-weight:bold;color:#00adff;border: 1px solid #00adff;padding:6px;">Visit Our Affiliate Program', 'mashsb'), 'https://www.mashshare.net/become-partner/?utm_source=mashsbadmin&utm_medium=website&utm_campaign=see_our_affiliate_program' )); ?></a></p>
51
 
52
 
53
  </form>