Changeset 3067167
- Timestamp:
- 04/08/2024 08:39:46 PM (7 months ago)
- Location:
- wp-guardian/trunk
- Files:
-
- 3 added
- 3 deleted
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
wp-guardian/trunk/assets/css/style.css
r1747467 r3067167 19 19 } 20 20 21 .dtjwpg .dtjwpg-main {22 width: 70%;23 padding: 0 20px 0 0;24 float: left;25 }26 27 .dtjwpg .dtjwpg-aside {28 width: 30%;29 padding: 0;30 float: right;31 }32 33 .dtjwpg .dtjwpg-box,34 21 .dtjwpg .dtjwpg-table { 35 22 background-color: #ffffff; … … 37 24 margin: 20px auto; 38 25 padding: 0; 39 -webkit-border-radius: 3px;40 -moz-border-radius: 3px;41 26 border-radius: 3px; 42 -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04);43 -moz-box-shadow: 0 1px 1px rgba(0,0,0,0.04);44 27 box-shadow: 0 1px 1px rgba(0,0,0,0.04); 45 28 overflow: hidden; … … 50 33 border: none; 51 34 margin: 20px auto; 52 -webkit-border-radius: 0px;53 -moz-border-radius: 0px;54 35 border-radius: 0px; 55 -webkit-box-shadow: none;56 -moz-box-shadow: none;57 36 box-shadow: none; 58 37 } … … 74 53 margin: 0; 75 54 padding: 12px 16px; 76 float: left;77 55 display: block; 78 }79 80 .dtjwpg .dtjwpg-title span {81 vertical-align: middle;82 }83 84 .dtjwpg .dtjwpg-title.blue {85 background-color: #51aaec;86 background-image: -webkit-linear-gradient(to left, #51aaec, #1277c3);87 background-image: -webkit-gradient(to left, #51aaec, #1277c3);88 background-image: -moz-linear-gradient(to left, #51aaec, #1277c3);89 background-image: -o-linear-gradient(to left, #51aaec, #1277c3);90 background-image: linear-gradient(to left, #51aaec, #1277c3);91 color: #ffffff;92 }93 94 .dtjwpg .dtjwpg-title a.button {95 margin: 0 0 0 10px;96 float: right;97 display: inline-block;98 vertical-align: top;99 position: relative;100 56 } 101 57 … … 104 60 margin: 0; 105 61 padding: 0 16px 6px; 106 float: left;107 62 } 108 63 … … 143 98 } 144 99 145 .dtjwpg form input[type="text"],146 .dtjwpg form input[type="email"],147 .dtjwpg form input[type="tel"],148 .dtjwpg form input[type="number"],149 .dtjwpg form input[type="date"],150 .dtjwpg form input[type="time"],151 .dtjwpg form select,152 .dtjwpg form textarea {153 width: 100%;154 min-height: 28px;155 }156 157 .dtjwpg form input[type="text"].dtjwpg-small,158 .dtjwpg form input[type="email"].dtjwpg-small,159 .dtjwpg form input[type="tel"].dtjwpg-small,160 .dtjwpg form input[type="number"].dtjwpg-small,161 .dtjwpg form input[type="date"].dtjwpg-small,162 .dtjwpg form input[type="time"].dtjwpg-small,163 .dtjwpg form select.dtjwpg-small,164 .dtjwpg form textarea.dtjwpg-small {165 width: auto;166 }167 168 100 .dtjwpg form .tablenav .tablenav-pages-navspan { 169 101 box-sizing: content-box; … … 173 105 .dtjwpg form .tablenav select { 174 106 width: auto; 175 }176 177 .dtjwpg form textarea {178 min-height: 100px;179 }180 181 .dtjwpg form textarea.dtjwpg-large {182 min-height: 240px;183 107 } 184 108 … … 188 112 margin: 20px auto; 189 113 padding: 0; 190 -webkit-border-radius: 3px;191 -moz-border-radius: 3px;192 114 border-radius: 3px; 193 -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04);194 -moz-box-shadow: 0 1px 1px rgba(0,0,0,0.04);195 115 box-shadow: 0 1px 1px rgba(0,0,0,0.04); 196 116 overflow: hidden; … … 202 122 width: 100%; 203 123 margin: 0; 204 float: left;205 124 display: block; 206 125 transition: ease-in border-left 0.5s; … … 246 165 } 247 166 248 .dtjwpg .dtjwpg-options-form { 249 border-top: 1px solid #eeeeee; 250 width: 100%; 251 margin: 10px 0 0; 252 float: left; 253 display: block; 254 } 255 256 #wpadminbar #wp-admin-bar-dtjwpg_guardian_link > .ab-item::before { 257 font: 400 20px/1 dashicons; 258 content: "\f332"; 259 top: 2px; 260 } 261 262 @media screen and (max-width: 1024px) { 263 264 .dtjwpg .dtjwpg-title span { 265 266 width: 100%; 267 margin: 0 0 10px; 268 float: left; 269 display: block; 270 271 } 272 273 .dtjwpg .dtjwpg-title a.button { 274 margin: 0 10px 10px 0; 275 float: left; 276 top: 0; 277 } 278 279 } 280 281 @media screen and (max-width: 782px) { 282 283 #wpadminbar #wp-admin-bar-dtjwpg_guardian_link { 284 display: block; 285 } 286 287 #wpadminbar #wp-admin-bar-dtjwpg_guardian_link > .ab-item { 288 width: 52px; 289 display: block; 290 overflow: hidden; 291 font-size: 0px; 292 } 293 294 #wpadminbar #wp-admin-bar-dtjwpg_guardian_link > .ab-item::before { 295 width: 52px; 296 top: 8px; 297 font: 400 32px/1 dashicons; 298 text-align: center; 299 } 300 301 } 302 303 @media screen and (max-width: 767px) { 304 305 .dtjwpg .dtjwpg-main, 306 .dtjwpg .dtjwpg-aside { 307 width: 100%; 308 padding: 0; 309 float: left; 310 } 311 312 } 313 314 @media screen and (max-width: 600px) { 315 316 #wpadminbar ul li.dtjwpg_guardian_link { 317 position: static; 318 } 319 320 } 167 168 169 /** 170 * Grid 171 */ 172 .lhf--grid { 173 display: grid; 174 grid-gap: 1em; 175 margin: 1em 0; 176 } 177 .lhf--grid-1 { 178 grid-template-columns: repeat(1, 1fr); 179 } 180 .lhf--grid-2 { 181 grid-template-columns: repeat(2, 1fr); 182 } 183 .lhf--grid-4 { 184 grid-template-columns: repeat(4, 1fr); 185 } 186 .lhf--grid-5 { 187 grid-template-columns: repeat(5, 1fr); 188 } 189 190 .lhf--grid-item { 191 background-color: #ffffff; 192 padding: 2em 1em; 193 box-shadow: 0px 25px 15px -25px rgb(151 163 184 / 50%); /* #97a3b8 */ 194 border-radius: 4px; 195 } 196 .lhf--grid-item hr { 197 margin: 1em 0; 198 border: 0; 199 border-top: 1px solid #e2e8f0; 200 } 201 .lhf--grid-item h3 { 202 text-transform: uppercase; 203 font-size: 16px; 204 display: flex; 205 align-items: center; 206 gap: 1em; 207 } -
wp-guardian/trunk/assets/includes/config.php
r3061202 r3067167 15 15 delete_option( 'dtjwpg_donate_upsell' ); 16 16 add_option( 'dtjwpg_core_uninstall_remember', 'on' ); 17 17 18 // Hide Admin Backend 18 19 add_option( 'dtjwpg_backend_token_option', '' ); … … 27 28 add_option( 'dtjwpg_lockout_logins_time_option', '30' ); 28 29 // WordPress Options 29 add_option( 'dtjwpg_wp_unfilter_option', 'off' );30 30 add_option( 'dtjwpg_wp_fileedit_option', 'off' ); 31 31 add_option( 'dtjwpg_wp_xmlrpc_option', '1' ); … … 34 34 add_option( 'dtjwpg_wp_emojis_option', 'off' ); 35 35 add_option( 'dtjwpg_wp_debug_option', 'off' ); 36 add_option( 'dtjwpg_wp_wpssl_option', 'off' );37 // Server Configuration38 add_option( 'dtjwpg_server_config_option', '' );39 36 // Two Step Verification 40 37 add_option( 'dtjwpg_verify_option', 'off' ); … … 46 43 delete_option( 'dtjwpg_update_themes_option' ); 47 44 delete_option( 'dtjwpg_update_l10n_option' ); 45 46 47 48 48 49 49 // Check if the database version is up to date … … 150 150 delete_option('dtjwpg_wp_debug_option'); 151 151 delete_option('dtjwpg_wp_wpssl_option'); 152 // Server Configuration 153 delete_option('dtjwpg_server_config_option'); 152 154 153 // Two Step Verification 155 154 delete_option('dtjwpg_verify_option'); … … 161 160 delete_option( 'dtjwpg_update_themes_option' ); 162 161 delete_option( 'dtjwpg_update_l10n_option' ); 162 163 163 164 164 // Finally delete the plugin database version. -
wp-guardian/trunk/assets/includes/core.php
r3062713 r3067167 1 1 <?php 2 if ( ! defined( 'ABSPATH') ) {2 if ( ! defined() ) { 3 3 die; 4 4 } 5 6 function dtjwpg_load_text_domain() {7 load_plugin_textdomain( 'wp-guardian', false, DTJWPG_LANGUAGE );8 }9 add_action( 'plugins_loaded', 'dtjwpg_load_text_domain', 10 );10 5 11 6 function dtjwpg_plugin_assets() { … … 13 8 wp_register_script( 'dtjwpg_admin_ajax', plugins_url( 'wp-guardian', 'wp-guardian' ) . '/assets/js/ajax.js', [ 'jquery' ], DTJWPG_VERSION, true ); 14 9 wp_register_script( 'dtjwpg_admin_scripts', plugins_url( 'wp-guardian', 'wp-guardian' ) . '/assets/js/scripts.js', [ 'jquery' ], DTJWPG_VERSION, true ); 10 11 12 13 15 14 16 15 if ( is_user_logged_in() ) { -
wp-guardian/trunk/assets/includes/guardian.php
r3062713 r3067167 98 98 99 99 /** 100 * Disables users from posting unfiltered HTML.101 *102 * @since 1.0103 * @return void104 */105 function dtjwpg_disable_unfiltered_html() {106 107 // Check if unfiltered HTML should be disabled108 if ( 'on' == get_option('dtjwpg_wp_unfilter_option') ) {109 110 // Check it's not already defined and then define it111 if ( ! defined('DISALLOW_UNFILTERED_HTML') ) {112 define('DISALLOW_UNFILTERED_HTML', true);113 }114 115 }116 117 }118 add_action('plugins_loaded', 'dtjwpg_disable_unfiltered_html', 1);119 120 /**121 100 * Disables file editing within wp-admin. 122 101 * … … 323 302 } 324 303 add_action('plugins_loaded', 'dtjwpg_wp_debug_mode', 1); 325 326 /**327 * Forces the website to default to HTTPS.328 *329 * @since 1.0330 * @return void331 */332 function dtjwpg_force_site_ssl() {333 334 // Check if the site should be served over HTTPS335 if ( 'on' == get_option('dtjwpg_wp_wpssl_option') ) {336 337 // Check if the constants are already defined and if not, define them338 339 if ( ! defined('FORCE_SSL_LOGIN') ) {340 define('FORCE_SSL_LOGIN', true);341 }342 343 if ( ! defined('FORCE_SSL_ADMIN') ) {344 define('FORCE_SSL_ADMIN', true);345 }346 347 }348 349 }350 add_action('plugins_loaded', 'dtjwpg_force_site_ssl', 1);351 304 352 305 // Check if the backend is hidden to prevent brute force attacks -
wp-guardian/trunk/assets/js/ajax.js
r3061202 r3067167 1 /**2 * ajax.js3 */4 5 1 jQuery(document).ready(function($) { 6 7 2 // On click of the database upgrade link 8 3 $('body').on('click', '.dtjwpg-upgrade-db-link', function(e) { … … 19 14 // On confirmation of the upgrade dialog box 20 15 if ( confirm( DTJWPG_AJAX.confirm_upgrade_db ) ) { 21 22 16 // Make an Ajax request 23 17 $.ajax({ … … 29 23 url: DTJWPG_AJAX.admin_ajax, 30 24 success: function(response) { 31 32 25 // Hide the spinner now we're done 33 26 $('.dtjwpg-db-upgrade-spinner').css('visibility', 'hidden'); … … 35 28 // If the response is successful, show a notice 36 29 if ( response == "1" ) { 37 38 30 // Show the success message and hide the warning 39 31 $('.dtjwpg-notice-upgrade-success').show(); 40 32 $('.dtjwpg-notice-upgrade-warning').remove(); 41 42 33 } 43 44 34 } 45 35 }); 46 47 36 } else { 48 49 37 // Upgrade cancelled so hide the spinner for 50 38 $('.dtjwpg-db-upgrade-spinner').css('visibility', 'hidden'); 51 52 39 } 53 54 40 }); 55 41 56 42 // On click of one of the save settings buttons 57 43 $('body').on('click', '.dtjwpg-save-settings-button', function(e) { 58 59 44 // Get this button and add to a variable 60 45 var currentButton = $(this); … … 69 54 // Check which button was clicked to decide what data to pass to the Ajax request 70 55 if ( $(this).hasClass('dtjwpg-wordpress-button') ) { 71 72 56 var ajax_nonce = 'dtjwpg_save_option_nonce'; 73 57 var ajax_safety = $('.dtjwpg_save_option_nonce').val(); 74 58 var ajax_options = { 75 dtjwpg_wp_unfilter_option: $('.dtjwpg_wp_unfilter_option').is(':checked') ? 'on' : 'off',76 59 dtjwpg_wp_fileedit_option: $('.dtjwpg_wp_fileedit_option').is(':checked') ? 'on' : 'off', 77 60 dtjwpg_wp_xmlrpc_option: $('.dtjwpg_wp_xmlrpc_option').val(), … … 80 63 dtjwpg_wp_emojis_option: $('.dtjwpg_wp_emojis_option').is(':checked') ? 'on' : 'off', 81 64 dtjwpg_wp_debug_option: $('.dtjwpg_wp_debug_option').is(':checked') ? 'on' : 'off', 82 dtjwpg_wp_wpssl_option: $('.dtjwpg_wp_wpssl_option').is(':checked') ? 'on' : 'off',83 65 }; 84 85 66 } else if ( $(this).hasClass('dtjwpg-backend-button') ) { 86 87 67 var ajax_nonce = 'dtjwpg_save_backend_nonce'; 88 68 var ajax_safety = $('.dtjwpg_save_backend_nonce').val(); … … 91 71 dtjwpg_backend_redirect_option: $('.dtjwpg_backend_redirect_option').val(), 92 72 }; 93 94 73 } else if ( $(this).hasClass('dtjwpg-lockouts-button') ) { 95 96 74 var ajax_nonce = 'dtjwpg_save_lockout_nonce'; 97 75 var ajax_safety = $('.dtjwpg_save_lockout_nonce').val(); … … 102 80 dtjwpg_lockout_logins_time_option: $('.dtjwpg_lockout_logins_time_option').val(), 103 81 }; 104 105 } else if ( $(this).hasClass('dtjwpg-server-button') ) {106 107 return false;108 109 82 } else if ( $(this).hasClass('dtjwpg-verify-button') ) { 110 111 83 var ajax_nonce = 'dtjwpg_save_verify_nonce'; 112 84 var ajax_safety = $('.dtjwpg_save_verify_nonce').val(); … … 114 86 dtjwpg_verify_option: $('.dtjwpg_verify_option').is(':checked') ? 'on' : 'off', 115 87 }; 116 117 88 } else { 118 119 89 // Invalid button clicked, stop here 120 90 return false; 121 122 91 } 123 92 … … 127 96 // Setup a new Ajax request 128 97 $.ajax({ 129 130 98 // Set the data and run 131 99 data: { … … 138 106 url: DTJWPG_AJAX.admin_ajax, 139 107 success: function(response) { 140 141 108 // Hide the progress spinner from the interface 142 109 $('.dtjwpg-save-spinner').css('visibility', 'hidden'); … … 144 111 // Check the response, if 1 success and anything else is a failure 145 112 if ( response == "1" ) { 146 147 113 // Add the success class to the section element 148 114 $(currentButton).closest('.dtjwpg-options-item').addClass('dtjwpg-options-success'); 149 150 115 } else { 151 152 116 // Add the failure class to the section element 153 117 $(currentButton).closest('.dtjwpg-options-item').addClass('dtjwpg-options-failure'); 154 155 118 } 156 157 119 } 158 159 120 }); 160 161 121 }); 162 163 122 }); 164 -
wp-guardian/trunk/assets/js/scripts.js
r1745008 r3067167 1 /**2 * scripts.js3 */4 5 1 jQuery(document).ready(function($) { 6 7 2 // Hide all option content blocks 8 3 $('.dtjwpg-options-content').hide(); … … 10 5 // Function to toggle each setting section 11 6 $('.dtjwpg-options-toggle').on('click', function(e) { 12 13 7 e.preventDefault(); 14 8 … … 17 11 $(this).parent('.dtjwpg-options-item').toggleClass('dtjwpg-options-active'); 18 12 $(this).next('.dtjwpg-options-content').slideToggle('slow'); 19 20 13 }); 21 14 22 15 // Function to close the current section 23 16 $('.dtjwpg-close-button').on('click', function(e) { 24 25 17 e.preventDefault(); 26 18 … … 29 21 $(this).closest('.dtjwpg-options-item').removeClass('dtjwpg-options-active'); 30 22 $(this).closest('.dtjwpg-options-content').slideUp('slow'); 31 32 23 }); 33 34 24 }); 35 -
wp-guardian/trunk/assets/templates/aside.php
r3061202 r3067167 4 4 } 5 5 ?> 6 <div class="dtjwpg-box">7 <h3 class="dtjwpg-title blue"><?php _e( 'Buy me a coffee', 'wp-guardian' ); ?></h3>8 6 9 <div class="dtjwpg-content"> 10 <p><?php _e( 'Are you enjoying using this plugin? Please consider donating to the author, it would help to continue the development of the plugin and make it even better. Even a small amount is appreciated!', 'wp-guardian' ); ?></p> 11 <p><a href="https://getbutterfly.com/" target="_blank"><?php _e( 'Check out my other plugins.', 'wp-guardian' ); ?></a></p> 12 <p><a href="https://www.buymeacoffee.com/wolffe" class="button button-primary" target="_blank"><?php _e( 'Donate Now', 'wp-guardian' ); ?></a></p> 13 </div> 14 </div> 7 <h3><?php _e( 'Buy me a coffee', 'wp-guardian' ); ?></h3> 15 8 16 <div class="dtjwpg-box"> 17 <h3 class="dtjwpg-title"><?php _e( 'Information', 'wp-guardian' ); ?></h3> 9 <p><?php _e( 'Are you enjoying using this plugin? Please consider donating to the author, it would help to continue the development of the plugin and make it even better. Even a small amount is appreciated!', 'wp-guardian' ); ?></p> 10 <p> 11 <a href="https://getbutterfly.com/" class="button button-secondary" target="_blank"><?php _e( 'Check out my other plugins.', 'wp-guardian' ); ?></a> 12 <a href="https://www.buymeacoffee.com/wolffe" class="button button-primary" target="_blank"><?php _e( 'Donate Now', 'wp-guardian' ); ?></a> 13 </p> 18 14 19 <div class="dtjwpg-content"> 20 <p><strong><?php _e( 'Need help with something?', 'wp-guardian' ); ?></strong> <?php _e( 'You can ask a question today in the WordPress forums or read the plugin information on the plugin details page.', 'wp-guardian' ); ?></p> 21 <p><?php printf( __( 'You're currently using <strong>Version %s</strong> of the plugin.', 'wp-guardian' ), DTJWPG_VERSION ); ?></p> 22 <p><em><?php _e( 'Thanks for using WP Guardian!', 'wp-guardian' ); ?></em></p> 23 </div> 24 </div> 15 <hr> 16 17 <h3><?php _e( 'Information', 'wp-guardian' ); ?></h3> 18 19 <p><strong><?php _e( 'Need help with something?', 'wp-guardian' ); ?></strong> <?php _e( 'You can ask a question today in the WordPress forums or read the plugin information on the plugin details page.', 'wp-guardian' ); ?></p> 20 <p><?php printf( __( 'You're currently using <strong>Version %s</strong> of the plugin.', 'wp-guardian' ), DTJWPG_VERSION ); ?></p> 21 <p><em><?php _e( 'Thanks for using WP Guardian!', 'wp-guardian' ); ?></em></p> -
wp-guardian/trunk/assets/templates/guardian-backend.php
r1747467 r3067167 1 1 2 2 <a href="#" class="dtjwpg-options-toggle dtjwpg-title"><?php _e('Hide Admin Dashboard', 'wp-guardian'); ?></a>3 <div class="dtjwpg-options-content dtjwpg-content" style="display: none;">3 > 4 > 4 5 5 <p><?php _e('By default the WordPress dashboard is easily accessible to anyone via <code>/wp-admin/</code> or <code>/wp-login.php</code>. Now you can add a token to those requests which will prevent people from reaching the login page.', 'wp-guardian'); ?></p> 6 7 <div class="dtjwpg-options-form dtjwpg-backend-form"> 8 9 <form method="post"> 10 11 <table class="dtjwpg-form form-table"> 12 13 <tbody> 14 15 <tr> 16 <th><label for="dtjwpg_backend_token_option"><?php _e('Secret Login Token', 'wp-guardian'); ?></label></th> 17 <td> 18 <p><input type="text" id="dtjwpg_backend_token_option" class="dtjwpg_backend_token_option small-text dtjwpg-small" name="dtjwpg_backend_token_option" value="<?php echo get_option('dtjwpg_backend_token_option'); ?>" aria-describedby="description-dtjwpg_backend_token_option" /></p> 19 <p class="description" id="description-dtjwpg_backend_token_option"><?php _e('Enter a string of letters & numbers that will act as a token to verify the request made to the login page. For example, if the path was set to <code>a1b2c3</code>, the login URL becomes <code>/wp-login.php?dtjwpg-token=a1b2c3</code>. <strong>Leave this field blank to disable this setting.</strong>', 'wp-guardian'); ?></p> 20 </td> 21 </tr> 22 23 <tr> 24 <th><label for="dtjwpg_backend_redirect_option"><?php _e('Incorrect Token Redirect', 'wp-guardian'); ?></label></th> 25 <td> 26 <p><input type="text" id="dtjwpg_backend_redirect_option" class="dtjwpg_backend_redirect_option small-text dtjwpg-small" name="dtjwpg_backend_redirect_option" value="<?php echo get_option('dtjwpg_backend_redirect_option'); ?>" aria-describedby="description-dtjwpg_backend_redirect_option" /></p> 27 <p class="description" id="description-dtjwpg_backend_redirect_option"><?php _e('When an incorrect token is provided for the login page, the user will be redirected to the homepage by default. You can enter a slug for a different page if you'd like to redirect them elsewhere.', 'wp-guardian'); ?></p> 28 </td> 29 </tr> 30 31 <tr> 32 <th></th> 33 <td> 34 <?php $dtjwpg_save_backend_nonce = wp_create_nonce('dtjwpg_save_backend_nonce'); ?> 35 <input type="hidden" name="dtjwpg_save_backend_nonce" class="dtjwpg_save_backend_nonce" value="<?php echo $dtjwpg_save_backend_nonce; ?>" /> 36 <button type="button" class="dtjwpg-save-settings-button dtjwpg-backend-button button button-primary"><?php _e('Save Settings', 'wp-guardian'); ?></button> 37 <button type="button" class="dtjwpg-close-button button button-secondary"><?php _e('Close', 'wp-guardian'); ?></button> 38 <span class="spinner dtjwpg-save-spinner"></span> 39 </td> 40 </tr> 41 42 </tbody> 43 44 </table> 45 46 </form> 47 48 </div> 49 50 </div> 6 <form method="post"> 7 <table class="dtjwpg-form form-table"> 8 <tbody> 9 <tr> 10 <th><label for="dtjwpg_backend_token_option"><?php _e( 'Secret Login Token', 'wp-guardian' ); ?></label></th> 11 <td> 12 <p><input type="text" id="dtjwpg_backend_token_option" class="dtjwpg_backend_token_option regular-text" name="dtjwpg_backend_token_option" value="<?php echo get_option( 'dtjwpg_backend_token_option' ); ?>"></p> 13 <p class="description" id="description-dtjwpg_backend_token_option"><?php _e( 'Enter a string of letters & numbers that will act as a token to verify the request made to the login page. For example, if the path was set to <code>a1b2c3</code>, the login URL becomes <code>/wp-login.php?dtjwpg-token=a1b2c3</code>. <strong>Leave this field blank to disable this setting.</strong>', 'wp-guardian' ); ?></p> 14 </td> 15 </tr> 16 <tr> 17 <th><label for="dtjwpg_backend_redirect_option"><?php _e( 'Incorrect Token Redirect', 'wp-guardian' ); ?></label></th> 18 <td> 19 <p><input type="text" id="dtjwpg_backend_redirect_option" class="dtjwpg_backend_redirect_option regular-text" name="dtjwpg_backend_redirect_option" value="<?php echo get_option( 'dtjwpg_backend_redirect_option' ); ?>"></p> 20 <p class="description" id="description-dtjwpg_backend_redirect_option"><?php _e( 'When an incorrect token is provided for the login page, the user will be redirected to the homepage by default. You can enter a slug for a different page if you'd like to redirect them elsewhere.', 'wp-guardian' ); ?></p> 21 </td> 22 </tr> 23 <tr> 24 <th></th> 25 <td> 26 <?php $dtjwpg_save_backend_nonce = wp_create_nonce( 'dtjwpg_save_backend_nonce' ); ?> 27 <input type="hidden" name="dtjwpg_save_backend_nonce" class="dtjwpg_save_backend_nonce" value="<?php echo $dtjwpg_save_backend_nonce; ?>" /> 28 <button type="button" class="dtjwpg-save-settings-button dtjwpg-backend-button button button-primary"><?php _e( 'Save Settings', 'wp-guardian' ); ?></button> 29 <button type="button" class="dtjwpg-close-button button button-secondary"><?php _e( 'Close', 'wp-guardian' ); ?></button> 30 <span class="spinner dtjwpg-save-spinner"></span> 31 </td> 32 </tr> 33 </tbody> 34 </table> 35 </form> 36 </div> -
wp-guardian/trunk/assets/templates/guardian-firewall.php
r3062713 r3067167 9 9 update_option( 'wp_guardian_firewall_log', (int) sanitize_text_field( $_POST['wp_guardian_firewall_log'] ) ); 10 10 11 11 12 update_option( 'wp_guardian_firewall_long_requests_length', (int) sanitize_text_field( $_POST['wp_guardian_firewall_long_requests_length'] ) ); 12 13 … … 46 47 </p> 47 48 <p> 48 <input type="number" value="<?php echo get_option( 'wp_guardian_firewall_long_requests_length' ); ?>" name="wp_guardian_firewall_long_requests_length" placeholder="2000" min="0" style="width: 200px;"> characters 49 <input type="number" value="<?php echo get_option( 'wp_guardian_firewall_long_requests_length' ); ?>" name="wp_guardian_firewall_long_requests_length" placeholder="2000" min="0" style="width: 200px;"> characters in URL to check for 50 </p> 51 <p> 52 <input type="number" value="<?php echo get_option( 'wp_guardian_firewall_log_size' ); ?>" name="wp_guardian_firewall_log_size" placeholder="10000" min="0" style="width: 200px;"> records to keep in the log 49 53 </p> 50 54 </td> -
wp-guardian/trunk/assets/templates/guardian-lockouts.php
r1747467 r3067167 1 1 2 2 <a href="#" class="dtjwpg-options-toggle dtjwpg-title"><?php _e('Lockout Management', 'wp-guardian'); ?></a>3 <div class="dtjwpg-options-content dtjwpg-content" style="display: none;">3 > 4 > 4 5 5 <p><?php _e('You can manage site lockouts from this section by configuring when people are blocked from accessing the site after they perform particular forbidden actions on the site.', 'wp-guardian'); ?></p> 6 7 <div class="dtjwpg-options-form dtjwpg-lockouts-form"> 8 9 <form method="post"> 10 11 <table class="dtjwpg-form form-table"> 12 13 <tbody> 14 15 <tr> 16 <th><label for="dtjwpg_lockout_logins_option"><?php _e('Track Failed Logins', 'wp-guardian'); ?></label></th> 17 <td> 18 <p><input type="checkbox" id="dtjwpg_lockout_logins_option" class="dtjwpg_lockout_logins_option" name="dtjwpg_lockout_logins_option"<?php if ( 'on' == get_option('dtjwpg_lockout_logins_option') ) : ?> checked="checked"<?php endif; ?> aria-describedby="description-dtjwpg_lockout_logins_option" /></p> 19 <p class="description" id="description-dtjwpg_lockout_logins_option"><?php _e('Turning this setting on will track incorrect login attempts by users and lockout them out after a specified amount of attempts.', 'wp-guardian'); ?></p> 20 </td> 21 </tr> 22 23 <tr> 24 <th><label for="dtjwpg_lockout_email_option"><?php _e('Send Email On Lockout', 'wp-guardian'); ?></label></th> 25 <td> 26 <p><input type="checkbox" id="dtjwpg_lockout_email_option" class="dtjwpg_lockout_email_option" name="dtjwpg_lockout_email_option"<?php if ( 'on' == get_option('dtjwpg_lockout_email_option') ) : ?> checked="checked"<?php endif; ?> aria-describedby="description-dtjwpg_lockout_email_option" /></p> 27 <p class="description" id="description-dtjwpg_lockout_email_option"><?php _e('Choose whether you would like to be notified by email when someone has failed too many login attempts and is locked out.', 'wp-guardian'); ?></p> 28 </td> 29 </tr> 30 31 <tr> 32 <th><label for="dtjwpg_lockout_logins_threshold_option"><?php _e('Incorrect Login Threshold', 'wp-guardian'); ?></label></th> 33 <td> 34 <p><input type="number" id="dtjwpg_lockout_logins_threshold_option" class="dtjwpg_lockout_logins_threshold_option small-text dtjwpg-small" name="dtjwpg_lockout_logins_threshold_option" value="<?php echo get_option('dtjwpg_lockout_logins_threshold_option'); ?>" aria-describedby="description-dtjwpg_lockout_logins_threshold_option" /></p> 35 <p class="description" id="description-dtjwpg_lockout_logins_threshold_option"><?php _e('The number of incorrect login attempts that should be made before the user is locked out from accessing the site.', 'wp-guardian'); ?></p> 36 </td> 37 </tr> 38 39 <tr> 40 <th><label for="dtjwpg_lockout_logins_time_option"><?php _e('Incorrect Login Lockout', 'wp-guardian'); ?></label></th> 41 <td> 42 <p><input type="number" id="dtjwpg_lockout_logins_time_option" class="dtjwpg_lockout_logins_time_option small-text dtjwpg-small" name="dtjwpg_lockout_logins_time_option" value="<?php echo get_option('dtjwpg_lockout_logins_time_option'); ?>" aria-describedby="description-dtjwpg_lockout_logins_time_option" /> minutes</p> 43 <p class="description" id="description-dtjwpg_lockout_logins_time_option"><?php _e('Enter the number of minutes that a user should be locked out from the site after the specified amount of incorrect logins.', 'wp-guardian'); ?></p> 44 </td> 45 </tr> 46 47 <tr> 48 <th></th> 49 <td> 50 <?php $dtjwpg_save_lockout_nonce = wp_create_nonce('dtjwpg_save_lockout_nonce'); ?> 51 <input type="hidden" name="dtjwpg_save_lockout_nonce" class="dtjwpg_save_lockout_nonce" value="<?php echo $dtjwpg_save_lockout_nonce; ?>" /> 52 <button type="button" class="dtjwpg-save-settings-button dtjwpg-lockouts-button button button-primary"><?php _e('Save Settings', 'wp-guardian'); ?></button> 53 <button type="button" class="dtjwpg-close-button button button-secondary"><?php _e('Close', 'wp-guardian'); ?></button> 54 <span class="spinner dtjwpg-save-spinner"></span> 55 </td> 56 </tr> 57 58 </tbody> 59 60 </table> 61 62 </form> 63 64 </div> 65 66 </div> 6 <form method="post"> 7 <table class="dtjwpg-form form-table"> 8 <tbody> 9 <tr> 10 <th><label for="dtjwpg_lockout_logins_option"><?php _e( 'Track Failed Logins', 'wp-guardian' ); ?></label></th> 11 <td> 12 <p><input type="checkbox" id="dtjwpg_lockout_logins_option" class="dtjwpg_lockout_logins_option" name="dtjwpg_lockout_logins_option"<?php checked( 'on', (string) get_option( 'dtjwpg_lockout_logins_option' ) ); ?>></p> 13 <p class="description" id="description-dtjwpg_lockout_logins_option"><?php _e( 'Turning this setting on will track incorrect login attempts by users and lockout them out after a specified amount of attempts.', 'wp-guardian' ); ?></p> 14 </td> 15 </tr> 16 <tr> 17 <th><label for="dtjwpg_lockout_email_option"><?php _e( 'Send Email On Lockout', 'wp-guardian' ); ?></label></th> 18 <td> 19 <p><input type="checkbox" id="dtjwpg_lockout_email_option" class="dtjwpg_lockout_email_option" name="dtjwpg_lockout_email_option"<?php checked( 'on', (string) get_option( 'dtjwpg_lockout_email_option' ) ); ?>></p> 20 <p class="description" id="description-dtjwpg_lockout_email_option"><?php _e( 'Choose whether you would like to be notified by email when someone has failed too many login attempts and is locked out.', 'wp-guardian' ); ?></p> 21 </td> 22 </tr> 23 <tr> 24 <th><label for="dtjwpg_lockout_logins_threshold_option"><?php _e( 'Incorrect Login Threshold', 'wp-guardian ' ); ?></label></th> 25 <td> 26 <p><input type="number" id="dtjwpg_lockout_logins_threshold_option" class="dtjwpg_lockout_logins_threshold_option" name="dtjwpg_lockout_logins_threshold_option" value="<?php echo get_option( 'dtjwpg_lockout_logins_threshold_option' ); ?>"></p> 27 <p class="description" id="description-dtjwpg_lockout_logins_threshold_option"><?php _e( 'The number of incorrect login attempts that should be made before the user is locked out from accessing the site.', 'wp-guardian' ); ?></p> 28 </td> 29 </tr> 30 <tr> 31 <th><label for="dtjwpg_lockout_logins_time_option"><?php _e( 'Incorrect Login Lockout', 'wp-guardian' ); ?></label></th> 32 <td> 33 <p><input type="number" id="dtjwpg_lockout_logins_time_option" class="dtjwpg_lockout_logins_time_option" name="dtjwpg_lockout_logins_time_option" value="<?php echo get_option( 'dtjwpg_lockout_logins_time_option' ); ?>"> minutes</p> 34 <p class="description" id="description-dtjwpg_lockout_logins_time_option"><?php _e( 'Enter the number of minutes that a user should be locked out from the site after the specified amount of incorrect logins.', 'wp-guardian' ); ?></p> 35 </td> 36 </tr> 37 <tr> 38 <th></th> 39 <td> 40 <?php $dtjwpg_save_lockout_nonce = wp_create_nonce( 'dtjwpg_save_lockout_nonce' ); ?> 41 <input type="hidden" name="dtjwpg_save_lockout_nonce" class="dtjwpg_save_lockout_nonce" value="<?php echo $dtjwpg_save_lockout_nonce; ?>"> 42 <button type="button" class="dtjwpg-save-settings-button dtjwpg-lockouts-button button button-primary"><?php _e( 'Save Settings', 'wp-guardian' ); ?></button> 43 <button type="button" class="dtjwpg-close-button button button-secondary"><?php _e( 'Close', 'wp-guardian' ); ?></button> 44 <span class="spinner dtjwpg-save-spinner"></span> 45 </td> 46 </tr> 47 </tbody> 48 </table> 49 </form> 50 </div> -
wp-guardian/trunk/assets/templates/guardian-options.php
r1765383 r3067167 1 1 2 2 <a href="#" class="dtjwpg-options-toggle dtjwpg-title"><?php _e('WordPress Options', 'wp-guardian'); ?></a>3 <div class="dtjwpg-options-content dtjwpg-content" style="display: none;">3 > 4 > 4 5 5 <p><?php _e('WordPress is highly configurable, but there are some settings that cannot be changed without going into the code. Now you can manage these settings easily.', 'wp-guardian'); ?></p> 6 7 <div class="dtjwpg-options-form dtjwpg-options-form"> 8 9 <form method="post"> 10 11 <table class="dtjwpg-form form-table"> 12 13 <tbody> 14 15 <tr> 16 <th><label for="dtjwpg_wp_unfilter_option"><?php _e('Disable Unfiltered HTML', 'wp-guardian'); ?></label></th> 17 <td> 18 <p><input type="checkbox" id="dtjwpg_wp_unfilter_option" class="dtjwpg_wp_unfilter_option" name="dtjwpg_wp_unfilter_option" <?php if ( 'on' == get_option('dtjwpg_wp_unfilter_option') ) : ?> checked="checked"<?php endif; ?> aria-describedby="description-dtjwpg_wp_unfilter_option" /></p> 19 <p class="description" id="description-dtjwpg_wp_unfilter_option"><?php _e('Removes the ability for super admins (multi-sites only), admins and editors (single sites) to post unfiltered HTML in posts and other content areas which could harm your website.', 'wp-guardian'); ?></p> 20 </td> 21 </tr> 22 23 <tr> 24 <th><label for="dtjwpg_wp_fileedit_option"><?php _e('Disable File Editor', 'wp-guardian'); ?></label></th> 25 <td> 26 <p><input type="checkbox" id="dtjwpg_wp_fileedit_option" class="dtjwpg_wp_fileedit_option" name="dtjwpg_wp_fileedit_option" <?php if ( 'on' == get_option('dtjwpg_wp_fileedit_option') ) : ?> checked="checked"<?php endif; ?> aria-describedby="description-dtjwpg_wp_fileedit_option" /></p> 27 <p class="description" id="description-dtjwpg_wp_fileedit_option"><?php _e('Editing Core, plugin and theme files via the WordPress admin area is unnecessary and can be a security risk if your account is hacked. Turning this off ensures files aren't editable by site users.', 'wp-guardian'); ?></p> 28 </td> 29 </tr> 30 31 <tr> 32 <th><label for="dtjwpg_wp_xmlrpc_option"><?php _e('XML-RPC Safety', 'wp-guardian'); ?></label></th> 33 <td> 34 <p> 35 <select class="dtjwpg_wp_xmlrpc_option dtjwpg-small" id="dtjwpg_wp_xmlrpc_option" name="dtjwpg_wp_xmlrpc_option" aria-describedby="description-dtjwpg_wp_xmlrpc_option"> 36 <option value="1"<?php if ( '1' == get_option('dtjwpg_wp_xmlrpc_option') ) : ?> selected="selected"<?php endif; ?>><?php _e('Allow all XML-RPC requests', 'wp-guardian'); ?></option> 37 <option value="2"<?php if ( '2' == get_option('dtjwpg_wp_xmlrpc_option') ) : ?> selected="selected"<?php endif; ?>><?php _e('Limit XML-RPC requests to logged in users', 'wp-guardian'); ?></option> 38 <option value="3"<?php if ( '3' == get_option('dtjwpg_wp_xmlrpc_option') ) : ?> selected="selected"<?php endif; ?>><?php _e('Disallow XML-RPC requests for everyone', 'wp-guardian'); ?></option> 39 </select> 40 </p> 41 <p class="description" id="description-dtjwpg_wp_xmlrpc_option"><?php _e('XML-RPC is an API that allows services such as WordPress.com to communicate with your website. This option will let you choose whether you want to publicly expose the XML-RPC API to requests.', 'wp-guardian'); ?></p> 42 </td> 43 </tr> 44 45 <tr> 46 <th><label for="dtjwpg_wp_restapi_option"><?php _e('REST API Safety', 'wp-guardian'); ?></label></th> 47 <td> 48 <p> 49 <select class="dtjwpg_wp_restapi_option dtjwpg-small" id="dtjwpg_wp_restapi_option" name="dtjwpg_wp_restapi_option" aria-describedby="description-dtjwpg_wp_restapi_option"> 50 <option value="1"<?php if ( '1' == get_option('dtjwpg_wp_restapi_option') ) : ?> selected="selected"<?php endif; ?>><?php _e('Allow all RESTful API requests', 'wp-guardian'); ?></option> 51 <option value="2"<?php if ( '2' == get_option('dtjwpg_wp_restapi_option') ) : ?> selected="selected"<?php endif; ?>><?php _e('Limit RESTful API requests to logged in users', 'wp-guardian'); ?></option> 52 <option value="3"<?php if ( '3' == get_option('dtjwpg_wp_restapi_option') ) : ?> selected="selected"<?php endif; ?>><?php _e('Limit RESTful API requests to administrators', 'wp-guardian'); ?></option> 53 <option value="4"<?php if ( '4' == get_option('dtjwpg_wp_restapi_option') ) : ?> selected="selected"<?php endif; ?>><?php _e('Disable the REST API completely', 'wp-guardian'); ?></option> 54 </select> 55 </p> 56 <p class="description" id="description-dtjwpg_wp_restapi_option"><?php _e('The WordPress REST API is a great tool that allows you to extend the capabilities of your website, however by default it's accessible to everyone including guests. This setting will let you restrict who can use it.', 'wp-guardian'); ?></p> 57 </td> 58 </tr> 59 60 <tr> 61 <th><label for="dtjwpg_wp_headers_option"><?php _e('Header Safe Mode', 'wp-guardian'); ?></label></th> 62 <td> 63 <p><input type="checkbox" id="dtjwpg_wp_headers_option" class="dtjwpg_wp_headers_option" name="dtjwpg_wp_headers_option" <?php if ( 'on' == get_option('dtjwpg_wp_headers_option') ) : ?> checked="checked"<?php endif; ?> aria-describedby="description-dtjwpg_wp_headers_option" /></p> 64 <p class="description" id="description-dtjwpg_wp_headers_option"><?php _e('By default WordPress adds additional header meta information that is unnecessary. Enabling safe mode will remove this pointless headers.', 'wp-guardian'); ?></p> 65 </td> 66 </tr> 67 68 <tr> 69 <th><label for="dtjwpg_wp_emojis_option"><?php _e('Filter Emoji Support', 'wp-guardian'); ?></label></th> 70 <td> 71 <p><input type="checkbox" id="dtjwpg_wp_emojis_option" class="dtjwpg_wp_emojis_option" name="dtjwpg_wp_emojis_option" <?php if ( 'on' == get_option('dtjwpg_wp_emojis_option') ) : ?> checked="checked"<?php endif; ?> aria-describedby="description-dtjwpg_wp_emojis_option" /></p> 72 <p class="description" id="description-dtjwpg_wp_emojis_option"><?php _e('By turning this option on, support for Emojis will be turned off. This removes unnecessary scripts and stylesheets from being loaded.', 'wp-guardian'); ?></p> 73 </td> 74 </tr> 75 76 <tr> 77 <th><label for="dtjwpg_wp_debug_option"><?php _e('Enable Debug Mode', 'wp-guardian'); ?></label></th> 78 <td> 79 <p><input type="checkbox" id="dtjwpg_wp_debug_option" class="dtjwpg_wp_debug_option" name="dtjwpg_wp_debug_option" <?php if ( 'on' == get_option('dtjwpg_wp_debug_option') ) : ?> checked="checked"<?php endif; ?> aria-describedby="description-dtjwpg_wp_debug_option" /></p> 80 <p class="description" id="description-dtjwpg_wp_debug_option"><?php _e('You can enable <code>WP_DEBUG</code> mode by turning this setting on. <strong>Do not enable this on a production website unless you know what you're doing.</strong>', 'wp-guardian'); ?></p> 81 </td> 82 </tr> 83 84 <tr> 85 <th><label for="dtjwpg_wp_wpssl_option"><?php _e('Enable Site HTTPS', 'wp-guardian'); ?></label></th> 86 <td> 87 <p><input type="checkbox" id="dtjwpg_wp_wpssl_option" class="dtjwpg_wp_wpssl_option" name="dtjwpg_wp_wpssl_option" <?php if ( 'on' == get_option('dtjwpg_wp_wpssl_option') ) : ?> checked="checked"<?php endif; ?> aria-describedby="description-dtjwpg_wp_wpssl_option" /></p> 88 <p class="description" id="description-dtjwpg_wp_wpssl_option"><?php _e('Enabling this setting will force your site to be served over HTTPS which will secure connections to your site for your visitors. <strong>You must have a valid SSL certificate before enabling this setting. Without one, your site will not work and cause an endless redirect loop.</strong>', 'wp-guardian'); ?></p> 89 </td> 90 </tr> 91 92 <tr> 93 <th></th> 94 <td> 95 <?php $dtjwpg_save_option_nonce = wp_create_nonce('dtjwpg_save_option_nonce'); ?> 96 <input type="hidden" name="dtjwpg_save_option_nonce" class="dtjwpg_save_option_nonce" value="<?php echo $dtjwpg_save_option_nonce; ?>" /> 97 <button type="button" class="dtjwpg-save-settings-button dtjwpg-wordpress-button button button-primary"><?php _e('Save Settings', 'wp-guardian'); ?></button> 98 <button type="button" class="dtjwpg-close-button button button-secondary"><?php _e('Close', 'wp-guardian'); ?></button> 99 <span class="spinner dtjwpg-save-spinner"></span> 100 </td> 101 </tr> 102 103 </tbody> 104 105 </table> 106 107 </form> 108 109 </div> 110 111 </div> 6 <form method="post"> 7 <table class="dtjwpg-form form-table"> 8 <tbody> 9 <tr> 10 <th><label for="dtjwpg_wp_fileedit_option"><?php _e( 'Disable File Editor', 'wp-guardian' ); ?></label></th> 11 <td> 12 <p><input type="checkbox" id="dtjwpg_wp_fileedit_option" class="dtjwpg_wp_fileedit_option" name="dtjwpg_wp_fileedit_option" <?php checked( 'on', (string) get_option( 'dtjwpg_wp_fileedit_option' ) ); ?>></p> 13 <p class="description" id="description-dtjwpg_wp_fileedit_option"><?php _e( 'Editing Core, plugin and theme files via the WordPress admin area is unnecessary and can be a security risk if your account is hacked. Turning this off ensures files aren't editable by site users.', 'wp-guardian' ); ?></p> 14 </td> 15 </tr> 16 <tr> 17 <th><label for="dtjwpg_wp_xmlrpc_option"><?php _e( 'XML-RPC', 'wp-guardian' ); ?></label></th> 18 <td> 19 <p> 20 <select class="dtjwpg_wp_xmlrpc_option" id="dtjwpg_wp_xmlrpc_option" name="dtjwpg_wp_xmlrpc_option" aria-describedby="description-dtjwpg_wp_xmlrpc_option"> 21 <option value="1"<?php selected( 1, (int) get_option( 'dtjwpg_wp_xmlrpc_option' ) ); ?>><?php _e( 'Allow all XML-RPC requests', 'wp-guardian' ); ?></option> 22 <option value="2"<?php selected( 2, (int) get_option( 'dtjwpg_wp_xmlrpc_option' ) ); ?>><?php _e( 'Limit XML-RPC requests to logged in users', 'wp-guardian' ); ?></option> 23 <option value="3"<?php selected( 3, (int) get_option( 'dtjwpg_wp_xmlrpc_option' ) ); ?>><?php _e( 'Disallow XML-RPC requests for everyone', 'wp-guardian' ); ?></option> 24 </select> 25 </p> 26 <p class="description" id="description-dtjwpg_wp_xmlrpc_option"><?php _e( 'XML-RPC is an API that allows services such as WordPress.com to communicate with your website. This option will let you choose whether you want to publicly expose the XML-RPC API to requests.', 'wp-guardian' ); ?></p> 27 </td> 28 </tr> 29 <tr> 30 <th><label for="dtjwpg_wp_restapi_option"><?php _e( 'REST API', 'wp-guardian' ); ?></label></th> 31 <td> 32 <p> 33 <select class="dtjwpg_wp_restapi_option" id="dtjwpg_wp_restapi_option" name="dtjwpg_wp_restapi_option"> 34 <option value="1"<?php selected( 1, (int) get_option( 'dtjwpg_wp_restapi_option' ) ); ?>><?php _e( 'Allow all RESTful API requests', 'wp-guardian' ); ?></option> 35 <option value="2"<?php selected( 2, (int) get_option( 'dtjwpg_wp_restapi_option' ) ); ?>><?php _e( 'Limit RESTful API requests to logged in users', 'wp-guardian' ); ?></option> 36 <option value="3"<?php selected( 3, (int) get_option( 'dtjwpg_wp_restapi_option' ) ); ?>><?php _e( 'Limit RESTful API requests to administrators', 'wp-guardian' ); ?></option> 37 <option value="4"<?php selected( 4, (int) get_option( 'dtjwpg_wp_restapi_option' ) ); ?>><?php _e( 'Disable the REST API completely', 'wp-guardian' ); ?></option> 38 </select> 39 </p> 40 <p class="description" id="description-dtjwpg_wp_restapi_option"><?php _e( 'The WordPress REST API is a great tool that allows you to extend the capabilities of your website, however by default it's accessible to everyone including guests. This setting will let you restrict who can use it.', 'wp-guardian' ); ?></p> 41 </td> 42 </tr> 43 <tr> 44 <th><label for="dtjwpg_wp_headers_option"><?php _e( 'Header Safe Mode', 'wp-guardian' ); ?></label></th> 45 <td> 46 <p><input type="checkbox" id="dtjwpg_wp_headers_option" class="dtjwpg_wp_headers_option" name="dtjwpg_wp_headers_option" <?php checked( 'on', (string) get_option( 'dtjwpg_wp_headers_option' ) ); ?>></p> 47 <p class="description" id="description-dtjwpg_wp_headers_option"><?php _e( 'By default WordPress adds additional header meta information that is unnecessary. Enabling safe mode will remove this pointless headers.', 'wp-guardian' ); ?></p> 48 </td> 49 </tr> 50 <tr> 51 <th><label for="dtjwpg_wp_emojis_option"><?php _e( 'Filter Emoji Support', 'wp-guardian' ); ?></label></th> 52 <td> 53 <p><input type="checkbox" id="dtjwpg_wp_emojis_option" class="dtjwpg_wp_emojis_option" name="dtjwpg_wp_emojis_option" <?php checked( 'on', (string) get_option( 'dtjwpg_wp_emojis_option' ) ); ?>></p> 54 <p class="description" id="description-dtjwpg_wp_emojis_option"><?php _e( 'By turning this option on, support for Emojis will be turned off. This removes unnecessary scripts and stylesheets from being loaded.', 'wp-guardian' ); ?></p> 55 </td> 56 </tr> 57 <tr> 58 <th><label for="dtjwpg_wp_debug_option"><?php _e( 'Enable Debug Mode', 'wp-guardian' ); ?></label></th> 59 <td> 60 <p><input type="checkbox" id="dtjwpg_wp_debug_option" class="dtjwpg_wp_debug_option" name="dtjwpg_wp_debug_option" <?php checked( 'on', (string) get_option( 'dtjwpg_wp_debug_option' ) ); ?>></p> 61 <p class="description" id="description-dtjwpg_wp_debug_option"><?php _e( 'You can enable <code>WP_DEBUG</code> mode by turning this setting on. <strong>Do not enable this on a production website unless you know what you're doing.</strong>', 'wp-guardian' ); ?></p> 62 </td> 63 </tr> 64 <tr> 65 <th></th> 66 <td> 67 <?php $dtjwpg_save_option_nonce = wp_create_nonce( 'dtjwpg_save_option_nonce' ); ?> 68 <input type="hidden" name="dtjwpg_save_option_nonce" class="dtjwpg_save_option_nonce" value="<?php echo $dtjwpg_save_option_nonce; ?>"> 69 <button type="button" class="dtjwpg-save-settings-button dtjwpg-wordpress-button button button-primary"><?php _e( 'Save Settings', 'wp-guardian' ); ?></button> 70 <button type="button" class="dtjwpg-close-button button button-secondary"><?php _e( 'Close', 'wp-guardian' ); ?></button> 71 <span class="spinner dtjwpg-save-spinner"></span> 72 </td> 73 </tr> 74 </tbody> 75 </table> 76 </form> 77 </div> -
wp-guardian/trunk/assets/templates/guardian-verify.php
r1747467 r3067167 1 1 2 2 <a href="#" class="dtjwpg-options-toggle dtjwpg-title"><?php _e('Two Step Verification', 'wp-guardian'); ?></a>3 <div class="dtjwpg-options-content dtjwpg-content" style="display: none;">3 > 4 > 4 5 5 <p><?php _e('Two Step Verification gives you the option to add another step to the login process by requiring a code to be entered when a user wants to login.', 'wp-guardian'); ?></p> 6 7 <div class="dtjwpg-options-form dtjwpg-verify-form"> 8 9 <form method="post"> 10 11 <table class="dtjwpg-form form-table"> 12 13 <tbody> 14 15 <tr> 16 <th><label for="dtjwpg_verify_option"><?php _e('Enable Two Step Verification', 'wp-guardian'); ?></label></th> 17 <td> 18 <p><input type="checkbox" id="dtjwpg_verify_option" class="dtjwpg_verify_option" name="dtjwpg_verify_option" <?php if ( 'on' == get_option('dtjwpg_verify_option') ) : ?> checked="checked"<?php endif; ?> aria-describedby="description-dtjwpg_verify_option" /></p> 19 <p class="description" id="description-dtjwpg_verify_option"><?php _e('Turning this setting on allows people to use Two Step Verification to secure their accounts requiring them to verify who they are with their password and a code that is sent to them. Users will need to choose a verification method first before this is activated but turning this option off will disable it for everyone.', 'wp-guardian'); ?></p> 20 </td> 21 </tr> 22 23 <tr> 24 <th></th> 25 <td> 26 <?php $dtjwpg_save_verify_nonce = wp_create_nonce('dtjwpg_save_verify_nonce'); ?> 27 <input type="hidden" name="dtjwpg_save_verify_nonce" class="dtjwpg_save_verify_nonce" value="<?php echo $dtjwpg_save_verify_nonce; ?>" /> 28 <button type="button" class="dtjwpg-save-settings-button dtjwpg-verify-button button button-primary"><?php _e('Save Settings', 'wp-guardian'); ?></button> 29 <button type="button" class="dtjwpg-close-button button button-secondary"><?php _e('Close', 'wp-guardian'); ?></button> 30 <span class="spinner dtjwpg-save-spinner"></span> 31 </td> 32 </tr> 33 34 </tbody> 35 36 </table> 37 38 </form> 39 40 </div> 41 42 </div> 6 <form method="post"> 7 <table class="dtjwpg-form form-table"> 8 <tbody> 9 <tr> 10 <th><label for="dtjwpg_verify_option"><?php _e( 'Enable Two Step Verification', 'wp-guardian' ); ?></label></th> 11 <td> 12 <p><input type="checkbox" id="dtjwpg_verify_option" class="dtjwpg_verify_option" name="dtjwpg_verify_option" <?php checked( 'on', (string) get_option( 'dtjwpg_verify_option' ) ); ?>></p> 13 <p class="description" id="description-dtjwpg_verify_option"><?php _e( 'Turning this setting on allows people to use Two Step Verification to secure their accounts requiring them to verify who they are with their password and a code that is sent to them. Users will need to choose a verification method first before this is activated but turning this option off will disable it for everyone.', 'wp-guardian' ); ?></p> 14 </td> 15 </tr> 16 <tr> 17 <th></th> 18 <td> 19 <?php $dtjwpg_save_verify_nonce = wp_create_nonce( 'dtjwpg_save_verify_nonce' ); ?> 20 <input type="hidden" name="dtjwpg_save_verify_nonce" class="dtjwpg_save_verify_nonce" value="<?php echo $dtjwpg_save_verify_nonce; ?>"> 21 <button type="button" class="dtjwpg-save-settings-button dtjwpg-verify-button button button-primary"><?php _e( 'Save Settings', 'wp-guardian' ); ?></button> 22 <button type="button" class="dtjwpg-close-button button button-secondary"><?php _e( 'Close', 'wp-guardian' ); ?></button> 23 <span class="spinner dtjwpg-save-spinner"></span> 24 </td> 25 </tr> 26 </tbody> 27 </table> 28 </form> 29 </div> -
wp-guardian/trunk/assets/templates/guardian.php
r3062713 r3067167 18 18 <a href="<?php echo $section; ?>dashboard" class="nav-tab <?php echo $tab === 'dashboard' ? 'nav-tab-active' : ''; ?>">Dashboard</a> 19 19 <a href="<?php echo $section; ?>firewall" class="nav-tab <?php echo $tab === 'firewall' ? 'nav-tab-active' : ''; ?>">Firewall</a> 20 20 21 <a href="<?php echo $section; ?>settings" class="nav-tab <?php echo $tab === 'settings' ? 'nav-tab-active' : ''; ?>">Settings</a> 21 22 </h2> … … 23 24 <?php 24 25 if ( $tab === 'dashboard' ) { 25 settings_errors(); 26 wp_enqueue_style( 'dtjwpg-datatables' ); 27 wp_enqueue_script( 'dtjwpg-datatables' ); 26 28 ?> 27 <div class="dtjwpg-main"> 28 <ul class="dtjwpg-options-list"> 29 <li class="dtjwpg-options-item dtjwpg-wordpress"> 30 <?php require_once DTJWPG_TEMPLATES . 'guardian-options.php'; ?> 31 </li> 32 <li class="dtjwpg-options-item dtjwpg-backend"> 33 <?php require_once DTJWPG_TEMPLATES . 'guardian-backend.php'; ?> 34 </li> 35 <li class="dtjwpg-options-item dtjwpg-lockouts"> 36 <?php require_once DTJWPG_TEMPLATES . 'guardian-lockouts.php'; ?> 37 </li> 38 <li class="dtjwpg-options-item dtjwpg-server"> 39 <?php require_once DTJWPG_TEMPLATES . 'guardian-server.php'; ?> 40 </li> 41 <li class="dtjwpg-options-item dtjwpg-verify"> 42 <?php require_once DTJWPG_TEMPLATES . 'guardian-verify.php'; ?> 43 </li> 44 </ul> 29 <div class="lhf--grid lhf--grid-2"> 30 <div class="lhf--grid-item"> 31 <h3><?php _e( 'Latest Potential Threats', 'wp-guardian' ); ?></h3> 32 33 <?php 34 // Database file path in the wp-content directory 35 $db_path = get_option( 'wp_guardian_gatekeeper_db_path' ); 36 37 try { 38 // Create (connect to) SQLite database in file 39 $pdo = new PDO( 'sqlite:' . $db_path ); 40 // Set errormode to exceptions 41 $pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); 42 43 // Prepare SELECT statement to fetch all records from the logs table 44 $stmt = $pdo->prepare( "SELECT date, request_uri, query_string, user_agent, referrer FROM logs ORDER BY date DESC" ); 45 $stmt->execute(); 46 47 // Fetch all the records 48 $logs = $stmt->fetchAll( PDO::FETCH_ASSOC ); 49 50 echo '<table class="display" id="gatekeeper-logs" style="width:100%"> 51 <thead> 52 <tr> 53 <th>Date</th> 54 <th>Request URI</th> 55 </tr> 56 </thead> 57 <tbody>'; 58 59 // Iterate over each log entry and display it in the table 60 foreach ( $logs as $log ) { 61 echo '<tr> 62 <td style="white-space:nowrap">' . $log['date'] . '</td> 63 <td> 64 <code>' . $log['request_uri'] . '</code> 65 <br><b>UA</b>: ' . htmlspecialchars( $log['user_agent'] ); 66 67 if ( (string) $log['referrer'] !== '' ) { 68 echo '<br>→ ' . htmlspecialchars( $log['referrer'] ); 69 } 70 echo '</td> 71 </tr>'; 72 } 73 74 echo '</tbody> 75 </table>'; 76 77 } catch ( PDOException $e ) { 78 // Handle SQLite exception 79 echo "SQLite error: " . $e->getMessage(); 80 } 81 ?> 82 </div> 83 84 <div class="lhf--grid-item"> 85 <?php require_once DTJWPG_TEMPLATES . 'aside.php'; ?> 86 </div> 45 87 </div> 46 88 47 <div class="dtjwpg-aside"> 48 <?php require_once DTJWPG_TEMPLATES . 'aside.php'; ?> 49 </div> 89 <script> 90 document.addEventListener("DOMContentLoaded", (event) => { 91 let table = new DataTable('#gatekeeper-logs', { 92 order: [[0, 'desc']], 93 pageLength: 10, 94 lengthMenu: [10, 25, 50, 100, 250, 500] 95 }); 96 }); 97 </script> 98 <style> 99 #gatekeeper-logs code { 100 padding: 2px 4px; 101 margin: 1px; 102 background: #74b9ff; 103 font-size: 12px; 104 border-radius: 3px; 105 display: inline-block; 106 } 107 </style> 108 50 109 <?php 51 110 } elseif ( $tab === 'firewall' ) { 52 111 include DTJWPG_TEMPLATES . 'guardian-firewall.php'; 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 53 130 } elseif ( $tab === 'settings' ) { 54 131 include DTJWPG_TEMPLATES . 'guardian-settings.php'; 55 132 } 56 133 ?> 57 58 134 </div> 59 135 </div> -
wp-guardian/trunk/assets/templates/lockouts.php
r1770915 r3067167 1 1 <?php 2 3 4 2 5 3 /** 4 * lockouts.php 5 */ 6 require_once DTJWPG_INCLUDES . 'lockouts.php'; 6 7 7 // No thank you8 if ( ! defined('ABSPATH') ) die;9 10 // Include the list table class for lockouts11 require_once(DTJWPG_INCLUDES . "lockouts.php");12 13 // Create a new instance of the list table14 8 $dtjwpg_lockouts_table = new DTJWPG_Lockouts_Table(); 15 16 9 ?> 17 10 18 11 <div class="dtjwpg"> 12 13 14 19 15 20 <div class="dtjwpg-wrap wrap"> 16 <a href="https://wordpress.org/plugins/wp-guardian/" class="page-title-action" target="_blank"><?php _e( 'Support', 'wp-guardian' ); ?></a> 17 </h1> 21 18 22 <h1> 23 24 <?php _e('WP Guardian', 'wp-guardian'); ?> 25 26 <a href="https://wordpress.org/plugins/wp-guardian/" class="page-title-action" target="_blank"><?php _e('Support', 'wp-guardian'); ?></a> 27 28 </h1> 29 30 <div class="dtjwpg-main"> 31 32 <div class="dtjwpg-table"> 33 34 <div class="dtjwpg-content-table dtjwpg-lockouts"> 35 36 <form method="post"> 37 38 <?php $dtjwpg_lockouts_table->display(); ?> 39 40 </form> 41 42 </div> 43 44 </div> 45 46 </div> 47 48 <div class="dtjwpg-aside"> 49 50 <?php require_once(DTJWPG_TEMPLATES . 'aside.php'); ?> 51 52 </div> 53 54 </div> 55 19 <div class="dtjwpg-table"> 20 <div class="dtjwpg-content-table dtjwpg-lockouts"> 21 <form method="post"> 22 <?php $dtjwpg_lockouts_table->display(); ?> 23 </form> 24 </div> 25 </div> 26 </div> 56 27 </div> 57 -
wp-guardian/trunk/modules/firewall.php
r3062713 r3067167 21 21 } 22 22 add_action( 'wp_guardian_gatekeeper_long_req_length', 'wp_guardian_gatekeeper_long_req_length' ); 23 24 function wp_guardian_gatekeeper_match_logging( $enable ) {25 if ( (int) get_option( 'wp_guardian_firewall_log' ) === 1 ) {26 return true;27 }28 29 return false;30 }31 add_filter( 'wp_guardian_gatekeeper_match_logging', 'wp_guardian_gatekeeper_match_logging' );32 23 33 24 function wp_guardian_gatekeeper_post_scanning( $enable ) { … … 137 128 $matches = isset( $matches[0] ) ? $matches[0] : null; 138 129 139 if ( $matches && apply_filters( 'wp_guardian_gatekeeper_match_logging', false ) ) { 140 error_log( 'WP Guardian: ' . $matches ); 141 } 142 143 wp_guardian_gatekeeper_log( $matches, $request_uri_string, $query_string_string, $user_agent_string, $referrer_string ); 130 if ( (int) get_option( 'wp_guardian_firewall_log' ) === 1 ) { 131 wp_guardian_gatekeeper_log( $matches, $request_uri_string, $query_string_string, $user_agent_string, $referrer_string ); 132 } 144 133 145 134 $header_1 = apply_filters( 'wp_guardian_gatekeeper_header_1', 'HTTP/1.1 403 Forbidden' ); … … 209 198 210 199 function wp_guardian_gatekeeper_log( $data, $request_uri_string, $query_string_string, $user_agent_string, $referrer_string ) { 211 $path = sprintf( '%s/wp-guardian-gatekeeper-%s.log', WP_CONTENT_DIR, hash( 'adler32', sprintf( '%s|%s|%s', AUTH_KEY, AUTH_COOKIE, AUTH_SALT ) ) ); 212 213 if ( $fp = fopen( $path, 'a' ) ) { 214 if ( is_array( $data ) || is_object( $data ) ) { 215 $data = print_r( $data, true ); 216 } 217 218 $json_string = json_encode( 200 $db_path = sprintf( '%s/wp-guardian-gatekeeper-%s.sqlite', WP_CONTENT_DIR, hash( 'adler32', sprintf( '%s|%s|%s', AUTH_KEY, AUTH_COOKIE, AUTH_SALT ) ) ); 201 update_option( 'wp_guardian_gatekeeper_db_path', $db_path ); 202 203 try { 204 // Create (connect to) SQLite database in file 205 $pdo = new PDO( 'sqlite:' . $db_path ); 206 // Set errormode to exceptions 207 $pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); 208 209 // Enable Write-Ahead Logging for better concurrency 210 $pdo->exec( 'PRAGMA journal_mode=WAL;' ); 211 // Adjust synchronous mode to NORMAL for faster writes at slight risk of data loss 212 $pdo->exec( 'PRAGMA synchronous=NORMAL;' ); 213 // Increase cache size for better performance 214 $pdo->exec( 'PRAGMA cache_size=-32000;' ); // Example: 32 MB cache 215 216 // Create table if it does not exist 217 $pdo->exec( 218 "CREATE TABLE IF NOT EXISTS logs ( 219 id INTEGER PRIMARY KEY, 220 date TEXT, 221 request_uri TEXT, 222 query_string TEXT, 223 user_agent TEXT, 224 referrer TEXT 225 )" 226 ); 227 228 // Prepare the insert statement 229 $stmt = $pdo->prepare( "INSERT INTO logs (date, request_uri, query_string, user_agent, referrer) VALUES (?, ?, ?, ?, ?)" ); 230 231 // Bind and insert the data 232 $stmt->execute( 219 233 [ 220 'date' => date_i18n( 'Y-m-d H:i:s', time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ), 221 'data' => $data, 222 'request_uri' => $request_uri_string, 223 'query_string' => $query_string_string, 224 'user_agent' => $user_agent_string, 225 'referrer' => $referrer_string, 234 date_i18n( 'Y-m-d H:i:s', time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ), 235 $request_uri_string, 236 $query_string_string, 237 $user_agent_string, 238 $referrer_string, 226 239 ] 227 240 ); 228 241 229 fwrite( $fp, $json_string ); 230 fclose( $fp ); 231 } 232 } 242 // echo "Log entry added."; 243 244 } catch ( PDOException $e ) { 245 // Handle SQLite exception 246 // echo "SQLite error: " . $e->getMessage(); 247 } 248 } 249 250 251 252 /** 253 * Clean up the database and keep only the most recent 10,000 records. 254 * 255 * This function connects to the SQLite database, checks the total number of records, 256 * and deletes the excess records if the total exceeds 10,000, keeping only the 257 * most recent 10,000 records. 258 * 259 */ 260 function wp_guardian_cleanup_database_job() { 261 // Your SQLite database connection code and cleanup logic here 262 $db_path = get_option( 'wp_guardian_gatekeeper_db_path' ); 263 $db_records = get_option( 'wp_guardian_firewall_log_size', 10000 ); 264 265 if ( ! file_exists( $db_path ) ) { 266 return; 267 } 268 269 $pdo = new PDO( 'sqlite:' . $db_path ); 270 $pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); 271 272 // Retrieve total number of records 273 $total_records = $pdo->query( "SELECT COUNT(*) FROM logs" )->fetchColumn(); 274 275 // If total records exceed 10,000, delete excess records 276 if ( $total_records > 10000 ) { 277 $excess_count = $total_records - 10000; 278 $pdo->exec( "DELETE FROM logs WHERE id IN (SELECT id FROM logs ORDER BY id LIMIT $excess_count)" ); 279 } 280 } 281 282 // Hook the cleanup function to run daily using WordPress CRON 283 add_action( 'wp_guardian_cleanup_database_daily', 'wp_guardian_cleanup_database_job' ); 284 285 // Schedule the CRON job to run daily at midnight 286 if ( ! wp_next_scheduled( 'wp_guardian_cleanup_database_daily' ) ) { 287 wp_schedule_event( strtotime( 'midnight' ), 'daily', 'wp_guardian_cleanup_database_daily' ); 288 } -
wp-guardian/trunk/readme.txt
r3061202 r3067167 6 6 Tested up to: 6.5 7 7 Requires PHP: 7.0 8 Stable tag: 1.4. 38 Stable tag: 1.4. 9 9 License: GPLv3 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 50 50 == Changelog == 51 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 52 67 = 1.4.3 = 53 54 68 * Fix issues with the firewall (for good) 55 69 * Remove obsolete features, such as database backups and version control 56 70 57 71 = 1.4.2 = 58 59 72 * Fix issues with pattern matching in the firewall 60 73 61 74 = 1.4.1 = 62 63 75 * Add new firewall feature 64 76 * Add new security settings … … 66 78 67 79 = 1.4.0 = 68 69 80 * Fix the plugin header information (stable tag, tested up to, etc.) 70 81 * Implement WordPress Coding Standards (WPCS) … … 74 85 75 86 = 1.3.4 = 76 77 * More updaes to author information 87 * More updates to author information 78 88 79 89 = 1.3.3 = 80 81 90 * Updated author information - Removed Daniel James danieltj 82 91 * To see the full revision history, please read the `CHANGELOG.md` file which explains any changes that have been made. 83 92 84 93 = 1.3.2 = 85 86 94 * Released: 19th November 2017 87 95 * Fixed a mistake listed in the change log file. … … 89 97 90 98 = 1.3.1 = 91 92 99 * Released: 19th November 2017 93 100 * Fixed a bug where database backups weren't attached to emails. … … 95 102 96 103 = 1.3.0 = 97 98 104 * Released: 13th November 2017 99 105 * Added the ability to remove support for Emoji scripts. … … 102 108 103 109 = 1.2.2 = 104 105 110 * Released: 8th November 2017 106 111 * Fixed a bug which caused some meta data to not be removed properly. … … 108 113 109 114 = 1.2.1 = 110 111 115 * Released: 26th October 2017 112 116 * Added a new directory within the uploads folder for database backups. … … 117 121 118 122 = 1.2.0 = 119 120 123 * Released: 16th October 2017 121 124 * Added new field to send backup emails to different email address. … … 127 130 128 131 = 1.1.0 = 129 130 132 * Released: 12th October 2017 131 133 * Fixed the implementation of Two Step Verification code expiry. … … 136 138 137 139 = 1.0.0 = 138 139 140 * Released: 11th October 2017 140 141 * Initial version -
wp-guardian/trunk/wp-guardian.php
r3062713 r3067167 4 4 * Plugin URI: https://getbutterfly.com/wordpress-plugins/wp-guardian/ 5 5 * Description: An easy way to harden your website's security effectively. 6 * Version: 1.4. 46 * Version: 1.4. 7 7 * Author: Ciprian Popescu 8 8 * Author URI: https://getbutterfly.com/ … … 33 33 } 34 34 35 define( 'DTJWPG_VERSION', '1.4. 4' );35 define( 'DTJWPG_VERSION', '1.4.' ); 36 36 define( 'DTJWPG_DB_VERSION', '1.0' ); 37 37 define( 'DTJWPG_URL', __FILE__ ); … … 40 40 define( 'DTJWPG_DB_LOGINS', 'dtjwpg_logins' ); 41 41 define( 'DTJWPG_DB_LOCKOUTS', 'dtjwpg_lockouts' ); 42 define( 'DTJWPG_ LANGUAGE', DTJWPG_DIR . '/assets/languages' );42 define( 'DTJWPG_s' ); 43 43 define( 'DTJWPG_INCLUDES', DTJWPG_DIR . '/assets/includes/' ); 44 44 define( 'DTJWPG_MODULES', DTJWPG_DIR . '/modules/' );
Note: See TracChangeset
for help on using the changeset viewer.