Plugin Directory

Changeset 3050160

Timestamp:
03/13/2024 04:18:02 AM (5 months ago)
Author:
freewebmentor
Message:

Performance changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • disable-features/tags/1.0/includes/AdminSettings.php

    r3037756 r3050160  
    88class AdminSettings {
    99
    10     // Add the admin stylesheet file.
    11     public function dwf_admin_style() {
    12         if ( isset( $_GET['page'] ) && 'disable-feature' === $_GET['page'] ) {
    13             wp_enqueue_style( 'dwun-admin-style', plugins_url( "css/admin-style.css", __FILE__ ) );
    14         }
    15     }
    16 
    17     // Add in admin side panel.
    18     public function Admin_menu_dwnSettings() {
    19         add_options_page( 'Disable WordPress Features Settings', 'Disable Features', 'manage_options', 'disable-feature', [ $this, 'dwf_settings' ] );
    20     }
    21 
    22     // Add in admin settiings.
    23     public function dwf_settings() {
    24 
    25         // Update the plugin settings.
    26         if ( isset( $_POST['submit-nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash ( $_POST['submit-nonce'] ) ), 'submit_form' ) ) {   
    27             $dwf_settings = [
    28                 'dxmlrpcswitch_value' => sanitize_text_field( $_POST[ 'dxmlrpcswitch' ] ),
    29                 'hsotswitch_value' =>  sanitize_text_field( $_POST[ 'hsotswitch' ] ),
    30                 'hwvnswitch_value' =>  sanitize_text_field( $_POST[ 'hwvnswitch' ] ),
    31                 'dwbswitch_value' =>  sanitize_text_field( $_POST[ 'dwbswitch' ] ),
    32                 'dwabswitch_value' =>  sanitize_text_field( $_POST[ 'dwabswitch' ] ),
    33                 'dauswitch_value' =>  sanitize_text_field( $_POST[ 'dauswitch' ] ),
    34                 'dcpmswitch_value' =>  sanitize_text_field( $_POST[ 'dcpmswitch' ] ),
    35                 'dafswitch_value' =>  sanitize_text_field( $_POST[ 'dafswitch' ] ),
    36             ];
    37 
    38             update_option( 'dwf_settings', $dwf_settings );
    39         }
    40 
    41         if ( isset( $_POST['submit-nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash ( $_POST['submit-nonce'] ) ), 'submit_form' ) ) {
    42             echo '<div class="updated notice notice-success is-dismissible below-h2" id="message"><p>Settings updated successfully. </p></div>';
    43         }
    44         // Get dwf settings values.
    45         $option_values = get_option( 'dwf_settings' );
     10    // Add the admin stylesheet file.
     11    public function dwf_admin_style() {
     12        if ( isset( $_GET['page'] ) && 'disable-feature' === $_GET['page'] ) {
     13            wp_enqueue_style( 'dwun-admin-style', plugins_url( "css/admin-style.css", __FILE__ ) );
     14        }
     15    }
     16
     17    // Add in admin side panel.
     18    public function Admin_menu_dwnSettings() {
     19        add_options_page( 'Disable WordPress Features Settings', 'Disable Features', 'manage_options', 'disable-feature', [ $this, 'dwf_settings' ] );
     20    }
     21
     22    // Add in admin settiings.
     23    public function dwf_settings() {
     24
     25        // Update the plugin settings.
     26        if ( isset( $_POST['submit-nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash ( $_POST['submit-nonce'] ) ), 'submit_form' ) ) {   
     27            $dwf_settings = [
     28                'dxmlrpcswitch_value' => sanitize_text_field( isset( $_POST[ 'dxmlrpcswitch' ] ) ),
     29                'hsotswitch_value' =>  sanitize_text_field( isset( $_POST[ 'hsotswitch' ] ) ),
     30                'hwvnswitch_value' =>  sanitize_text_field( isset( $_POST[ 'hwvnswitch' ] ) ),
     31                'dwbswitch_value' =>  sanitize_text_field( isset( $_POST[ 'dwbswitch' ] ) ),
     32                'dwabswitch_value' =>  sanitize_text_field( isset( $_POST[ 'dwabswitch' ] ) ),
     33                'dauswitch_value' =>  sanitize_text_field( isset( $_POST[ 'dauswitch' ] ) ),
     34                'dcpmswitch_value' =>  sanitize_text_field( isset( $_POST[ 'dcpmswitch' ] ) ),
     35                'dafswitch_value' =>  sanitize_text_field( isset( $_POST[ 'dafswitch' ] ) ),
     36            ];
     37
     38            update_option( 'dwf_settings', $dwf_settings );
     39            echo '<div class="updated notice notice-success is-dismissible below-h2" id="message"><p>Settings updated successfully. </p></div>';
     40        }
     41
     42        // Get dwf settings values.
     43        $option_values = get_option( 'dwf_settings' );
    4644?>
    47     <div class="clear"></div>
    48     <div class="wbcr-factory-page-header">
    49         <h1 style="color:#fff">Disable Features — Settings </h1>
    50     </div>
    51 
    52     <div class="tabordion">
    53         <section id="section1">
    54             <input type="radio" name="sections" id="option1" checked>
    55             <label for="option1">Settings
    56                 <span class="dashicons dashicons-admin-generic"></span>
    57                 <div class="wbcr-factory-tab__short-description">
    58                     General settings
    59                 </div>
    60             </label>
    61             <article>
    62                 <p style=" font-size: 16px;">By using this All-in-One plugin you can simply disable feature that you do not want to use with one click. Doing this will improve your WordPress website performance.</p>
    63                 <form name="fm_dwun" method="POST">
    64                     <table>
    65                         <tbody>
    66                         <tr class="mlw-box-left">
    67                             <th scope="row">
    68                                 <span for="dxmlrpcswitch">Disable XML-RPC </span><br>
    69                                 <small>On sites running WordPress 3.5+, disable XML-RPC completely.</small>
    70                             </th>
    71                             <td>
    72                                 <div class="onoffswitch">
    73                                     <input type="checkbox" name="dxmlrpcswitch" class="onoffswitch-checkbox" id="dxmlrpcswitch" <?php if ( ! empty( $option_values['dxmlrpcswitch_value'] ) ) {
    74                                         echo "checked"; } ?>>
    75                                     <label class="onoffswitch-label" for="dxmlrpcswitch" style="background: none; width: 56px; border: none;padding: inherit;">
    76                                         <span class="onoffswitch-inner"></span>
    77                                         <span class="onoffswitch-switch"></span>
    78                                     </label>
    79                                 </div>
    80                             </td>
    81                         </tr>
    82 
    83                         <tr class="mlw-box-left">
    84                             <th scope="row">
    85                                 <span for="hsotswitch">Hide ‘Screen Options’ Tab </span><br>
    86                                 <small>Remove the Screen Options menu at the top of admin pages.</small>
    87                             </th>
    88                             <td>
    89                                 <div class="onoffswitch">
    90                                     <input type="checkbox" name="hsotswitch" class="onoffswitch-checkbox" id="hsotswitch" <?php if ( ! empty( $option_values['hsotswitch_value'] ) ) {
    91                                         echo "checked"; } ?>>
    92                                     <label class="onoffswitch-label" for="hsotswitch" style="background: none; width: 56px; border: none;padding: inherit;">
    93                                         <span class="onoffswitch-inner"></span>
    94                                         <span class="onoffswitch-switch"></span>
    95                                     </label>
    96                                 </div>
    97                             </td>
    98                         </tr>
    99 
    100                         <tr class="mlw-box-left">
    101                             <th scope="row">
    102                                 <span for="hsotswitch">Hide WordPress Version Number </span><br>
    103                                 <small>Remove the WordPress version number from the frontend site and feeds.</small>
    104                             </th>
    105                             <td>
    106                                 <div class="onoffswitch">
    107                                     <input type="checkbox" name="hwvnswitch" class="onoffswitch-checkbox" id="hwvnswitch" <?php if ( ! empty( $option_values['hwvnswitch_value'] ) ) {
    108                                         echo "checked"; } ?>>
    109                                     <label class="onoffswitch-label" for="hwvnswitch" style="background: none; width: 56px; border: none;padding: inherit;">
    110                                         <span class="onoffswitch-inner"></span>
    111                                         <span class="onoffswitch-switch"></span>
    112                                     </label>
    113                                 </div>
    114                             </td>
    115                         </tr>
    116 
    117                         <tr class="mlw-box-left">
    118                             <th scope="row">
    119                                 <span for="hsotswitch">Disable Blocks Widget </span><br>
    120                                 <small>Disable the Blocks widgets and use the Classic Widgets</small>
    121                             </th>
    122                             <td>
    123                                 <div class="onoffswitch">
    124                                     <input type="checkbox" name="dwbswitch" class="onoffswitch-checkbox" id="dwbswitch" <?php if ( ! empty( $option_values['dwbswitch_value'] ) ) {
    125                                         echo "checked"; } ?>>
    126                                     <label class="onoffswitch-label" for="dwbswitch" style="background: none; width: 56px; border: none;padding: inherit;">
    127                                         <span class="onoffswitch-inner"></span>
    128                                         <span class="onoffswitch-switch"></span>
    129                                     </label>
    130                                 </div>
    131                             </td>
    132                         </tr>
    133 
    134                         <tr class="mlw-box-left">
    135                             <th scope="row">
    136                                 <span for="hsotswitch">Disable WordPress Admin Bar</span><br>
    137                                 <small>Disable the WordPress Admin Bar for all users in the frontend.</small>
    138                             </th>
    139                             <td>
    140                                 <div class="onoffswitch">
    141                                     <input type="checkbox" name="dwabswitch" class="onoffswitch-checkbox" id="dwabswitch" <?php if ( ! empty( $option_values['dwabswitch_value'] ) ) {
    142                                         echo "checked"; } ?>>
    143                                     <label class="onoffswitch-label" for="dwabswitch" style="background: none; width: 56px; border: none;padding: inherit;">
    144                                         <span class="onoffswitch-inner"></span>
    145                                         <span class="onoffswitch-switch"></span>
    146                                     </label>
    147                                 </div>
    148                             </td>
    149                         </tr>
    150 
    151                         <tr class="mlw-box-left">
    152                             <th scope="row">
    153                                 <span for="hsotswitch">Disable Dashboard Welcome Panel</span><br>
    154                                 <small>Remove the Welcome Panel from the Admin Dashboard</small>
    155                             </th>
    156                             <td>
    157                                 <div class="onoffswitch">
    158                                     <input type="checkbox" name="rdwpswitch" class="onoffswitch-checkbox" id="rdwpswitch" <?php if ( ! empty( $option_values['rdwpswitch_value'] ) ) {
    159                                         echo "checked"; } ?>>
    160                                     <label class="onoffswitch-label" for="rdwpswitch" style="background: none; width: 56px; border: none;padding: inherit;">
    161                                         <span class="onoffswitch-inner"></span>
    162                                         <span class="onoffswitch-switch"></span>
    163                                     </label>
    164                                 </div>
    165                             </td>
    166                         </tr>
    167 
    168                         <tr class="mlw-box-left">
    169                             <th scope="row">
    170                                 <span for="hsotswitch">Disable comments page in menu</span><br>
    171                                 <small>Disable the comments page in admin menu in your site.</small>
    172                             </th>
    173                             <td>
    174                                 <div class="onoffswitch">
    175                                     <input type="checkbox" name="dcpmswitch" class="onoffswitch-checkbox" id="dcpmswitch" <?php if ( ! empty( $option_values['dcpmswitch_value'] ) ) {
    176                                         echo "checked"; } ?>>
    177                                     <label class="onoffswitch-label" for="dcpmswitch" style="background: none; width: 56px; border: none;padding: inherit;">
    178                                         <span class="onoffswitch-inner"></span>
    179                                         <span class="onoffswitch-switch"></span>
    180                                     </label>
    181                                 </div>
    182                             </td>
    183                         </tr>
    184                         <tr class="mlw-box-left">
    185                             <th scope="row">
    186                                 <span for="hsotswitch">Disable Admin Footer</span><br>
    187                                 <small>Disable the admin footer text.</small>
    188                             </th>
    189                             <td>
    190                                 <div class="onoffswitch">
    191                                     <input type="checkbox" name="dafswitch" class="onoffswitch-checkbox" id="dafswitch" <?php if ( ! empty( $option_values['dafswitch_value'] ) ) {
    192                                         echo "checked"; } ?>>
    193                                     <label class="onoffswitch-label" for="dafswitch" style="background: none; width: 56px; border: none;padding: inherit;">
    194                                         <span class="onoffswitch-inner"></span>
    195                                         <span class="onoffswitch-switch"></span>
    196                                     </label>
    197                                 </div>
    198                             </td>
    199                         </tr>
    200                         </tbody>
    201                     </table>
    202                     <p class="fm-footer">
    203                         <?php wp_nonce_field( 'submit_form', 'submit-nonce' ); ?>
    204                         <input type="submit" name="publish" id="publish" class="button button-primary" value="Save Changes">
    205                     </p>
    206                 </form>
    207             </article>
    208         </section>
    209        
    210         <section id="section3">
    211             <input type="radio" name="sections" id="option3">
    212             <label for="option3">Support
    213                 <span class="dashicons dashicons-admin-users"></span>
    214                 <div class="wbcr-factory-tab__short-description">
    215                     Having Issues?
    216                 </div>
    217             </label>
    218             <article>
    219                 <h2>Need Support</h2>
    220                 <div id="wbcr-clr-support-widget" class="wbcr-factory-sidebar-widget">
    221                     <p>
    222                         <strong>Do you want the plugin to improved and update?</strong>
    223                     </p>
    224                     <p>Help the author, leave a review on wordpress.org. Thanks to feedback, I will know that the plugin is really useful to you and is needed.</p>
    225                     <p><strong>Having Issues?</strong></p>
    226                     <div class="wbcr-clr-support-widget-body">
    227                         <p>
    228                             We provide free support for this plugin. If you are pushed with a problem, just create a new ticket. We will definitely help you!               </p>
    229                         <ul>
    230                             <li style="margin-top: 15px;background: #fff4f1;padding: 10px;color: #a58074;">
    231                                 <span class="dashicons dashicons-warning"></span>
    232                                 If you find a php error or a vulnerability in plugin, you can <a href="https://github.com/speedyprem/disable-features/issues" target="_blank" rel="noopener">raise an issue</a> in github.</li>
    233                         </ul>
    234                     </div>
    235                 </div>
    236             </article>
    237         </section>
    238     </div>
    239     <?php }
     45<div class="clear"></div>
     46<div class="wbcr-factory-page-header">
     47<h1 style="color:#fff">Disable Features — Settings </h1>
     48</div>
     49
     50<div class="tabordion">
     51<section id="section1">
     52<input type="radio" name="sections" id="option1" checked>
     53<label for="option1">Settings
     54<span class="dashicons dashicons-admin-generic"></span>
     55<div class="wbcr-factory-tab__short-description">
     56General settings
     57</div>
     58</label>
     59<article>
     60<p style=" font-size: 16px;">By using this All-in-One plugin you can simply disable feature that you do not want to use with one click. Doing this will improve your WordPress website performance.</p>
     61<form name="fm_dwun" method="POST">
     62<table>
     63<tbody>
     64<tr class="mlw-box-left">
     65<th scope="row">
     66<span for="dxmlrpcswitch">Disable XML-RPC </span><br>
     67<small>On sites running WordPress 3.5+, disable XML-RPC completely.</small>
     68</th>
     69<td>
     70<div class="onoffswitch">
     71<input type="checkbox" name="dxmlrpcswitch" class="onoffswitch-checkbox" id="dxmlrpcswitch" <?php if ( ! empty( $option_values['dxmlrpcswitch_value'] ) ) {
     72echo "checked"; } ?>>
     73<label class="onoffswitch-label" for="dxmlrpcswitch" style="background: none; width: 56px; border: none;padding: inherit;">
     74<span class="onoffswitch-inner"></span>
     75<span class="onoffswitch-switch"></span>
     76</label>
     77</div>
     78</td>
     79</tr>
     80
     81<tr class="mlw-box-left">
     82<th scope="row">
     83<span for="hsotswitch">Hide ‘Screen Options’ Tab </span><br>
     84<small>Remove the Screen Options menu at the top of admin pages.</small>
     85</th>
     86<td>
     87<div class="onoffswitch">
     88<input type="checkbox" name="hsotswitch" class="onoffswitch-checkbox" id="hsotswitch" <?php if ( ! empty( $option_values['hsotswitch_value'] ) ) {
     89echo "checked"; } ?>>
     90<label class="onoffswitch-label" for="hsotswitch" style="background: none; width: 56px; border: none;padding: inherit;">
     91<span class="onoffswitch-inner"></span>
     92<span class="onoffswitch-switch"></span>
     93</label>
     94</div>
     95</td>
     96</tr>
     97
     98<tr class="mlw-box-left">
     99<th scope="row">
     100<span for="hsotswitch">Hide WordPress Version Number </span><br>
     101<small>Remove the WordPress version number from the frontend site and feeds.</small>
     102</th>
     103<td>
     104<div class="onoffswitch">
     105<input type="checkbox" name="hwvnswitch" class="onoffswitch-checkbox" id="hwvnswitch" <?php if ( ! empty( $option_values['hwvnswitch_value'] ) ) {
     106echo "checked"; } ?>>
     107<label class="onoffswitch-label" for="hwvnswitch" style="background: none; width: 56px; border: none;padding: inherit;">
     108<span class="onoffswitch-inner"></span>
     109<span class="onoffswitch-switch"></span>
     110</label>
     111</div>
     112</td>
     113</tr>
     114
     115<tr class="mlw-box-left">
     116<th scope="row">
     117<span for="hsotswitch">Disable Blocks Widget </span><br>
     118<small>Disable the Blocks widgets and use the Classic Widgets</small>
     119</th>
     120<td>
     121<div class="onoffswitch">
     122<input type="checkbox" name="dwbswitch" class="onoffswitch-checkbox" id="dwbswitch" <?php if ( ! empty( $option_values['dwbswitch_value'] ) ) {
     123echo "checked"; } ?>>
     124<label class="onoffswitch-label" for="dwbswitch" style="background: none; width: 56px; border: none;padding: inherit;">
     125<span class="onoffswitch-inner"></span>
     126<span class="onoffswitch-switch"></span>
     127</label>
     128</div>
     129</td>
     130</tr>
     131
     132<tr class="mlw-box-left">
     133<th scope="row">
     134<span for="hsotswitch">Disable WordPress Admin Bar</span><br>
     135<small>Disable the WordPress Admin Bar for all users in the frontend.</small>
     136</th>
     137<td>
     138<div class="onoffswitch">
     139<input type="checkbox" name="dwabswitch" class="onoffswitch-checkbox" id="dwabswitch" <?php if ( ! empty( $option_values['dwabswitch_value'] ) ) {
     140echo "checked"; } ?>>
     141<label class="onoffswitch-label" for="dwabswitch" style="background: none; width: 56px; border: none;padding: inherit;">
     142<span class="onoffswitch-inner"></span>
     143<span class="onoffswitch-switch"></span>
     144</label>
     145</div>
     146</td>
     147</tr>
     148
     149<tr class="mlw-box-left">
     150<th scope="row">
     151<span for="hsotswitch">Disable Dashboard Welcome Panel</span><br>
     152<small>Remove the Welcome Panel from the Admin Dashboard</small>
     153</th>
     154<td>
     155<div class="onoffswitch">
     156<input type="checkbox" name="rdwpswitch" class="onoffswitch-checkbox" id="rdwpswitch" <?php if ( ! empty( $option_values['rdwpswitch_value'] ) ) {
     157echo "checked"; } ?>>
     158<label class="onoffswitch-label" for="rdwpswitch" style="background: none; width: 56px; border: none;padding: inherit;">
     159<span class="onoffswitch-inner"></span>
     160<span class="onoffswitch-switch"></span>
     161</label>
     162</div>
     163</td>
     164</tr>
     165
     166<tr class="mlw-box-left">
     167<th scope="row">
     168<span for="hsotswitch">Disable comments page in menu</span><br>
     169<small>Disable the comments page in admin menu in your site.</small>
     170</th>
     171<td>
     172<div class="onoffswitch">
     173<input type="checkbox" name="dcpmswitch" class="onoffswitch-checkbox" id="dcpmswitch" <?php if ( ! empty( $option_values['dcpmswitch_value'] ) ) {
     174echo "checked"; } ?>>
     175<label class="onoffswitch-label" for="dcpmswitch" style="background: none; width: 56px; border: none;padding: inherit;">
     176<span class="onoffswitch-inner"></span>
     177<span class="onoffswitch-switch"></span>
     178</label>
     179</div>
     180</td>
     181</tr>
     182                        <tr class="mlw-box-left">
     183<th scope="row">
     184<span for="hsotswitch">Disable Admin Footer</span><br>
     185<small>Disable the admin footer text.</small>
     186</th>
     187<td>
     188<div class="onoffswitch">
     189<input type="checkbox" name="dafswitch" class="onoffswitch-checkbox" id="dafswitch" <?php if ( ! empty( $option_values['dafswitch_value'] ) ) {
     190echo "checked"; } ?>>
     191<label class="onoffswitch-label" for="dafswitch" style="background: none; width: 56px; border: none;padding: inherit;">
     192<span class="onoffswitch-inner"></span>
     193<span class="onoffswitch-switch"></span>
     194</label>
     195</div>
     196</td>
     197</tr>
     198</tbody>
     199</table>
     200<p class="fm-footer">
     201<?php wp_nonce_field( 'submit_form', 'submit-nonce' ); ?>
     202<input type="submit" name="publish" id="publish" class="button button-primary" value="Save Changes">
     203</p>
     204</form>
     205</article>
     206</section>
     207       
     208<section id="section3">
     209<input type="radio" name="sections" id="option3">
     210<label for="option3">Support
     211<span class="dashicons dashicons-admin-users"></span>
     212<div class="wbcr-factory-tab__short-description">
     213Having Issues?
     214</div>
     215</label>
     216<article>
     217<h2>Need Support</h2>
     218<div id="wbcr-clr-support-widget" class="wbcr-factory-sidebar-widget">
     219<p>
     220<strong>Do you want the plugin to improved and update?</strong>
     221</p>
     222<p>Help the author, leave a review on wordpress.org. Thanks to feedback, I will know that the plugin is really useful to you and is needed.</p>
     223<p><strong>Having Issues?</strong></p>
     224<div class="wbcr-clr-support-widget-body">
     225<p>
     226We provide free support for this plugin. If you are pushed with a problem, just create a new ticket. We will definitely help you!               </p>
     227<ul>
     228<li style="margin-top: 15px;background: #fff4f1;padding: 10px;color: #a58074;">
     229<span class="dashicons dashicons-warning"></span>
     230If you find a php error or a vulnerability in plugin, you can <a href="https://github.com/speedyprem/disable-features/issues" target="_blank" rel="noopener">raise an issue</a> in github.</li>
     231</ul>
     232</div>
     233</div>
     234</article>
     235</section>
     236</div>
     237<?php }
    240238
    241239}
Note: See TracChangeset for help on using the changeset viewer.