Changeset 3178540
- Timestamp:
- 10/30/2024 07:17:41 AM (14 months ago)
- Location:
- http-requests-manager
- Files:
-
- 4 edited
- 6 copied
-
tags/1.3.6 (copied) (copied from http-requests-manager/trunk)
-
tags/1.3.6/assets/css/admin.css (copied) (copied from http-requests-manager/trunk/assets/css/admin.css)
-
tags/1.3.6/assets/js/admin.js (copied) (copied from http-requests-manager/trunk/assets/js/admin.js) (5 diffs)
-
tags/1.3.6/http-requests-manager.php (copied) (copied from http-requests-manager/trunk/http-requests-manager.php) (16 diffs)
-
tags/1.3.6/readme.txt (copied) (copied from http-requests-manager/trunk/readme.txt) (5 diffs)
-
tags/1.3.6/templates/page-settings.php (copied) (copied from http-requests-manager/trunk/templates/page-settings.php) (3 diffs)
-
trunk/assets/js/admin.js (modified) (5 diffs)
-
trunk/http-requests-manager.php (modified) (16 diffs)
-
trunk/readme.txt (modified) (5 diffs)
-
trunk/templates/page-settings.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
http-requests-manager/tags/1.3.6/assets/js/admin.js
r3145574 r3178540 649 649 if (row.request_source === 'core') 650 650 { 651 var more_info = VPHRM.row_core_more_info(row, request_args);652 if (more_info)653 { 654 row.request_source += ': ' +more_info;651 var more_info = VPHRM.row_core_more_info(row,request_args); 652 if(more_info) 653 { 654 row.request_source += ': '+more_info; 655 655 } 656 656 } … … 781 781 return 'health'; 782 782 } 783 if (backtrace[x] === 'WP_Upgrader->download_package')784 {785 return 'download';786 }787 783 } 788 784 … … 790 786 // check url 791 787 var base_url = row['url'].split('?')[0].replace('http://', 'https://'); 792 788 793 789 if (base_url.search('https://api.wordpress.org/plugins/update-check/') != -1) 794 790 { … … 822 818 { 823 819 return 'translations'; 824 }825 if (base_url.search('https://downloads.wordpress.org/') != -1)826 {827 return 'download';828 820 } 829 821 … … 882 874 { 883 875 page.badges = []; 884 876 885 877 page.badges.push('<i class="vphrm-badge"><b>page_type:</b> ' + page.page_type + '</i>'); 886 878 page.badges.push('<i class="vphrm-badge"><b>is_user_logged_in:</b> ' + (page.info.is_user_logged_in ? 'true' : 'false') + '</i>'); -
http-requests-manager/tags/1.3.6/http-requests-manager.php
r3145574 r3178540 5 5 Plugin URI: https://veppa.com/http-requests-manager/ 6 6 Description: Limit, Debug, Optimize WP_HTTP requests. Limit by request count, page load time, reduce timeout for each request. Speed up login and admin pages. 7 Version: 1.3. 57 Version: 1.3.6 8 8 Author: veppa 9 9 Author URI: https://veppa.com/ … … 31 31 /** 32 32 * TODO: 33 34 - marketing: remove all other affiliate links. 35 - - incorporate video tutorials to interface with popup/direct link. 36 37 33 * 34 - add blocking by theme 35 - add blocking by core function 36 - disable all enclosure checks and rely only on file extension 38 37 - safe-mode: show instruction about safe mode and operation mode on beginning. after dismissed move note to bottom. 39 38 - [maybe] group prevent enclosure checks and pingbacks. write 1 log instead of 50+ … … 42 41 - remove duplicate info about requests in page array. 43 42 - optimization: define hooks only for selected mode and logging combination. define hooks granularly. 44 45 43 ------------------------------------------- 46 44 * conflict test. … … 72 70 - - on shutdown 73 71 74 75 update plugin tags:76 tag total 1st page min top poistion77 -----------------------------------------78 wp_http 3 0 2000 279 log 100 400 200k80 - api 400 500081 - requests 5 0 2000 282 - update-checks 3 0 2000 283 --84 + debug 200 100085 + optimization 120 100086 + limit 40 10 10k87 --88 update 140 2000 700k89 speed 180 200090 optimize 140 9k 5m91 performance 380 100k 5m92 block 740 20k 700k93 *94 72 */ 95 73 defined('ABSPATH') or exit; … … 97 75 class HTTP_Requests_Manager 98 76 { 99 100 const VERSION = '1.3. 5';77 78 const VERSION = '1.3.6'; 101 79 const ID = 'http-requests-manager'; 102 80 const TIMEOUT = 2; … … 115 93 private static $request_action; 116 94 private static $request_action_info; 117 private static $custom_rules_limit = 10;95 private static $custom_rules_limit = 30; 118 96 private static $page_id; 119 97 private static $mu_plugin_file_name = '/a-http-requests-manager.php'; … … 1732 1710 1733 1711 /** 1734 * Count included plugin, theme, core files 1735 * 1736 * $arr_file_count = array( 1737 * core => 123 1738 * plugin => array( 1739 * plugin-slug => 2, 1740 * plugin-slug2 => 3, 1741 * plugin-slug3 => 6, 1742 * ) 1743 * theme => array( theme-slug => 9 ) 1744 * plugin_count => 3 1745 * ); 1712 * Return loaded plugin slugs as array 1746 1713 * 1747 1714 * @return array 1748 1715 */ 1749 static public function get_included_file_counts() 1750 { 1751 // count included files 1716 static public function get_loaded_plugins() 1717 { 1718 $plugin_slugs = array(); 1719 1720 static $abspath = null; 1721 if(is_null($abspath)) 1722 { 1723 $abspath = str_replace('\\', '/', ABSPATH); 1724 } 1725 1726 1752 1727 $incs = get_included_files(); 1753 1754 // count files per plugin, theme, core 1755 $arr_file_count = array( 1756 'total' => count($incs), 1757 'core' => 0, 1758 'plugin' => array() 1759 ); 1760 foreach($incs as $file) 1761 { 1762 $file_info = self::get_file_type($file); 1763 $type = $file_info['type']; 1764 $slug = isset($file_info['slug']) ? $file_info['slug'] : false; 1765 1766 if(false !== $slug) 1767 { 1768 if(!isset($arr_file_count[$type][$slug])) 1769 { 1770 $arr_file_count[$type][$slug] = 0; 1771 } 1772 $arr_file_count[$type][$slug]++; 1773 } 1774 else 1775 { 1776 $arr_file_count[$type]++; 1777 } 1778 } 1779 1780 if(isset($arr_file_count['plugin'])) 1781 { 1782 $arr_file_count['plugin_count'] = count($arr_file_count['plugin']); 1783 } 1784 1785 return $arr_file_count; 1786 } 1787 1788 /** 1789 * Return loaded plugin slugs as array 1790 * 1791 * @return array 1792 */ 1793 static public function get_loaded_plugins() 1794 { 1795 // get all loaded plugins as comma seperated string 1796 $file_counts = self::get_included_file_counts(); 1797 1798 $plugin_slugs = array(); 1799 1800 if(!empty($file_counts['plugin'])) 1801 { 1802 $plugin_slugs = array_keys($file_counts['plugin']); 1803 } 1728 $incs = implode("\n", $incs); 1729 $incs = str_replace('\\', '/', $incs); 1730 $incs = str_replace($abspath, '', $incs); 1731 1732 preg_match_all('(wp-content\/plugins\/([^/]*))', $incs, $matches); 1733 1734 if(!empty($matches[1])) 1735 { 1736 $plugin_slugs = array_unique($matches[1]); 1737 } 1738 1739 /* echo "<!-- get_loaded_plugins \n"; 1740 echo " --- \n" . $incs . " --- \n"; 1741 print_r($matches); 1742 echo " ---- \n"; 1743 print_r($plugin_slugs); 1744 echo " -->\n"; 1745 */ 1804 1746 1805 1747 return $plugin_slugs; … … 2390 2332 } 2391 2333 2334 static private function normalize_path_if_needed($file) 2335 { 2336 if(strpos($file, '\\')) 2337 { 2338 return wp_normalize_path($file); 2339 } 2340 return $file; 2341 } 2342 2392 2343 /** 2393 2344 * detect if file related to plugin, theme or core. Return array with wp root relative file name, type and slug of plugin. … … 2402 2353 if(is_null($abspath)) 2403 2354 { 2404 $abspath = wp_normalize_path(ABSPATH);2355 $abspath = self::normalize_path_if_needed(ABSPATH); 2405 2356 } 2406 2357 … … 2408 2359 $plugin_dir_prefix = 'wp-content/plugins/'; 2409 2360 2410 $file = wp_normalize_path($file);2361 $file = self::normalize_path_if_needed($file); 2411 2362 $file_short = self::remove_prefix($file, $abspath); 2412 2363 … … 2417 2368 2418 2369 // plugin or theme 2419 if( false !== strpos($file_short, $plugin_dir_prefix))2370 if(0 === strpos($file_short, $plugin_dir_prefix)) 2420 2371 { 2421 2372 // this is plugin … … 2424 2375 $row['type'] = 'plugin'; 2425 2376 } 2426 elseif( false !== strpos($file_short, $theme_dir_prefix))2377 elseif(0 === strpos($file_short, $theme_dir_prefix)) 2427 2378 { 2428 2379 // this is theme … … 2525 2476 static public function remove_prefix($str, $prefix) 2526 2477 { 2527 if(substr($str, 0, strlen($prefix)) == $prefix) 2478 //if(substr($str, 0, strlen($prefix)) == $prefix) 2479 if(strpos($str, $prefix) === 0) 2528 2480 { 2529 2481 $str = substr($str, strlen($prefix)); … … 2570 2522 $return = 'login'; 2571 2523 } 2572 2573 if(is_null($return)) 2574 { 2575 $return = (is_admin() ? 'admin' : 'frontend'); 2576 } 2577 } 2578 2579 return $return; 2524 } 2525 2526 // certain or fallback type 2527 return is_null($return) ? (is_admin() ? 'admin' : 'frontend') : $return; 2580 2528 } 2581 2529 … … 2795 2743 if(is_null($return)) 2796 2744 { 2745 2797 2746 // store sanitized value 2798 $return = strtolower(sanitize_text_field($_SERVER['SCRIPT_NAME'])); 2747 if(isset($_SERVER['SCRIPT_NAME'])) 2748 { 2749 $return = strtolower(sanitize_text_field($_SERVER['SCRIPT_NAME'])); 2750 } 2751 else 2752 { 2753 $return = ''; 2754 } 2799 2755 } 2800 2756 … … 2841 2797 static public function page_url() 2842 2798 { 2843 $host = sanitize_text_field($_SERVER['HTTP_HOST']); 2844 $uri = sanitize_text_field($_SERVER['REQUEST_URI']); 2845 2846 return (is_ssl() ? 'https://' : 'http://') . $host . $uri; 2799 if(isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) 2800 { 2801 $host = sanitize_text_field($_SERVER['HTTP_HOST']); 2802 $uri = sanitize_text_field($_SERVER['REQUEST_URI']); 2803 $current_url = (is_ssl() ? 'https://' : 'http://') . $host . $uri; 2804 } 2805 else 2806 { 2807 // use wordpress functions 2808 global $wp; 2809 $current_url = home_url(add_query_arg(array(), $wp->request)); 2810 } 2811 2812 return $current_url; 2847 2813 } 2848 2814 -
http-requests-manager/tags/1.3.6/readme.txt
r3145574 r3178540 5 5 Requires at least: 4.7 6 6 Tested up to: 6.6 7 Stable tag: 1.3. 57 Stable tag: 1.3.6 8 8 License: GPLv2 9 9 … … 17 17 18 18 Reason may be slow external WP_HTTP requests. [HTTP Requests Manager plugin](https://veppa.com/http-requests-manager/) will log all WP HTTP requests with time taken to complete for each request. If there are multiple requests per page they will be color grouped. 19 20 https://youtu.be/l_fvAnKPJkM 21 22 [Check plugin overview on YouTube] (https://youtu.be/l_fvAnKPJkM) | [Watch plugin tutorials] (https://youtube.com/playlist?list=PLvn-qBzU0II7b5D4OYDnKpNpuvxiM0f4b) 23 19 24 20 25 Plugin tested with PHP version 5.6, 7.x and up to 8.3. … … 121 126 * [Share button without plugin](https://veppa.com/share-button/) – add super fast native sharing button to your website. Tiny inline code, ad blocker safe, no external dependencies. 122 127 * [bbPress WP Tweaks](https://veppa.com/bbpress-wp-tweaks/) – add custom sidebar, additional widgets and forum columns for sites powered with bbPress forum plugin. 128 * [Tutorial to get high PageSpeed Score](https://veppa.com/share-button/) – video showing how I get PageSpeed Score 100 for my own website powered by WordPress CMS. 123 129 124 130 Visit veppa.com to learn from my [WordPress tutorials](https://veppa.com/category/learn-wordpress/). … … 127 133 128 134 1. Download and activate the plugin. 129 2. Browse to `Tools > HTTP Requests Manager` to view log entries and choose operation mode. Operation mode "Smart block" will be activated by default. 135 2. Browse to `Tools` → `HTTP Requests Manager` to view log entries and choose operation mode. Operation mode "Only log HTTP requests" will be activated by default. 136 3. Use "Smart block" operation mode to optimize WP_HTTP usage. 130 137 131 138 == Screenshots == … … 192 199 == Changelog == 193 200 201 = 1.3.6 - 30 October 2024 = 202 203 * Fixed: Checking HTTP_HOST variable existence before using. 204 * Fixed: Page type detection rechecked if used fallback type admin or frontend. (rest api detected as frontend because of late initialization). 205 * Update: Optimized code related to loaded plugin detection. Reduced function execution time from 300ms to 17ms. 206 * Update: Increased custom rules limit from 10 to 30. 207 194 208 = 1.3.5 - 2 September 2024 = 195 209 196 * Fixed: Increased request_source field size to 255 characters. Some requests were not written because of small field size.210 * Fixed: Increased request_source field size to 255 characters. 197 211 198 212 = 1.3.4 - 26 August 2024 = -
http-requests-manager/tags/1.3.6/templates/page-settings.php
r3141611 r3178540 59 59 <td> 60 60 <input type="checkbox" name="load_must_use" value="1" id="load_must_use" <?php echo (HTTP_Requests_Manager::get_option('load_must_use') ? ' checked="checked"' : '') ?> /> 61 <label for="load_must_use">Enable priority loading with Must-Use plugin feature.</label>61 <label>Enable priority loading with Must-Use plugin feature.</label> 62 62 </td> 63 63 </tr> … … 66 66 <td> 67 67 <input type="checkbox" name="disable_logging" value="1" id="disable_logging" <?php echo (HTTP_Requests_Manager::get_option('disable_logging') ? ' checked="checked"' : '') ?> /> 68 <label for="disable_logging">Disable logging. Faster, no new logs will be added to database. You can still analyze existing logs.</label>68 <label>Disable logging. Faster, no new logs will be added to database. You can still analyze existing logs.</label> 69 69 </td> 70 70 </tr> … … 236 236 Download PDF checklist that I use to get 90+ score on WordPress websites.</span> 237 237 </a> 238 <a class="vphrm-card vphrm-card-wide" href="https://veppa.com/tools/?utm_source=wp&utm_medium=plugin&utm_campaign=options#rankmath" target="_blank"> 239 <span class="vphrm-card-val">◢</span> 240 <span class="vphrm-card-name"><b class="vphrm-card-h3">Rank Math SEO plugin</b> 241 Optimize posts for target keyword. Content SEO checklist with best practices. Track SEO performance for each post using Google Search Console data.</span> 242 </a> 243 <a class="vphrm-card vphrm-card-wide" href="https://veppa.com/tools/?utm_source=wp&utm_medium=plugin&utm_campaign=options#a2hosting" target="_blank"> 244 <span class="vphrm-card-val">a2</span> 245 <span class="vphrm-card-name"><b class="vphrm-card-h3">A2hosting</b> 246 WordPress hosting for any website. Good for beginners and has managed hosting for big sites as well.</span> 247 </a> 248 <a class="vphrm-card vphrm-card-wide" href="https://veppa.com/tools/?utm_source=wp&utm_medium=plugin&utm_campaign=options#kwfinder" target="_blank"> 249 <span class="vphrm-card-val">𝕂</span> 250 <span class="vphrm-card-name"><b class="vphrm-card-h3">KWfinder</b> 251 Get easy to rank keywords. View best performing keywords of your competitors. Beginner friendly pricing. Has free plan as well.</span> 238 <a class="vphrm-card vphrm-card-wide" href="https://youtu.be/W9wroFTw2mM" target="_blank"> 239 <span class="vphrm-card-val">▷</span> 240 <span class="vphrm-card-name"><b class="vphrm-card-h3">PageSpeed Score 100</b> 241 Video tutorial optimizing WordPress with 25 plugins, 2 external JS, YouTube video embeds.</span> 252 242 </a> 253 243 </p> -
http-requests-manager/trunk/assets/js/admin.js
r3145574 r3178540 649 649 if (row.request_source === 'core') 650 650 { 651 var more_info = VPHRM.row_core_more_info(row, request_args);652 if (more_info)653 { 654 row.request_source += ': ' +more_info;651 var more_info = VPHRM.row_core_more_info(row,request_args); 652 if(more_info) 653 { 654 row.request_source += ': '+more_info; 655 655 } 656 656 } … … 781 781 return 'health'; 782 782 } 783 if (backtrace[x] === 'WP_Upgrader->download_package')784 {785 return 'download';786 }787 783 } 788 784 … … 790 786 // check url 791 787 var base_url = row['url'].split('?')[0].replace('http://', 'https://'); 792 788 793 789 if (base_url.search('https://api.wordpress.org/plugins/update-check/') != -1) 794 790 { … … 822 818 { 823 819 return 'translations'; 824 }825 if (base_url.search('https://downloads.wordpress.org/') != -1)826 {827 return 'download';828 820 } 829 821 … … 882 874 { 883 875 page.badges = []; 884 876 885 877 page.badges.push('<i class="vphrm-badge"><b>page_type:</b> ' + page.page_type + '</i>'); 886 878 page.badges.push('<i class="vphrm-badge"><b>is_user_logged_in:</b> ' + (page.info.is_user_logged_in ? 'true' : 'false') + '</i>'); -
http-requests-manager/trunk/http-requests-manager.php
r3145574 r3178540 5 5 Plugin URI: https://veppa.com/http-requests-manager/ 6 6 Description: Limit, Debug, Optimize WP_HTTP requests. Limit by request count, page load time, reduce timeout for each request. Speed up login and admin pages. 7 Version: 1.3. 57 Version: 1.3.6 8 8 Author: veppa 9 9 Author URI: https://veppa.com/ … … 31 31 /** 32 32 * TODO: 33 34 - marketing: remove all other affiliate links. 35 - - incorporate video tutorials to interface with popup/direct link. 36 37 33 * 34 - add blocking by theme 35 - add blocking by core function 36 - disable all enclosure checks and rely only on file extension 38 37 - safe-mode: show instruction about safe mode and operation mode on beginning. after dismissed move note to bottom. 39 38 - [maybe] group prevent enclosure checks and pingbacks. write 1 log instead of 50+ … … 42 41 - remove duplicate info about requests in page array. 43 42 - optimization: define hooks only for selected mode and logging combination. define hooks granularly. 44 45 43 ------------------------------------------- 46 44 * conflict test. … … 72 70 - - on shutdown 73 71 74 75 update plugin tags:76 tag total 1st page min top poistion77 -----------------------------------------78 wp_http 3 0 2000 279 log 100 400 200k80 - api 400 500081 - requests 5 0 2000 282 - update-checks 3 0 2000 283 --84 + debug 200 100085 + optimization 120 100086 + limit 40 10 10k87 --88 update 140 2000 700k89 speed 180 200090 optimize 140 9k 5m91 performance 380 100k 5m92 block 740 20k 700k93 *94 72 */ 95 73 defined('ABSPATH') or exit; … … 97 75 class HTTP_Requests_Manager 98 76 { 99 100 const VERSION = '1.3. 5';77 78 const VERSION = '1.3.6'; 101 79 const ID = 'http-requests-manager'; 102 80 const TIMEOUT = 2; … … 115 93 private static $request_action; 116 94 private static $request_action_info; 117 private static $custom_rules_limit = 10;95 private static $custom_rules_limit = 30; 118 96 private static $page_id; 119 97 private static $mu_plugin_file_name = '/a-http-requests-manager.php'; … … 1732 1710 1733 1711 /** 1734 * Count included plugin, theme, core files 1735 * 1736 * $arr_file_count = array( 1737 * core => 123 1738 * plugin => array( 1739 * plugin-slug => 2, 1740 * plugin-slug2 => 3, 1741 * plugin-slug3 => 6, 1742 * ) 1743 * theme => array( theme-slug => 9 ) 1744 * plugin_count => 3 1745 * ); 1712 * Return loaded plugin slugs as array 1746 1713 * 1747 1714 * @return array 1748 1715 */ 1749 static public function get_included_file_counts() 1750 { 1751 // count included files 1716 static public function get_loaded_plugins() 1717 { 1718 $plugin_slugs = array(); 1719 1720 static $abspath = null; 1721 if(is_null($abspath)) 1722 { 1723 $abspath = str_replace('\\', '/', ABSPATH); 1724 } 1725 1726 1752 1727 $incs = get_included_files(); 1753 1754 // count files per plugin, theme, core 1755 $arr_file_count = array( 1756 'total' => count($incs), 1757 'core' => 0, 1758 'plugin' => array() 1759 ); 1760 foreach($incs as $file) 1761 { 1762 $file_info = self::get_file_type($file); 1763 $type = $file_info['type']; 1764 $slug = isset($file_info['slug']) ? $file_info['slug'] : false; 1765 1766 if(false !== $slug) 1767 { 1768 if(!isset($arr_file_count[$type][$slug])) 1769 { 1770 $arr_file_count[$type][$slug] = 0; 1771 } 1772 $arr_file_count[$type][$slug]++; 1773 } 1774 else 1775 { 1776 $arr_file_count[$type]++; 1777 } 1778 } 1779 1780 if(isset($arr_file_count['plugin'])) 1781 { 1782 $arr_file_count['plugin_count'] = count($arr_file_count['plugin']); 1783 } 1784 1785 return $arr_file_count; 1786 } 1787 1788 /** 1789 * Return loaded plugin slugs as array 1790 * 1791 * @return array 1792 */ 1793 static public function get_loaded_plugins() 1794 { 1795 // get all loaded plugins as comma seperated string 1796 $file_counts = self::get_included_file_counts(); 1797 1798 $plugin_slugs = array(); 1799 1800 if(!empty($file_counts['plugin'])) 1801 { 1802 $plugin_slugs = array_keys($file_counts['plugin']); 1803 } 1728 $incs = implode("\n", $incs); 1729 $incs = str_replace('\\', '/', $incs); 1730 $incs = str_replace($abspath, '', $incs); 1731 1732 preg_match_all('(wp-content\/plugins\/([^/]*))', $incs, $matches); 1733 1734 if(!empty($matches[1])) 1735 { 1736 $plugin_slugs = array_unique($matches[1]); 1737 } 1738 1739 /* echo "<!-- get_loaded_plugins \n"; 1740 echo " --- \n" . $incs . " --- \n"; 1741 print_r($matches); 1742 echo " ---- \n"; 1743 print_r($plugin_slugs); 1744 echo " -->\n"; 1745 */ 1804 1746 1805 1747 return $plugin_slugs; … … 2390 2332 } 2391 2333 2334 static private function normalize_path_if_needed($file) 2335 { 2336 if(strpos($file, '\\')) 2337 { 2338 return wp_normalize_path($file); 2339 } 2340 return $file; 2341 } 2342 2392 2343 /** 2393 2344 * detect if file related to plugin, theme or core. Return array with wp root relative file name, type and slug of plugin. … … 2402 2353 if(is_null($abspath)) 2403 2354 { 2404 $abspath = wp_normalize_path(ABSPATH);2355 $abspath = self::normalize_path_if_needed(ABSPATH); 2405 2356 } 2406 2357 … … 2408 2359 $plugin_dir_prefix = 'wp-content/plugins/'; 2409 2360 2410 $file = wp_normalize_path($file);2361 $file = self::normalize_path_if_needed($file); 2411 2362 $file_short = self::remove_prefix($file, $abspath); 2412 2363 … … 2417 2368 2418 2369 // plugin or theme 2419 if( false !== strpos($file_short, $plugin_dir_prefix))2370 if(0 === strpos($file_short, $plugin_dir_prefix)) 2420 2371 { 2421 2372 // this is plugin … … 2424 2375 $row['type'] = 'plugin'; 2425 2376 } 2426 elseif( false !== strpos($file_short, $theme_dir_prefix))2377 elseif(0 === strpos($file_short, $theme_dir_prefix)) 2427 2378 { 2428 2379 // this is theme … … 2525 2476 static public function remove_prefix($str, $prefix) 2526 2477 { 2527 if(substr($str, 0, strlen($prefix)) == $prefix) 2478 //if(substr($str, 0, strlen($prefix)) == $prefix) 2479 if(strpos($str, $prefix) === 0) 2528 2480 { 2529 2481 $str = substr($str, strlen($prefix)); … … 2570 2522 $return = 'login'; 2571 2523 } 2572 2573 if(is_null($return)) 2574 { 2575 $return = (is_admin() ? 'admin' : 'frontend'); 2576 } 2577 } 2578 2579 return $return; 2524 } 2525 2526 // certain or fallback type 2527 return is_null($return) ? (is_admin() ? 'admin' : 'frontend') : $return; 2580 2528 } 2581 2529 … … 2795 2743 if(is_null($return)) 2796 2744 { 2745 2797 2746 // store sanitized value 2798 $return = strtolower(sanitize_text_field($_SERVER['SCRIPT_NAME'])); 2747 if(isset($_SERVER['SCRIPT_NAME'])) 2748 { 2749 $return = strtolower(sanitize_text_field($_SERVER['SCRIPT_NAME'])); 2750 } 2751 else 2752 { 2753 $return = ''; 2754 } 2799 2755 } 2800 2756 … … 2841 2797 static public function page_url() 2842 2798 { 2843 $host = sanitize_text_field($_SERVER['HTTP_HOST']); 2844 $uri = sanitize_text_field($_SERVER['REQUEST_URI']); 2845 2846 return (is_ssl() ? 'https://' : 'http://') . $host . $uri; 2799 if(isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) 2800 { 2801 $host = sanitize_text_field($_SERVER['HTTP_HOST']); 2802 $uri = sanitize_text_field($_SERVER['REQUEST_URI']); 2803 $current_url = (is_ssl() ? 'https://' : 'http://') . $host . $uri; 2804 } 2805 else 2806 { 2807 // use wordpress functions 2808 global $wp; 2809 $current_url = home_url(add_query_arg(array(), $wp->request)); 2810 } 2811 2812 return $current_url; 2847 2813 } 2848 2814 -
http-requests-manager/trunk/readme.txt
r3145574 r3178540 5 5 Requires at least: 4.7 6 6 Tested up to: 6.6 7 Stable tag: 1.3. 57 Stable tag: 1.3.6 8 8 License: GPLv2 9 9 … … 17 17 18 18 Reason may be slow external WP_HTTP requests. [HTTP Requests Manager plugin](https://veppa.com/http-requests-manager/) will log all WP HTTP requests with time taken to complete for each request. If there are multiple requests per page they will be color grouped. 19 20 https://youtu.be/l_fvAnKPJkM 21 22 [Check plugin overview on YouTube] (https://youtu.be/l_fvAnKPJkM) | [Watch plugin tutorials] (https://youtube.com/playlist?list=PLvn-qBzU0II7b5D4OYDnKpNpuvxiM0f4b) 23 19 24 20 25 Plugin tested with PHP version 5.6, 7.x and up to 8.3. … … 121 126 * [Share button without plugin](https://veppa.com/share-button/) – add super fast native sharing button to your website. Tiny inline code, ad blocker safe, no external dependencies. 122 127 * [bbPress WP Tweaks](https://veppa.com/bbpress-wp-tweaks/) – add custom sidebar, additional widgets and forum columns for sites powered with bbPress forum plugin. 128 * [Tutorial to get high PageSpeed Score](https://veppa.com/share-button/) – video showing how I get PageSpeed Score 100 for my own website powered by WordPress CMS. 123 129 124 130 Visit veppa.com to learn from my [WordPress tutorials](https://veppa.com/category/learn-wordpress/). … … 127 133 128 134 1. Download and activate the plugin. 129 2. Browse to `Tools > HTTP Requests Manager` to view log entries and choose operation mode. Operation mode "Smart block" will be activated by default. 135 2. Browse to `Tools` → `HTTP Requests Manager` to view log entries and choose operation mode. Operation mode "Only log HTTP requests" will be activated by default. 136 3. Use "Smart block" operation mode to optimize WP_HTTP usage. 130 137 131 138 == Screenshots == … … 192 199 == Changelog == 193 200 201 = 1.3.6 - 30 October 2024 = 202 203 * Fixed: Checking HTTP_HOST variable existence before using. 204 * Fixed: Page type detection rechecked if used fallback type admin or frontend. (rest api detected as frontend because of late initialization). 205 * Update: Optimized code related to loaded plugin detection. Reduced function execution time from 300ms to 17ms. 206 * Update: Increased custom rules limit from 10 to 30. 207 194 208 = 1.3.5 - 2 September 2024 = 195 209 196 * Fixed: Increased request_source field size to 255 characters. Some requests were not written because of small field size.210 * Fixed: Increased request_source field size to 255 characters. 197 211 198 212 = 1.3.4 - 26 August 2024 = -
http-requests-manager/trunk/templates/page-settings.php
r3141611 r3178540 59 59 <td> 60 60 <input type="checkbox" name="load_must_use" value="1" id="load_must_use" <?php echo (HTTP_Requests_Manager::get_option('load_must_use') ? ' checked="checked"' : '') ?> /> 61 <label for="load_must_use">Enable priority loading with Must-Use plugin feature.</label>61 <label>Enable priority loading with Must-Use plugin feature.</label> 62 62 </td> 63 63 </tr> … … 66 66 <td> 67 67 <input type="checkbox" name="disable_logging" value="1" id="disable_logging" <?php echo (HTTP_Requests_Manager::get_option('disable_logging') ? ' checked="checked"' : '') ?> /> 68 <label for="disable_logging">Disable logging. Faster, no new logs will be added to database. You can still analyze existing logs.</label>68 <label>Disable logging. Faster, no new logs will be added to database. You can still analyze existing logs.</label> 69 69 </td> 70 70 </tr> … … 236 236 Download PDF checklist that I use to get 90+ score on WordPress websites.</span> 237 237 </a> 238 <a class="vphrm-card vphrm-card-wide" href="https://veppa.com/tools/?utm_source=wp&utm_medium=plugin&utm_campaign=options#rankmath" target="_blank"> 239 <span class="vphrm-card-val">◢</span> 240 <span class="vphrm-card-name"><b class="vphrm-card-h3">Rank Math SEO plugin</b> 241 Optimize posts for target keyword. Content SEO checklist with best practices. Track SEO performance for each post using Google Search Console data.</span> 242 </a> 243 <a class="vphrm-card vphrm-card-wide" href="https://veppa.com/tools/?utm_source=wp&utm_medium=plugin&utm_campaign=options#a2hosting" target="_blank"> 244 <span class="vphrm-card-val">a2</span> 245 <span class="vphrm-card-name"><b class="vphrm-card-h3">A2hosting</b> 246 WordPress hosting for any website. Good for beginners and has managed hosting for big sites as well.</span> 247 </a> 248 <a class="vphrm-card vphrm-card-wide" href="https://veppa.com/tools/?utm_source=wp&utm_medium=plugin&utm_campaign=options#kwfinder" target="_blank"> 249 <span class="vphrm-card-val">𝕂</span> 250 <span class="vphrm-card-name"><b class="vphrm-card-h3">KWfinder</b> 251 Get easy to rank keywords. View best performing keywords of your competitors. Beginner friendly pricing. Has free plan as well.</span> 238 <a class="vphrm-card vphrm-card-wide" href="https://youtu.be/W9wroFTw2mM" target="_blank"> 239 <span class="vphrm-card-val">▷</span> 240 <span class="vphrm-card-name"><b class="vphrm-card-h3">PageSpeed Score 100</b> 241 Video tutorial optimizing WordPress with 25 plugins, 2 external JS, YouTube video embeds.</span> 252 242 </a> 253 243 </p>
Note: See TracChangeset
for help on using the changeset viewer.