PluginProbe
FluentAuth – The Ultimate Authorization & Security Plugin for WordPress / 2.1.1
FluentAuth – The Ultimate Authorization & Security Plugin for WordPress v2.1.1
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.1.0 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2
fluent-security / fluent-security.php

fluent-security.php in FluentAuth – The Ultimate Authorization & Security Plugin for WordPress 2.1.1, at fluent-security.php

101 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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.1
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.1');
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 $match = 'FluentAuth';
57
58 if (!preg_match("/\b{$match}\b/", $class)) {
59 return;
60 }
61
62 $path = plugin_dir_path(__FILE__);
63
64 $file = str_replace(
65 ['FluentAuth', '\\', '/App/'],
66 ['', DIRECTORY_SEPARATOR, 'app/'],
67 $class
68 );
69
70 require(trailingslashit($path) . trim($file, '/') . '.php');
71 });
72
73 require_once FLUENT_AUTH_PLUGIN_PATH . 'app/Services/DB/wpfluent.php';
74
75 add_action('rest_api_init', function () {
76 require_once FLUENT_AUTH_PLUGIN_PATH . 'app/Http/routes.php';
77 });
78
79 require_once FLUENT_AUTH_PLUGIN_PATH . 'app/Hooks/hooks.php';
80 }
81
82 public function addContextLinks($actions)
83 {
84 $actions['settings'] = sprintf(
85 '<a href="%s">%s</a>',
86 esc_url(admin_url('admin.php?page=fluent-auth#/settings')),
87 esc_html__('Settings', 'fluent-security')
88 );
89
90 $actions['dashboard_page'] = sprintf(
91 '<a href="%s">%s</a>',
92 esc_url(admin_url('admin.php?page=fluent-auth#/')),
93 esc_html__('Dashboard', 'fluent-security')
94 );
95
96 return $actions;
97 }
98 }
99
100 (new FluentAuthPlugin())->init();
101