-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjoinus.php
More file actions
106 lines (78 loc) · 2.58 KB
/
joinus.php
File metadata and controls
106 lines (78 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
/*
Plugin Name: Join Us
Plugin URI: https://joinus.fruitfulcode.com/
Description: A plugin that creates a gallery of users joined using social networks: Facebook in a free version and LinkedIn, Google, Instagram in a Pro version.
Version: 1.0
Author: fruitfulcode
Author URI: http://fruitfulcode.com
License: GPL
*/
if ( !class_exists( 'ff_joinus')) {
class ff_joinus {
public $view;
public $controller;
public $plugin_path;
public $plugin_url;
public $cache_time;
/**
Constructor
**/
public function __construct() {
$this->plugin_path = plugin_dir_path( __FILE__ );
$this->plugin_url = plugin_dir_url( __FILE__ );
$this->cache_time = '110320170225';
}
/**
Run the core
**/
public function run() {
// internationalization
load_plugin_textdomain( 'joinus', false, $this->plugin_path . '/languages' );
// load core classes
$this->_dispatch();
}
/**
* Load and instantiate all application
* classes neccessary for this plugin
**/
private function _dispatch() {
$this->view = new stdClass();
$this->controller = new stdClass();
// Manually instantiate dependency classes first, noticed loading problems on some hosts with autoload
// View
require_once $this->plugin_path . '/core/view/view.php';
$this->view = new ff_joinus_core_view();
// Controller
$this->controller->base = $this;
if( is_admin() ) {
require_once $this->plugin_path . '/core/controller/backend-controller.php';
$this->controller->backend = new ff_joinus_core_controller_backend();
// Fruitful statistics
require $this->plugin_path . '/fruitful-stats/send-statistics.php';
$ffc_stat = new ffc_joinus_stats();
} else {
require_once $this->plugin_path . '/core/controller/front-controller.php';
$this->controller->front = new ff_joinus_core_controller_front();
require_once $this->plugin_path . '/core/controller/front-oauth-controller.php';
$this->controller->front_oauth = new ff_joinus_core_controller_front_oauth();
}
// Inject models, view and controllers from this base controller into all OTHER controllers & models
foreach ( $this->controller as $controller ) {
$controller->_inject_application_classes( $this->view, $this->controller );
}
}
/**
* Inject models, view and controllers
* into all other controllers to make
* them callable from there
**/
private function _inject_application_classes( $view, $controller ) {
$this->view = $view;
$this->controller = $controller;
}
}
global $ff_joinus;
$ff_joinus = new ff_joinus;
$ff_joinus->run();
}