Changeset 3394970
- Timestamp:
- 11/13/2025 11:08:00 AM (3 months ago)
- Location:
- admin-safety-guard
- Files:
-
- 6 edited
- 1 copied
-
tags/1.0.9 (copied) (copied from admin-safety-guard/trunk)
-
tags/1.0.9/admin-safety-guard.php (modified) (2 diffs)
-
tags/1.0.9/app/Classes/Install.php (modified) (4 diffs)
-
tags/1.0.9/readme.txt (modified) (4 diffs)
-
trunk/admin-safety-guard.php (modified) (2 diffs)
-
trunk/app/Classes/Install.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
admin-safety-guard/tags/1.0.9/admin-safety-guard.php
r3389529 r3394970 4 4 Plugin URI: http://themepaste.com/product/themepaste-secure-admin-pro/ 5 5 Description: Secure your WordPress login with Admin safety guard to ensure secured access with limit login attempts, 2FA, reCaptcha, IP Blocking, Disable XML-RPC and activity tracking. 6 Version: 1.0. 86 Version: 1.0.9 7 7 Author: Themepaste Team 8 8 Author URI: http://themepaste.com/ … … 39 39 define( 'TPSA_PLUGIN_FILE', __FILE__ ); 40 40 define( 'TPSA_PREFIX', 'tpsa' ); 41 define( 'TPSA_PLUGIN_VERSION', '1.0. 8' );41 define( 'TPSA_PLUGIN_VERSION', '1.0.9' ); 42 42 define( 'TPSA_PLUGIN_DIRNAME', dirname( TPSA_PLUGIN_FILE ) ); 43 43 define( 'TPSA_PLUGIN_BASENAME', plugin_basename( TPSA_PLUGIN_FILE ) ); -
admin-safety-guard/tags/1.0.9/app/Classes/Install.php
r3340906 r3394970 5 5 defined( 'ABSPATH' ) || exit; 6 6 7 use ThemePaste\SecureAdmin\Traits\Asset; 7 8 use ThemePaste\SecureAdmin\Traits\Hook; 8 use ThemePaste\SecureAdmin\Traits\Asset;9 9 10 10 class Install { … … 17 17 */ 18 18 public function __construct() { 19 $this->activation( [ $this, 'bootstrapping' ] ); 19 $this->activation( [$this, 'bootstrapping'] ); 20 $this->activation( [$this, 'send_deactivation_email'] ); 21 $this->action( 'admin_post_admin_safety_guard_deactivate', [$this, 'handle_deactivate'] ); 20 22 } 21 23 … … 24 26 */ 25 27 public function bootstrapping() { 26 if ( ! $this->is_database_up_to_date() ) {28 if ( !$this->is_database_up_to_date() ) { 27 29 28 30 set_transient( 'tpsm_do_activation_redirect', true, 30 ); … … 73 75 74 76 /** 77 * Send deactivation email. 78 */ 79 public function send_deactivation_email() { 80 81 if ( !$this->is_database_up_to_date() ) { 82 return; 83 } 84 85 $admin_email = get_option( 'admin_email' ); 86 if ( !is_email( $admin_email ) ) { 87 return; 88 } 89 90 $site_name = get_bloginfo( 'name' ); 91 $site_url = home_url(); 92 $plugin_name = 'Admin Safety Guard'; 93 94 // Generate a secure token for one-click deactivate link 95 $token = wp_generate_password( 32, false ); 96 update_option( 'tp_admin_safety_guard_deactivate_token', $token ); 97 98 $deactivate_url = add_query_arg( 99 array( 100 'action' => 'admin_safety_guard_deactivate', 101 'token' => $token, 102 ), 103 admin_url( 'admin-post.php' ) 104 ); 105 106 $subject = sprintf( 107 '[%s] %s has been activated', 108 $site_name, 109 $plugin_name 110 ); 111 112 // Build HTML email body 113 $message = ' 114 <!doctype html> 115 <html lang="en"> 116 <head> 117 <meta charset="UTF-8"> 118 <meta name="viewport" content="width=device-width,initial-scale=1"> 119 <title>' . esc_html( $plugin_name ) . ' Activated</title> 120 <style> 121 /* Basic mobile-friendly styles – some clients ignore <style>, 122 so key layout is still inline */ 123 @media only screen and (max-width: 600px) { 124 .tp-container { 125 padding: 16px !important; 126 } 127 .tp-card { 128 padding: 20px !important; 129 } 130 .tp-title { 131 font-size: 20px !important; 132 } 133 .tp-text { 134 font-size: 14px !important; 135 } 136 .tp-button { 137 font-size: 14px !important; 138 padding: 10px 18px !important; 139 } 140 } 141 </style> 142 </head> 143 <body style="margin:0; padding:0; background:#f4f5fb; font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;"> 144 145 <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="background:#f4f5fb; padding:24px 0;"> 146 <tr> 147 <td align="center"> 148 <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" class="tp-container" style="max-width:600px; padding:0 24px;"> 149 <tr> 150 <td align="center" style="padding-bottom:16px;"> 151 <div style="font-size:12px; color:#9ca3af; text-transform:uppercase; letter-spacing:0.08em;"> 152 WordPress Security Notification 153 </div> 154 </td> 155 </tr> 156 157 <tr> 158 <td> 159 <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" class="tp-card" style="background:#ffffff; border-radius:16px; padding:28px 32px; box-shadow:0 10px 25px rgba(15,23,42,0.08);"> 160 <tr> 161 <td align="left" style="padding-bottom:18px;"> 162 <div class="tp-title" style="font-size:22px; font-weight:700; color:#111827;"> 163 ' . esc_html( $plugin_name ) . ' is now active on your site. 164 </div> 165 <div class="tp-text" style="margin-top:6px; font-size:14px; color:#6b7280;"> 166 ' . esc_html( $site_name ) . ' (' . esc_html( $site_url ) . ') 167 </div> 168 </td> 169 </tr> 170 171 <tr> 172 <td style="padding-bottom:16px;"> 173 <div class="tp-text" style="font-size:14px; line-height:1.7; color:#4b5563;"> 174 Hi, 175 <br><br> 176 <strong>' . esc_html( $plugin_name ) . '</strong> has just been installed and activated on your website. 177 We're here to help keep your site more secure and stable. 178 </div> 179 </td> 180 </tr> 181 182 <tr> 183 <td style="padding-bottom:20px;"> 184 <div class="tp-text" style="font-size:14px; line-height:1.7; color:#4b5563;"> 185 If you ever feel that this plugin does not work properly, causes layout issues, or you simply want to turn it off, you have a safe fallback: 186 </div> 187 </td> 188 </tr> 189 190 <!-- Primary Button --> 191 <tr> 192 <td align="center" style="padding-bottom:20px;"> 193 <a href="' . esc_url( $deactivate_url ) . '" class="tp-button" 194 style=" 195 display:inline-block; 196 padding:12px 24px; 197 border-radius:999px; 198 background: linear-gradient(90deg, #814bfe, #9c5bff); 199 color:#ffffff; 200 font-size:15px; 201 font-weight:600; 202 text-decoration:none; 203 box-shadow:0 8px 18px rgba(129, 75, 254, 0.35); 204 "> 205 Safe Deactivate Plugin 206 </a> 207 </td> 208 </tr> 209 210 <!-- Fallback link --> 211 <tr> 212 <td style="padding-bottom:24px;"> 213 <div class="tp-text" style="font-size:12px; line-height:1.6; color:#9ca3af; text-align:center;"> 214 If the button doesn't work, copy & paste this link into your browser (you must be logged in as an admin): 215 <br> 216 <a href="' . esc_url( $deactivate_url ) . '" style="color:#6366f1; text-decoration:underline; word-break:break-all;"> 217 ' . esc_html( $deactivate_url ) . ' 218 </a> 219 </div> 220 </td> 221 </tr> 222 223 <!-- Manual steps --> 224 <tr> 225 <td style="padding-bottom:16px;"> 226 <div class="tp-text" style="font-size:14px; line-height:1.7; color:#4b5563;"> 227 <strong>Manual deactivate (alternative):</strong><br> 228 Dashboard → <strong>Plugins</strong> → <strong>Installed Plugins</strong> → "<strong>' . esc_html( $plugin_name ) . '</strong>" → <strong>Deactivate</strong> 229 </div> 230 </td> 231 </tr> 232 233 <!-- Info box --> 234 <tr> 235 <td> 236 <div style="border-radius:12px; background:#f9fafb; border:1px solid #e5e7eb; padding:12px 14px; font-size:12px; color:#6b7280; line-height:1.6;"> 237 💡 <strong>Tip:</strong> For maximum safety, always keep a recent backup of your files and database before making major changes to security settings or installing new plugins. 238 </div> 239 </td> 240 </tr> 241 242 </table> 243 </td> 244 </tr> 245 246 <tr> 247 <td align="center" style="padding-top:12px;"> 248 <div style="font-size:11px; color:#9ca3af;"> 249 Sent from ' . esc_html( $plugin_name ) . ' • ' . esc_html( $site_name ) . ' 250 </div> 251 </td> 252 </tr> 253 254 </table> 255 </td> 256 </tr> 257 </table> 258 259 </body> 260 </html> 261 '; 262 263 $headers = array(); 264 $from_name = $plugin_name; 265 $from_email = 'no-reply@' . wp_parse_url( home_url(), PHP_URL_HOST ); 266 $headers[] = 'From: ' . $from_name . ' <' . $from_email . '>'; 267 $headers[] = 'Content-Type: text/html; charset=UTF-8'; 268 269 wp_mail( $admin_email, $subject, $message, $headers ); 270 271 } 272 273 public function handle_deactivate() { 274 auth_redirect(); 275 276 // Only allow admins with plugin activation capability 277 if ( !current_user_can( 'activate_plugins' ) ) { 278 wp_die( __( 'You do not have permission to deactivate plugins.', 'tp-secure-admin' ) ); 279 } 280 281 $stored_token = get_option( 'tp_admin_safety_guard_deactivate_token' ); 282 $token = isset( $_GET['token'] ) ? sanitize_text_field( wp_unslash( $_GET['token'] ) ) : ''; 283 284 // Check token 285 if ( empty( $stored_token ) || empty( $token ) || !hash_equals( $stored_token, $token ) ) { 286 wp_die( __( 'Invalid or expired deactivation link.', 'tp-secure-admin' ) ); 287 } 288 289 // Token is valid, so delete it to avoid unlimited re-use (optional but recommended) 290 delete_option( 'tp_admin_safety_guard_deactivate_token' ); 291 292 // Deactivate this plugin 293 deactivate_plugins( TPSA_PLUGIN_BASENAME ); 294 295 // Redirect back to plugins page with a notice 296 $redirect_url = add_query_arg( 297 array( 298 'tp_secure_admin_deactivated' => 1, 299 ), 300 admin_url( 'plugins.php' ) 301 ); 302 303 wp_safe_redirect( $redirect_url ); 304 exit; 305 } 306 307 /** 75 308 * Create a custom database table. 76 309 * -
admin-safety-guard/tags/1.0.9/readme.txt
r3389529 r3394970 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.0 7 Stable tag: 1.0. 87 Stable tag: 1.0.9 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 33 33 📈 **Online Businesses:** Secure customer data with 2FA, CAPTCHA, and password protection. 34 34 🎓 **Educators & Bloggers:** Maintain a professional look while increasing security. 35 36 == Features ==37 35 38 36 ### ✅ Free Features at a Glance … … 70 68 --- 71 69 72 == F eature Details ==70 == Free Feature Details == 73 71 74 72 **👤 Hide Admin Bar (With Conditions):** Hide the admin bar selectively for specific users or roles. … … 152 150 == Changelog == 153 151 152 = 1.0.9 = 153 [new] Added deactivation email feature on plugin activation 154 154 155 = 1.0.6, 1.0.8 = 155 156 [new] Release the pro version -
admin-safety-guard/trunk/admin-safety-guard.php
r3389529 r3394970 4 4 Plugin URI: http://themepaste.com/product/themepaste-secure-admin-pro/ 5 5 Description: Secure your WordPress login with Admin safety guard to ensure secured access with limit login attempts, 2FA, reCaptcha, IP Blocking, Disable XML-RPC and activity tracking. 6 Version: 1.0. 86 Version: 1.0.9 7 7 Author: Themepaste Team 8 8 Author URI: http://themepaste.com/ … … 39 39 define( 'TPSA_PLUGIN_FILE', __FILE__ ); 40 40 define( 'TPSA_PREFIX', 'tpsa' ); 41 define( 'TPSA_PLUGIN_VERSION', '1.0. 8' );41 define( 'TPSA_PLUGIN_VERSION', '1.0.9' ); 42 42 define( 'TPSA_PLUGIN_DIRNAME', dirname( TPSA_PLUGIN_FILE ) ); 43 43 define( 'TPSA_PLUGIN_BASENAME', plugin_basename( TPSA_PLUGIN_FILE ) ); -
admin-safety-guard/trunk/app/Classes/Install.php
r3340906 r3394970 5 5 defined( 'ABSPATH' ) || exit; 6 6 7 use ThemePaste\SecureAdmin\Traits\Asset; 7 8 use ThemePaste\SecureAdmin\Traits\Hook; 8 use ThemePaste\SecureAdmin\Traits\Asset;9 9 10 10 class Install { … … 17 17 */ 18 18 public function __construct() { 19 $this->activation( [ $this, 'bootstrapping' ] ); 19 $this->activation( [$this, 'bootstrapping'] ); 20 $this->activation( [$this, 'send_deactivation_email'] ); 21 $this->action( 'admin_post_admin_safety_guard_deactivate', [$this, 'handle_deactivate'] ); 20 22 } 21 23 … … 24 26 */ 25 27 public function bootstrapping() { 26 if ( ! $this->is_database_up_to_date() ) {28 if ( !$this->is_database_up_to_date() ) { 27 29 28 30 set_transient( 'tpsm_do_activation_redirect', true, 30 ); … … 73 75 74 76 /** 77 * Send deactivation email. 78 */ 79 public function send_deactivation_email() { 80 81 if ( !$this->is_database_up_to_date() ) { 82 return; 83 } 84 85 $admin_email = get_option( 'admin_email' ); 86 if ( !is_email( $admin_email ) ) { 87 return; 88 } 89 90 $site_name = get_bloginfo( 'name' ); 91 $site_url = home_url(); 92 $plugin_name = 'Admin Safety Guard'; 93 94 // Generate a secure token for one-click deactivate link 95 $token = wp_generate_password( 32, false ); 96 update_option( 'tp_admin_safety_guard_deactivate_token', $token ); 97 98 $deactivate_url = add_query_arg( 99 array( 100 'action' => 'admin_safety_guard_deactivate', 101 'token' => $token, 102 ), 103 admin_url( 'admin-post.php' ) 104 ); 105 106 $subject = sprintf( 107 '[%s] %s has been activated', 108 $site_name, 109 $plugin_name 110 ); 111 112 // Build HTML email body 113 $message = ' 114 <!doctype html> 115 <html lang="en"> 116 <head> 117 <meta charset="UTF-8"> 118 <meta name="viewport" content="width=device-width,initial-scale=1"> 119 <title>' . esc_html( $plugin_name ) . ' Activated</title> 120 <style> 121 /* Basic mobile-friendly styles – some clients ignore <style>, 122 so key layout is still inline */ 123 @media only screen and (max-width: 600px) { 124 .tp-container { 125 padding: 16px !important; 126 } 127 .tp-card { 128 padding: 20px !important; 129 } 130 .tp-title { 131 font-size: 20px !important; 132 } 133 .tp-text { 134 font-size: 14px !important; 135 } 136 .tp-button { 137 font-size: 14px !important; 138 padding: 10px 18px !important; 139 } 140 } 141 </style> 142 </head> 143 <body style="margin:0; padding:0; background:#f4f5fb; font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;"> 144 145 <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="background:#f4f5fb; padding:24px 0;"> 146 <tr> 147 <td align="center"> 148 <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" class="tp-container" style="max-width:600px; padding:0 24px;"> 149 <tr> 150 <td align="center" style="padding-bottom:16px;"> 151 <div style="font-size:12px; color:#9ca3af; text-transform:uppercase; letter-spacing:0.08em;"> 152 WordPress Security Notification 153 </div> 154 </td> 155 </tr> 156 157 <tr> 158 <td> 159 <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" class="tp-card" style="background:#ffffff; border-radius:16px; padding:28px 32px; box-shadow:0 10px 25px rgba(15,23,42,0.08);"> 160 <tr> 161 <td align="left" style="padding-bottom:18px;"> 162 <div class="tp-title" style="font-size:22px; font-weight:700; color:#111827;"> 163 ' . esc_html( $plugin_name ) . ' is now active on your site. 164 </div> 165 <div class="tp-text" style="margin-top:6px; font-size:14px; color:#6b7280;"> 166 ' . esc_html( $site_name ) . ' (' . esc_html( $site_url ) . ') 167 </div> 168 </td> 169 </tr> 170 171 <tr> 172 <td style="padding-bottom:16px;"> 173 <div class="tp-text" style="font-size:14px; line-height:1.7; color:#4b5563;"> 174 Hi, 175 <br><br> 176 <strong>' . esc_html( $plugin_name ) . '</strong> has just been installed and activated on your website. 177 We're here to help keep your site more secure and stable. 178 </div> 179 </td> 180 </tr> 181 182 <tr> 183 <td style="padding-bottom:20px;"> 184 <div class="tp-text" style="font-size:14px; line-height:1.7; color:#4b5563;"> 185 If you ever feel that this plugin does not work properly, causes layout issues, or you simply want to turn it off, you have a safe fallback: 186 </div> 187 </td> 188 </tr> 189 190 <!-- Primary Button --> 191 <tr> 192 <td align="center" style="padding-bottom:20px;"> 193 <a href="' . esc_url( $deactivate_url ) . '" class="tp-button" 194 style=" 195 display:inline-block; 196 padding:12px 24px; 197 border-radius:999px; 198 background: linear-gradient(90deg, #814bfe, #9c5bff); 199 color:#ffffff; 200 font-size:15px; 201 font-weight:600; 202 text-decoration:none; 203 box-shadow:0 8px 18px rgba(129, 75, 254, 0.35); 204 "> 205 Safe Deactivate Plugin 206 </a> 207 </td> 208 </tr> 209 210 <!-- Fallback link --> 211 <tr> 212 <td style="padding-bottom:24px;"> 213 <div class="tp-text" style="font-size:12px; line-height:1.6; color:#9ca3af; text-align:center;"> 214 If the button doesn't work, copy & paste this link into your browser (you must be logged in as an admin): 215 <br> 216 <a href="' . esc_url( $deactivate_url ) . '" style="color:#6366f1; text-decoration:underline; word-break:break-all;"> 217 ' . esc_html( $deactivate_url ) . ' 218 </a> 219 </div> 220 </td> 221 </tr> 222 223 <!-- Manual steps --> 224 <tr> 225 <td style="padding-bottom:16px;"> 226 <div class="tp-text" style="font-size:14px; line-height:1.7; color:#4b5563;"> 227 <strong>Manual deactivate (alternative):</strong><br> 228 Dashboard → <strong>Plugins</strong> → <strong>Installed Plugins</strong> → "<strong>' . esc_html( $plugin_name ) . '</strong>" → <strong>Deactivate</strong> 229 </div> 230 </td> 231 </tr> 232 233 <!-- Info box --> 234 <tr> 235 <td> 236 <div style="border-radius:12px; background:#f9fafb; border:1px solid #e5e7eb; padding:12px 14px; font-size:12px; color:#6b7280; line-height:1.6;"> 237 💡 <strong>Tip:</strong> For maximum safety, always keep a recent backup of your files and database before making major changes to security settings or installing new plugins. 238 </div> 239 </td> 240 </tr> 241 242 </table> 243 </td> 244 </tr> 245 246 <tr> 247 <td align="center" style="padding-top:12px;"> 248 <div style="font-size:11px; color:#9ca3af;"> 249 Sent from ' . esc_html( $plugin_name ) . ' • ' . esc_html( $site_name ) . ' 250 </div> 251 </td> 252 </tr> 253 254 </table> 255 </td> 256 </tr> 257 </table> 258 259 </body> 260 </html> 261 '; 262 263 $headers = array(); 264 $from_name = $plugin_name; 265 $from_email = 'no-reply@' . wp_parse_url( home_url(), PHP_URL_HOST ); 266 $headers[] = 'From: ' . $from_name . ' <' . $from_email . '>'; 267 $headers[] = 'Content-Type: text/html; charset=UTF-8'; 268 269 wp_mail( $admin_email, $subject, $message, $headers ); 270 271 } 272 273 public function handle_deactivate() { 274 auth_redirect(); 275 276 // Only allow admins with plugin activation capability 277 if ( !current_user_can( 'activate_plugins' ) ) { 278 wp_die( __( 'You do not have permission to deactivate plugins.', 'tp-secure-admin' ) ); 279 } 280 281 $stored_token = get_option( 'tp_admin_safety_guard_deactivate_token' ); 282 $token = isset( $_GET['token'] ) ? sanitize_text_field( wp_unslash( $_GET['token'] ) ) : ''; 283 284 // Check token 285 if ( empty( $stored_token ) || empty( $token ) || !hash_equals( $stored_token, $token ) ) { 286 wp_die( __( 'Invalid or expired deactivation link.', 'tp-secure-admin' ) ); 287 } 288 289 // Token is valid, so delete it to avoid unlimited re-use (optional but recommended) 290 delete_option( 'tp_admin_safety_guard_deactivate_token' ); 291 292 // Deactivate this plugin 293 deactivate_plugins( TPSA_PLUGIN_BASENAME ); 294 295 // Redirect back to plugins page with a notice 296 $redirect_url = add_query_arg( 297 array( 298 'tp_secure_admin_deactivated' => 1, 299 ), 300 admin_url( 'plugins.php' ) 301 ); 302 303 wp_safe_redirect( $redirect_url ); 304 exit; 305 } 306 307 /** 75 308 * Create a custom database table. 76 309 * -
admin-safety-guard/trunk/readme.txt
r3389529 r3394970 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.0 7 Stable tag: 1.0. 87 Stable tag: 1.0.9 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 33 33 📈 **Online Businesses:** Secure customer data with 2FA, CAPTCHA, and password protection. 34 34 🎓 **Educators & Bloggers:** Maintain a professional look while increasing security. 35 36 == Features ==37 35 38 36 ### ✅ Free Features at a Glance … … 70 68 --- 71 69 72 == F eature Details ==70 == Free Feature Details == 73 71 74 72 **👤 Hide Admin Bar (With Conditions):** Hide the admin bar selectively for specific users or roles. … … 152 150 == Changelog == 153 151 152 = 1.0.9 = 153 [new] Added deactivation email feature on plugin activation 154 154 155 = 1.0.6, 1.0.8 = 155 156 [new] Release the pro version
Note: See TracChangeset
for help on using the changeset viewer.