| 1 |
<?php |
| 2 |
/** |
| 3 |
Plugin Name: FormLayer |
| 4 |
Plugin URI: https://formlayer.net |
| 5 |
Description: Build fast and powerful contact forms in WordPress with an intuitive drag-and-drop builder packed with smart features. |
| 6 |
Version: 1.0.9 |
| 7 |
Author: Softaculous Team |
| 8 |
Author URI: https://softaculous.com/ |
| 9 |
Text Domain: formlayer |
| 10 |
License: GPLv2 |
| 11 |
*/ |
| 12 |
|
| 13 |
if(!defined('ABSPATH')){ |
| 14 |
exit; |
| 15 |
} |
| 16 |
|
| 17 |
if(!function_exists('add_action')){ |
| 18 |
echo 'You are not allowed to access this page directly.'; |
| 19 |
exit; |
| 20 |
} |
| 21 |
|
| 22 |
// Define Constants |
| 23 |
define('FORMLAYER_VERSION', '1.0.9' ); |
| 24 |
define('FORMLAYER_FILE', __FILE__); |
| 25 |
define('FORMLAYER_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
| 26 |
define('FORMLAYER_PLUGIN_URL', plugin_dir_url(__FILE__)); |
| 27 |
define('FORMLAYER_ASSETS_URL', FORMLAYER_PLUGIN_URL . 'assets'); |
| 28 |
|
| 29 |
function formlayer_autoloader($class){ |
| 30 |
if(!preg_match('/^FormLayer\\\(.*)/is', $class, $m)){ |
| 31 |
return; |
| 32 |
} |
| 33 |
|
| 34 |
$m[1] = str_replace('\\', '/', $m[1]); |
| 35 |
|
| 36 |
$file = FORMLAYER_PLUGIN_DIR . 'main/' . strtolower($m[1]) . '.php'; |
| 37 |
if(file_exists($file)){ |
| 38 |
include_once($file); |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
spl_autoload_register('formlayer_autoloader'); |
| 43 |
register_activation_hook(FORMLAYER_FILE, '\FormLayer\Install::activate'); |
| 44 |
register_deactivation_hook(FORMLAYER_FILE, '\FormLayer\Install::deactivate'); |
| 45 |
register_uninstall_hook(FORMLAYER_FILE, '\FormLayer\Install::uninstall'); |
| 46 |
add_action('plugins_loaded', 'formlayer_load_plugin'); |
| 47 |
|
| 48 |
/** |
| 49 |
* Initialize plugin on plugins_loaded hook |
| 50 |
*/ |
| 51 |
function formlayer_load_plugin(){ |
| 52 |
global $formlayer; |
| 53 |
|
| 54 |
if(empty($formlayer)){ |
| 55 |
$formlayer = new stdClass(); |
| 56 |
} |
| 57 |
|
| 58 |
if(wp_doing_ajax()){ |
| 59 |
\FormLayer\Ajax::hooks(); |
| 60 |
} |
| 61 |
|
| 62 |
\FormLayer\Migration::init(); |
| 63 |
|
| 64 |
// Load frontend class and init (priority 15) |
| 65 |
add_action('init', '\FormLayer\Frontend::init', 15); |
| 66 |
|
| 67 |
if(is_admin()){ |
| 68 |
\FormLayer\Admin::init(); |
| 69 |
return; |
| 70 |
} |
| 71 |
} |