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

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