| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* WP Adminify has some hooks for developers. |
| 5 |
*/ |
| 6 |
if (!class_exists('WP_Adminify_Developer_Hooks')) { |
| 7 |
|
| 8 |
/** |
| 9 |
* Developer friendly hooks. |
| 10 |
*/ |
| 11 |
class WP_Adminify_Developer_Hooks |
| 12 |
{ |
| 13 |
|
| 14 |
/* * * * * * * * * * |
| 15 |
* Class constructor |
| 16 |
* * * * * * * * * */ |
| 17 |
public function __construct() |
| 18 |
{ |
| 19 |
$this->_hooks(); |
| 20 |
} |
| 21 |
|
| 22 |
public function _hooks() |
| 23 |
{ |
| 24 |
add_filter('wp_adminify_remember_me', [$this, 'wp_adminify_remember_me_callback'], 10, 1); |
| 25 |
} |
| 26 |
|
| 27 |
/** |
| 28 |
* wp_adminify_remember_me_callback [turn off the remember me option from WordPress login form.] |
| 29 |
* @param bolean $activate |
| 30 |
* @since 1.0.0 |
| 31 |
*/ |
| 32 |
public function wp_adminify_remember_me_callback($activate) |
| 33 |
{ |
| 34 |
|
| 35 |
if (!$activate) |
| 36 |
return; |
| 37 |
|
| 38 |
// Add the hook into the login_form |
| 39 |
add_action('login_form', [$this, 'wp_adminify_login_form'], 99); |
| 40 |
// Reset any attempt to set the remember option |
| 41 |
add_action('login_head', [$this, 'unset_remember_me_option'], 99); |
| 42 |
} |
| 43 |
|
| 44 |
function unset_remember_me_option() |
| 45 |
{ |
| 46 |
|
| 47 |
// Remove the rememberme post value |
| 48 |
if (isset($_POST['rememberme'])) { |
| 49 |
unset($_POST['rememberme']); |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
function wp_adminify_login_form() |
| 54 |
{ |
| 55 |
|
| 56 |
ob_start(array($this, 'remove_forgetmenot_class')); |
| 57 |
} |
| 58 |
|
| 59 |
function remove_forgetmenot_class($content) |
| 60 |
{ |
| 61 |
|
| 62 |
$content = preg_replace('/<p class="forgetmenot">(.*)<\/p>/', '', $content); |
| 63 |
return $content; |
| 64 |
} |
| 65 |
} |
| 66 |
} |
| 67 |
|