PluginProbe
FormLayer / 1.0.3
FormLayer v1.0.3
1.0.9 1.0.8 1.0.7 1.0.6 trunk 1.0.3 1.0.4 1.0.5
formlayer / formlayer.php

formlayer.php in FormLayer 1.0.3, at formlayer.php

69 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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.4
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.4' );
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 // Load frontend class and init (priority 15)
63 add_action('init', '\FormLayer\Frontend::init', 15);
64
65 if(is_admin()){
66 \FormLayer\Admin::init();
67 return;
68 }
69 }