Plugin Directory

Changeset 1891716


Ignore:
Timestamp:
06/12/2018 04:06:32 PM (8 years ago)
Author:
digitalarbyter
Message:

Shrunk the core-file, added categories

Location:
wp-tweaker/trunk
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • wp-tweaker/trunk/readme.txt

    r1890217 r1891716  
    11=== WP-Tweaker ===
    22Contributors: digitalarbyter
    3 Tags: tweaks, booster, performance, speed, optimisation
     3Tags: tweaks, booster, performance, speed, optimisation, page speed, page load time
    44Requires at least: 4.9.6
    55Tested up to: 4.9.6
     
    2222- Limit the stored Post-Revisions to a maximum of 5
    2323- Disable automatic http-requests by Plugins & Themes
     24- Disable the WordPress-hearbeat
    2425
    2526All you need to do to control this features/functions is
     
    4041
    4142== Changelog ==
     431.2 12.06.18
     44- Performance optimization (reduced code of core-file by 76%)
     45- added categories
     46- added feature heartbeat
    42471.1 09.06.18:
    4348- Added feature "disable http-requests"
  • wp-tweaker/trunk/wp-tweaker.php

    r1890217 r1891716  
    88
    99Description: This slim plugin removes many (unneeded) standard features from WordPress to give your blog the ultimate performance boost! Currently you can disable 8 WordPress functions each with one mouse click.
    10 Version: 1.1
     10Version: 1.2
    1111Author: Olli Kluth
    1212Author URI:  https://blog-optimierung.de
     
    2727*/
    2828
    29 class WPTweaker_SettingsPage
     29define('wp-tweaker-admin', 1);
     30
     31if(is_admin())
    3032{
    31     private $wptweaker_options;
    32 
    33     public function __construct()
    34     {
    35         add_action( 'admin_menu', array( $this, 'wptweaker_add_plugin_page' ) );
    36         add_action( 'admin_init', array( $this, 'wptweaker_page_init' ) );
    37     }
    38 
    39     public function wptweaker_add_plugin_page()
    40     {
    41         add_options_page(
    42             'WP-Tweaker',
    43             'WP-Tweaker',
    44             'manage_options',
    45             'wptweaker-settings',
    46             array( $this, 'wptweaker_create_admin_page' )
    47         );
    48     }
    49 
    50     public function wptweaker_create_admin_page()
    51     {
    52         // Set class property
    53         $this->wptweaker_options = get_option( 'wptweaker_settings' );
    54         ?>
    55         <div class="wrap">
    56             <h1>Settings</h1>
    57             <form method="post" action="options.php">
    58             <?php
    59                 // This prints out all hidden setting fields
    60                 settings_fields( 'my_option_group' );
    61                 do_settings_sections( 'my-setting-admin' );
    62                 submit_button();
    63             ?>
    64             </form>
    65         </div>
    66         <?php
    67     }
    68 
    69     public function wptweaker_page_init()
    70     {
    71         register_setting(
    72             'my_option_group', // Option group
    73             'wptweaker_settings', // Option name
    74             array( $this, 'wptweaker_sanitize' ) // Sanitize
    75         );
    76 
    77         add_settings_section(
    78             'wptweaker_setting_section_id', // ID
    79             'Onboard WP-Functions', // Title
    80             array( $this, 'print_section_info' ), // Callback
    81             'my-setting-admin' // Page
    82         );
    83 
    84         add_settings_field(
    85             'wptweaker_setting_1',
    86             'Disable the WordPress-Version in the header.',
    87             array( $this, 'callback_wptweaker_setting_1' ),
    88             'my-setting-admin',
    89             'wptweaker_setting_section_id'
    90         );
    91 
    92         add_settings_field(
    93             'wptweaker_setting_2',
    94             'Deactivate WP-Emojis',
    95             array( $this, 'callback_wptweaker_setting_2' ),
    96             'my-setting-admin',
    97             'wptweaker_setting_section_id'
    98         );
    99 
    100         add_settings_field(
    101             'wptweaker_setting_3',
    102             'Remove the WP-Manifest',
    103             array( $this, 'callback_wptweaker_setting_3' ),
    104             'my-setting-admin',
    105             'wptweaker_setting_section_id'
    106         );
    107 
    108         add_settings_field(
    109             'wptweaker_setting_4',
    110             'Remove the RSD-Links',
    111             array( $this, 'callback_wptweaker_setting_4' ),
    112             'my-setting-admin',
    113             'wptweaker_setting_section_id'
    114         );
    115 
    116         add_settings_field(
    117             'wptweaker_setting_5',
    118             'Remove RSS-Links',
    119             array( $this, 'callback_wptweaker_setting_5' ),
    120             'my-setting-admin',
    121             'wptweaker_setting_section_id'
    122         );
    123 
    124         add_settings_field(
    125             'wptweaker_setting_6',
    126             'Remove Shortlinks',
    127             array( $this, 'callback_wptweaker_setting_6' ),
    128             'my-setting-admin',
    129             'wptweaker_setting_section_id'
    130         );
    131 
    132         add_settings_field(
    133             'wptweaker_setting_7',
    134             'Remove links to adjacent Posts',
    135             array( $this, 'callback_wptweaker_setting_7' ),
    136             'my-setting-admin',
    137             'wptweaker_setting_section_id'
    138         );
    139 
    140         add_settings_field(
    141             'wptweaker_setting_8',
    142             'Limit Post-Revisions to 5',
    143             array( $this, 'callback_wptweaker_setting_8' ),
    144             'my-setting-admin',
    145             'wptweaker_setting_section_id'
    146         );
    147         add_settings_field(
    148             'wptweaker_setting_9',
    149             'Disable automatic http-requests by Plugins & Themes',
    150             array( $this, 'callback_wptweaker_setting_9' ),
    151             'my-setting-admin',
    152             'wptweaker_setting_section_id'
    153         );
    154     }
    155 
    156     public function wptweaker_sanitize( $wptweaker_input )
    157     {
    158         $wptweaker_new_input = array();
    159         if( isset( $wptweaker_input['wptweaker_setting_1'] ) )
    160             $wptweaker_new_input['wptweaker_setting_1'] = absint( $wptweaker_input['wptweaker_setting_1'] );
    161         if( isset( $wptweaker_input['wptweaker_setting_2'] ) )
    162             $wptweaker_new_input['wptweaker_setting_2'] = absint( $wptweaker_input['wptweaker_setting_2'] );
    163         if( isset( $wptweaker_input['wptweaker_setting_3'] ) )
    164             $wptweaker_new_input['wptweaker_setting_3'] = absint( $wptweaker_input['wptweaker_setting_3'] );
    165         if( isset( $wptweaker_input['wptweaker_setting_4'] ) )
    166             $wptweaker_new_input['wptweaker_setting_4'] = absint( $wptweaker_input['wptweaker_setting_4'] );
    167         if( isset( $wptweaker_input['wptweaker_setting_5'] ) )
    168             $wptweaker_new_input['wptweaker_setting_5'] = absint( $wptweaker_input['wptweaker_setting_5'] );
    169         if( isset( $wptweaker_input['wptweaker_setting_6'] ) )
    170             $wptweaker_new_input['wptweaker_setting_6'] = absint( $wptweaker_input['wptweaker_setting_6'] );
    171         if( isset( $wptweaker_input['wptweaker_setting_7'] ) )
    172             $wptweaker_new_input['wptweaker_setting_7'] = absint( $wptweaker_input['wptweaker_setting_7'] );
    173         if( isset( $wptweaker_input['wptweaker_setting_8'] ) )
    174             $wptweaker_new_input['wptweaker_setting_8'] = absint( $wptweaker_input['wptweaker_setting_8'] );
    175         if( isset( $wptweaker_input['wptweaker_setting_9'] ) )
    176             $wptweaker_new_input['wptweaker_setting_9'] = absint( $wptweaker_input['wptweaker_setting_9'] );
    177         return $wptweaker_new_input;
    178     }
    179 
    180     public function print_section_info()
    181     {
    182         print 'Turn each function/feature seperately on or off.';
    183     }
    184 
    185     public function callback_wptweaker_setting_1()
    186      {
    187          printf(
    188              '<input type="radio" id="wptweaker_setting_1" name="wptweaker_settings[wptweaker_setting_1]" value="0" %s /> off ',
    189              $this->wptweaker_options['wptweaker_setting_1'] == 0  ? "checked" : ''
    190              );
    191          printf(
    192              '<input type="radio" id="wptweaker_setting_1" name="wptweaker_settings[wptweaker_setting_1]" value="1" %s /> on ',
    193              $this->wptweaker_options['wptweaker_setting_1'] == 1  ? "checked" : ''
    194              );
    195      }
    196 
    197      public function callback_wptweaker_setting_2()
    198      {
    199          printf(
    200              '<input type="radio" id="wptweaker_setting_2" name="wptweaker_settings[wptweaker_setting_2]" value="0" %s /> off ',
    201              $this->wptweaker_options['wptweaker_setting_2'] == 0  ? "checked" : ''
    202              );
    203          printf(
    204              '<input type="radio" id="wptweaker_setting_2" name="wptweaker_settings[wptweaker_setting_2]" value="1" %s /> on ',
    205              $this->wptweaker_options['wptweaker_setting_2'] == 1  ? "checked" : ''
    206              );
    207      }
    208 
    209      public function callback_wptweaker_setting_3()
    210      {
    211          printf(
    212              '<input type="radio" id="wptweaker_setting_3" name="wptweaker_settings[wptweaker_setting_3]" value="0" %s /> off ',
    213              $this->wptweaker_options['wptweaker_setting_3'] == 0  ? "checked" : ''
    214              );
    215          printf(
    216              '<input type="radio" id="wptweaker_setting_3" name="wptweaker_settings[wptweaker_setting_3]" value="1" %s /> on ',
    217              $this->wptweaker_options['wptweaker_setting_3'] == 1  ? "checked" : ''
    218              );
    219      }
    220 
    221      public function callback_wptweaker_setting_4()
    222      {
    223          printf(
    224              '<input type="radio" id="wptweaker_setting_4" name="wptweaker_settings[wptweaker_setting_4]" value="0" %s /> off ',
    225              $this->wptweaker_options['wptweaker_setting_4'] == 0  ? "checked" : ''
    226              );
    227          printf(
    228              '<input type="radio" id="wptweaker_setting_4" name="wptweaker_settings[wptweaker_setting_4]" value="1" %s /> on ',
    229              $this->wptweaker_options['wptweaker_setting_4'] == 1  ? "checked" : ''
    230              );
    231      }
    232 
    233      public function callback_wptweaker_setting_5()
    234      {
    235          printf(
    236              '<input type="radio" id="wptweaker_setting_5" name="wptweaker_settings[wptweaker_setting_5]" value="0" %s /> off ',
    237              $this->wptweaker_options['wptweaker_setting_5'] == 0  ? "checked" : ''
    238              );
    239          printf(
    240              '<input type="radio" id="wptweaker_setting_5" name="wptweaker_settings[wptweaker_setting_5]" value="1" %s /> on ',
    241              $this->wptweaker_options['wptweaker_setting_5'] == 1  ? "checked" : ''
    242              );
    243      }
    244 
    245      public function callback_wptweaker_setting_6()
    246      {
    247          printf(
    248              '<input type="radio" id="wptweaker_setting_6" name="wptweaker_settings[wptweaker_setting_6]" value="0" %s /> off ',
    249              $this->wptweaker_options['wptweaker_setting_6'] == 0  ? "checked" : ''
    250              );
    251          printf(
    252              '<input type="radio" id="wptweaker_setting_6" name="wptweaker_settings[wptweaker_setting_6]" value="1" %s /> on ',
    253              $this->wptweaker_options['wptweaker_setting_6'] == 1  ? "checked" : ''
    254              );
    255      }
    256 
    257      public function callback_wptweaker_setting_7()
    258      {
    259          printf(
    260              '<input type="radio" id="wptweaker_setting_7" name="wptweaker_settings[wptweaker_setting_7]" value="0" %s /> off ',
    261              $this->wptweaker_options['wptweaker_setting_7'] == 0  ? "checked" : ''
    262              );
    263          printf(
    264              '<input type="radio" id="wptweaker_setting_7" name="wptweaker_settings[wptweaker_setting_7]" value="1" %s /> on ',
    265              $this->wptweaker_options['wptweaker_setting_7'] == 1  ? "checked" : ''
    266              );
    267      }
    268 
    269      public function callback_wptweaker_setting_8()
    270      {
    271          printf(
    272              '<input type="radio" id="wptweaker_setting_8" name="wptweaker_settings[wptweaker_setting_8]" value="0" %s /> off ',
    273              $this->wptweaker_options['wptweaker_setting_8'] == 0  ? "checked" : ''
    274              );
    275          printf(
    276              '<input type="radio" id="wptweaker_setting_8" name="wptweaker_settings[wptweaker_setting_8]" value="1" %s /> on ',
    277              $this->wptweaker_options['wptweaker_setting_8'] == 1  ? "checked" : ''
    278              );
    279      }
    280 
    281      public function callback_wptweaker_setting_9()
    282      {
    283          printf(
    284              '<input type="radio" id="wptweaker_setting_9" name="wptweaker_settings[wptweaker_setting_9]" value="0" %s /> off ',
    285              $this->wptweaker_options['wptweaker_setting_9'] == 0  ? "checked" : ''
    286              );
    287          printf(
    288              '<input type="radio" id="wptweaker_setting_9" name="wptweaker_settings[wptweaker_setting_9]" value="1" %s /> on ',
    289              $this->wptweaker_options['wptweaker_setting_9'] == 1  ? "checked" : ''
    290              );
    291      }
     33    require plugin_dir_path(__FILE__).'inc/wp-tweaker-admin.php';
    29234}
    29335
Note: See TracChangeset for help on using the changeset viewer.