PluginProbe
Lasso Lite – Affiliate Link Manager & Product Displays / 116
Lasso Lite – Affiliate Link Manager & Product Displays v116
157 155 156 154 153 152 151 150 149 148 trunk 0.9.9 104 105 106 107 108 109 110 111 112 113 114 115 116 All 56 releases
simple-urls / classes / class-init.php

class-init.php in Lasso Lite – Affiliate Link Manager & Product Displays 116, at classes/class-init.php

122 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Declare class Helper
4 *
5 * @package Helper
6 */
7
8 namespace LassoLite\Classes;
9
10 use LassoLite\Admin\Constant;
11 use LassoLite\Classes\Helper;
12
13 /**
14 * Init
15 */
16 class Init {
17
18 /**
19 * Init constructor.
20 */
21 public function __construct() {
22
23 $this->init_site_id();
24
25 $this->ajaxes = array(
26 '\LassoLite\Pages\Ajax',
27 '\LassoLite\Pages\Dashboard\Ajax',
28 '\LassoLite\Pages\Import_Urls\Ajax',
29 '\LassoLite\Pages\Url_Details\Ajax',
30 '\LassoLite\Pages\Settings\Ajax',
31 '\LassoLite\Pages\Groups\Ajax',
32 );
33
34 $this->hooks = array(
35 '\LassoLite\Pages\Hook',
36 '\LassoLite\Pages\Url_Details\Hook',
37 '\LassoLite\Pages\Import_Urls\Hook',
38 );
39
40 $this->classes = array(
41 '\LassoLite\Classes\Cron',
42 );
43
44 $this->processes = array(
45 '\LassoLite\Classes\Processes\Import_All',
46 '\LassoLite\Classes\Processes\Revert_All',
47 );
48
49 $this->load_classes();
50 $this->update_db();
51 }
52
53 /**
54 * Load classes
55 */
56 public function load_classes() {
57 $this->initalize_ajaxes();
58 $this->initalize_hooks();
59 $this->initalize_classes();
60 $this->initalize_processes();
61 }
62
63 /**
64 * Register hooks
65 */
66 public function initalize_hooks() {
67 foreach ( $this->hooks as $hook_class ) {
68 $hook_object = new $hook_class();
69 $hook_object->register_hooks();
70 }
71 }
72
73 /**
74 * Register Ajax hooks
75 */
76 public function initalize_ajaxes() {
77 foreach ( $this->ajaxes as $ajax_class ) {
78 $ajax_object = new $ajax_class();
79 $ajax_object->register_hooks();
80 }
81 }
82
83 /**
84 * Create an object of class
85 */
86 public function initalize_classes() {
87 foreach ( $this->classes as $class ) {
88 new $class();
89 }
90 }
91
92 /**
93 * Create an object of class
94 */
95 public function initalize_processes() {
96 foreach ( $this->processes as $process ) {
97 new $process();
98 }
99 }
100
101 /**
102 * Init Lasso Lite site id
103 */
104 public function init_site_id() {
105 if ( empty( Helper::get_option( Constant::SITE_ID_KEY ) ) ) {
106 $url_parts = wp_parse_url( home_url() );
107 $domain = $url_parts['host'];
108 $hash_site_id = md5( $domain );
109 Helper::update_option( Constant::SITE_ID_KEY, $hash_site_id );
110 }
111 }
112
113 /**
114 * Execute Update Database
115 *
116 * @return void
117 */
118 public function update_db() {
119 new Update_DB();
120 }
121 }
122