| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package PublishPress |
| 4 |
* @author PublishPress |
| 5 |
* |
| 6 |
* Copyright (c) 2025 PublishPress |
| 7 |
* |
| 8 |
* ------------------------------------------------------------------------------ |
| 9 |
* Based on Edit Flow |
| 10 |
* Author: Daniel Bachhuber, Scott Bressler, Mohammad Jangda, Automattic, and |
| 11 |
* others |
| 12 |
* Copyright (c ) 2009-2016 Mohammad Jangda, Daniel Bachhuber, et al. |
| 13 |
* ------------------------------------------------------------------------------ |
| 14 |
* |
| 15 |
* This file is part of PublishPress |
| 16 |
* |
| 17 |
* PublishPress is free software: you can redistribute it and/or modify |
| 18 |
* it under the terms of the GNU General Public License as published by |
| 19 |
* the Free Software Foundation, either version 3 of the License, or |
| 20 |
* (at your option ) any later version. |
| 21 |
* |
| 22 |
* PublishPress is distributed in the hope that it will be useful, |
| 23 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 24 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 25 |
* GNU General Public License for more details. |
| 26 |
* |
| 27 |
* You should have received a copy of the GNU General Public License |
| 28 |
* along with PublishPress. If not, see <http://www.gnu.org/licenses/>. |
| 29 |
*/ |
| 30 |
|
| 31 |
use PPVersionNotices\Module\MenuLink\Module; |
| 32 |
use PublishPress\Legacy\Auto_loader; |
| 33 |
|
| 34 |
if (! defined('PP_LOADED')) { |
| 35 |
if (! defined('PUBLISHPRESS_VERSION')) { |
| 36 |
// Define constants |
| 37 |
define('PUBLISHPRESS_VERSION', '4.8.0'); |
| 38 |
define('PUBLISHPRESS_BASE_PATH', __DIR__); |
| 39 |
define('PUBLISHPRESS_VIEWS_PATH', __DIR__ . '/views'); |
| 40 |
define('PUBLISHPRESS_FILE_PATH', PUBLISHPRESS_BASE_PATH . '/publishpress.php'); |
| 41 |
define('PUBLISHPRESS_LIBRARIES_PATH', PUBLISHPRESS_BASE_PATH . '/lib'); |
| 42 |
|
| 43 |
|
| 44 |
if (! defined('PUBLISHPRESS_INTERNAL_VENDORPATH')) { |
| 45 |
/** |
| 46 |
* @deprecated 3.12.0 Use PP_LIB_VENDOR_PATH instead. |
| 47 |
*/ |
| 48 |
define('PUBLISHPRESS_INTERNAL_VENDORPATH', PP_LIB_VENDOR_PATH); |
| 49 |
} |
| 50 |
|
| 51 |
if (! defined('PUBLISHPRESS_ACTION_PRIORITY_INIT')) { |
| 52 |
define('PUBLISHPRESS_ACTION_PRIORITY_INIT', 10); |
| 53 |
} |
| 54 |
|
| 55 |
if (! defined('PUBLISHPRESS_ACTION_PRIORITY_INIT_LATE')) { |
| 56 |
define('PUBLISHPRESS_ACTION_PRIORITY_INIT_LATE', 1100); |
| 57 |
} |
| 58 |
|
| 59 |
if (! defined('PUBLISHPRESS_ACTION_PRIORITY_INIT_ADMIN')) { |
| 60 |
define('PUBLISHPRESS_ACTION_PRIORITY_INIT_ADMIN', 1010); |
| 61 |
} |
| 62 |
|
| 63 |
$relativePath = PUBLISHPRESS_BASE_PATH; |
| 64 |
|
| 65 |
if (defined('PUBLISHPRESS_CUSTOM_VENDOR_PATH') && defined('PUBLISHPRESS_CUSTOM_VENDOR_URL')) { |
| 66 |
$relativePath = str_replace(PUBLISHPRESS_CUSTOM_VENDOR_PATH, '', $relativePath); |
| 67 |
define('PUBLISHPRESS_URL', PUBLISHPRESS_CUSTOM_VENDOR_URL . $relativePath . '/'); |
| 68 |
} else { |
| 69 |
define('PUBLISHPRESS_URL', plugins_url('/', __FILE__)); |
| 70 |
} |
| 71 |
|
| 72 |
$settingsPage = add_query_arg( |
| 73 |
[ |
| 74 |
'page' => 'pp-modules-settings', |
| 75 |
'settings_module' => 'pp-modules-settings-settings', |
| 76 |
], |
| 77 |
get_admin_url(null, 'admin.php') |
| 78 |
); |
| 79 |
define('PUBLISHPRESS_SETTINGS_PAGE', $settingsPage); |
| 80 |
|
| 81 |
/** |
| 82 |
* Use PUBLISHPRESS_BASE_PATH instead. |
| 83 |
* |
| 84 |
* @deprecated |
| 85 |
*/ |
| 86 |
define('PUBLISHPRESS_ROOT', PUBLISHPRESS_BASE_PATH); |
| 87 |
|
| 88 |
// Define the Priority for the notification/notification_status_change method |
| 89 |
// Added to allow users select a custom priority |
| 90 |
if (! defined('PP_NOTIFICATION_PRIORITY_STATUS_CHANGE')) { |
| 91 |
define('PP_NOTIFICATION_PRIORITY_STATUS_CHANGE', 10); |
| 92 |
} |
| 93 |
|
| 94 |
define('PUBLISHPRESS_NOTIF_POST_TYPE_WORKFLOW', 'psppnotif_workflow'); |
| 95 |
} |
| 96 |
|
| 97 |
// Register the legacy autoloader |
| 98 |
if (! class_exists('\\PublishPress\\Legacy\\Auto_loader')) { |
| 99 |
require_once PUBLISHPRESS_LIBRARIES_PATH . '/Legacy/Auto_loader.php'; |
| 100 |
} |
| 101 |
|
| 102 |
|
| 103 |
Auto_loader::register('PublishPress\\Core\\', __DIR__ . '/core/'); |
| 104 |
Auto_loader::register('PublishPress\\Legacy\\', __DIR__ . '/lib/Legacy'); |
| 105 |
Auto_loader::register('PublishPress\\Notifications\\', __DIR__ . '/lib/Notifications'); |
| 106 |
Auto_loader::register('PublishPress\\Utility\\', __DIR__ . '/lib/Utility'); |
| 107 |
|
| 108 |
require_once PUBLISHPRESS_BASE_PATH . '/deprecated.php'; |
| 109 |
|
| 110 |
|
| 111 |
if (! defined('PUBLISHPRESS_NOTIF_LOADED')) { |
| 112 |
define('PUBLISHPRESS_NOTIF_MODULE_PATH', __DIR__ . '/modules/improved-notifications'); |
| 113 |
define('PUBLISHPRESS_NOTIF_VIEWS_PATH', PUBLISHPRESS_BASE_PATH . '/views'); |
| 114 |
define('PUBLISHPRESS_NOTIF_LOADED', 1); |
| 115 |
} |
| 116 |
|
| 117 |
// Load the improved notifications |
| 118 |
$plugin = new PublishPress\Notifications\Plugin(); |
| 119 |
$plugin->init(); |
| 120 |
|
| 121 |
if (is_admin() && ! defined('PUBLISHPRESS_SKIP_VERSION_NOTICES')) { |
| 122 |
if (current_user_can('install_plugins')) { |
| 123 |
add_filter( |
| 124 |
\PPVersionNotices\Module\TopNotice\Module::SETTINGS_FILTER, |
| 125 |
function ($settings) { |
| 126 |
$settings['publishpress'] = [ |
| 127 |
'message' => __('You\'re using PublishPress Planner Free. The Pro version has more features and support. %sUpgrade to Pro%s', 'publishpress'), |
| 128 |
'link' => 'https://publishpress.com/links/publishpress-banner', |
| 129 |
'screens' => [ |
| 130 |
['base' => 'planner_page_pp-modules-settings'], |
| 131 |
['base' => 'planner_page_pp-manage-roles'], |
| 132 |
['base' => 'planner_page_pp-editorial-metadata'], |
| 133 |
['base' => 'planner_page_pp-editorial-comments'], |
| 134 |
['base' => 'planner_page_publishpress_debug_log'], |
| 135 |
['base' => 'admin_page_pp-notif-log'], |
| 136 |
['base' => 'edit', 'id' => 'edit-psppnotif_workflow'], |
| 137 |
['base' => 'post', 'id' => 'psppnotif_workflow'], |
| 138 |
['base' => 'planner_page_pp-content-overview'], |
| 139 |
['base' => 'planner_page_pp-content-board'], |
| 140 |
['base' => 'toplevel_page_pp-calendar', 'id' => 'toplevel_page_pp-calendar'], |
| 141 |
] |
| 142 |
]; |
| 143 |
|
| 144 |
return $settings; |
| 145 |
} |
| 146 |
); |
| 147 |
|
| 148 |
add_filter( |
| 149 |
Module::SETTINGS_FILTER, |
| 150 |
function ($settings) { |
| 151 |
$settings['publishpress'] = [ |
| 152 |
'parent' => [ |
| 153 |
'pp-calendar', |
| 154 |
'pp-content-overview', |
| 155 |
'pp-content-board', |
| 156 |
'edit.php?post_type=psppnotif_workflow', |
| 157 |
'pp-notif-log', |
| 158 |
'pp-manage-roles', |
| 159 |
'pp-modules-settings', |
| 160 |
], |
| 161 |
'label' => __('Upgrade to Pro', 'publishpress'), |
| 162 |
'link' => 'https://publishpress.com/links/publishpress-menu', |
| 163 |
]; |
| 164 |
|
| 165 |
return $settings; |
| 166 |
} |
| 167 |
); |
| 168 |
} |
| 169 |
} |
| 170 |
|
| 171 |
if (is_admin() && !defined('PUBLISHPRESS_STATUSES_VERSION')) { |
| 172 |
require_once PUBLISHPRESS_BASE_PATH . '/statuses-intro.php'; |
| 173 |
} |
| 174 |
|
| 175 |
define('PP_LOADED', 1); |
| 176 |
} |
| 177 |
|