PluginProbe
LoftLoader / 1.0.0
LoftLoader v1.0.0
trunk 1.0.0 1.0.1 1.0.2 2.0.0 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.3 2.3.1 2.3.2 2.3.3 All 34 releases
loftloader / loftloader.php

loftloader.php in LoftLoader 1.0.0, at loftloader.php

93 lines 2.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: LoftLoader
4 Plugin URI: http://www.loftocean.com/
5 Description: An easy to use plugin to add an animated preloader to your website with fully customisations.
6 Version: 1.0.0
7 Author: Loft Ocean
8 Author URI: http://www.loftocean.com/
9 Text Domain: loftloader
10 Domain Path: /languages
11 License: GPLv2
12 License URI: https://www.gnu.org/licenses/gpl-2.0.html
13 */
14
15
16 /**
17 * LoftLoader main file
18 *
19 * @package LoftLoader
20 * @version 1.0
21 * @link http://www.loftocean.com/
22 * @author Suihai Huang from Loft Ocean Team
23 */
24
25 // Not allowed by directly accessing.
26 if(!defined('ABSPATH')){
27 die('Access not allowed!');
28 }
29
30 if(!class_exists('LoftLoader')){
31 register_activation_hook(__FILE__, 'loftloader_activate'); //
32 register_deactivation_hook(__FILE__, 'loftloader_deactivate');
33 /*
34 * Update the plugin version for initial version
35 */
36 function loftloader_activate(){
37 update_option('loftloader_plugin_version', '1.0.0');
38 }
39 /**
40 * Do nothing for initial version
41 */
42 function loftloader_deactivate(){ }
43 /**
44 * Define the constant used in this plugin
45 */
46 define('LOFTLOADER_ROOT', dirname(__FILE__) . '/');
47 define('LOFTLOADER_NAME', plugin_basename( __FILE__ ));
48 define('LOFTLOADER_URI', plugin_dir_url( __FILE__ ));
49 define('LOFTLOADER_JS_URI', LOFTLOADER_URI . 'js/');
50 define('LOFTLOADER_CSS_URI', LOFTLOADER_URI . 'css/');
51
52 /**
53 * Main plugin class
54 * @since version 1.0.0
55 */
56 class LoftLoader{
57 public function __construct(){
58 load_plugin_textdomain('loftloader', false, dirname(plugin_basename(__FILE__)) . '/languages/'); // Load the text domain
59 $this->load_configs();
60 add_action('init', array($this, 'load_settings')); // Load the plugin settings
61 add_action('wp', array($this, 'load_front')); // Load the front main class
62 add_action('wp_enqueue_scripts', array($this, 'enqueue_loader_styles'));
63 add_action('admin_enqueue_scripts', array($this, 'enqueue_loader_styles'));
64 }
65 /**
66 * @description load configuration files
67 */
68 public function load_configs(){
69 require_once LOFTLOADER_ROOT . 'configs/loftloader-config.php';
70 }
71 /**
72 * @description load plugin settings main class
73 */
74 public function load_settings(){
75 is_admin() ? require_once LOFTLOADER_ROOT . 'settings/class-loftloader-settings.php' : '';
76 }
77 /**
78 * @description load plugin front main class
79 */
80 public function load_front(){
81 !is_admin() ? require_once LOFTLOADER_ROOT . 'front/class-loftloader-front.php' : '';
82 }
83 /**
84 * @description register the loader style css for both plugin setting page and front end
85 */
86 public function enqueue_loader_styles(){
87 wp_register_style('loftloader-animation', LOFTLOADER_CSS_URI . 'loftloader-animation.css', array(), '1.0');
88 }
89 }
90 new LoftLoader(); // Enable LoftLoader
91 }
92 ?>
93