forked from mintplugins/mp-stacks-video-backgrounds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mp-stacks-video-backgrounds.php
executable file
·170 lines (138 loc) · 5.78 KB
/
mp-stacks-video-backgrounds.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
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
170
<?php
/*
Plugin Name: MP Stacks + Video Backgrounds
Plugin URI: http://mintplugins.com/plugins/mp-stacks-video-backgrounds
Description: Add aBackground Video to any Brick in MP Stacks.
Version: 1.0.0.4
Author: Mint Plugins
Author URI: http://mintplugins.com
Text Domain: mp_stacks_video_backgrounds
Domain Path: languages
License: GPL2
*/
/* Copyright 2015 Phil Johnston (email : phil@mintplugins.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Mint Plugins Core.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Mint Plugins Core, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
|--------------------------------------------------------------------------
| CONSTANTS
|--------------------------------------------------------------------------
*/
// Plugin version
if( !defined( 'MP_STACKS_VIDEO_BACKGROUNDS_VERSION' ) )
define( 'MP_STACKS_VIDEO_BACKGROUNDS_VERSION', '1.0.0.4' );
// Plugin Folder URL
if( !defined( 'MP_STACKS_VIDEO_BACKGROUNDS_PLUGIN_URL' ) )
define( 'MP_STACKS_VIDEO_BACKGROUNDS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
// Plugin Folder Path
if( !defined( 'MP_STACKS_VIDEO_BACKGROUNDS_PLUGIN_DIR' ) )
define( 'MP_STACKS_VIDEO_BACKGROUNDS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
// Plugin Root File
if( !defined( 'MP_STACKS_VIDEO_BACKGROUNDS_PLUGIN_FILE' ) )
define( 'MP_STACKS_VIDEO_BACKGROUNDS_PLUGIN_FILE', __FILE__ );
/*
|--------------------------------------------------------------------------
| GLOBALS
|--------------------------------------------------------------------------
*/
/*
|--------------------------------------------------------------------------
| INTERNATIONALIZATION
|--------------------------------------------------------------------------
*/
function mp_stacks_video_backgrounds_textdomain() {
// Set filter for plugin's languages directory
$mp_stacks_video_backgrounds_lang_dir = dirname( plugin_basename( MP_STACKS_VIDEO_BACKGROUNDS_PLUGIN_FILE ) ) . '/languages/';
$mp_stacks_video_backgrounds_lang_dir = apply_filters( 'mp_stacks_video_backgrounds_languages_directory', $mp_stacks_video_backgrounds_lang_dir );
// Traditional WordPress plugin locale filter
$locale = apply_filters( 'plugin_locale', get_locale(), 'mp-stacks-video-backgrounds' );
$mofile = sprintf( '%1$s-%2$s.mo', 'mp-stacks-video-backgrounds', $locale );
// Setup paths to current locale file
$mofile_local = $mp_stacks_video_backgrounds_lang_dir . $mofile;
$mofile_global = WP_LANG_DIR . '/mp-stacks-video-backgrounds/' . $mofile;
if ( file_exists( $mofile_global ) ) {
// Look in global /wp-content/languages/mp_stacks_video_backgrounds folder
load_textdomain( 'mp_stacks_video_backgrounds', $mofile_global );
} elseif ( file_exists( $mofile_local ) ) {
// Look in local /wp-content/plugins/message_bar/languages/ folder
load_textdomain( 'mp_stacks_video_backgrounds', $mofile_local );
} else {
// Load the default language files
load_plugin_textdomain( 'mp_stacks_video_backgrounds', false, $mp_stacks_video_backgrounds_lang_dir );
}
}
add_action( 'init', 'mp_stacks_video_backgrounds_textdomain', 1 );
/*
|--------------------------------------------------------------------------
| INCLUDES
|--------------------------------------------------------------------------
*/
function mp_stacks_video_backgrounds_include_files(){
/**
* If mp_core isn't active, stop and install it now
*/
if (!function_exists('mp_core_textdomain')){
/**
* Include Plugin Checker
*/
require( MP_STACKS_VIDEO_BACKGROUNDS_PLUGIN_DIR . '/includes/plugin-checker/class-plugin-checker.php' );
/**
* Include Plugin Installer
*/
require( MP_STACKS_VIDEO_BACKGROUNDS_PLUGIN_DIR . '/includes/plugin-checker/class-plugin-installer.php' );
/**
* Check if wp_core in installed
*/
include_once( MP_STACKS_VIDEO_BACKGROUNDS_PLUGIN_DIR . 'includes/plugin-checker/included-plugins/mp-core-check.php' );
}
/**
* If mp_core is active but mp_stacks isn't, stop and install it now
*/
elseif(!function_exists('mp_stacks_textdomain')){
/**
* Check if wp_html_in_post in installed
*/
include_once( MP_STACKS_VIDEO_BACKGROUNDS_PLUGIN_DIR . 'includes/plugin-checker/included-plugins/mp-stacks.php' );
}
/**
* Otherwise, if mp_core and mp_stacks are installed, carry out the plugin's functions
*/
else{
/**
* Update script - keeps this plugin up to date
*/
require( MP_STACKS_VIDEO_BACKGROUNDS_PLUGIN_DIR . 'includes/updater/mp-stacks-video-backgrounds-update.php' );
/**
* Enqueue Scripts
*/
require( MP_STACKS_VIDEO_BACKGROUNDS_PLUGIN_DIR . 'includes/misc-functions/admin-enqueue-scripts.php' );
/**
* Hook callback for video background
*/
require( MP_STACKS_VIDEO_BACKGROUNDS_PLUGIN_DIR . 'includes/misc-functions/mp-stacks-hooks.php' );
/**
* Video Backgrounds Metabox
*/
require( MP_STACKS_VIDEO_BACKGROUNDS_PLUGIN_DIR . 'includes/metaboxes/video-backgrounds/video-backgrounds.php' );
/**
* Add this add on to the list of Active MP Stacks Add Ons
*/
if ( function_exists('mp_stacks_developer_textdomain') ){
function mp_stacks_video_backgrounds_add_active( $required_add_ons ){
$required_add_ons['mp_stacks_video_backgrounds'] = 'MP Stacks + Video Backgrounds';
return $required_add_ons;
}
add_filter( 'mp_stacks_active_add_ons', 'mp_stacks_video_backgrounds_add_active' );
}
}
}
add_action('plugins_loaded', 'mp_stacks_video_backgrounds_include_files', 9);