Plugin Directory

Changeset 2875036


Ignore:
Timestamp:
03/05/2023 07:56:15 PM (3 years ago)
Author:
ariapadweb
Message:

v 3.1 updated

Location:
remove-all-question-marks
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • remove-all-question-marks/trunk/readme.txt

    r2860921 r2875036  
    1414License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1515
     16
     17
     18
    1619Remove all question marks css and js for Speed and Seo
    1720
    1821== Description ==
    1922
    20 Remove all question marks css and js file in Source
     23The "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.
    2124
    22 Compatible with PHP 7.3
     25Compatible with PHP 8.1
    2326
    2427== Installation ==
     
    3538== Frequently Asked Questions ==
    3639
    37 = How this plugin works =
     40= What does the "Remove all Question Marks" plugin do? =
    3841
    39 remove all question marks css and js
     42The 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
     46You 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
     50Yes, 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
     54Some 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
     58Yes, 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.
    4059
    4160== Screenshots ==
     
    4362== Changelog ==
    4463
     64= 3.1 =
     65Remove version numbers from CSS and JS files
     66Enable or disable plugin functionality
     67Modify CSS and/or JS files
     68Cache CSS and JS files on server and user's browser
     69Enable or disable cache functionality
     70Improve website performance by reducing HTTP requests
     71Customize plugin settings through a user-friendly interface
     72Get support from plugin developers through the website
     73Compatible with various plugins and themes
     74Minimize the risk of conflicts with other website components.
     75add setting box
    4576= 1.0 =
    4677* init
  • remove-all-question-marks/trunk/remove-all-question-marks-css-and-js.php

    r2860921 r2875036  
    44Plugin URI: https://coindej.com/
    55description: remove all question marks css and js
    6 Version: 3.0
     6Version: 3.1
    77Author: CoinDej - AriaHaman Group
    88Author URI: https://coindej.com/
     
    1010*/
    1111
     12// Add the settings page
     13function 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}
     22add_action( 'admin_menu', 'raqm_add_settings_page' );
     23
     24// Register the plugin settings
     25function 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}
     30add_action( 'admin_init', 'raqm_register_settings' );
     31
     32// Define the settings page UI
     33function 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
    1293function 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];
    15109
     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;
    16125}
    17  add_filter('script_loader_src','raqm_remove_script_version', 15, 1 );
    18 add_filter('style_loader_src','raqm_remove_script_version', 15, 1 );
     126add_filter( 'script_loader_src', 'raqm_remove_script_version', 15, 1 );
     127add_filter( 'style_loader_src', 'raqm_remove_script_version', 15, 1 );
Note: See TracChangeset for help on using the changeset viewer.