Changeset 2875036
- Timestamp:
- 03/05/2023 07:56:15 PM (3 years ago)
- Location:
- remove-all-question-marks
- Files:
-
- 3 added
- 2 edited
-
tags/3.1 (added)
-
tags/3.1/readme.txt (added)
-
tags/3.1/remove-all-question-marks-css-and-js.php (added)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/remove-all-question-marks-css-and-js.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
remove-all-question-marks/trunk/readme.txt
r2860921 r2875036 14 14 License URI: https://www.gnu.org/licenses/gpl-2.0.html 15 15 16 17 18 16 19 Remove all question marks css and js for Speed and Seo 17 20 18 21 == Description == 19 22 20 Remove all question marks css and js file in Source 23 The "Remove all Question Marks" plugin removes the query string containing the version number from CSS and JS files, which can improve website performance by reducing the number of HTTP requests made by the browser. It also adds the ability to cache CSS and JS files on the server and the user's browser, with the option to activate or deactivate the cache in the plugin's settings. The plugin may need to be disabled or checked with plugin or theme developers if issues arise with the version number. 21 24 22 Compatible with PHP 7.325 Compatible with PHP 8.1 23 26 24 27 == Installation == … … 35 38 == Frequently Asked Questions == 36 39 37 = How this plugin works=40 = What does the "Remove all Question Marks" plugin do? = 38 41 39 remove all question marks css and js 42 The plugin removes the query string that contains the version number from CSS and JS files. This can improve the performance of your website by reducing the number of HTTP requests made by the browser. 43 44 = How can I enable or disable the plugin? = 45 46 You can enable or disable the plugin by checking or unchecking the "Enable Plugin" checkbox in the plugin's settings page. 47 48 = Can I choose which files to modify? = 49 50 Yes, you can choose to modify CSS and/or JS files by checking the corresponding checkboxes in the plugin's settings page. 51 52 = What happens if I experience issues after enabling the plugin? = 53 54 Some plugins and themes may rely on the version number to load scripts and styles correctly. If you experience issues after enabling this plugin, try disabling it or checking with the plugin or theme developers. 55 56 = Does the plugin have any caching functionality? = 57 58 Yes, the plugin has caching functionality that can cache CSS and JS files on the server and user's browser. You can enable or disable the cache in the plugin's settings page. 40 59 41 60 == Screenshots == … … 43 62 == Changelog == 44 63 64 = 3.1 = 65 Remove version numbers from CSS and JS files 66 Enable or disable plugin functionality 67 Modify CSS and/or JS files 68 Cache CSS and JS files on server and user's browser 69 Enable or disable cache functionality 70 Improve website performance by reducing HTTP requests 71 Customize plugin settings through a user-friendly interface 72 Get support from plugin developers through the website 73 Compatible with various plugins and themes 74 Minimize the risk of conflicts with other website components. 75 add setting box 45 76 = 1.0 = 46 77 * init -
remove-all-question-marks/trunk/remove-all-question-marks-css-and-js.php
r2860921 r2875036 4 4 Plugin URI: https://coindej.com/ 5 5 description: remove all question marks css and js 6 Version: 3. 06 Version: 3.1 7 7 Author: CoinDej - AriaHaman Group 8 8 Author URI: https://coindej.com/ … … 10 10 */ 11 11 12 // Add the settings page 13 function raqm_add_settings_page() { 14 add_options_page( 15 __( 'Remove all Question Marks', 'raqm' ), 16 __( 'Remove all Question Marks', 'raqm' ), 17 'manage_options', 18 'raqm-settings', 19 'raqm_settings_page' 20 ); 21 } 22 add_action( 'admin_menu', 'raqm_add_settings_page' ); 23 24 // Register the plugin settings 25 function raqm_register_settings() { 26 register_setting( 'raqm-settings-group', 'raqm_enabled' ); 27 register_setting( 'raqm-settings-group', 'raqm_modify_css' ); 28 register_setting( 'raqm-settings-group', 'raqm_modify_js' ); 29 } 30 add_action( 'admin_init', 'raqm_register_settings' ); 31 32 // Define the settings page UI 33 function raqm_settings_page() { 34 ?> 35 <div class="wrap"> 36 <h1><?php _e( 'Remove all Question Marks', 'raqm' ); ?></h1> 37 <div class="notice notice-info"> 38 <p><strong>Help:</strong></p> 39 <p>The Remove all Question Marks plugin removes the query string that contains the version number from CSS and JS files. This can improve the performance of your website by reducing the number of HTTP requests made by the browser.</p> 40 <p>To use the plugin, enable it by checking the "Enable Plugin" checkbox. You can also choose to modify CSS and/or JS files by checking the corresponding checkboxes.</p> 41 <p><strong>Note:</strong> Some plugins and themes may rely on the version number to load scripts and styles correctly. If you experience issues after enabling this plugin, try disabling it or checking with the plugin or theme developers.</p> 42 </div> 43 <form method="post" action="options.php"> 44 <?php settings_fields( 'raqm-settings-group' ); ?> 45 <?php do_settings_sections( 'raqm-settings-group' ); ?> 46 <table class="form-table"> 47 <tr valign="top"> 48 <th scope="row"><?php _e( 'Enable Plugin', 'raqm' ); ?></th> 49 <td> 50 <label> 51 <input type="checkbox" name="raqm_enabled" value="1" <?php checked( get_option( 'raqm_enabled' ), 1 ); ?>> 52 <?php _e( 'Enable the Remove all Question Marks plugin', 'raqm' ); ?> 53 </label> 54 </td> 55 </tr> 56 <tr valign="top"> 57 <th scope="row"><?php _e( 'Modify CSS Files', 'raqm' ); ?></th> 58 <td> 59 <label> 60 <input type="checkbox" name="raqm_modify_css" value="1" <?php checked( get_option( 'raqm_modify_css' ), 1 ); ?>> 61 <?php _e( 'Modify question marks in CSS files', 'raqm' ); ?> 62 </label> 63 </td> 64 </tr> 65 <tr valign="top"> 66 <th scope="row"><?php _e( 'Modify JS Files', 'raqm' ); ?></th> 67 <td> 68 <label> 69 <input type="checkbox" name="raqm_modify_js" value="1" <?php checked( get_option( 'raqm_modify_js' ), 1 ); ?>> 70 <?php _e( 'Modify question marks in JS files', 'raqm' ); ?> 71 </label> 72 </td> 73 </tr> 74 <tr valign="top"> 75 <th scope="row"><?php _e( 'Enable Cache', 'raqm' ); ?></th> 76 <td> 77 <label> 78 <input type="checkbox" name="raqm_enable_cache" value="1" <?php checked( get_option( 'raqm_enable_cache' ), 1 ); ?>> 79 <?php _e( 'Enable caching of CSS and JS files', 'raqm' ); ?> 80 </label> 81 </td> 82 </tr> 83 </table> 84 <?php submit_button(); ?> 85 </form> 86 </div> 87 <?php 88 } 89 90 91 92 // Modify the script and style URLs 12 93 function raqm_remove_script_version( $src ){ 13 $parts = explode( '?ver', $src ); 14 return $parts[0]; 94 if ( ! get_option( 'raqm_enabled' ) ) { 95 return $src; 96 } 97 98 $modify_css = get_option( 'raqm_modify_css' ); 99 $modify_js = get_option( 'raqm_modify_js' ); 100 $enable_cache = get_option( 'raqm_enable_cache' ); // new option 101 102 // Modify both CSS and JS files 103 $is_css = strpos( $src, '.css' ) !== false; 104 $is_js = strpos( $src, '.js' ) !== false; 105 106 if ( $modify_css && $is_css || $modify_js && $is_js ) { 107 $parts = explode( '?', $src ); 108 return $parts[0]; 15 109 110 // Set cache headers 111 $expires = 31536000; // 1 year 112 header( "Cache-Control: public, max-age=$expires" ); 113 header( "Expires: " . gmdate( 'D, d M Y H:i:s', time() + $expires ) . ' GMT' ); 114 115 if ( $enable_cache ) { 116 // Add version to URL to force cache busting 117 $src = add_query_arg( 'v', get_theme_file_version(), $src ); 118 } else { 119 // Remove query string 120 $src = strtok( $src, '?' ); 121 } 122 } 123 124 return $src; 16 125 } 17 add_filter('script_loader_src','raqm_remove_script_version', 15, 1 );18 add_filter( 'style_loader_src','raqm_remove_script_version', 15, 1 );126 add_filter( 'script_loader_src', 'raqm_remove_script_version', 15, 1 ); 127 add_filter( 'style_loader_src', 'raqm_remove_script_version', 15, 1 );
Note: See TracChangeset
for help on using the changeset viewer.