| 1 |
<?php |
| 2 |
|
| 3 |
if(!defined('ABSPATH')){ |
| 4 |
die('Hacking Attempt!'); |
| 5 |
} |
| 6 |
|
| 7 |
|
| 8 |
// HOOKS |
| 9 |
add_action('admin_menu', 'loginizer_admin_menu'); |
| 10 |
//add_filter("plugin_action_links_plugin_loginizer", 'loginizer_plugin_action_links'); |
| 11 |
|
| 12 |
|
| 13 |
// Add settings link on plugin page |
| 14 |
function loginizer_plugin_action_links($links) { |
| 15 |
|
| 16 |
if(!defined('LOGINIZER_PREMIUM')){ |
| 17 |
$links[] = '<a href="'.LOGINIZER_PRO_URL.'" style="color:#3db634;" target="_blank">'._x('Upgrade', 'Plugin action link label.', 'loginizer').'</a>'; |
| 18 |
} |
| 19 |
|
| 20 |
$settings_link = '<a href="admin.php?page=loginizer">Settings</a>'; |
| 21 |
array_unshift($links, $settings_link); |
| 22 |
|
| 23 |
return $links; |
| 24 |
} |
| 25 |
|
| 26 |
function loginizer_newsletter_subscribe(){ |
| 27 |
|
| 28 |
$newsletter_dismiss = get_option('loginizer_dismiss_newsletter'); |
| 29 |
|
| 30 |
if(!empty($newsletter_dismiss)){ |
| 31 |
return; |
| 32 |
} |
| 33 |
|
| 34 |
$env['url'] = 'https://loginizer.com/'; |
| 35 |
|
| 36 |
echo ' |
| 37 |
<style> |
| 38 |
.newsletter_container{ |
| 39 |
color: #000000; |
| 40 |
background: #FFFFFF; |
| 41 |
text-align:center; |
| 42 |
} |
| 43 |
.subscribe_form_row{ |
| 44 |
color: #000000; |
| 45 |
padding-bottom:0px !important; |
| 46 |
} |
| 47 |
.subscribe_heading{ |
| 48 |
font-size:22px; |
| 49 |
} |
| 50 |
</style> |
| 51 |
|
| 52 |
<div class="notice my-loginizer-dismiss-notice is-dismissible" style="background:#FFF;padding:15px; border: 1px solid #ccd0d4; width:80%;margin-left:0px;margin:auto;"> |
| 53 |
<div class="container"> |
| 54 |
<div class="col-md-6 col-md-offset-3 text-center newsletter_container"> |
| 55 |
<h2 style="font-weight:100; margin-bottom:20px; margin-top:5px;" class="subscribe_heading">Subscribe to our Newsletter</h2> |
| 56 |
<form class="form-inline" action="" method="POST"> |
| 57 |
<div class="row subscribe_form_row"> |
| 58 |
<div class="col-md-12"> |
| 59 |
<input type="email" name="email" size="40" id="subscribe_email" class="" placeholder="email@example.com" value=""> |
| 60 |
<input type="button" name="subscribe" id="subscribe_button" class="button button-primary" value="Subscribe" onclick="loginizer_email_subscribe();" style="margin-top:0px;"> |
| 61 |
</div> |
| 62 |
<div class="col-md-3"> |
| 63 |
</div> |
| 64 |
</div> |
| 65 |
</form> |
| 66 |
<p><b>Note :</b> If a Loginizer account does not exist it will be created.</p> |
| 67 |
</div> |
| 68 |
</div> |
| 69 |
</div><br /> |
| 70 |
|
| 71 |
<script type="text/javascript"> |
| 72 |
function loginizer_dismiss_newsletter(){ |
| 73 |
|
| 74 |
var data = new Object(); |
| 75 |
data["action"] = "loginizer_dismiss_newsletter"; |
| 76 |
data["nonce"] = "'.wp_create_nonce('loginizer_admin_ajax').'"; |
| 77 |
|
| 78 |
var admin_url = "'.admin_url().'"+"admin-ajax.php"; |
| 79 |
jQuery.post(admin_url, data, function(response){ |
| 80 |
|
| 81 |
}); |
| 82 |
|
| 83 |
} |
| 84 |
|
| 85 |
function loginizer_email_subscribe(){ |
| 86 |
var subs_location = "'.$env['url'].'?email="+encodeURIComponent(jQuery("#subscribe_email").val()); |
| 87 |
window.open(subs_location, "_blank"); |
| 88 |
} |
| 89 |
jQuery(document).on("click", ".my-loginizer-dismiss-notice .notice-dismiss", loginizer_dismiss_newsletter); |
| 90 |
</script>'; |
| 91 |
|
| 92 |
return true; |
| 93 |
} |
| 94 |
|
| 95 |
function loginizer_backuply_promo(){ |
| 96 |
|
| 97 |
$plugins = get_plugins(); |
| 98 |
|
| 99 |
// Dont show Backuply Promo if its already installed |
| 100 |
if(array_key_exists('backuply-pro/backuply-pro.php', $plugins) || array_key_exists('backuply/backuply.php', $plugins)){ |
| 101 |
return; |
| 102 |
} |
| 103 |
|
| 104 |
if(isset($_REQUEST['install_backuply'])){ |
| 105 |
if(!wp_verify_nonce($_REQUEST['security'], 'loginizer_install_backuply') || !current_user_can('activate_plugins')){ |
| 106 |
die('Only Admin can access it'); |
| 107 |
} |
| 108 |
|
| 109 |
loginizer_backuply_install(); |
| 110 |
return; |
| 111 |
} |
| 112 |
|
| 113 |
echo '<div class="notice is-dismissible lz-welcome-panel lz-backuply-dismissible" style="padding:20px; margin:0;"> |
| 114 |
<table> |
| 115 |
<tr> |
| 116 |
<th width="25%"> |
| 117 |
<img src="'.LOGINIZER_URL.'\assets\images\backuply-square.png" height="150px" width="150px"/> |
| 118 |
</th> |
| 119 |
<td width="75%"> |
| 120 |
<div class="inside" style="margin-left: 20px;"> |
| 121 |
<strong><i>'.__('Backups are the best form of security. Secure your WordPress site by creating backups with Backuply','loginizer').'</i>:</strong><br> |
| 122 |
<ul class="lz-right-ul"> |
| 123 |
<li>'.__('Backup to remote locations like FTP, FTPS, SFTP, WebDAV, Google Drive, OneDrive, Dropbox, Amazon S3','loginizer').'</li> |
| 124 |
<li>'.__('Auto Backups','loginizer').'</li> |
| 125 |
<li>'.__('Easy One-Click restores','loginizer').'</li> |
| 126 |
<li>'.__('Stress Free Migrations','loginizer').'</li> |
| 127 |
</ul> |
| 128 |
<a class="button button-primary" href="'.esc_url(admin_url('admin.php?page=loginizer&install_backuply=1&security='.wp_create_nonce('loginizer_install_backuply'))).'">'.__('Install Backuply', 'loginizer').'</a> <a class="button button-secondary" target="_blank" href="https://wordpress.org/plugins/backuply/">'.__('Visit Backuply','loginizer').'</a> |
| 129 |
</div> |
| 130 |
</td> |
| 131 |
</tr> |
| 132 |
</table> |
| 133 |
</div><br /> |
| 134 |
<script type="text/javascript"> |
| 135 |
function loginizer_dismiss_backuply(){ |
| 136 |
|
| 137 |
var data = new Object(); |
| 138 |
data["action"] = "loginizer_dismiss_backuply"; |
| 139 |
data["nonce"] = "'.wp_create_nonce('loginizer_admin_ajax').'"; |
| 140 |
|
| 141 |
var admin_url = "'.admin_url().'"+"admin-ajax.php"; |
| 142 |
jQuery.post(admin_url, data, function(response){ |
| 143 |
|
| 144 |
}); |
| 145 |
|
| 146 |
} |
| 147 |
|
| 148 |
jQuery(document).on("click", ".lz-backuply-dismissible .notice-dismiss", loginizer_dismiss_backuply); |
| 149 |
</script>'; |
| 150 |
|
| 151 |
return true; |
| 152 |
} |
| 153 |
|
| 154 |
function loginizer_csrf_promo(){ |
| 155 |
|
| 156 |
echo '<div class="notice notice-success is-dismissible lz-csrf-dismissible"><p>Secure your WordPress site from CSRF attacks with our new feature <strong>CSRF Protection</strong> <a href="https://loginizer.com/docs/configuration-and-settings/how-to-enable-csrf-protection/" target="_blank" class="button button-primary">Read More</a></p></div>'; |
| 157 |
|
| 158 |
echo'<script type="text/javascript"> |
| 159 |
function loginizer_dismiss_csrf(){ |
| 160 |
|
| 161 |
var data = new Object(); |
| 162 |
data["action"] = "loginizer_dismiss_csrf"; |
| 163 |
data["nonce"] = "'.wp_create_nonce('loginizer_admin_ajax').'"; |
| 164 |
|
| 165 |
var admin_url = "'.admin_url().'"+"admin-ajax.php"; |
| 166 |
jQuery.post(admin_url, data, function(response){ |
| 167 |
|
| 168 |
}); |
| 169 |
|
| 170 |
} |
| 171 |
|
| 172 |
jQuery(document).on("click", ".lz-csrf-dismissible", loginizer_dismiss_csrf); |
| 173 |
</script>'; |
| 174 |
} |
| 175 |
|
| 176 |
// Install Backuply |
| 177 |
function loginizer_backuply_install(){ |
| 178 |
|
| 179 |
// Include the necessary stuff |
| 180 |
include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); |
| 181 |
|
| 182 |
// Includes necessary for Plugin_Upgrader and Plugin_Installer_Skin |
| 183 |
include_once( ABSPATH . 'wp-admin/includes/file.php' ); |
| 184 |
include_once( ABSPATH . 'wp-admin/includes/misc.php' ); |
| 185 |
include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
| 186 |
|
| 187 |
// Filter to prevent the activate text |
| 188 |
add_filter('install_plugin_complete_actions', 'loginizer_backuply_install_complete_actions', 10, 3); |
| 189 |
|
| 190 |
$upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin() ); |
| 191 |
$installed = $upgrader->install('https://downloads.wordpress.org/plugin/backuply.zip'); |
| 192 |
|
| 193 |
if ( !is_wp_error( $installed ) && $installed ) { |
| 194 |
echo 'Activating Backuply !'; |
| 195 |
$activate = activate_plugin('backuply/backuply.php'); |
| 196 |
|
| 197 |
if ( is_null($activate) ) { |
| 198 |
echo '<div id="message" class="updated"><p>'. esc_html__('Done! Backuply is now installed and activated.', 'loginizer'). '</p></div><br /><br><br><b>'. esc_html__('Done! Backuply is now installed and activated.', 'loginizer').'</b>'; |
| 199 |
} |
| 200 |
} |
| 201 |
|
| 202 |
return $installed; |
| 203 |
} |
| 204 |
|
| 205 |
// Prevent pro activate text for installer |
| 206 |
function loginizer_backuply_install_complete_actions($install_actions, $api, $plugin_file){ |
| 207 |
|
| 208 |
if($plugin_file == 'backuply/backuply.php'){ |
| 209 |
return array(); |
| 210 |
} |
| 211 |
|
| 212 |
return $install_actions; |
| 213 |
} |
| 214 |
|
| 215 |
// The Loginizer Theme footer |
| 216 |
function loginizer_page_footer(){ |
| 217 |
|
| 218 |
if(!loginizer_is_premium()){ |
| 219 |
echo '<script> |
| 220 |
jQuery("[loginizer-premium-only]").each(function(index) { |
| 221 |
jQuery(this).find( "input, textarea, select" ).attr("disabled", true); |
| 222 |
}); |
| 223 |
</script>'; |
| 224 |
} |
| 225 |
|
| 226 |
echo '</td> |
| 227 |
<td width="200" valign="top" id="loginizer-right-bar">'; |
| 228 |
|
| 229 |
if(!defined('SITEPAD')){ |
| 230 |
|
| 231 |
if(!defined('LOGINIZER_PREMIUM')){ |
| 232 |
|
| 233 |
echo ' |
| 234 |
<div class="postbox" style="min-width:0px !important;"> |
| 235 |
<div class="postbox-header"> |
| 236 |
<h2 class="hndle ui-sortable-handle"> |
| 237 |
<span>'.__('Premium Version','loginizer').'</span> |
| 238 |
</h2> |
| 239 |
</div> |
| 240 |
|
| 241 |
<div class="inside"> |
| 242 |
<i>'.__('Upgrade to the premium version and get the following features','loginizer').' </i>:<br> |
| 243 |
<ul class="lz-right-ul"> |
| 244 |
<li>'.__('PasswordLess Login','loginizer').'</li> |
| 245 |
<li>'.__('Two Factor Auth - Email','loginizer').'</li> |
| 246 |
<li>'.__('Two Factor Auth - App','loginizer').'</li> |
| 247 |
<li>'.__('Login Challenge Question','loginizer').'</li> |
| 248 |
<li>'.__('reCAPTCHA','loginizer').'</li> |
| 249 |
<li>'.__('Rename Login Page','loginizer').'</li> |
| 250 |
<li>'.__('Disable XML-RPC','loginizer').'</li> |
| 251 |
<li>'.__('And many more ...','loginizer').'</li> |
| 252 |
</ul> |
| 253 |
<center><a class="button button-primary" target="_blank" href="'.LOGINIZER_PRICING_URL.'">Upgrade</a></center> |
| 254 |
</div> |
| 255 |
</div>'; |
| 256 |
|
| 257 |
}else{ |
| 258 |
|
| 259 |
echo ' |
| 260 |
<div class="postbox" style="min-width:0px !important;"> |
| 261 |
<div class="postbox-header"> |
| 262 |
<h2 class="hndle ui-sortable-handle"> |
| 263 |
<span>'.__('Recommendations','loginizer').'</span> |
| 264 |
</h2> |
| 265 |
</div> |
| 266 |
<div class="inside"> |
| 267 |
<i>'.__('We recommed that you enable atleast one of the following security features','loginizer').'</i>:<br> |
| 268 |
<ul class="lz-right-ul"> |
| 269 |
<li>'.__('Rename Login Page','loginizer').'</li> |
| 270 |
<li>'.__('Login Challenge Question','loginizer').'</li> |
| 271 |
<li>'.__('reCAPTCHA','loginizer').'</li> |
| 272 |
<li>'.__('Two Factor Auth - Email','loginizer').'</li> |
| 273 |
<li>'.__('Two Factor Auth - App','loginizer').'</li> |
| 274 |
<li>'.__('Change \'admin\' Username','loginizer').'</li> |
| 275 |
</ul> |
| 276 |
</div> |
| 277 |
</div>'; |
| 278 |
} |
| 279 |
|
| 280 |
echo ' |
| 281 |
<div class="postbox" style="min-width:0px !important;"> |
| 282 |
<div class="postbox-header"> |
| 283 |
<h2 class="hndle ui-sortable-handle"> |
| 284 |
<span><a target="_blank" href="https://backuply.com/?from=loginizer-plugin"><img src="'.LOGINIZER_URL.'/assets/images/backuply-black.png" width="100%" /></a></span> |
| 285 |
</h2> |
| 286 |
</div> |
| 287 |
<div class="inside"> |
| 288 |
<i>'.__('Secure your WordPress site by creating backups with Backuply', 'loginizer').'</i>:<br> |
| 289 |
<ul class="lz-right-ul"> |
| 290 |
<li>'.__('Remote Backup to 8 location','loginizer').'</li> |
| 291 |
<li>'.__('Auto Backups', 'loginizer').'</li> |
| 292 |
<li>'.__('Backup Rotation', 'loginizer').'</li> |
| 293 |
<li>'.__('One-Click Restore', 'loginizer').'</li> |
| 294 |
<li>'.__('Stress-free Migration', 'loginizer').'</li> |
| 295 |
<li>'.__('Backup to Google Drive', 'loginizer').'</li> |
| 296 |
<li>'.__('Backup to Amazon S3', 'loginizer').'</li> |
| 297 |
<li>'.__('Backup to Dropbox', 'loginizer').'</li> |
| 298 |
<li>'.__('Backup to FTP,FTPS and many more ...','loginizer').'</li> |
| 299 |
</ul> |
| 300 |
<center><a class="button button-primary" target="_blank" href="https://wordpress.org/plugins/backuply/">'.__('Visit Backuply','loginizer').'</a></center> |
| 301 |
</div> |
| 302 |
</div>'; |
| 303 |
|
| 304 |
echo ' |
| 305 |
<div class="postbox" style="min-width:0px !important;"> |
| 306 |
<div class="postbox-header"> |
| 307 |
<h2 class="hndle ui-sortable-handle"> |
| 308 |
<span><a target="_blank" href="https://pagelayer.com/?from=loginizer-plugin"><img src="'.LOGINIZER_URL.'/assets/images/pagelayer_product.png" width="100%" /></a></span> |
| 309 |
</h2> |
| 310 |
</div> |
| 311 |
<div class="inside"> |
| 312 |
<i>'.__('Easily manage and make professional pages and content with our Pagelayer builder','loginizer').'</i>:<br> |
| 313 |
<ul class="lz-right-ul"> |
| 314 |
<li>'.__('30+ Free Widgets','loginizer').'</li> |
| 315 |
<li>'.__('60+ Premium Widgets','loginizer').'</li> |
| 316 |
<li>'.__('400+ Premium Sections','loginizer').'</li> |
| 317 |
<li>'.__('Theme Builder','loginizer').'</li> |
| 318 |
<li>'.__('WooCommerce Builder','loginizer').'</li> |
| 319 |
<li>'.__('Theme Creator and Exporter','loginizer').'</li> |
| 320 |
<li>'.__('Form Builder','loginizer').'</li> |
| 321 |
<li>'.__('Popup Builder','loginizer').'</li> |
| 322 |
<li>'.__('And many more ...','loginizer').'</li> |
| 323 |
</ul> |
| 324 |
<center><a class="button button-primary" target="_blank" href="https://wordpress.org/plugins/pagelayer/">'.__('Visit Pagelayer','loginizer').'</a></center> |
| 325 |
</div> |
| 326 |
</div>'; |
| 327 |
|
| 328 |
echo ' |
| 329 |
<div class="postbox" style="min-width:0px !important;"> |
| 330 |
<div class="postbox-header"> |
| 331 |
<h2 class="hndle ui-sortable-handle"> |
| 332 |
<span><a target="_blank" href="https://wpcentral.co/?from=loginizer-plugin"><img src="'.LOGINIZER_URL.'/assets/images/wpcentral_product.png" width="100%" /></a></span> |
| 333 |
</h2> |
| 334 |
</div> |
| 335 |
<div class="inside"> |
| 336 |
<i>'.__('Manage all your WordPress sites from <b>1 dashboard</b> ','loginizer').'</i>:<br> |
| 337 |
<ul class="lz-right-ul"> |
| 338 |
<li>'.__('1-click Admin Access','loginizer').'</li> |
| 339 |
<li>'.__('Update WordPress','loginizer').'</li> |
| 340 |
<li>'.__('Update Themes','loginizer').'</li> |
| 341 |
<li>'.__('Update Plugins','loginizer').'</li> |
| 342 |
<li>'.__('Backup your WordPress Site','loginizer').'</li> |
| 343 |
<li>'.__('Plugins & Theme Management','loginizer').'</li> |
| 344 |
<li>'.__('Post Management','loginizer').'</li> |
| 345 |
<li>'.__('And many more ...','loginizer').'</li> |
| 346 |
</ul> |
| 347 |
<center><a class="button button-primary" target="_blank" href="https://wpcentral.co/?from=loginizer-plugin">'.__('Visit wpCentral','loginizer').'</a></center> |
| 348 |
</div> |
| 349 |
</div>'; |
| 350 |
|
| 351 |
} |
| 352 |
|
| 353 |
echo '</td> |
| 354 |
</tr> |
| 355 |
</table>'; |
| 356 |
|
| 357 |
if(!defined('SITEPAD')){ |
| 358 |
|
| 359 |
echo '<br /> |
| 360 |
<div style="width:45%;background:#FFF;padding:15px; margin:auto"> |
| 361 |
<b>'.__('Let your friends know that you have secured your website :','loginizer').'</b> |
| 362 |
<form method="get" action="https://twitter.com/intent/tweet" id="tweet" onsubmit="return dotweet(this);"> |
| 363 |
<textarea name="text" cols="45" row="3" style="resize:none;">'.__('I just secured my @WordPress site against #bruteforce using @loginizer','loginizer').'</textarea> |
| 364 |
<input type="submit" value="Tweet!" class="button button-primary" onsubmit="return false;" id="twitter-btn" style="margin-top:20px;"/> |
| 365 |
</form> |
| 366 |
|
| 367 |
</div> |
| 368 |
<br /> |
| 369 |
|
| 370 |
<script> |
| 371 |
function dotweet(ele){ |
| 372 |
window.open(jQuery("#"+ele.id).attr("action")+"?"+jQuery("#"+ele.id).serialize(), "_blank", "scrollbars=no, menubar=no, height=400, width=500, resizable=yes, toolbar=no, status=no"); |
| 373 |
return false; |
| 374 |
} |
| 375 |
</script> |
| 376 |
|
| 377 |
<hr /> |
| 378 |
<a href="http://loginizer.com" target="_blank">Loginizer</a> '.__('v'.LOGINIZER_VERSION.'. You can report any bugs ','loginizer').'<a href="http://wordpress.org/support/plugin/loginizer" target="_blank">'.__('here','loginizer').'</a>.'; |
| 379 |
|
| 380 |
} |
| 381 |
|
| 382 |
echo ' |
| 383 |
</div> |
| 384 |
</div> |
| 385 |
</div> |
| 386 |
</div>'; |
| 387 |
|
| 388 |
} |
| 389 |
|
| 390 |
// The Loginizer Admin Options Page |
| 391 |
function loginizer_page_header($title = 'Loginizer'){ |
| 392 |
|
| 393 |
global $loginizer; |
| 394 |
|
| 395 |
?> |
| 396 |
<style> |
| 397 |
.lz-right-ul{ |
| 398 |
padding-left: 10px !important; |
| 399 |
} |
| 400 |
|
| 401 |
.lz-right-ul li{ |
| 402 |
list-style: circle !important; |
| 403 |
} |
| 404 |
</style> |
| 405 |
<?php |
| 406 |
|
| 407 |
echo '<div style="margin: 10px 20px 0 2px;"> |
| 408 |
<div class="metabox-holder columns-2"> |
| 409 |
<div class="postbox-container"> |
| 410 |
<div id="top-sortables" class="meta-box-sortables ui-sortable"> |
| 411 |
|
| 412 |
<table cellpadding="2" cellspacing="1" width="100%" class="fixed" border="0"> |
| 413 |
<tr> |
| 414 |
<td valign="top"><h3>'.$loginizer['prefix'].$title.'</h3></td>'; |
| 415 |
|
| 416 |
if(!defined('SITEPAD')){ |
| 417 |
|
| 418 |
echo '<td align="right"><a href="https://www.softaculous.com/clients?ca=affiliate" class="button button-primary" target="_blank">'. __('Refer and Earn', 'loginizer'). '</a> <a target="_blank" class="button button-primary" href="https://wordpress.org/support/view/plugin-reviews/loginizer">'.__('Review Loginizer', 'loginizer').'</a></td> |
| 419 |
<td align="right" width="40"><a target="_blank" href="https://twitter.com/loginizer"><img src="'.LOGINIZER_URL.'/assets/images/twitter.png" /></a></td> |
| 420 |
<td align="right" width="40"><a target="_blank" href="https://www.facebook.com/Loginizer-815504798591884"><img src="'.LOGINIZER_URL.'/assets/images/facebook.png" /></a></td>'; |
| 421 |
|
| 422 |
} |
| 423 |
|
| 424 |
echo ' |
| 425 |
</tr> |
| 426 |
</table> |
| 427 |
<hr /> |
| 428 |
|
| 429 |
<!--Main Table--> |
| 430 |
<table cellpadding="8" cellspacing="1" width="100%" class="fixed"> |
| 431 |
<tr> |
| 432 |
<td valign="top">'; |
| 433 |
|
| 434 |
if(file_exists(LOGINIZER_DIR.'/premium.php') && !empty($loginizer['enable_csrf_protection']) && !loginizer_is_csrf_prot_mod_set()){ |
| 435 |
|
| 436 |
$lz_error['csrf_mod'] = esc_html__('You have enabled CSRF protection but the .htaccess file has not been updated', 'loginizer'); |
| 437 |
|
| 438 |
if(!empty($lz_error)){ |
| 439 |
lz_report_error($lz_error);echo '<br />'; |
| 440 |
} |
| 441 |
} |
| 442 |
|
| 443 |
} |
| 444 |
|
| 445 |
// Shows the admin menu of Loginizer |
| 446 |
function loginizer_admin_menu() { |
| 447 |
|
| 448 |
global $wp_version, $loginizer; |
| 449 |
|
| 450 |
if(!defined('SITEPAD')){ |
| 451 |
|
| 452 |
// Add the menu page |
| 453 |
add_menu_page(__('Loginizer Dashboard', 'loginizer'), __('Loginizer Security', 'loginizer'), 'activate_plugins', 'loginizer', 'loginizer_dashboard'); |
| 454 |
|
| 455 |
// Dashboard |
| 456 |
add_submenu_page('loginizer', __('Loginizer Dashboard', 'loginizer'), __('Dashboard', 'loginizer'), 'activate_plugins', 'loginizer', 'loginizer_dashboard'); |
| 457 |
|
| 458 |
}else{ |
| 459 |
|
| 460 |
// Add the menu page |
| 461 |
add_menu_page(__('Security', 'loginizer'), __('Security', 'loginizer'), 'activate_plugins', 'loginizer', 'loginizer_security_settings', 'dashicons-shield', 85); |
| 462 |
|
| 463 |
// Rename Login |
| 464 |
add_submenu_page('loginizer', __('Security Settings', 'loginizer'), __('Rename Login', 'loginizer'), 'activate_plugins', 'loginizer', 'loginizer_security_settings'); |
| 465 |
|
| 466 |
} |
| 467 |
|
| 468 |
// Brute Force |
| 469 |
add_submenu_page('loginizer', __('Brute Force Settings', 'loginizer'), __('Brute Force', 'loginizer'), 'activate_plugins', 'loginizer_brute_force', 'loginizer_brute_force_settings'); |
| 470 |
|
| 471 |
// PasswordLess |
| 472 |
add_submenu_page('loginizer', __($loginizer['prefix'].'PasswordLess Settings', 'loginizer'), __('PasswordLess', 'loginizer'), 'activate_plugins', 'loginizer_passwordless', 'loginizer_passwordless_settings'); |
| 473 |
|
| 474 |
// Security Settings |
| 475 |
if(!defined('SITEPAD')){ |
| 476 |
|
| 477 |
// Two Factor Auth |
| 478 |
add_submenu_page('loginizer', __($loginizer['prefix'].' Two Factor Authentication', 'loginizer'), __('Two Factor Auth', 'loginizer'), 'activate_plugins', 'loginizer_2fa', 'loginizer_2fa_settings'); |
| 479 |
|
| 480 |
} |
| 481 |
|
| 482 |
// reCaptcha |
| 483 |
add_submenu_page('loginizer', __($loginizer['prefix'].'reCAPTCHA Settings', 'loginizer'), __('reCAPTCHA', 'loginizer'), 'activate_plugins', 'loginizer_recaptcha', 'loginizer_recaptcha_settings'); |
| 484 |
|
| 485 |
// Temporary Login |
| 486 |
add_submenu_page('loginizer', __($loginizer['prefix'].'SSO', 'loginizer'), __('Single Sign On', 'loginizer'). ((time() < strtotime('30 November 2023')) ? ' <span style="color:yellow;">Update</span>' : ''), 'activate_plugins', 'loginizer_sso', 'loginizer_sso_settings'); |
| 487 |
|
| 488 |
// Security Settings |
| 489 |
if(!defined('SITEPAD')){ |
| 490 |
|
| 491 |
// Security Settings |
| 492 |
add_submenu_page('loginizer', __($loginizer['prefix'].'Security Settings', 'loginizer'), __('Security Settings', 'loginizer'), 'activate_plugins', 'loginizer_security', 'loginizer_security_settings'); |
| 493 |
|
| 494 |
// File Checksums |
| 495 |
add_submenu_page('loginizer', __('Loginizer File Checksums', 'loginizer'), __('File Checksums', 'loginizer'), 'activate_plugins', 'loginizer_checksums', 'loginizer_checksums_settings'); |
| 496 |
|
| 497 |
} |
| 498 |
|
| 499 |
if(!defined('LOGINIZER_PREMIUM') && !empty($loginizer['ins_time']) && $loginizer['ins_time'] < (time() - (30*24*3600))){ |
| 500 |
|
| 501 |
// Go Pro link |
| 502 |
add_submenu_page('loginizer', __('Loginizer Go Pro', 'loginizer'), __('Go Pro', 'loginizer'), 'activate_plugins', LOGINIZER_PRO_URL); |
| 503 |
|
| 504 |
} |
| 505 |
|
| 506 |
} |
| 507 |
|
| 508 |
// Show the promo |
| 509 |
function loginizer_promo(){ |
| 510 |
|
| 511 |
echo ' |
| 512 |
<style> |
| 513 |
.lz_button { |
| 514 |
background-color: #4CAF50; /* Green */ |
| 515 |
border: none; |
| 516 |
color: white; |
| 517 |
padding: 8px 16px; |
| 518 |
text-align: center; |
| 519 |
text-decoration: none; |
| 520 |
display: inline-block; |
| 521 |
font-size: 16px; |
| 522 |
margin: 4px 2px; |
| 523 |
-webkit-transition-duration: 0.4s; /* Safari */ |
| 524 |
transition-duration: 0.4s; |
| 525 |
cursor: pointer; |
| 526 |
} |
| 527 |
|
| 528 |
.lz_button:focus{ |
| 529 |
border: none; |
| 530 |
color: white; |
| 531 |
} |
| 532 |
|
| 533 |
.lz_button1 { |
| 534 |
color: white; |
| 535 |
background-color: #4CAF50; |
| 536 |
border:3px solid #4CAF50; |
| 537 |
} |
| 538 |
|
| 539 |
.lz_button1:hover { |
| 540 |
box-shadow: 0 6px 8px 0 rgba(0,0,0,0.24), 0 9px 25px 0 rgba(0,0,0,0.19); |
| 541 |
color: white; |
| 542 |
border:3px solid #4CAF50; |
| 543 |
} |
| 544 |
|
| 545 |
.lz_button2 { |
| 546 |
color: white; |
| 547 |
background-color: #0085ba; |
| 548 |
} |
| 549 |
|
| 550 |
.lz_button2:hover { |
| 551 |
box-shadow: 0 6px 8px 0 rgba(0,0,0,0.24), 0 9px 25px 0 rgba(0,0,0,0.19); |
| 552 |
color: white; |
| 553 |
} |
| 554 |
|
| 555 |
.lz_button3 { |
| 556 |
color: white; |
| 557 |
background-color: #365899; |
| 558 |
} |
| 559 |
|
| 560 |
.lz_button3:hover { |
| 561 |
box-shadow: 0 6px 8px 0 rgba(0,0,0,0.24), 0 9px 25px 0 rgba(0,0,0,0.19); |
| 562 |
color: white; |
| 563 |
} |
| 564 |
|
| 565 |
.lz_button4 { |
| 566 |
color: white; |
| 567 |
background-color: rgb(66, 184, 221); |
| 568 |
} |
| 569 |
|
| 570 |
.lz_button4:hover { |
| 571 |
box-shadow: 0 6px 8px 0 rgba(0,0,0,0.24), 0 9px 25px 0 rgba(0,0,0,0.19); |
| 572 |
color: white; |
| 573 |
} |
| 574 |
|
| 575 |
.loginizer_promo-close{ |
| 576 |
float:right; |
| 577 |
text-decoration:none; |
| 578 |
margin: 5px 10px 0px 0px; |
| 579 |
} |
| 580 |
|
| 581 |
.loginizer_promo-close:hover{ |
| 582 |
color: red; |
| 583 |
} |
| 584 |
</style> |
| 585 |
|
| 586 |
<script> |
| 587 |
jQuery(document).ready( function() { |
| 588 |
(function($) { |
| 589 |
$("#loginizer_promo .loginizer_promo-close").click(function(){ |
| 590 |
var data; |
| 591 |
|
| 592 |
// Hide it |
| 593 |
$("#loginizer_promo").hide(); |
| 594 |
|
| 595 |
// Save this preference |
| 596 |
$.post("'.admin_url('?loginizer_promo=0').'", data, function(response) { |
| 597 |
//alert(response); |
| 598 |
}); |
| 599 |
}); |
| 600 |
})(jQuery); |
| 601 |
}); |
| 602 |
</script> |
| 603 |
|
| 604 |
<div class="notice notice-success" id="loginizer_promo" style="min-height:120px"> |
| 605 |
<a class="loginizer_promo-close" href="javascript:" aria-label="Dismiss this Notice"> |
| 606 |
<span class="dashicons dashicons-dismiss"></span> Dismiss |
| 607 |
</a> |
| 608 |
<img src="'.LOGINIZER_URL.'/assets/images/loginizer-200.png" style="float:left; margin:10px 20px 10px 10px" width="100" /> |
| 609 |
<p style="font-size:16px">We are glad you like Loginizer and have been using it since the past few days. It is time to take the next step </p> |
| 610 |
<p> |
| 611 |
<a class="lz_button lz_button1" target="_blank" href="https://loginizer.com/features">Upgrade to Pro</a> |
| 612 |
<a class="lz_button lz_button2" target="_blank" href="https://wordpress.org/support/view/plugin-reviews/loginizer">Rate it 5� |
| 613 |
\'s</a> |
| 614 |
<a class="lz_button lz_button3" target="_blank" href="https://www.facebook.com/Loginizer-815504798591884/">Like Us on Facebook</a> |
| 615 |
<a class="lz_button lz_button4" target="_blank" href="https://twitter.com/home?status='.rawurlencode('I use @loginizer to secure my #WordPress site - https://loginizer.com').'">Tweet about Loginizer</a> |
| 616 |
</p> |
| 617 |
</div>'; |
| 618 |
|
| 619 |
} |
| 620 |
|
| 621 |
|
| 622 |
function loginizer_recaptcha_settings(){ |
| 623 |
include_once LOGINIZER_DIR . '/main/settings/recaptcha.php'; |
| 624 |
loginizer_page_recaptcha(); |
| 625 |
} |
| 626 |
|
| 627 |
function loginizer_2fa_settings(){ |
| 628 |
include_once LOGINIZER_DIR . '/main/settings/2fa.php'; |
| 629 |
loginizer_page_2fa(); |
| 630 |
} |
| 631 |
|
| 632 |
function loginizer_passwordless_settings(){ |
| 633 |
include_once LOGINIZER_DIR . '/main/settings/passwordless.php'; |
| 634 |
loginizer_page_passwordless(); |
| 635 |
} |
| 636 |
|
| 637 |
function loginizer_security_settings(){ |
| 638 |
include_once LOGINIZER_DIR . '/main/settings/security.php'; |
| 639 |
loginizer_page_security(); |
| 640 |
} |
| 641 |
|
| 642 |
function loginizer_brute_force_settings(){ |
| 643 |
include_once LOGINIZER_DIR . '/main/settings/brute-force.php'; |
| 644 |
loginizer_page_brute_force(); |
| 645 |
} |
| 646 |
|
| 647 |
function loginizer_checksums_settings(){ |
| 648 |
include_once LOGINIZER_DIR . '/main/settings/checksum.php'; |
| 649 |
loginizer_page_checksums(); |
| 650 |
} |
| 651 |
|
| 652 |
function loginizer_dashboard(){ |
| 653 |
include_once LOGINIZER_DIR . '/main/settings/dashboard.php'; |
| 654 |
|
| 655 |
loginizer_page_dashboard(); |
| 656 |
} |
| 657 |
|
| 658 |
function loginizer_sso_settings(){ |
| 659 |
loginizer_enqueue_admin_script(); |
| 660 |
include_once LOGINIZER_DIR . '/main/settings/sso.php'; |
| 661 |
|
| 662 |
loginizer_sso(); |
| 663 |
} |
| 664 |
|
| 665 |
function loginizer_enqueue_admin_script(){ |
| 666 |
wp_enqueue_script('loginizer-admin', LOGINIZER_URL . '/assets/js/loginizer-admin.js', LOGINIZER_VERSION, true); |
| 667 |
|
| 668 |
$loginizer_script_data = array( |
| 669 |
'nonce' => wp_create_nonce('loginizer_nonce'), |
| 670 |
'ajax_url' => admin_url('admin-ajax.php'), |
| 671 |
); |
| 672 |
|
| 673 |
wp_localize_script('loginizer-admin', 'lz_obj', $loginizer_script_data); |
| 674 |
} |
| 675 |
|