PluginProbe
FluentAuth – The Ultimate Authorization & Security Plugin for WordPress / 2.0.3
FluentAuth – The Ultimate Authorization & Security Plugin for WordPress v2.0.3
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.0.3, at fluent-security.php

100 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.0.3
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 if (defined('FLUENT_AUTH_VERSION')) {
19 return;
20 }
21
22 define('FLUENT_AUTH_PLUGIN_PATH', plugin_dir_path(__FILE__));
23 define('FLUENT_AUTH_PLUGIN_URL', plugin_dir_url(__FILE__));
24 define('FLUENT_AUTH_VERSION', '2.0.3');
25
26 class FluentAuthPlugin
27 {
28 public function init()
29 {
30 $this->autoLoad();
31
32 register_activation_hook(__FILE__, [$this, 'activatePlugin']);
33 register_deactivation_hook(__FILE__, [$this, 'deactivatePlugin']);
34
35 load_plugin_textdomain('fluent-security', false, dirname(plugin_basename(__FILE__)) . '/language');
36
37 $plugin_file = plugin_basename(__FILE__);
38 add_filter("plugin_action_links_{$plugin_file}", [$this, 'addContextLinks'], 10, 1);
39 }
40
41 public function activatePlugin($siteWide = false)
42 {
43 \FluentAuth\App\Helpers\Activator::activate($siteWide);
44 }
45
46 public function deactivatePlugin()
47 {
48 wp_clear_scheduled_hook('fluent_auth_daily_tasks');
49 wp_clear_scheduled_hook('fluent_auth_hourly_tasks');
50 }
51
52 private function autoLoad()
53 {
54 spl_autoload_register(function ($class) {
55 $match = 'FluentAuth';
56
57 if (!preg_match("/\b{$match}\b/", $class)) {
58 return;
59 }
60
61 $path = plugin_dir_path(__FILE__);
62
63 $file = str_replace(
64 ['FluentAuth', '\\', '/App/'],
65 ['', DIRECTORY_SEPARATOR, 'app/'],
66 $class
67 );
68
69 require(trailingslashit($path) . trim($file, '/') . '.php');
70 });
71
72 require_once FLUENT_AUTH_PLUGIN_PATH . 'app/Services/DB/wpfluent.php';
73
74 add_action('rest_api_init', function () {
75 require_once FLUENT_AUTH_PLUGIN_PATH . 'app/Http/routes.php';
76 });
77
78 require_once FLUENT_AUTH_PLUGIN_PATH . 'app/Hooks/hooks.php';
79 }
80
81 public function addContextLinks($actions)
82 {
83 $actions['settings'] = sprintf(
84 '<a href="%s">%s</a>',
85 esc_url(admin_url('admin.php?page=fluent-auth#/settings')),
86 esc_html__('Settings', 'fluent-security')
87 );
88
89 $actions['dashboard_page'] = sprintf(
90 '<a href="%s">%s</a>',
91 esc_url(admin_url('admin.php?page=fluent-auth#/')),
92 esc_html__('Dashboard', 'fluent-security')
93 );
94
95 return $actions;
96 }
97 }
98
99 (new FluentAuthPlugin())->init();
100