forked from wpmovielibrary/wpmovielibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwpmovielibrary.php
197 lines (167 loc) · 7.66 KB
/
wpmovielibrary.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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<?php
/**
* WordPress Movie Library Plugin
*
* WPMOLY is a WordPress Plugin designed to handle a personnal library of
* movies. Using Custom Post Type you can add new movies, manage collections,
* write reviews and share your latest-seen/favorite movies.
* WPMOLY uses TMDb to gather movies' informations.
*
* @package WPMovieLibrary
* @author Charlie MERLAND <charlie@caercam.org>
* @license GPL-3.0
* @link https://www.caercam.org/
* @copyright 2016 CaerCam.org
*
* @wordpress-plugin
* Plugin Name: WPMovieLibrary
* Plugin URI: https://wplibraries.com
* Description: A WordPress Plugin to manage a personnal library of movies.
* Version: 2.1.4.9
* Author: Charlie MERLAND
* Author URI: https://www.caercam.org/
* Text Domain: wpmovielibrary
* License: GPL-3.0
* License URI: https://www.gnu.org/licenses/gpl-3.0.txt
* Domain Path: /languages
* GitHub Plugin URI: https://github.com/wpmovielibrary/wpmovielibrary
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
define( 'WPMOLY_PLUGIN', plugin_basename( __FILE__ ) );
define( 'WPMOLY_NAME', 'WPMovieLibrary' );
define( 'WPMOLY_VERSION', '2.1.4.9' );
define( 'WPMOLY_SLUG', 'wpmoly' );
define( 'WPMOLY_URL', plugins_url( basename( __DIR__ ) ) );
define( 'WPMOLY_PATH', plugin_dir_path( __FILE__ ) );
define( 'WPMOLY_REQUIRED_PHP_VERSION', '7.4' );
define( 'WPMOLY_REQUIRED_WP_VERSION', '4.2' );
define( 'WPMOLY_DEFAULT_POSTER_URL', plugins_url( basename( __DIR__ ) ) . '/assets/img/no_poster{size}.jpg' );
define( 'WPMOLY_DEFAULT_POSTER_PATH', WPMOLY_PATH . '/assets/img/no_poster{size}.jpg' );
define( 'WPMOLY_MAX_TAXONOMY_LIST', 50 );
/**
* Checks if the system requirements are met
*
* @since 1.0.1
*
* @return bool True if system requirements are met, false if not
*/
function wpmoly_requirements_met() {
global $wp_version;
if ( version_compare( PHP_VERSION, WPMOLY_REQUIRED_PHP_VERSION, '<' ) )
return false;
if ( version_compare( $wp_version, WPMOLY_REQUIRED_WP_VERSION, '<' ) )
return false;
return true;
}
/**
* Prints an error that the system requirements weren't met.
*
* @since 1.0.1
*/
function wpmoly_requirements_error() {
global $wp_version;
require_once WPMOLY_PATH . 'views/admin/requirements-error.php';
}
/**
* Prints an error that the system requirements weren't met.
*
* @since 1.0.1
*/
function wpmoly_l10n() {
$domain = 'wpmovielibrary';
$domain_iso = 'wpmovielibrary-iso';
$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
$locale_iso = apply_filters( 'plugin_locale', get_locale(), $domain_iso );
load_textdomain( $domain, WPMOLY_PATH . $domain . '/languages/'. $domain . '-' . $locale . '.mo' );
load_textdomain( $domain_iso, WPMOLY_PATH . $domain . '/languages/'. $domain_iso . '-' . $locale . '.mo' );
load_plugin_textdomain( $domain, FALSE, basename( __DIR__ ) . '/languages/' );
load_plugin_textdomain( $domain_iso, FALSE, basename( __DIR__ ) . '/languages/' );
}
wpmoly_l10n();
/*
* Check requirements and load main class
* The main program needs to be in a separate file that only gets loaded if the
* plugin requirements are met. Otherwise older PHP installations could crash
* when trying to parse it.
*/
if ( wpmoly_requirements_met() ) {
/*----------------------------------------------------------------------------*
* Public-Facing Functionality
*----------------------------------------------------------------------------*/
// Core
require_once( WPMOLY_PATH . 'includes/functions/wpmoly-core-functions.php' );
require_once( WPMOLY_PATH . 'includes/classes/class-module.php' );
require_once( WPMOLY_PATH . 'public/class-wpmovielibrary.php' );
// Basics
require_once( WPMOLY_PATH . 'includes/classes/class-wpmoly-settings.php' );
if ( ! class_exists( 'ReduxFramework' ) )
require_once( WPMOLY_PATH . 'includes/framework/redux/ReduxCore/framework.php' );
if ( ! isset( $wpmoly_settings ) )
require_once( WPMOLY_PATH . 'includes/classes/class-wpmoly-redux.php' );
//require_once( WPMOLY_PATH . 'includes/framework/redux/sample-config.php' );
require_once( WPMOLY_PATH . 'includes/classes/class-wpmoly-cache.php' );
require_once( WPMOLY_PATH . 'includes/classes/class-wpmoly-l10n.php' );
require_once( WPMOLY_PATH . 'includes/classes/class-wpmoly-utils.php' );
// CPT and Taxo
require_once( WPMOLY_PATH . 'public/class-wpmoly-movies.php' );
require_once( WPMOLY_PATH . 'public/class-wpmoly-headbox.php' );
require_once( WPMOLY_PATH . 'public/class-wpmoly-grid.php' );
require_once( WPMOLY_PATH . 'public/class-wpmoly-search.php' );
require_once( WPMOLY_PATH . 'public/class-wpmoly-collections.php' );
require_once( WPMOLY_PATH . 'public/class-wpmoly-genres.php' );
require_once( WPMOLY_PATH . 'public/class-wpmoly-actors.php' );
require_once( WPMOLY_PATH . 'public/class-wpmoly-archives.php' );
// Self-speaking
require_once( WPMOLY_PATH . 'public/class-wpmoly-shortcodes.php' );
// Widgets
require_once( WPMOLY_PATH . 'includes/classes/class-wpmoly-widget.php' );
require_once( WPMOLY_PATH . 'includes/widgets/class-statistics-widget.php' );
require_once( WPMOLY_PATH . 'includes/widgets/class-taxonomies-widget.php' );
require_once( WPMOLY_PATH . 'includes/widgets/class-details-widget.php' );
require_once( WPMOLY_PATH . 'includes/widgets/class-movies-widget.php' );
// Legacy
require_once( WPMOLY_PATH . 'includes/classes/legacy/class-wpmoly-legacy.php' );
/*
* Register hooks that are fired when the plugin is activated or deactivated.
* When the plugin is deleted, the uninstall.php file is loaded.
*/
if ( class_exists( 'WPMovieLibrary' ) ) {
$GLOBALS['wpmoly'] = WPMovieLibrary::get_instance();
register_activation_hook( __FILE__, array( $GLOBALS['wpmoly'], 'activate' ) );
register_deactivation_hook( __FILE__, array( $GLOBALS['wpmoly'], 'deactivate' ) );
}
/*----------------------------------------------------------------------------*
* Dashboard and Administrative Functionality
*----------------------------------------------------------------------------*/
/*
* The code below is intended to to give the lightest footprint possible.
*/
if ( is_admin() ) {
require_once( WPMOLY_PATH . 'includes/classes/class-wpmoly-ajax.php' );
require_once( WPMOLY_PATH . 'admin/class-wpmoly-admin.php' );
require_once( WPMOLY_PATH . 'admin/class-dashboard.php' );
require_once( WPMOLY_PATH . 'admin/class-dashboard-stats-widget.php' );
require_once( WPMOLY_PATH . 'admin/class-dashboard-latest-movies-widget.php' );
require_once( WPMOLY_PATH . 'admin/class-dashboard-most-rated-movies-widget.php' );
require_once( WPMOLY_PATH . 'admin/class-dashboard-quickaction-widget.php' );
require_once( WPMOLY_PATH . 'admin/class-dashboard-helper-widget.php' );
require_once( WPMOLY_PATH . 'admin/class-dashboard-vendor-widget.php' );
require_once( WPMOLY_PATH . 'admin/class-wpmoly-api.php' );
require_once( WPMOLY_PATH . 'admin/class-wpmoly-api-wrapper.php' );
require_once( WPMOLY_PATH . 'admin/class-wpmoly-diagnose.php' );
require_once( WPMOLY_PATH . 'admin/class-wpmoly-metaboxes.php' );
require_once( WPMOLY_PATH . 'admin/class-wpmoly-edit-movies.php' );
require_once( WPMOLY_PATH . 'admin/class-wpmoly-media.php' );
require_once( WPMOLY_PATH . 'admin/class-wpmoly-list-table.php' );
require_once( WPMOLY_PATH . 'admin/class-wpmoly-import-table.php' );
require_once( WPMOLY_PATH . 'admin/class-wpmoly-import-queue.php' );
require_once( WPMOLY_PATH . 'admin/class-wpmoly-import.php' );
add_action( 'plugins_loaded', array( 'WPMovieLibrary_Admin', 'get_instance' ) );
}
}
else {
add_action( 'admin_notices', 'wpmoly_requirements_error' );
}