| 1 |
<?php |
| 2 |
defined('ABSPATH') or die; |
| 3 |
|
| 4 |
/* |
| 5 |
Plugin Name: FluentAuth - Auth Security Plugin |
| 6 |
Plugin URI: https://fluentauth.com |
| 7 |
Description: Super Simple Login / Signup Security and Social Login Plugin for WordPress |
| 8 |
Version: 2.1.2 |
| 9 |
Author: Fluent Auth Team |
| 10 |
Author URI: https://fluentauth.com |
| 11 |
License: GPLv2 or later |
| 12 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 13 |
Text Domain: fluent-security |
| 14 |
Domain Path: /language/ |
| 15 |
*/ |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
if (defined('FLUENT_AUTH_VERSION')) { |
| 20 |
return; |
| 21 |
} |
| 22 |
|
| 23 |
define('FLUENT_AUTH_PLUGIN_PATH', plugin_dir_path(__FILE__)); |
| 24 |
define('FLUENT_AUTH_PLUGIN_URL', plugin_dir_url(__FILE__)); |
| 25 |
define('FLUENT_AUTH_VERSION', '2.1.2'); |
| 26 |
|
| 27 |
class FluentAuthPlugin |
| 28 |
{ |
| 29 |
public function init() |
| 30 |
{ |
| 31 |
$this->autoLoad(); |
| 32 |
|
| 33 |
register_activation_hook(__FILE__, [$this, 'activatePlugin']); |
| 34 |
register_deactivation_hook(__FILE__, [$this, 'deactivatePlugin']); |
| 35 |
|
| 36 |
load_plugin_textdomain('fluent-security', false, dirname(plugin_basename(__FILE__)) . '/language'); |
| 37 |
|
| 38 |
$plugin_file = plugin_basename(__FILE__); |
| 39 |
add_filter("plugin_action_links_{$plugin_file}", [$this, 'addContextLinks'], 10, 1); |
| 40 |
} |
| 41 |
|
| 42 |
public function activatePlugin($siteWide = false) |
| 43 |
{ |
| 44 |
\FluentAuth\App\Helpers\Activator::activate($siteWide); |
| 45 |
} |
| 46 |
|
| 47 |
public function deactivatePlugin() |
| 48 |
{ |
| 49 |
wp_clear_scheduled_hook('fluent_auth_daily_tasks'); |
| 50 |
wp_clear_scheduled_hook('fluent_auth_hourly_tasks'); |
| 51 |
} |
| 52 |
|
| 53 |
private function autoLoad() |
| 54 |
{ |
| 55 |
spl_autoload_register(function ($class) { |
| 56 |
if (strpos($class, 'FluentAuth\\') !== 0) { |
| 57 |
return; |
| 58 |
} |
| 59 |
|
| 60 |
$file = str_replace( |
| 61 |
['FluentAuth\\App\\', '\\'], |
| 62 |
['app' . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR], |
| 63 |
$class |
| 64 |
); |
| 65 |
|
| 66 |
require FLUENT_AUTH_PLUGIN_PATH . $file . '.php'; |
| 67 |
}); |
| 68 |
|
| 69 |
require_once FLUENT_AUTH_PLUGIN_PATH . 'app/Services/DB/wpfluent.php'; |
| 70 |
|
| 71 |
add_action('rest_api_init', function () { |
| 72 |
require_once FLUENT_AUTH_PLUGIN_PATH . 'app/Http/routes.php'; |
| 73 |
}); |
| 74 |
|
| 75 |
require_once FLUENT_AUTH_PLUGIN_PATH . 'app/Hooks/hooks.php'; |
| 76 |
} |
| 77 |
|
| 78 |
public function addContextLinks($actions) |
| 79 |
{ |
| 80 |
$actions['settings'] = sprintf( |
| 81 |
'<a href="%s">%s</a>', |
| 82 |
esc_url(admin_url('admin.php?page=fluent-auth#/settings')), |
| 83 |
esc_html__('Settings', 'fluent-security') |
| 84 |
); |
| 85 |
|
| 86 |
$actions['dashboard_page'] = sprintf( |
| 87 |
'<a href="%s">%s</a>', |
| 88 |
esc_url(admin_url('admin.php?page=fluent-auth#/')), |
| 89 |
esc_html__('Dashboard', 'fluent-security') |
| 90 |
); |
| 91 |
|
| 92 |
return $actions; |
| 93 |
} |
| 94 |
} |
| 95 |
|
| 96 |
(new FluentAuthPlugin())->init(); |
| 97 |
|