PluginProbe
Lasso Lite – Affiliate Link Manager & Product Displays / 113
Lasso Lite – Affiliate Link Manager & Product Displays v113
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 113, at classes/class-init.php

121 lines 2.1 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 );
38
39 $this->classes = array(
40 '\LassoLite\Classes\Cron',
41 );
42
43 $this->processes = array(
44 '\LassoLite\Classes\Processes\Import_All',
45 '\LassoLite\Classes\Processes\Revert_All',
46 );
47
48 $this->load_classes();
49 $this->update_db();
50 }
51
52 /**
53 * Load classes
54 */
55 public function load_classes() {
56 $this->initalize_ajaxes();
57 $this->initalize_hooks();
58 $this->initalize_classes();
59 $this->initalize_processes();
60 }
61
62 /**
63 * Register hooks
64 */
65 public function initalize_hooks() {
66 foreach ( $this->hooks as $hook_class ) {
67 $hook_object = new $hook_class();
68 $hook_object->register_hooks();
69 }
70 }
71
72 /**
73 * Register Ajax hooks
74 */
75 public function initalize_ajaxes() {
76 foreach ( $this->ajaxes as $ajax_class ) {
77 $ajax_object = new $ajax_class();
78 $ajax_object->register_hooks();
79 }
80 }
81
82 /**
83 * Create an object of class
84 */
85 public function initalize_classes() {
86 foreach ( $this->classes as $class ) {
87 new $class();
88 }
89 }
90
91 /**
92 * Create an object of class
93 */
94 public function initalize_processes() {
95 foreach ( $this->processes as $process ) {
96 new $process();
97 }
98 }
99
100 /**
101 * Init Lasso Lite site id
102 */
103 public function init_site_id() {
104 if ( empty( Helper::get_option( Constant::SITE_ID_KEY ) ) ) {
105 $url_parts = wp_parse_url( home_url() );
106 $domain = $url_parts['host'];
107 $hash_site_id = md5( $domain );
108 Helper::update_option( Constant::SITE_ID_KEY, $hash_site_id );
109 }
110 }
111
112 /**
113 * Execute Update Database
114 *
115 * @return void
116 */
117 public function update_db() {
118 new Update_DB();
119 }
120 }
121