Changeset 3050160
- Timestamp:
- 03/13/2024 04:18:02 AM (5 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
disable-features/tags/1.0/includes/AdminSettings.php
r3037756 r3050160 8 8 class AdminSettings { 9 9 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' ); 46 44 ?> 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 <tr class="mlw-box-left"> 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 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"> 56 General 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'] ) ) { 72 echo "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'] ) ) { 89 echo "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'] ) ) { 106 echo "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'] ) ) { 123 echo "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'] ) ) { 140 echo "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'] ) ) { 157 echo "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'] ) ) { 174 echo "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'] ) ) { 190 echo "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"> 213 Having 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> 226 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> 227 <ul> 228 <li style="margin-top: 15px;background: #fff4f1;padding: 10px;color: #a58074;"> 229 <span class="dashicons dashicons-warning"></span> 230 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> 231 </ul> 232 </div> 233 </div> 234 </article> 235 </section> 236 </div> 237 <?php } 240 238 241 239 }
Note: See TracChangeset
for help on using the changeset viewer.