| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Fluent Snippets |
| 4 |
* Plugin URI: https://fluentsnippets.com |
| 5 |
* Description: Super Fast File Based Native Code Snippets (header / footer codes) Manager for WordPress |
| 6 |
* Author: Fluent Snippets |
| 7 |
* Author URI: https://fluentsnippets.com |
| 8 |
* License: GPL-2.0-or-later |
| 9 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 10 |
* Text Domain: easy-code-manager |
| 11 |
* Version: 10.51 |
| 12 |
* Requires PHP: 7.3 |
| 13 |
* Requires at least: 6.0 |
| 14 |
* Domain Path: /language |
| 15 |
*/ |
| 16 |
|
| 17 |
// Exit if accessed directly. |
| 18 |
if (!defined('ABSPATH')) { |
| 19 |
return; |
| 20 |
} |
| 21 |
|
| 22 |
if (defined('FLUENT_SNIPPETS_PLUGIN_PATH')) { |
| 23 |
return; |
| 24 |
} |
| 25 |
|
| 26 |
define('FLUENT_SNIPPETS_PLUGIN_PATH', plugin_dir_path(__FILE__)); |
| 27 |
define('FLUENT_SNIPPETS_PLUGIN_URL', plugin_dir_url(__FILE__)); |
| 28 |
define('FLUENT_SNIPPETS_PLUGIN_VERSION', '10.51'); |
| 29 |
|
| 30 |
class FluentCodeSnippetsBoot |
| 31 |
{ |
| 32 |
public function boot() |
| 33 |
{ |
| 34 |
$this->autoLoad(); |
| 35 |
|
| 36 |
add_action('init', function () { |
| 37 |
load_plugin_textdomain('easy-code-manager', false, 'fluent-snippets/language'); |
| 38 |
}); |
| 39 |
} |
| 40 |
|
| 41 |
private function autoLoad() |
| 42 |
{ |
| 43 |
|
| 44 |
spl_autoload_register(function ($class) { |
| 45 |
$match = 'FluentSnippets'; |
| 46 |
|
| 47 |
if (!preg_match("/\b{$match}\b/", $class)) { |
| 48 |
return; |
| 49 |
} |
| 50 |
|
| 51 |
$path = plugin_dir_path(__FILE__); |
| 52 |
|
| 53 |
$file = str_replace( |
| 54 |
['FluentSnippets', '\\', '/App/'], |
| 55 |
['', DIRECTORY_SEPARATOR, 'app/'], |
| 56 |
$class |
| 57 |
); |
| 58 |
|
| 59 |
require(trailingslashit($path) . trim($file, '/') . '.php'); |
| 60 |
}); |
| 61 |
|
| 62 |
add_action('plugins_loaded', function () { |
| 63 |
add_action('rest_api_init', function () { |
| 64 |
require_once FLUENT_SNIPPETS_PLUGIN_PATH . 'app/Http/routes.php'; |
| 65 |
}); |
| 66 |
}); |
| 67 |
|
| 68 |
require_once FLUENT_SNIPPETS_PLUGIN_PATH . 'app/Hooks/hooks.php'; |
| 69 |
|
| 70 |
register_deactivation_hook(__FILE__, [\FluentSnippets\App\Helpers\Helper::class, 'handleDeactivate']); |
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
(new FluentCodeSnippetsBoot())->boot(); |
| 75 |
|