-
Notifications
You must be signed in to change notification settings - Fork 123
Expand file tree
/
Copy pathindex.php
More file actions
169 lines (147 loc) · 4.81 KB
/
index.php
File metadata and controls
169 lines (147 loc) · 4.81 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<?php
/**
* Plugin Name: rtMedia for WordPress, BuddyPress and bbPress
* Plugin URI: https://rtmedia.io/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
* Description: This plugin adds missing media rich features like photos, videos and audio uploading to BuddyPress which are essential if you are building social network, seriously!
* Version: 4.7.9
* Requires at least: 4.1
* Text Domain: buddypress-media
* Author: rtCamp
* Author URI: http://rtcamp.com/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
* Domain Path: /languages/
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*
* Main file, contains the plugin metadata and activation processes
*
* @package BuddyPressMedia
* @subpackage Main
*/
if ( ! defined( 'RTMEDIA_VERSION' ) ) {
/**
* The version of the plugin
*/
define( 'RTMEDIA_VERSION', '4.7.9' );
}
if ( ! defined( 'RTMEDIA_PATH' ) ) {
/**
* The server file system path to the plugin directory
*/
define( 'RTMEDIA_PATH', plugin_dir_path( __FILE__ ) );
}
if ( ! defined( 'BP_MEDIA_PATH' ) ) {
/**
* Legacy support
*/
define( 'BP_MEDIA_PATH', RTMEDIA_PATH );
}
if ( ! defined( 'RTMEDIA_URL' ) ) {
/**
* The url to the plugin directory
*/
define( 'RTMEDIA_URL', plugin_dir_url( __FILE__ ) );
}
if ( ! defined( 'RTMEDIA_BASE_NAME' ) ) {
/**
* The url to the plugin directory
*/
define( 'RTMEDIA_BASE_NAME', plugin_basename( __FILE__ ) );
}
/**
* To prevent fatal errors when calling is_plugin_active(), we first check if the
* function exists. If it doesn't, we include the file manually to ensure the
* function is available.
*/
if ( ! function_exists( 'is_plugin_active' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
if ( ! defined( 'RTMEDIA_GODAM_ACTIVE' ) ) {
/**
* Check if Godam plugin is active and set constant accordingly.
*/
define( 'RTMEDIA_GODAM_ACTIVE', is_plugin_active( 'godam/godam.php' ) );
}
/**
* Auto Loader Function
*
* Autoloads classes on instantiation. Used by spl_autoload_register.
*
* @param string $class_name The name of the class to autoload.
*/
function rtmedia_autoloader( $class_name ) {
$rtlibpath = array(
'app/services/' . $class_name . '.php',
'app/helper/' . $class_name . '.php',
'app/helper/db/' . $class_name . '.php',
'app/admin/' . $class_name . '.php',
'app/main/interactions/' . $class_name . '.php',
'app/main/routers/' . $class_name . '.php',
'app/main/routers/query/' . $class_name . '.php',
'app/main/controllers/upload/' . $class_name . '.php',
'app/main/controllers/upload/processors/' . $class_name . '.php',
'app/main/controllers/shortcodes/' . $class_name . '.php',
'app/main/controllers/template/' . $class_name . '.php',
'app/main/controllers/media/' . $class_name . '.php',
'app/main/controllers/group/' . $class_name . '.php',
'app/main/controllers/privacy/' . $class_name . '.php',
'app/main/controllers/activity/' . $class_name . '.php',
'app/main/deprecated/' . $class_name . '.php',
'app/main/contexts/' . $class_name . '.php',
'app/main/' . $class_name . '.php',
'app/main/includes/' . $class_name . '.php',
'app/main/widgets/' . $class_name . '.php',
'app/main/upload/' . $class_name . '.php',
'app/main/upload/processors/' . $class_name . '.php',
'app/main/template/' . $class_name . '.php',
'app/log/' . $class_name . '.php',
'app/importers/' . $class_name . '.php',
'app/main/controllers/api/' . $class_name . '.php',
'app/helper/rtUploadAttachment.php',
);
foreach ( $rtlibpath as $path ) {
$path = RTMEDIA_PATH . $path;
if ( file_exists( $path ) ) {
include $path;
break;
}
}
}
/**
* Register the autoloader function into spl_autoload
*/
try {
spl_autoload_register( 'rtmedia_autoloader' );
} catch ( Exception $e ) {
echo esc_html( $e->getMessage() );
}
/**
* Instantiate the BuddyPressMedia class.
*/
global $rtmedia;
$rtmedia = new RTMedia();
/**
* Check if it's VIP environment or not.
*
* @return bool
*/
function is_rtmedia_vip_plugin() {
return ( defined( 'WPCOM_IS_VIP_ENV' ) && WPCOM_IS_VIP_ENV );
}
/**
* Look Ma! Very few includes! Next File: /app/main/RTMedia.php
*/
/**
* Do stuff on plugin deactivation
*/
function rtmedia_plugin_deactivate() {
update_option( 'is_permalink_reset', 'no' );
}
register_deactivation_hook( __FILE__, 'rtmedia_plugin_deactivate' );
// Call Admin file of upload terms to provide I agree button in uploader.
require_once 'app/admin/RTMediaUploadTermsAdmin.php';
// Call file of upload terms to provide I agree button in uploader.
require_once 'app/main/RTMediaUploadTerms.php';
// Require deactivation survey installer.
require_once RTMEDIA_PATH . '/lib/deactivation-survey/deactivation-survey.php';
// Load Godam integration (custom integration hooks & assets).
require_once RTMEDIA_PATH . 'templates/media/godam-integration.php';