-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathstream-manager.php
98 lines (76 loc) · 2.97 KB
/
stream-manager.php
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
<?php
/**
* Stream Manager
*
* @package StreamManager
* @author Upstatement
* @license MIT
* @link http://upstatement.com
* @copyright 2015 Upstatement
*
* @wordpress-plugin
* Plugin Name: Stream Manager
* Description: Conquerer of Streams.
* Version: 1.3.4
* Author: Upstatement
* Author URI: http://upstatement.com
* Text Domain: stream-manager
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Domain Path: /languages
* GitHub Plugin URI: https://github.com/upstatement/stream-manager
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) die;
////////////////////////////////////////////
//
// Dependencies
//
////////////////////////////////////////////
// Check if Timber is installed, and include it before any stream manager
// things are initiated. This is needed for the TimberStream class.
if ( !class_exists('Timber') ) {
// WP plugin repo version
if ( is_dir( plugin_dir_path(__DIR__).'timber-library') ) {
include_once( plugin_dir_path(__DIR__).'timber-library/timber.php' );
}
// old development copy
elseif( is_dir( plugin_dir_path(__DIR__).'timber' ) ) {
include_once( plugin_dir_path(__DIR__).'timber/timber.php' );
}
// included directly in the theme via composer
elseif ( is_dir( get_template_directory() . '/vendor/timber' ) ) {
include_once( get_template_directory() . '/vendor/autoload.php');
// initialize Timber class to run backwards compatibility methods
new Timber\Timber();
}
// Timber is nowhere to be found, throw a notice and return
else {
add_action('admin_notices', function() {
echo('<div class="error"><p>Please install <a href="http://upstatement.com/timber/">Timber</a> to use Stream Manager.</p></div>');
});
return;
}
}
////////////////////////////////////////////
//
// Public-Facing Functionality
//
////////////////////////////////////////////
require_once( plugin_dir_path( __FILE__ ) . 'includes/class-stream-manager-utilities.php' );
require_once( plugin_dir_path( __FILE__ ) . 'includes/class-stream-manager-ajax-helper.php' );
require_once( plugin_dir_path( __FILE__ ) . 'includes/class-stream-manager.php' );
require_once( plugin_dir_path( __FILE__ ) . 'includes/timber-stream.php' );
require_once( plugin_dir_path( __FILE__ ) . 'includes/class-stream-manager-manager.php');
require_once( plugin_dir_path( __FILE__ ) . 'includes/class-stream-manager-api.php');
add_action( 'plugins_loaded', array( 'StreamManager', 'get_instance' ) );
add_action( 'plugins_loaded', array( 'StreamManagerManager', 'get_instance' ) );
////////////////////////////////////////////
//
// Dashboard & Administrative Functionality
//
////////////////////////////////////////////
if ( is_admin() ) {
require_once( plugin_dir_path( __FILE__ ) . 'includes/class-stream-manager-admin.php' );
add_action( 'plugins_loaded', array( 'StreamManagerAdmin', 'get_instance' ) );
}