Changeset 2939166 for wp-slimstat
- Timestamp:
- 07/16/2023 01:26:02 PM (3 years ago)
- Location:
- wp-slimstat
- Files:
-
- 10 edited
- 1 copied
-
tags/5.0.6 (copied) (copied from wp-slimstat/trunk)
-
tags/5.0.6/admin/index.php (modified) (5 diffs)
-
tags/5.0.6/admin/view/right-now.php (modified) (1 diff)
-
tags/5.0.6/admin/view/wp-slimstat-reports.php (modified) (3 diffs)
-
tags/5.0.6/readme.txt (modified) (2 diffs)
-
tags/5.0.6/wp-slimstat.php (modified) (1 diff)
-
trunk/admin/index.php (modified) (5 diffs)
-
trunk/admin/view/right-now.php (modified) (1 diff)
-
trunk/admin/view/wp-slimstat-reports.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/wp-slimstat.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wp-slimstat/tags/5.0.6/admin/index.php
r2893473 r2939166 211 211 // Dashboard Widgets 212 212 if (wp_slimstat::$settings['add_dashboard_widgets'] == 'on') { 213 $temp = strlen(sanitize_url(wp_unslash($_SERVER['REQUEST_URI']))) - 10; 214 215 if (strpos($_SERVER['REQUEST_URI'], 'index.php') !== false || ($temp >= 0 && strpos($_SERVER['REQUEST_URI'], '/wp-admin/', $temp) !== false)) { 213 $request_length = strlen(sanitize_url(wp_unslash($_SERVER['REQUEST_URI']))); 214 $temp = $request_length - 10; 215 216 if (strpos($_SERVER['REQUEST_URI'], 'index.php') !== false || ($temp >= 0 && $temp <= $request_length && strpos($_SERVER['REQUEST_URI'], '/wp-admin/', $temp) !== false)) { 216 217 add_action('admin_enqueue_scripts', array(__CLASS__, 'wp_slimstat_enqueue_scripts')); 217 218 add_action('admin_enqueue_scripts', array(__CLASS__, 'wp_slimstat_stylesheet')); 218 219 } 219 220 220 221 221 add_action('wp_dashboard_setup', array(__CLASS__, 'add_dashboard_widgets')); … … 243 243 wp_schedule_event(time(), 'twicedaily', 'wp_slimstat_purge'); 244 244 } 245 246 self::initFeedback(); 245 247 } 246 248 // END: init … … 895 897 $tag = current_filter(); 896 898 897 if (!empty($tag) ) {899 if (!empty($tag) && current_user_can('manage_options') && wp_verify_nonce($_POST['security'], 'meta-box-order')) { 898 900 $tag = str_replace('wp_ajax_slimstat_', '', $tag); 899 901 wp_slimstat::$settings[$tag] = 'no'; … … 914 916 $my_wpdb = apply_filters('slimstat_custom_wpdb', $GLOBALS['wpdb']); 915 917 $pageview_id = intval($_POST['pageview_id']); 918 919 // Delete page view if user has enough access 920 $current_user_can_delete = (current_user_can(wp_slimstat::$settings['capability_can_admin']) && !is_network_admin()); 921 if (!$current_user_can_delete || !wp_verify_nonce($_POST['security'], 'meta-box-order')) { 922 return; 923 } 916 924 $my_wpdb->query("DELETE ts FROM {$GLOBALS[ 'wpdb' ]->prefix}slim_stats ts WHERE ts.id = $pageview_id"); 917 925 exit(); … … 1104 1112 } 1105 1113 // END: _create_table 1114 1115 /** 1116 * Init FeedbackBird widget a third-party service to get feedbacks from users 1117 * 1118 * @url https://feedbackbird.io 1119 * 1120 * @return void 1121 */ 1122 private static function initFeedback() 1123 { 1124 add_action('admin_enqueue_scripts', function () { 1125 $screen = get_current_screen(); 1126 1127 if (stristr($screen->id, 'slimview')) { 1128 wp_enqueue_script('feedbackbird-app-script', 'https://cdn.jsdelivr.net/gh/feedbackbird/assets@master/wp/app.js?uid=01H5FBKA9Z5M2VJWQXZSX4Q7MS'); 1129 wp_add_inline_script('feedbackbird-app-script', sprintf('var feedbackBirdObject = %s;', json_encode([ 1130 'user_email' => function_exists('wp_get_current_user') ? wp_get_current_user()->user_email : '', 1131 'meta' => [ 1132 'php_version' => PHP_VERSION, 1133 'active_plugins' => array_map(function ($plugin, $pluginPath) { 1134 return [ 1135 'name' => $plugin['Name'], 1136 'version' => $plugin['Version'], 1137 'status' => is_plugin_active($pluginPath) ? 'active' : 'deactivate', 1138 ]; 1139 }, get_plugins(), array_keys(get_plugins())), 1140 ] 1141 ]))); 1142 1143 add_filter('script_loader_tag', function ($tag, $handle, $src) { 1144 if ('feedbackbird-app-script' === $handle) { 1145 return preg_replace('/^<script /i', '<script type="module" crossorigin="crossorigin" ', $tag); 1146 } 1147 return $tag; 1148 }, 10, 3); 1149 } 1150 }); 1151 } 1106 1152 } 1107 1153 // END: class declaration -
wp-slimstat/tags/5.0.6/admin/view/right-now.php
r2891987 r2939166 28 28 wp_slimstat_db::$debug_message = ''; 29 29 $all_results = wp_slimstat_db::get_recent(wp_slimstat_reports::$reports['slim_p7_02']['callback_args']); 30 31 // Backward compatibility 32 if (!$all_results) { 33 $all_results = array(); 34 } 35 30 36 $results = array_slice( 31 37 $all_results, -
wp-slimstat/tags/5.0.6/admin/view/wp-slimstat-reports.php
r2916675 r2939166 580 580 'type' => 'recent', 581 581 'columns' => 'searchterms', 582 'where' => 'content_type LIKE "% search%" AND searchterms <> "" AND searchterms IS NOT NULL',582 'where' => 'content_type LIKE "%%search%%" AND searchterms <> "" AND searchterms IS NOT NULL', 583 583 'raw' => array('wp_slimstat_db', 'get_recent') 584 584 ), … … 655 655 'type' => 'top', 656 656 'columns' => 'searchterms', 657 'where' => 'content_type LIKE "% search%" AND searchterms <> "" AND searchterms IS NOT NULL',657 'where' => 'content_type LIKE "%%search%%" AND searchterms <> "" AND searchterms IS NOT NULL', 658 658 'raw' => array('wp_slimstat_db', 'get_top') 659 659 ), … … 1527 1527 { 1528 1528 $countries = wp_slimstat_db::get_top('country'); 1529 1530 // Backward compatibility 1531 if (!$countries) { 1532 $countries = array(); 1533 } 1534 1529 1535 $recent_visits = wp_slimstat_db::get_recent('location', '', '', true, '', 'city'); 1530 1536 -
wp-slimstat/tags/5.0.6/readme.txt
r2916675 r2939166 6 6 Requires PHP: 7.4+ 7 7 Tested up to: 6.2 8 Stable tag: 5.0. 5.18 Stable tag: 5.0.6 9 9 10 10 == Description == … … 49 49 50 50 == Changelog == 51 = 5.0.6 = 52 * [New] Integrated a Feedback button powered by [FeedbackBird!](https://feedbackbird.io/) in the admin area to gather user feedback. 53 * [Fix] Resolve STRPOS error when enqueuing scripts. 54 * [Fix] Ensure backward compatibility for null values. 55 * [Fix] Fix broken access in delete_pageView and notices_handler functions. 56 * [Fix] Resolve escaping issue with literal '%' character in wpdb->prepare(). 57 51 58 = 5.0.5.1 = 52 59 * [Fix] Backward compatibility -
wp-slimstat/tags/5.0.6/wp-slimstat.php
r2916675 r2939166 4 4 Plugin URI: https://wp-slimstat.com/ 5 5 Description: The leading web analytics plugin for WordPress 6 Version: 5.0. 5.16 Version: 5.0.6 7 7 Author: Jason Crouse, VeronaLabs 8 8 Text Domain: wp-slimstat -
wp-slimstat/trunk/admin/index.php
r2893473 r2939166 211 211 // Dashboard Widgets 212 212 if (wp_slimstat::$settings['add_dashboard_widgets'] == 'on') { 213 $temp = strlen(sanitize_url(wp_unslash($_SERVER['REQUEST_URI']))) - 10; 214 215 if (strpos($_SERVER['REQUEST_URI'], 'index.php') !== false || ($temp >= 0 && strpos($_SERVER['REQUEST_URI'], '/wp-admin/', $temp) !== false)) { 213 $request_length = strlen(sanitize_url(wp_unslash($_SERVER['REQUEST_URI']))); 214 $temp = $request_length - 10; 215 216 if (strpos($_SERVER['REQUEST_URI'], 'index.php') !== false || ($temp >= 0 && $temp <= $request_length && strpos($_SERVER['REQUEST_URI'], '/wp-admin/', $temp) !== false)) { 216 217 add_action('admin_enqueue_scripts', array(__CLASS__, 'wp_slimstat_enqueue_scripts')); 217 218 add_action('admin_enqueue_scripts', array(__CLASS__, 'wp_slimstat_stylesheet')); 218 219 } 219 220 220 221 221 add_action('wp_dashboard_setup', array(__CLASS__, 'add_dashboard_widgets')); … … 243 243 wp_schedule_event(time(), 'twicedaily', 'wp_slimstat_purge'); 244 244 } 245 246 self::initFeedback(); 245 247 } 246 248 // END: init … … 895 897 $tag = current_filter(); 896 898 897 if (!empty($tag) ) {899 if (!empty($tag) && current_user_can('manage_options') && wp_verify_nonce($_POST['security'], 'meta-box-order')) { 898 900 $tag = str_replace('wp_ajax_slimstat_', '', $tag); 899 901 wp_slimstat::$settings[$tag] = 'no'; … … 914 916 $my_wpdb = apply_filters('slimstat_custom_wpdb', $GLOBALS['wpdb']); 915 917 $pageview_id = intval($_POST['pageview_id']); 918 919 // Delete page view if user has enough access 920 $current_user_can_delete = (current_user_can(wp_slimstat::$settings['capability_can_admin']) && !is_network_admin()); 921 if (!$current_user_can_delete || !wp_verify_nonce($_POST['security'], 'meta-box-order')) { 922 return; 923 } 916 924 $my_wpdb->query("DELETE ts FROM {$GLOBALS[ 'wpdb' ]->prefix}slim_stats ts WHERE ts.id = $pageview_id"); 917 925 exit(); … … 1104 1112 } 1105 1113 // END: _create_table 1114 1115 /** 1116 * Init FeedbackBird widget a third-party service to get feedbacks from users 1117 * 1118 * @url https://feedbackbird.io 1119 * 1120 * @return void 1121 */ 1122 private static function initFeedback() 1123 { 1124 add_action('admin_enqueue_scripts', function () { 1125 $screen = get_current_screen(); 1126 1127 if (stristr($screen->id, 'slimview')) { 1128 wp_enqueue_script('feedbackbird-app-script', 'https://cdn.jsdelivr.net/gh/feedbackbird/assets@master/wp/app.js?uid=01H5FBKA9Z5M2VJWQXZSX4Q7MS'); 1129 wp_add_inline_script('feedbackbird-app-script', sprintf('var feedbackBirdObject = %s;', json_encode([ 1130 'user_email' => function_exists('wp_get_current_user') ? wp_get_current_user()->user_email : '', 1131 'meta' => [ 1132 'php_version' => PHP_VERSION, 1133 'active_plugins' => array_map(function ($plugin, $pluginPath) { 1134 return [ 1135 'name' => $plugin['Name'], 1136 'version' => $plugin['Version'], 1137 'status' => is_plugin_active($pluginPath) ? 'active' : 'deactivate', 1138 ]; 1139 }, get_plugins(), array_keys(get_plugins())), 1140 ] 1141 ]))); 1142 1143 add_filter('script_loader_tag', function ($tag, $handle, $src) { 1144 if ('feedbackbird-app-script' === $handle) { 1145 return preg_replace('/^<script /i', '<script type="module" crossorigin="crossorigin" ', $tag); 1146 } 1147 return $tag; 1148 }, 10, 3); 1149 } 1150 }); 1151 } 1106 1152 } 1107 1153 // END: class declaration -
wp-slimstat/trunk/admin/view/right-now.php
r2891987 r2939166 28 28 wp_slimstat_db::$debug_message = ''; 29 29 $all_results = wp_slimstat_db::get_recent(wp_slimstat_reports::$reports['slim_p7_02']['callback_args']); 30 31 // Backward compatibility 32 if (!$all_results) { 33 $all_results = array(); 34 } 35 30 36 $results = array_slice( 31 37 $all_results, -
wp-slimstat/trunk/admin/view/wp-slimstat-reports.php
r2916675 r2939166 580 580 'type' => 'recent', 581 581 'columns' => 'searchterms', 582 'where' => 'content_type LIKE "% search%" AND searchterms <> "" AND searchterms IS NOT NULL',582 'where' => 'content_type LIKE "%%search%%" AND searchterms <> "" AND searchterms IS NOT NULL', 583 583 'raw' => array('wp_slimstat_db', 'get_recent') 584 584 ), … … 655 655 'type' => 'top', 656 656 'columns' => 'searchterms', 657 'where' => 'content_type LIKE "% search%" AND searchterms <> "" AND searchterms IS NOT NULL',657 'where' => 'content_type LIKE "%%search%%" AND searchterms <> "" AND searchterms IS NOT NULL', 658 658 'raw' => array('wp_slimstat_db', 'get_top') 659 659 ), … … 1527 1527 { 1528 1528 $countries = wp_slimstat_db::get_top('country'); 1529 1530 // Backward compatibility 1531 if (!$countries) { 1532 $countries = array(); 1533 } 1534 1529 1535 $recent_visits = wp_slimstat_db::get_recent('location', '', '', true, '', 'city'); 1530 1536 -
wp-slimstat/trunk/readme.txt
r2916675 r2939166 6 6 Requires PHP: 7.4+ 7 7 Tested up to: 6.2 8 Stable tag: 5.0. 5.18 Stable tag: 5.0.6 9 9 10 10 == Description == … … 49 49 50 50 == Changelog == 51 = 5.0.6 = 52 * [New] Integrated a Feedback button powered by [FeedbackBird!](https://feedbackbird.io/) in the admin area to gather user feedback. 53 * [Fix] Resolve STRPOS error when enqueuing scripts. 54 * [Fix] Ensure backward compatibility for null values. 55 * [Fix] Fix broken access in delete_pageView and notices_handler functions. 56 * [Fix] Resolve escaping issue with literal '%' character in wpdb->prepare(). 57 51 58 = 5.0.5.1 = 52 59 * [Fix] Backward compatibility -
wp-slimstat/trunk/wp-slimstat.php
r2916675 r2939166 4 4 Plugin URI: https://wp-slimstat.com/ 5 5 Description: The leading web analytics plugin for WordPress 6 Version: 5.0. 5.16 Version: 5.0.6 7 7 Author: Jason Crouse, VeronaLabs 8 8 Text Domain: wp-slimstat
Note: See TracChangeset
for help on using the changeset viewer.