Repository navigation
Expand file tree
/
Copy pathorgSeries.php
More file actions
218 lines (185 loc) · 8.31 KB
/
Copy pathorgSeries.php
File metadata and controls
218 lines (185 loc) · 8.31 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
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<?php
/**
* Plugin Name: PublishPress Series Free
* Plugin URI: https://publishpress.com/publishpress-series/
* Description: PublishPress Series allows you to group content together into a series. This is ideal for magazines, newspapers, short-story writers, teachers, comic artists, or anyone who writes multiple posts on the same topic.
* Version: 3.1.5
* Author: PublishPress
* Author URI: https://publishpress.com/
* Text Domain: organize-series
* Domain Path: /languages
* Requires at least: 5.5
* Requires PHP: 8.2.0
* License: GPLv3
*
* Copyright (c) 2022 PublishPress
*
* ------------------------------------------------------------------------------
* Based on Organize Series
* Author: Darren Ethier
* Copyright (c) 2007, 2011 Darren Ethier
* ------------------------------------------------------------------------------
*
* @package publishpress-series
* @author PublishPress
* @copyright Copyright (C) 2007, 2011 Darren Ethier; modifications Copyright (C) 2022 PublishPress
* @license GNU General Public License version 2
* @link https://publishpress.com/
*/
######################################
######################################
// Publishpress Series Wordpress Plugin
//
// "PublishPress Series Plugin" is copyright (c) 2007-2021 Darren Ethier and also PublishPress LLC. This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// 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
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
//
######################################
/* Changelog
Visit @link http://wordpress.org/extend/plugins/organize-series/changelog/ for the list of all the changes in Publishpress Series.
*/
defined('ABSPATH') || exit;
global $wp_version;
$min_php_version = '8.2.0';
$min_wp_version = '5.5';
$invalid_php_version = version_compare(phpversion(), $min_php_version, '<');
$invalid_wp_version = version_compare($wp_version, $min_wp_version, '<');
if ($invalid_php_version || $invalid_wp_version) {
return;
}
// Check whether this file is the copy bundled inside Pro.
$pp_series_pro_loaded = defined('PUBLISHPRESS_SERIES_PRO_LOADED');
$pp_series_loaded_as_library = $pp_series_pro_loaded
&& defined('PP_SERIES_PRO_LIB_VENDOR_PATH')
&& 0 === strpos(
wp_normalize_path(__FILE__),
trailingslashit(wp_normalize_path(PP_SERIES_PRO_LIB_VENDOR_PATH))
);
// Only define vendor path if not already defined (Pro may have defined it)
if (! defined('PP_SERIES_LIB_VENDOR_PATH')) {
define('PP_SERIES_LIB_VENDOR_PATH', __DIR__ . '/lib/vendor');
}
// Skip instance protection if Pro already loaded it.
if (!$pp_series_pro_loaded) {
$instanceProtectionIncPath = PP_SERIES_LIB_VENDOR_PATH . '/publishpress/instance-protection/include.php';
if (is_file($instanceProtectionIncPath) && is_readable($instanceProtectionIncPath)) {
require_once $instanceProtectionIncPath;
}
if (class_exists('PublishPressInstanceProtection\\Config')) {
$pluginCheckerConfig = new PublishPressInstanceProtection\Config();
$pluginCheckerConfig->pluginSlug = 'orgSeries';
$pluginCheckerConfig->pluginFolder = 'organize-series';
$pluginCheckerConfig->pluginName = 'PublishPress Series';
$pluginChecker = new PublishPressInstanceProtection\InstanceChecker($pluginCheckerConfig);
}
$autoloadFilePath = PP_SERIES_LIB_VENDOR_PATH . '/autoload.php';
if (
! class_exists('ComposerAutoloaderInitPublishPressSeries')
&& is_file($autoloadFilePath)
&& is_readable($autoloadFilePath)
) {
require_once $autoloadFilePath;
}
}
/*
* Register the activation hook at the top level.
*
* On activation WordPress loads this file after 'plugins_loaded' has fired, so
* a hook registered inside a 'plugins_loaded' callback is never registered in
* that request. The callback loads its own dependencies for the same reason.
*/
if (!defined('PUBLISHPRESS_SERIES_PRO_LOADED')) {
register_activation_hook(__FILE__, function () {
require_once dirname(__FILE__) . '/inc/utility-functions.php';
require_once dirname(__FILE__) . '/includes-core/functions.php';
pp_series_core_activation();
});
}
add_action('plugins_loaded', function () use ($pp_series_loaded_as_library) {
$loaded_as_library = $pp_series_loaded_as_library;
if (! class_exists('PublishPress\\OrganizeSeries\\Autoloader')) {
require_once __DIR__ . '/includes-core/Autoloader.php';
}
$autoloader = new PublishPress\OrganizeSeries\Autoloader();
$autoloader->register();
require_once(dirname(__FILE__) . '/inc/utility-functions.php');
require_once(dirname(__FILE__) . '/includes-core/functions.php');
if (!defined('ORG_SERIES_VERSION')) {
define('ORG_SERIES_VERSION', '3.1.5');
define('SERIES_FILE_PATH', __FILE__);
define('SERIES_PATH_URL', plugins_url('', __FILE__) . '/');
define('SERIES_LOC', plugins_url('', __FILE__) . '/'); //the uri of the orgSeries files.
define('SERIES_PATH', plugin_dir_path(__FILE__)); //the path of the orgSeries file
//note 'SERIES_QUERY_VAR' is now defined in orgSeries class.
define('SERIES_TOC_QUERYVAR', 'series-toc'); //get/post variable name for querying series-toc from WP
define('SERIES_SEARCHURL', 'search'); //local search URL (from mod_rewrite_rules)
define('SERIES_PART_KEY', '_series_part'); //the default key for the Custom Field that distinguishes what part a post is in the series it belongs to. The underscore makes this hidden on edit post/page screens.
define('SPOST_SHORTTITLE_KEY', '_spost_short_title');
define('SERIES_REWRITERULES', '1'); //flag to determine if plugin can change WP rewrite rules.
define('PUBLISHPRESS_SERIES_ABSPATH', __DIR__);
define('SERIES_DIR', orgSeries_dir()); //the name of the directory that orgSeries files are located.
}
// Skip Pro detection if loaded as library (we ARE the Pro)
$pro_active = $loaded_as_library;
if (!$loaded_as_library) {
foreach ((array)get_option('active_plugins') as $plugin_file) {
if (false !== strpos($plugin_file, 'publishpress-series-pro.php')) {
$pro_active = true;
break;
}
}
if (!$pro_active && is_multisite()) {
foreach (array_keys((array)get_site_option('active_sitewide_plugins')) as $plugin_file) {
if (false !== strpos($plugin_file, 'publishpress-series-pro.php')) {
$pro_active = true;
break;
}
}
}
}
if ($pro_active) {
add_filter(
'plugin_row_meta',
function ($links, $file) {
if ($file == plugin_basename(__FILE__)) {
$links[] = __('<strong>This plugin can be deleted.</strong>', 'organize-series');
}
return $links;
},
10,
2
);
}
// If Pro is active as separate plugin, don't initialize Free
if ($pro_active && !$loaded_as_library) {
// The external Free plugin still provides the shared Gutenberg blocks.
$blocks_path = __DIR__ . '/includes-core/blocks.php';
if (is_file($blocks_path)) {
require_once $blocks_path;
}
return;
}
// Don't re-initialize if already done
if (defined('PPSERIES_FILE')) {
return;
}
define('PPSERIES_FILE', __FILE__);
define('PPSERIES_PATH', plugin_dir_path(__FILE__));
define('PPSERIES_URL', plugin_dir_url(__FILE__));
define('PPSERIES_BASE_NAME', plugin_basename(__FILE__));
//new bootstrapping, eventually this will replace all of the above.
require PPSERIES_PATH . 'bootstrap.php';
pp_series_free_version_init();
do_action('publishpress_series_after_init');
}, -10);