Changeset 1843718
- Timestamp:
- 03/20/2018 06:50:51 PM (8 years ago)
- Location:
- publishpress/trunk
- Files:
-
- 116 added
- 13 deleted
- 34 edited
-
common/css/pressshack-admin.css (modified) (1 diff)
-
common/libs (added)
-
common/libs/chosen (added)
-
common/libs/chosen/bower.json (added)
-
common/libs/chosen/chosen-sprite.png (added)
-
common/libs/chosen/[email protected] (added)
-
common/libs/chosen/chosen.css (added)
-
common/libs/chosen/chosen.jquery.js (added)
-
common/libs/chosen/chosen.jquery.min.js (added)
-
common/libs/chosen/chosen.min.css (added)
-
common/libs/chosen/chosen.proto.js (added)
-
common/libs/chosen/chosen.proto.min.js (added)
-
common/libs/chosen/docsupport (added)
-
common/libs/chosen/docsupport/chosen.png (added)
-
common/libs/chosen/docsupport/init.js (added)
-
common/libs/chosen/docsupport/init.proto.js (added)
-
common/libs/chosen/docsupport/jquery-1.12.4.min.js (added)
-
common/libs/chosen/docsupport/jquery-3.2.1.min.js (added)
-
common/libs/chosen/docsupport/oss-credit.png (added)
-
common/libs/chosen/docsupport/prism.css (added)
-
common/libs/chosen/docsupport/prism.js (added)
-
common/libs/chosen/docsupport/prototype-1.7.0.0.js (added)
-
common/libs/chosen/docsupport/style.css (added)
-
common/libs/chosen/index.html (added)
-
common/libs/chosen/index.proto.html (added)
-
common/libs/chosen/options.html (added)
-
common/libs/chosen/package.json (added)
-
common/php/class-module.php (modified) (5 diffs)
-
composer.json (deleted)
-
composer.lock (deleted)
-
core (added)
-
core/Modules (added)
-
core/Modules/AbstractModule.php (added)
-
core/Modules/ModuleInterface.php (added)
-
deprecated.php (added)
-
includes.php (modified) (2 diffs)
-
includes_notifications.php (modified) (1 diff)
-
libraries/Auto_loader.php (deleted)
-
libraries/Legacy (added)
-
libraries/Legacy/Auto_loader.php (added)
-
libraries/Legacy/Util.php (added)
-
libraries/Notifications/Workflow/Controller.php (modified) (1 diff)
-
libraries/Notifications/Workflow/Step/Channel/Email.php (modified) (1 diff)
-
libraries/Notifications/Workflow/Step/Event/Filter/Base.php (modified) (1 diff)
-
libraries/Notifications/Workflow/Step/Event/Filter/Post_Status.php (modified) (1 diff)
-
libraries/Notifications/Workflow/Step/Receiver/Follower.php (modified) (4 diffs)
-
libraries/Notifications/Workflow/Step/Receiver/Role.php (added)
-
libraries/Notifications/Workflow/Step/Receiver/User.php (modified) (2 diffs)
-
libraries/Notifications/Workflow/Step/Receiver/User_Group.php (deleted)
-
libraries/Util.php (deleted)
-
modules/addons/addons.php (modified) (1 diff)
-
modules/async-notifications/async-notifications.php (modified) (3 diffs)
-
modules/async-notifications/library/Queue/WPCron.php (modified) (2 diffs)
-
modules/calendar/calendar.php (modified) (1 diff)
-
modules/calendar/lib/calendar.css (modified) (1 diff)
-
modules/content-overview/content-overview.php (modified) (1 diff)
-
modules/custom-status/custom-status.php (modified) (3 diffs)
-
modules/dashboard/dashboard.php (modified) (1 diff)
-
modules/improved-notifications/assets/css/admin.css (modified) (4 diffs)
-
modules/improved-notifications/assets/js/workflow_form.js (modified) (2 diffs)
-
modules/improved-notifications/improved-notifications.php (modified) (6 diffs)
-
modules/improved-notifications/libs/opentip (added)
-
modules/improved-notifications/libs/opentip/.travis.yml (added)
-
modules/improved-notifications/libs/opentip/CONTRIBUTING.md (added)
-
modules/improved-notifications/libs/opentip/Gruntfile.coffee (added)
-
modules/improved-notifications/libs/opentip/Makefile (added)
-
modules/improved-notifications/libs/opentip/README.md (added)
-
modules/improved-notifications/libs/opentip/bower.json (added)
-
modules/improved-notifications/libs/opentip/component.json (added)
-
modules/improved-notifications/libs/opentip/css (added)
-
modules/improved-notifications/libs/opentip/css/opentip.css (added)
-
modules/improved-notifications/libs/opentip/css/stylus (added)
-
modules/improved-notifications/libs/opentip/css/stylus/opentip.styl (added)
-
modules/improved-notifications/libs/opentip/docs (added)
-
modules/improved-notifications/libs/opentip/docs/adapter.ender.html (added)
-
modules/improved-notifications/libs/opentip/docs/adapter.jquery.html (added)
-
modules/improved-notifications/libs/opentip/docs/adapter.native.html (added)
-
modules/improved-notifications/libs/opentip/docs/adapter.prototype.html (added)
-
modules/improved-notifications/libs/opentip/docs/docco.css (added)
-
modules/improved-notifications/libs/opentip/docs/opentip.html (added)
-
modules/improved-notifications/libs/opentip/downloads (added)
-
modules/improved-notifications/libs/opentip/downloads/opentip-jquery-excanvas.js (added)
-
modules/improved-notifications/libs/opentip/downloads/opentip-jquery-excanvas.min.js (added)
-
modules/improved-notifications/libs/opentip/downloads/opentip-jquery.js (added)
-
modules/improved-notifications/libs/opentip/downloads/opentip-jquery.min.js (added)
-
modules/improved-notifications/libs/opentip/downloads/opentip-native-excanvas.js (added)
-
modules/improved-notifications/libs/opentip/downloads/opentip-native-excanvas.min.js (added)
-
modules/improved-notifications/libs/opentip/downloads/opentip-native.js (added)
-
modules/improved-notifications/libs/opentip/downloads/opentip-native.min.js (added)
-
modules/improved-notifications/libs/opentip/downloads/opentip-prototype-excanvas.js (added)
-
modules/improved-notifications/libs/opentip/downloads/opentip-prototype-excanvas.min.js (added)
-
modules/improved-notifications/libs/opentip/downloads/opentip-prototype.js (added)
-
modules/improved-notifications/libs/opentip/downloads/opentip-prototype.min.js (added)
-
modules/improved-notifications/libs/opentip/downloads/readme.md (added)
-
modules/improved-notifications/libs/opentip/files (added)
-
modules/improved-notifications/libs/opentip/files/close-button-angle.png (added)
-
modules/improved-notifications/libs/opentip/files/explanations.psd (added)
-
modules/improved-notifications/libs/opentip/files/tests.png (added)
-
modules/improved-notifications/libs/opentip/index.js (added)
-
modules/improved-notifications/libs/opentip/lib (added)
-
modules/improved-notifications/libs/opentip/lib/adapter-component.js (added)
-
modules/improved-notifications/libs/opentip/lib/adapter-ender.js (added)
-
modules/improved-notifications/libs/opentip/lib/adapter-jquery.js (added)
-
modules/improved-notifications/libs/opentip/lib/adapter-native.js (added)
-
modules/improved-notifications/libs/opentip/lib/adapter-prototype.js (added)
-
modules/improved-notifications/libs/opentip/lib/opentip.js (added)
-
modules/improved-notifications/libs/opentip/package.json (added)
-
modules/improved-notifications/libs/opentip/src (added)
-
modules/improved-notifications/libs/opentip/src/adapter-component.coffee (added)
-
modules/improved-notifications/libs/opentip/src/adapter-ender.coffee (added)
-
modules/improved-notifications/libs/opentip/src/adapter-jquery.coffee (added)
-
modules/improved-notifications/libs/opentip/src/adapter-native.coffee (added)
-
modules/improved-notifications/libs/opentip/src/adapter-prototype.coffee (added)
-
modules/improved-notifications/libs/opentip/src/opentip.coffee (added)
-
modules/improved-notifications/libs/opentip/test (added)
-
modules/improved-notifications/libs/opentip/test/ender.js (added)
-
modules/improved-notifications/libs/opentip/test/readme.md (added)
-
modules/improved-notifications/libs/opentip/test/src (added)
-
modules/improved-notifications/libs/opentip/test/src/010-opentip.coffee (added)
-
modules/improved-notifications/libs/opentip/test/src/020-opentip-startup.coffee (added)
-
modules/improved-notifications/libs/opentip/test/src/030-opentip-show.coffee (added)
-
modules/improved-notifications/libs/opentip/test/src/040-opentip-positioning.coffee (added)
-
modules/improved-notifications/libs/opentip/test/src/050-opentip-draw.coffee (added)
-
modules/improved-notifications/libs/opentip/test/src/060-opentip-ajax.coffee (added)
-
modules/improved-notifications/libs/opentip/test/src/100-utils.coffee (added)
-
modules/improved-notifications/libs/opentip/test/src/110-joint.coffee (added)
-
modules/improved-notifications/libs/opentip/test/src/200-adapters.coffee (added)
-
modules/improved-notifications/libs/opentip/test/src/210-adapter-native.coffee (added)
-
modules/improved-notifications/libs/opentip/test/src/220-adapter-ender.coffee (added)
-
modules/improved-notifications/libs/opentip/test/test.html (added)
-
modules/improved-notifications/libs/opentip/test/test.js (added)
-
modules/improved-notifications/libs/opentip/test/vendor (added)
-
modules/improved-notifications/libs/opentip/test/vendor/jquery-1.9.1.js (added)
-
modules/improved-notifications/libs/opentip/test/vendor/prototype-1.7.1.js (added)
-
modules/improved-notifications/libs/opentip/test/vendor/sinon-1.6.0.js (added)
-
modules/notifications/assets/notifications.css (modified) (4 diffs)
-
modules/notifications/assets/notifications.js (modified) (1 diff)
-
modules/roles/assets/css/profile.css (added)
-
modules/roles/assets/js (added)
-
modules/roles/assets/js/admin.js (added)
-
modules/roles/assets/js/profile.js (added)
-
modules/roles/lib/list_table.php (modified) (1 diff)
-
modules/roles/roles.php (modified) (9 diffs)
-
modules/roles/twig/roles-list-table-column-name.twig.html (added)
-
modules/roles/twig/roles-list-table-column-users.twig.html (added)
-
modules/roles/twig/settings-tab-roles.twig.html (modified) (1 diff)
-
modules/settings/settings.php (modified) (2 diffs)
-
modules/user-groups/lib/user-groups.css (modified) (4 diffs)
-
package.json (deleted)
-
publishpress.php (modified) (6 diffs)
-
readme.txt (modified) (2 diffs)
-
twig/workflow_help.twig (modified) (1 diff)
-
twig/workflow_metabox.twig (modified) (1 diff)
-
twig/workflow_receiver_role_field.twig (added)
-
twig/workflow_receiver_user_field.twig (modified) (1 diff)
-
twig/workflow_receiver_user_group_field.twig (deleted)
-
vendor/composer/installed.json (modified) (2 diffs)
-
vendor/pimple/pimple/.gitignore (deleted)
-
vendor/pimple/pimple/ext/pimple/.gitignore (deleted)
-
vendor/psr/container/.gitignore (deleted)
-
vendor/publishpress/wordpress-plugin-builder (deleted)
-
vendor/twig/twig/.gitignore (deleted)
-
vendor/twig/twig/ext/twig/.gitignore (deleted)
Legend:
- Unmodified
- Added
- Removed
-
publishpress/trunk/common/css/pressshack-admin.css
r1839780 r1843718 79 79 } 80 80 81 .pressshack-admin-wrapper > header h1{81 .pressshack-admin-wrapper > header .pressshack-title { 82 82 margin: .67em 0 15px .15em; 83 83 font-weight: 600; -
publishpress/trunk/common/php/class-module.php
r1839780 r1843718 161 161 public function get_post_types_for_module($module) 162 162 { 163 return PublishPress\ Util::get_post_types_for_module($module);163 return PublishPress\Legacy\Util::get_post_types_for_module($module); 164 164 } 165 165 … … 335 335 public function get_current_post_type() 336 336 { 337 return PublishPress\ Util::get_current_post_type();337 return PublishPress\Legacy\Util::get_current_post_type(); 338 338 } 339 339 … … 624 624 public function users_select_form($selected = null, $args = null) 625 625 { 626 global $publishpress; 626 627 627 628 // Set up arguments … … 649 650 $selected = array(); 650 651 } 652 653 $roles = get_editable_roles(); 651 654 ?> 652 655 653 656 <?php if (!empty($users)) : ?> 654 <ul class="<?php echo esc_attr($list_class) ?>"> 655 <?php foreach ($users as $user) : ?> 656 <?php $checked = (in_array($user->ID, $selected)) ? 'checked="checked"' : ''; 657 ?> 658 <li> 659 <label for="<?php echo esc_attr($input_id . '-' . $user->ID) ?>"> 660 <input type="checkbox" id="<?php echo esc_attr($input_id . '-' . $user->ID) ?>" 661 name="<?php echo esc_attr($input_id) ?>[]" value="<?php echo esc_attr($user->ID); 662 ?>" <?php echo $checked; 663 ?> /> 664 <span class="pp-user_displayname"><?php echo esc_html($user->display_name); 665 ?></span> 666 <span class="pp-user_useremail"><?php echo esc_html($user->user_email); 667 ?></span> 668 </label> 669 </li> 670 <?php endforeach; 671 ?> 672 </ul> 673 <?php endif; 674 ?> 657 <select class="chosen-select" name="to_notify[]" multiple> 658 <?php if (!empty($roles)) : ?> 659 <optgroup label="<?php echo __('Roles', 'publishpress'); ?>"> 660 <?php foreach ($roles as $role => $data) : ?> 661 <?php $attrSelected = (in_array($role, $selected)) ? 'selected="selected"' : ''; ?> 662 <option value="<?php echo $role; ?>" <?php echo $attrSelected; ?>><?php echo __('Role', 'publishpress'); ?>: <?php echo $data['name']; ?></option> 663 <?php endforeach; ?> 664 </optgroup> 665 <?php endif; ?> 666 <optgroup label="<?php echo __('Users', 'publishpress'); ?>"> 667 <?php foreach ($users as $user) : ?> 668 <?php $attrSelected = (in_array($user->ID, $selected)) ? 'selected="selected"' : ''; ?> 669 <option value="<?php echo $user->ID; ?>" <?php echo $attrSelected; ?>><?php echo $user->display_name; ?></option> 670 <?php endforeach; ?> 671 </optgroup> 672 </select> 673 <?php endif; ?> 675 674 <?php 676 677 675 } 678 676 … … 686 684 { 687 685 688 PublishPress\ Util::add_caps_to_role($role, $caps);686 PublishPress\Legacy\Util::add_caps_to_role($role, $caps); 689 687 } 690 688 -
publishpress/trunk/includes.php
r1843103 r1843718 29 29 */ 30 30 31 use PublishPress\ Auto_loader;31 use PublishPress\Legacy\Auto_loader; 32 32 33 if (!defined('PP_LOADED')) 34 { 33 if (!defined('PP_LOADED')) { 35 34 $settingsPage = add_query_arg( 36 35 array( … … 42 41 43 42 // Define contants 44 define('PUBLISHPRESS_VERSION', '1.11. 2');45 define('PUBLISHPRESS_ ROOT', dirname(__FILE__));46 define('PUBLISHPRESS_FILE_PATH', PUBLISHPRESS_ ROOT. '/' . basename(__FILE__));43 define('PUBLISHPRESS_VERSION', '1.11.3'); 44 define('PUBLISHPRESS_BASE_PATH', __DIR__); 45 define('PUBLISHPRESS_FILE_PATH', PUBLISHPRESS_BASE_PATH . '/' . basename(__FILE__)); 47 46 define('PUBLISHPRESS_URL', plugins_url('/', __FILE__)); 48 47 define('PUBLISHPRESS_SETTINGS_PAGE', $settingsPage); 49 define('PUBLISHPRESS_LIBRARIES_PATH', PUBLISHPRESS_ROOT . '/libraries'); 48 define('PUBLISHPRESS_LIBRARIES_PATH', PUBLISHPRESS_BASE_PATH . '/libraries'); 49 50 /** 51 * Use PUBLISHPRESS_BASE_PATH instead. 52 * 53 * @deprecated 54 */ 55 define('PUBLISHPRESS_ROOT', PUBLISHPRESS_BASE_PATH); 50 56 51 57 // Define the Priority for the notification/notification_status_change method 52 58 // Added to allow users select a custom priority 53 if (!defined('PP_NOTIFICATION_PRIORITY_STATUS_CHANGE')) 54 { 59 if (!defined('PP_NOTIFICATION_PRIORITY_STATUS_CHANGE')) { 55 60 define('PP_NOTIFICATION_PRIORITY_STATUS_CHANGE', 10); 56 61 } 57 62 58 require_once PUBLISHPRESS_ROOT . '/vendor/autoload.php'; 63 if (file_exists(PUBLISHPRESS_BASE_PATH . '/vendor/autoload.php')) { 64 require_once PUBLISHPRESS_BASE_PATH . '/vendor/autoload.php'; 65 } 59 66 60 67 // Register the autoloader 61 if (!class_exists('\\PublishPress\\Auto_loader')) 62 { 63 require_once PUBLISHPRESS_LIBRARIES_PATH . '/Auto_loader.php'; 68 if (!class_exists('\\PublishPress\\Legacy\\Auto_loader')) { 69 require_once PUBLISHPRESS_LIBRARIES_PATH . '/Legacy/Auto_loader.php'; 64 70 } 65 71 66 72 // Register the library 67 Auto_loader::register('\\PublishPress\\', PUBLISHPRESS_LIBRARIES_PATH); 73 Auto_loader::register('\\PublishPress\\Legacy\\', PUBLISHPRESS_LIBRARIES_PATH . '/Legacy'); 74 Auto_loader::register('\\PublishPress\\Notifications\\', PUBLISHPRESS_LIBRARIES_PATH . '/Notifications'); 75 76 require_once PUBLISHPRESS_BASE_PATH . '/deprecated.php'; 68 77 69 78 define('PP_LOADED', 1); -
publishpress/trunk/includes_notifications.php
r1839780 r1843718 10 10 */ 11 11 12 use PublishPress\Notifications\Auto_loader;13 14 12 defined('ABSPATH') or die('No direct script access allowed.'); 15 16 require_once 'vendor/autoload.php';17 13 18 14 if (!defined('PUBLISHPRESS_NOTIF_LOADED')) 19 15 { 20 16 define('PUBLISHPRESS_NOTIF_MODULE_PATH', __DIR__ . '/modules/improved-notifications'); 21 define('PUBLISHPRESS_NOTIF_TWIG_PATH', PUBLISHPRESS_ ROOT. '/twig');17 define('PUBLISHPRESS_NOTIF_TWIG_PATH', PUBLISHPRESS_BASE_PATH . '/twig'); 22 18 define('PUBLISHPRESS_NOTIF_LOADED', 1); 23 19 -
publishpress/trunk/libraries/Notifications/Workflow/Controller.php
r1839780 r1843718 139 139 '\\PublishPress\\Notifications\\Workflow\\Step\\Receiver\\Author', 140 140 '\\PublishPress\\Notifications\\Workflow\\Step\\Receiver\\User', 141 '\\PublishPress\\Notifications\\Workflow\\Step\\Receiver\\ User_Group',141 '\\PublishPress\\Notifications\\Workflow\\Step\\Receiver\\Role', 142 142 '\\PublishPress\\Notifications\\Workflow\\Step\\Receiver\\Follower', 143 143 ]; -
publishpress/trunk/libraries/Notifications/Workflow/Step/Channel/Email.php
r1839780 r1843718 46 46 if (empty($receivers)) { 47 47 return; 48 } 49 50 // Make sure we unserialize the content when it comes from async notifications. 51 if (is_string($content)) { 52 $content = maybe_unserialize($content); 48 53 } 49 54 -
publishpress/trunk/libraries/Notifications/Workflow/Step/Event/Filter/Base.php
r1839780 r1843718 41 41 * 42 42 * @return string 43 * 44 * @throws \Exception 43 45 */ 44 46 public function render() -
publishpress/trunk/libraries/Notifications/Workflow/Step/Event/Filter/Post_Status.php
r1839780 r1843718 50 50 { 51 51 $statuses = $this->get_post_statuses(); 52 $metadata = (array)$this->get_metadata(''); 52 53 $options = []; 53 $metadata = (array)$this->get_metadata(''); 54 55 if ('from' === $group) { 56 // Add an status to represent new posts 57 $options = [ 58 [ 59 'value' => 'auto-draft', 60 'label' => __('"New"', 'publishpress'), 61 'selected' => in_array('auto-draft', $metadata[$group]), 62 ], 63 ]; 64 } 54 65 55 66 foreach ($statuses as $status) -
publishpress/trunk/libraries/Notifications/Workflow/Step/Receiver/Follower.php
r1839780 r1843718 46 46 if ($this->is_selected($workflow->ID)) 47 47 { 48 49 48 $post_id = $args['post']->ID; 50 49 … … 56 55 $followers = array(); 57 56 58 if ($publishpress->improved_notifications->module_enabled('user_groups'))59 {60 // Get following users and usergroups61 $usergroups = $publishpress->notifications->get_following_usergroups($post_id, 'ids');62 57 63 foreach ((array)$usergroups as $usergroup_id) 58 // Check if we just created the post and the metadata is not saved yet. 59 if ('POST' === $_SERVER['REQUEST_METHOD'] 60 && (isset($_POST['action']) && 'editpost' === $_POST['action']) 61 && (isset($_POST['original_post_status']) && 'auto-draft' === $_POST['original_post_status']) 62 ) { 63 $toNotify = $_POST['to_notify']; 64 65 $roles = array(); 66 $users = array(); 67 68 foreach ($toNotify as $item) { 69 if (is_numeric($item)) { 70 $users[] = $item; 71 } else { 72 $roles[] = $item; 73 } 74 } 75 } else { 76 // Get following users and roles 77 $roles = $publishpress->notifications->get_roles_to_notify($post_id, 'slugs'); 78 $users = $publishpress->notifications->get_users_to_notify($post_id, 'id'); 79 } 80 81 // Extract users from roles 82 if (!empty($roles)) { 83 foreach ($roles as $role) 64 84 { 65 $usergroup = $publishpress->user_groups->get_usergroup_by('id', $usergroup_id); 85 $roleUsers = get_users( 86 [ 87 'role' => $role, 88 ] 89 ); 66 90 67 foreach ((array)$usergroup->user_ids as $user_id) 68 { 69 $usergroup_user = get_user_by('id', $user_id); 70 71 if ($usergroup_user && is_user_member_of_blog($user_id)) 91 if (!empty($roleUsers)) { 92 foreach ($roleUsers as $user) 72 93 { 73 $followers[] = $usergroup_user; 94 if (is_user_member_of_blog($user->ID)) 95 { 96 $followers[] = $user->ID; 97 } 74 98 } 75 99 } … … 77 101 } 78 102 79 $users = $publishpress->notifications->get_following_users($post_id, 'object'); 80 81 // Merge usergroup users and users 103 // Merge roles' users and users 82 104 $followers = array_merge($followers, $users); 83 105 84 106 // Process the recipients for this email to be sent 85 foreach ($followers as $key => $user) 86 { 107 if (!empty($followers)) { 108 foreach ($followers as $key => $user) 109 { 110 // Make sure we have only user objects in the list 111 if (is_numeric($user)) { 112 $user = get_user_by('ID', $user); 113 } 87 114 88 // Don't send the email to the current user unless we've explicitly indicated they should receive it 89 if (false === apply_filters('pp_notification_email_current_user', false) && wp_get_current_user()->user_email == $user->user_email) 90 { 91 unset($followers[$key]); 115 // Don't send the email to the current user unless we've explicitly indicated they should receive it 116 if (false === apply_filters('publishpress_notify_current_user', false) && wp_get_current_user()->user_email == $user->user_email) 117 { 118 unset($followers[$key]); 119 } 92 120 } 93 121 } … … 107 135 foreach ($followers as $user) 108 136 { 109 $receivers[] = $user->ID; 137 if (is_object($user)) { 138 $receivers[] = $user->ID; 139 } else { 140 $receivers[] = $user; 141 } 110 142 } 111 143 } -
publishpress/trunk/libraries/Notifications/Workflow/Step/Receiver/User.php
r1839780 r1843718 112 112 $template_context['list_class'] = 'publishpress_notif_user_list'; 113 113 $template_context['input_name'] = 'publishpress_notif[receiver_user][]'; 114 $template_context['input_id'] = 'publishpress_notif_user_ ';114 $template_context['input_id'] = 'publishpress_notif_user_list'; 115 115 116 116 $template_context = parent::filter_workflow_metabox_context($template_context); … … 137 137 138 138 // Get the users following the post 139 $users = $this->get_service('publishpress')->notifications->get_ following_users($args['post']->ID, 'id');139 $users = $this->get_service('publishpress')->notifications->get_users_to_notify($args['post']->ID, 'id'); 140 140 $receivers = array_merge($receivers, $users); 141 141 -
publishpress/trunk/modules/addons/addons.php
r1839780 r1843718 136 136 protected function is_plugin_installed($plugin) 137 137 { 138 return file_exists(plugin_dir_path(PUBLISHPRESS_ ROOT) . "{$plugin}/{$plugin}.php");138 return file_exists(plugin_dir_path(PUBLISHPRESS_BASE_PATH) . "{$plugin}/{$plugin}.php"); 139 139 } 140 140 -
publishpress/trunk/modules/async-notifications/async-notifications.php
r1839780 r1843718 29 29 */ 30 30 31 use PublishPress\ Auto_loader;31 use PublishPress\Legacy\Auto_loader; 32 32 use PublishPress\Notifications\Traits\Dependency_Injector; 33 33 use PublishPress\Notifications\Traits\PublishPress_Module; … … 89 89 $args['default_options'] = apply_filters('publishpress_async_notif_default_options', $args['default_options']); 90 90 $this->module = $publishpress->register_module( 91 PublishPress\ Util::sanitize_module_name($this->module_name),91 PublishPress\Legacy\Util::sanitize_module_name($this->module_name), 92 92 $args 93 93 ); … … 183 183 ]; 184 184 $receivers = [$receiver]; 185 186 // Decode the content 187 $content = base64_decode(maybe_unserialize($content)); 185 188 186 189 /** -
publishpress/trunk/modules/async-notifications/library/Queue/WPCron.php
r1843103 r1843718 55 55 if (!empty($receivers)) 56 56 { 57 $data = [ 58 'workflow_post_id' => $workflowPost->ID, 59 'action' => $actionArgs['action'], 60 'post_id' => $actionArgs['post']->ID, 61 'content' => $content, 62 'old_status' => isset($actionArgs['old_status']) ? $actionArgs['old_status'] : null, 63 'new_status' => isset($actionArgs['new_status']) ? $actionArgs['new_status'] : null, 64 'channel' => $channel, 57 $baseData = [ 58 // workflow_post_id 59 $workflowPost->ID, 60 // action 61 $actionArgs['action'], 62 // post_id 63 $actionArgs['post']->ID, 64 // content 65 base64_encode(maybe_serialize($content)), 66 // old_status 67 isset($actionArgs['old_status']) ? $actionArgs['old_status'] : null, 68 // new_status 69 isset($actionArgs['new_status']) ? $actionArgs['new_status'] : null, 70 // channel 71 $channel, 65 72 ]; 66 73 … … 68 75 foreach ($receivers as $receiver) 69 76 { 70 $data['receiver'] = $receiver; 77 // Base data 78 $data = $baseData; 79 80 // Receiver 81 $data[] = $receiver; 71 82 72 83 $this->scheduleEvent($data); -
publishpress/trunk/modules/calendar/calendar.php
r1839780 r1843718 184 184 $this->create_post_cap = apply_filters('pp_calendar_create_post_cap', 'edit_posts'); 185 185 186 require_once(PUBLISHPRESS_ ROOT. '/common/php/' . 'screen-options.php');186 require_once(PUBLISHPRESS_BASE_PATH . '/common/php/' . 'screen-options.php'); 187 187 188 188 add_action('admin_init', array($this, 'register_settings')); -
publishpress/trunk/modules/calendar/lib/calendar.css
r1839780 r1843718 614 614 } 615 615 } 616 617 #publishpress-ics-copy .dashicons, 618 #publishpress-ics-download .dashicons { 619 margin-top: 4px; 620 margin-right: 2px; 621 } 622 -
publishpress/trunk/modules/content-overview/content-overview.php
r1839780 r1843718 147 147 add_action('admin_init', array($this, 'handle_form_date_range_change')); 148 148 149 include_once PUBLISHPRESS_ ROOT. '/common/php/' . 'screen-options.php';149 include_once PUBLISHPRESS_BASE_PATH . '/common/php/' . 'screen-options.php'; 150 150 151 151 if (function_exists('add_screen_options_panel')) -
publishpress/trunk/modules/custom-status/custom-status.php
r1839780 r1843718 216 216 { 217 217 $default_terms = $this->get_default_terms(); 218 $roles = ['administrator', 'author', 'editor', 'contributor']; 218 219 219 220 // Okay, now add the default statuses to the db if they don't already exist … … 223 224 { 224 225 $this->add_custom_status($term['term'], $term['args']); 226 } 227 } 228 229 // Add basic capabilities for each post status 230 $default_terms['publish'] = array(); 231 foreach ($default_terms as $termSlug => $data) 232 { 233 foreach ($roles as $roleName) { 234 $role = get_role($roleName); 235 $role->add_cap('status_change_' . str_replace('-', '_', $termSlug)); 236 237 if ('publish' === $termSlug) { 238 $role->add_cap('status_change_private'); 239 $role->add_cap('status_change_future'); 240 } 225 241 } 226 242 } … … 927 943 $this->custom_statuses_cache = array(); 928 944 945 // Set permissions for the base roles 946 $roles = ['administrator', 'editor', 'author', 'contributor']; 947 foreach ($roles as $roleSlug) { 948 $role = get_role($roleSlug); 949 if (!empty($role)) { 950 $role->add_cap('status_change_' . str_replace('-', '_', $slug)); 951 } 952 } 953 929 954 return $response; 930 955 } -
publishpress/trunk/modules/dashboard/dashboard.php
r1839780 r1843718 247 247 global $publishpress; 248 248 249 $myposts = $publishpress->notifications->get_user_ following_posts();249 $myposts = $publishpress->notifications->get_user_to_notify_posts(); 250 250 251 251 ?> -
publishpress/trunk/modules/improved-notifications/assets/css/admin.css
r1839780 r1843718 93 93 } 94 94 95 #psppno-workflow-metabox-section-receiver #pp -post_following_users_box {95 #psppno-workflow-metabox-section-receiver #pp_post_notify_users_box { 96 96 float: none; 97 97 margin-right: 0; 98 98 } 99 99 100 #psppno-workflow-metabox-section-receiver #pp -post_following_users_box,100 #psppno-workflow-metabox-section-receiver #pp_post_notify_users_box, 101 101 #psppno-workflow-metabox-section-receiver #pp-post_following_usergroups_box { 102 102 width: 100%; … … 112 112 113 113 #psppno-workflow-metabox-section-receiver .publishpress_notif_user_list, 114 #psppno-workflow-metabox-section-receiver .publishpress_notif_ user_group_list {114 #psppno-workflow-metabox-section-receiver .publishpress_notif_role_list { 115 115 margin-bottom: 9px; 116 116 } … … 168 168 } 169 169 170 /* Branding for pages */171 body.post-type-psppnotif_workflow h1.wp-heading-inline:before {172 display: block;173 padding: 10px 0 10px 55px;174 background-image: url(../../../settings/lib/icon-128x128.png);175 background-size: 45px auto;176 background-position: left center;177 background-repeat: no-repeat;178 background-color: transparent;179 content: 'PublishPress';180 font-weight: bold;181 font-size: 26px;182 margin-bottom: 15px;183 margin-top: 8px;184 margin-left: 4px;185 margin-right: 0;186 padding-bottom: 10px;187 padding-left: 55px;188 padding-right: 0px;189 padding-top: 10px;190 }191 192 170 body.post-type-psppnotif_workflow #wpbody-content { 193 171 margin-bottom: 100px; … … 211 189 border-left: 8px solid #f3f3f3; 212 190 } 191 192 193 .psppno_workflow_metabox_section_header.invalid { 194 background-color: #ff8585 !important; 195 } -
publishpress/trunk/modules/improved-notifications/assets/js/workflow_form.js
r1839780 r1843718 44 44 setupFieldFilters('event_content_category'); 45 45 setupFieldFilters('user'); 46 setupFieldFilters(' user_group');46 setupFieldFilters('role'); 47 47 48 48 // List search 49 // $('.publishpress-filter-checkbox-list ul').listFilterizer();50 49 $('.publishpress-filter-checkbox-list select').multipleSelect({ 51 50 filter: true … … 53 52 54 53 // Form validation 55 54 $('form#post').on('submit', function (event) { 55 var selected, 56 sections = ['event', 'event_content'], 57 messages = []; 58 59 /** 60 * Set the validation status to the given section. 61 * 62 * @param section 63 * @param status 64 */ 65 function set_validation_status(section, status) { 66 var selector = '#psppno-workflow-metabox-section-' + section + ' .psppno_workflow_metabox_section_header'; 67 68 if (status) { 69 $(selector).removeClass('invalid'); 70 } else { 71 $(selector).addClass('invalid'); 72 } 73 } 74 75 function set_tooltip(section) { 76 var selector = '#psppno-workflow-metabox-section-' + section + ' .psppno_workflow_metabox_section_header'; 77 78 $(selector).tooltip(); 79 } 80 81 // Check the Event and Event Content sections 82 $.each(sections, function (index, section) { 83 // Check if the "When" and "Which content" filter has at least one selected option. 84 selected = $('[name="publishpress_notif[' + section + '][]"]:checked').length; 85 86 if (selected === 0) { 87 set_validation_status(section, false); 88 89 messages.push(workflowFormData.messages['selectAllIn_' + section]); 90 } else { 91 set_validation_status(section, true); 92 } 93 }); 94 95 // Check if any status was selected for "moving to new status" 96 if ($('#publishpress_notif_event_post_save:checked').length > 0) { 97 if ($('#publishpress_notif_event_post_save_filters_post_status_from').val() == null 98 || $('#publishpress_notif_event_post_save_filters_post_status_to').val() == null) { 99 100 set_validation_status('event', false); 101 102 if ($('#publishpress_notif_event_post_save_filters_post_status_from').val() == null) { 103 messages.push(workflowFormData.messages['selectAPreviousStatus']); 104 } 105 106 if ($('#publishpress_notif_event_post_save_filters_post_status_to').val() == null) { 107 messages.push(workflowFormData.messages['selectANewStatus']); 108 } 109 } else { 110 set_validation_status('event', true); 111 } 112 } 113 114 // Check if any post type was selected (if checked) 115 if ($('#publishpress_notif_event_content_post_type:checked').length > 0) { 116 if ($('#publishpress_notif_event_content_post_type_filters_post_type').val() == null) { 117 set_validation_status('event_content', false); 118 119 messages.push(workflowFormData.messages['selectPostType']); 120 } else { 121 set_validation_status('event_content', true); 122 } 123 } 124 125 // Check if any category was selected (if checked) 126 if ($('#publishpress_notif_event_content_category:checked').length > 0) { 127 if ($('#publishpress_notif_event_content_category_filters_category').val() == null) { 128 set_validation_status('event_content', false); 129 130 messages.push(workflowFormData.messages['selectCategory']); 131 } else { 132 set_validation_status('event_content', true); 133 } 134 } 135 136 // Check the Receivers section 137 if ($('#psppno-workflow-metabox-section-receiver input[type="checkbox"][name^="publishpress_notif"]:checked').length === 0) { 138 set_validation_status('receiver', false); 139 140 messages.push(workflowFormData.messages['selectAReceiver']); 141 } else { 142 set_validation_status('receiver', true); 143 } 144 145 // Check if any user was selected (if checked) 146 if ($('#publishpress_notif_user:checked').length > 0) { 147 if ($('#publishpress_notif_user_list').val() == null) { 148 set_validation_status('receiver', false); 149 150 messages.push(workflowFormData.messages['selectAUser']); 151 } else { 152 set_validation_status('receiver', true); 153 } 154 } 155 156 // Check if any role was selected (if checked) 157 if ($('#publishpress_notif_role:checked').length > 0) { 158 if ($('#publishpress_notif_roles').val() == null) { 159 set_validation_status('receiver', false); 160 161 messages.push(workflowFormData.messages['selectARole']); 162 } else { 163 set_validation_status('receiver', true); 164 } 165 } 166 167 // Check the Content section 168 if ($('#publishpress_notification_content_main_subject').val().trim() == '' 169 || tinymce.activeEditor.getContent().trim() === '') { 170 set_validation_status('content', false); 171 172 if ($('#publishpress_notification_content_main_subject').val().trim() == '') { 173 messages.push(workflowFormData.messages['setASubject']); 174 } 175 176 if (tinymce.activeEditor.getContent().trim() === '') { 177 messages.push(workflowFormData.messages['setABody']); 178 } 179 } else { 180 set_validation_status('content', true); 181 } 182 183 var valid = $('form#post .invalid').length === 0; 184 185 if (!valid) { 186 if (messages.length > 0) { 187 $('#error_messages').remove(); 188 var $messageBox = $('<div id="error_messages" class="notice notice-error"></div>'); 189 $('.wp-header-end').after($messageBox); 190 191 for (var i = 0; i < messages.length; i++) { 192 $element = $('<p>'); 193 $element.text(messages[i]); 194 $messageBox.append($element); 195 } 196 } 197 } else { 198 $('#error_messages').remove(); 199 } 200 201 return valid; 202 }); 56 203 }); 57 204 })(jQuery); -
publishpress/trunk/modules/improved-notifications/improved-notifications.php
r1839780 r1843718 103 103 $args['default_options'] = apply_filters('publishpress_notif_default_options', $args['default_options']); 104 104 $this->module = $publishpress->register_module( 105 PublishPress\ Util::sanitize_module_name($this->module_name),105 PublishPress\Legacy\Util::sanitize_module_name($this->module_name), 106 106 $args 107 107 ); … … 362 362 } 363 363 } 364 } 364 365 if (version_compare($previous_version, '1.10', '<=')) { 366 $this->migrate_legacy_metadata_for_role(); 367 } 368 } 369 370 protected function migrate_legacy_metadata_for_role() 371 { 372 global $wpdb; 373 374 $query = "UPDATE {$wpdb->prefix}postmeta SET meta_key = '_psppno_torole' WHERE meta_key = '_psppno_togroup'"; 375 $wpdb->query($query); 376 377 $query = "UPDATE {$wpdb->prefix}postmeta SET meta_key = '_psppno_torolelist' WHERE meta_key = '_psppno_togrouplist'"; 378 $wpdb->query($query); 379 } 380 365 381 366 382 /** … … 451 467 if (in_array($hook_suffix, ['post.php', 'post-new.php'])) 452 468 { 453 wp_enqueue_script('psppno-workflow-form', plugin_dir_url(__FILE__) . 'assets/js/workflow_form.js', [], PUBLISHPRESS_VERSION); 454 wp_enqueue_script('psppno-multiple-select', plugin_dir_url(__FILE__) . 'assets/js/multiple-select.js', [], PUBLISHPRESS_VERSION); 469 wp_enqueue_script('psppno-multiple-select', plugin_dir_url(__FILE__) . 'assets/js/multiple-select.js', ['jquery'], PUBLISHPRESS_VERSION); 470 wp_enqueue_script('psppno-workflow-tooltip', plugin_dir_url(__FILE__) . 'libs/opentip/downloads/opentip-jquery.js', ['jquery'], PUBLISHPRESS_VERSION); 471 wp_enqueue_script('psppno-workflow-form', plugin_dir_url(__FILE__) . 'assets/js/workflow_form.js', ['jquery', 'psppno-workflow-tooltip', 'psppno-multiple-select'], PUBLISHPRESS_VERSION); 472 473 wp_localize_script( 474 'psppno-workflow-form', 475 'workflowFormData', 476 [ 477 'messages' => [ 478 'selectAllIn_event' => 'Select at least one event.', 479 'selectAllIn_event_content' => 'Select at least a filter for the content.', 480 'selectAPreviousStatus' => 'Select at least one previous status.', 481 'selectANewStatus' => 'Select at least one new status.', 482 'selectPostType' => 'Select at least one post type.', 483 'selectCategory' => 'Select at least one category.', 484 'selectAReceiver' => 'Select at least one receiver.', 485 'selectAUser' => 'Select at least one user.', 486 'selectARole' => 'Select at least one role.', 487 'setASubject' => 'Type a subject for the notification.', 488 'setABody' => 'Type a body text for the notification.', 489 ], 490 ] 491 ); 455 492 } 456 493 } … … 526 563 $context = [ 527 564 'id' => 'event_content', 528 'header' => __('F ilter thecontent?', 'publishpress'),565 'header' => __('For which content?', 'publishpress'), 529 566 'html' => apply_filters('publishpress_notif_render_metabox_section_event_content', ''), 530 567 'class' => 'pure-u-1-3 pure-u-sm-1 pure-u-md-1-2 pure-u-lg-1-3', … … 571 608 $context = [ 572 609 'labels' => [ 610 'validation_help' => __('Select at least one option for each section.', 'publishpress'), 573 611 'pre_text' => __('You can add dynamic information to the Subject or Body text using the following shortcodes:', 'publishpress'), 574 612 'content' => __('Content', 'publishpress'), … … 597 635 * @param int $id Unique ID for the post being saved 598 636 * @param WP_Post $post Post object 637 * 638 * @return int|null 599 639 */ 600 640 public function save_meta_boxes($id, $post) -
publishpress/trunk/modules/notifications/assets/notifications.css
r1839780 r1843718 7 7 } 8 8 9 .pp -post_following_list {9 .pp_post_notify_list { 10 10 } 11 11 12 .pp -post_following_list li {12 .pp_post_notify_list li { 13 13 padding: 10px 5px 5px 5px; 14 14 margin: 0; … … 16 16 } 17 17 18 .pp -post_following_list li:hover {18 .pp_post_notify_list li:hover { 19 19 background: #EAF2FA; 20 20 } 21 21 22 .pp -post_following_list li input {22 .pp_post_notify_list li input { 23 23 float: right; 24 24 } 25 25 26 .pp -post_following_list .pp-user_displayname,27 .pp -post_following_list .pp-usergroup_name {26 .pp_post_notify_list .pp-user_displayname, 27 .pp_post_notify_list .pp-usergroup_name { 28 28 display: block; 29 29 font-size: 14px; 30 30 } 31 31 32 .pp -post_following_list .pp-user_useremail,33 .pp -post_following_list .pp-usergroup_description {32 .pp_post_notify_list .pp-user_useremail, 33 .pp_post_notify_list .pp-usergroup_description { 34 34 display: block; 35 35 color: #ccc; … … 37 37 } 38 38 39 #pp -post_following_box {39 #pp_post_notify_box { 40 40 margin: 10px 0; 41 41 } 42 42 43 #pp -post_following_box h4 {43 #pp_post_notify_box h4 { 44 44 background: #F1F1F1; 45 45 font-weight: bold; … … 50 50 } 51 51 52 #pp -post_following_box .error {52 #pp_post_notify_box .error { 53 53 color: red; 54 54 } 55 55 56 #pp -post_following_box label.pp-select_all_box {56 #pp_post_notify_box label.pp-select_all_box { 57 57 float: right; 58 58 margin: -20px 10px; 59 59 } 60 60 61 #pp -post_following_box label.pp-select_all_box input {61 #pp_post_notify_box label.pp-select_all_box input { 62 62 margin-bottom: 5px; 63 63 } 64 65 #pp-post_following_users_box,66 #pp-post_following_usergroups_box {67 width: 49%;68 }69 70 #pp-post_following_users_box {71 float: left;72 margin-right: 10px;73 }74 75 #pp-post_following_usergroups_box {76 float: right;77 }78 79 #pp-post_following_users_box .pp-post_following_list,80 #pp-post_following_usergroups_box .pp-post_following_list {81 max-height: 300px !important;82 overflow: auto !important;83 }84 85 #pp-post_following_users_box .list-filterizer-tools,86 #pp-post_following_usergroups_box .list-filterizer-tools {87 margin-top: 5px;88 }89 90 /** User Groups **/91 #profile-page #post_following_usergroups {92 width: 300px;93 }94 95 #pp-usergroup-users form.quicksearch,96 #pp-post_following_users_box form.quicksearch {97 display: none;98 }99 100 #pp-usergroup-users h4 {101 margin-top: 0;102 } -
publishpress/trunk/modules/notifications/assets/notifications.js
r1839780 r1843718 1 jQuery(document).ready(function ($) { 2 $('#pp-post_following_users_box ul').listFilterizer(); 3 4 var params = { 5 action: 'save_notifications', 6 post_id: $('#post_ID').val(), 7 }; 8 9 $(document).on('click', '.pp-post_following_list li input:checkbox, .pp-following_usergroups li input:checkbox', function () { 10 var user_group_ids = []; 11 var parent_this = $(this); 12 params.pp_notifications_name = $(this).attr('name'); 13 params._nonce = $("#pp_notifications_nonce").val(); 14 15 $(this) 16 .parent() 17 .parent() 18 .parent() 19 .find('input:checked') 20 .map(function () { 21 user_group_ids.push($(this).val()); 22 }) 23 24 params.user_group_ids = user_group_ids; 25 26 $.ajax({ 27 type: 'POST', 28 url: (ajaxurl) ? ajaxurl : wpListL10n.url, 29 data: params, 30 success: function (x) { 31 var backgroundColor = parent_this.css('background-color'); 32 $(parent_this.parent().parent()) 33 .animate({'backgroundColor': '#CCEEBB'}, 200) 34 .animate({'backgroundColor': backgroundColor}, 200); 35 }, 36 error: function (r) { 37 $('#pp-post_following_users_box').prev().append(' <p class="error">There was an error. Please reload the page.</p>'); 38 } 39 }); 1 jQuery(function ($) { 2 $(".chosen-select").chosen({ 3 'width': '95%' 40 4 }); 41 5 }); -
publishpress/trunk/modules/roles/lib/list_table.php
r1843103 r1843718 138 138 $actions = array(); 139 139 $actions['edit edit-role'] = sprintf('<a href="%1$s">' . __('Edit', 'publishpress') . '</a>', $publishpress->roles->getLink(array('action' => 'edit-role', 'role-id' => $role->name))); 140 $actions['delete delete-role'] = sprintf('<a href="%1$s">' . __('Delete', 'publishpress') . '</a>', $publishpress->roles->getLink(array('action' => 'delete-role', 'role-id' => $role->name))); 140 141 if ('administrator' !== $role->name) { 142 $actions['delete delete-role'] = sprintf('<a href="%1$s">' . __('Delete', 'publishpress') . '</a>', $publishpress->roles->getLink(array('action' => 'delete-role', 'role-id' => $role->name))); 143 } 141 144 142 145 return $this->twig->render( -
publishpress/trunk/modules/roles/roles.php
r1843103 r1843718 162 162 public function install() 163 163 { 164 $this->addCapabilitiesToAdmin(); 164 165 $this->scheduleUserGroupMigration(); 165 166 } … … 172 173 public function upgrade($previous_version) 173 174 { 174 if (version_compare($previous_version, '1.1 0.0', '<=')) {175 if (version_compare($previous_version, '1.11.3', '<')) { 175 176 $this->addCapabilitiesToAdmin(); 176 177 $this->scheduleUserGroupMigration(); … … 243 244 ?> 244 245 <div class="notice notice-warning is-dismissible"> 245 <p><?php _e('PublishPress detected legacy data which needs to be migrated. This task should run in the background in the next minutes.', 'publishpress'); ?></p>246 <p><?php _e('PublishPress detected legacy data which needs to be migrated. This task should run in the background in the next few minutes.', 'publishpress'); ?></p> 246 247 </div> 247 248 <?php … … 255 256 ?> 256 257 <div class="notice notice-success is-dismissible"> 257 <p><?php _e('PublishPress finished migrating the legacy data successfully.', 'publishpress'); ?></p>258 <p><?php _e('PublishPress finished migrating the legacy data.', 'publishpress'); ?></p> 258 259 </div> 259 260 <?php … … 685 686 686 687 /** 687 * 688 * @throws Exception 688 689 */ 689 690 public function render_admin_page() … … 765 766 'publishpress'), 766 767 'users' => __("Users", 'publishpress'), 767 'users_description' => __("Add users t hat belongs to this role.", 'publishpress'),768 'users_description' => __("Add users to this role.", 'publishpress'), 768 769 ], 769 770 'role' => $role, … … 890 891 $name = sanitize_title(strip_tags(trim($_POST['role-id']))); 891 892 $display_name = stripslashes(strip_tags(trim($_POST['display_name']))); 892 $users = $_POST['users'];893 $users = isset($_POST['users']) ? $_POST['users'] : []; 893 894 894 895 $_REQUEST['form-errors'] = []; … … 941 942 if (!empty($users_in_the_role)) { 942 943 foreach ($users_in_the_role as $user) { 944 // Check if you not are trying to remove yourself from administrator, and block if so. 945 if ('administrator' === $name && $user->ID === get_current_user_id()) { 946 continue; 947 } 948 943 949 if (!in_array($user->ID, $users)) { 944 950 $user->remove_role($name); … … 986 992 $name = sanitize_title(strip_tags(trim($_GET['role-id']))); 987 993 994 // Avoid deleting administrator 995 if ('administrator' === $name) { 996 wp_die(__('You can\'t delete the administrator role.', 'publishpress')); 997 } 998 988 999 // Check if the role exists 989 1000 $role = get_role($name); -
publishpress/trunk/modules/roles/twig/settings-tab-roles.twig.html
r1843103 r1843718 46 46 <select data-placeholder="{{ labels.select_users }}" multiple class="chosen-select" name="users[]"> 47 47 {% for user in users %} 48 <option value="{{ user. id }}" {% if user.idin role_users %}selected{% endif %}>{{ user.display_name }}</option>48 <option value="{{ user.ID }}" {% if user.ID in role_users %}selected{% endif %}>{{ user.display_name }}</option> 49 49 {% endfor %} 50 50 </select> -
publishpress/trunk/modules/settings/settings.php
r1839780 r1843718 165 165 <div class="publishpress-admin pressshack-admin-wrapper wrap"> 166 166 <header> 167 <h1 class="pressshack-title"> 168 <a href="//wordpress.org/plugins/publishpress" target="_blank" rel="noopener noreferrer" title="PublishPress"> 169 <?php _e('PublishPress', 'publishpress') ?> 170 </a> 171 </h1> 167 <h1 class="wp-heading-inline"><?php echo $current_module->title; ?></h1> 172 168 173 169 <?php echo !empty($display_text) ? $display_text : ''; ?> … … 344 340 345 341 foreach ($_POST['publishpress_module_name'] as $moduleSlug) { 346 $module_name = sanitize_key( PublishPress\ Util::sanitize_module_name( $moduleSlug ) );342 $module_name = sanitize_key( PublishPress\Legacy\Util::sanitize_module_name( $moduleSlug ) ); 347 343 348 344 if ($_POST['action'] != 'update' -
publishpress/trunk/modules/user-groups/lib/user-groups.css
r1839780 r1843718 1 1 /** Post subscriptions **/ 2 .pp -post_following_list {2 .pp_post_notify_list { 3 3 } 4 4 5 .pp -post_following_list li {5 .pp_post_notify_list li { 6 6 padding: 10px 5px 5px 5px; 7 7 margin: 0; … … 9 9 } 10 10 11 .pp -post_following_list li:hover {11 .pp_post_notify_list li:hover { 12 12 background: #EAF2FA; 13 13 } 14 14 15 .pp -post_following_list li input {15 .pp_post_notify_list li input { 16 16 float: right; 17 17 } 18 18 19 .pp -post_following_list .pp-user_displayname,20 .pp -post_following_list .pp-usergroup_name {19 .pp_post_notify_list .pp-user_displayname, 20 .pp_post_notify_list .pp-usergroup_name { 21 21 display: block; 22 22 font-size: 14px; 23 23 } 24 24 25 .pp -post_following_list .pp-user_useremail,26 .pp -post_following_list .pp-usergroup_description {25 .pp_post_notify_list .pp-user_useremail, 26 .pp_post_notify_list .pp-usergroup_description { 27 27 display: block; 28 28 color: #ccc; … … 30 30 } 31 31 32 #pp -post_following_box {32 #pp_post_notify_box { 33 33 margin: 10px 0; 34 34 } 35 35 36 #pp -post_following_box h4 {36 #pp_post_notify_box h4 { 37 37 background: #F1F1F1; 38 38 font-weight: bold; … … 43 43 } 44 44 45 #pp -post_following_box label.pp-select_all_box {45 #pp_post_notify_box label.pp-select_all_box { 46 46 float: right; 47 47 margin: -20px 10px; 48 48 } 49 49 50 #pp -post_following_box label.pp-select_all_box input {50 #pp_post_notify_box label.pp-select_all_box input { 51 51 margin-bottom: 5px; 52 52 } 53 53 54 #pp-post_following_users_box, 55 #pp-post_following_usergroups_box { 56 width: 49%; 57 } 58 59 #pp-post_following_users_box { 60 float: left; 61 margin-right: 2%; 62 } 63 64 #pp-post_following_usergroups_box { 65 float: right; 66 } 67 68 .pp-post_following_list { 54 .pp_post_notify_list { 69 55 max-height: 500px !important; 70 56 overflow: auto !important; 71 57 margin-bottom: 0; 72 58 } 73 74 #pp-post_following_users_box .list-filterizer-tools,75 #pp-post_following_usergroups_box .list-filterizer-tools {76 margin-top: 5px;77 }78 79 /** User Groups **/80 #profile-page #post_following_usergroups {81 width: 300px;82 }83 84 #pp-usergroup-users form.quicksearch,85 #pp-post_following_users_box form.quicksearch {86 display: none;87 }88 89 #pp-usergroup-users h4 {90 margin-top: 0;91 }92 93 .list-filterizer-tabs li {94 color: #655997;95 }96 97 .list-filterizer-tabs li.active,98 .list-filterizer-tabs li:hover {99 background: #655997;100 border-color: #655997;101 color: #fff;102 }103 104 @media (max-width: 767px) {105 106 #pp-post_following_usergroups_box,107 #pp-post_following_users_box {108 float: none;109 width: 100%;110 }111 112 #pp-post_following_users_box {113 margin-right: 0;114 margin-bottom: 20px;115 }116 } -
publishpress/trunk/publishpress.php
r1843103 r1843718 6 6 * Author: PublishPress 7 7 * Author URI: https://publishpress.com 8 * Version: 1.11. 28 * Version: 1.11.3 9 9 * Text Domain: publishpress 10 10 * Domain Path: /languages … … 137 137 foreach ($roles as $role => $caps) 138 138 { 139 PublishPress\ Util::add_caps_to_role($role, $caps);140 } 141 142 // User groups139 PublishPress\Legacy\Util::add_caps_to_role($role, $caps); 140 } 141 142 // Additional capabilities 143 143 $roles = array( 144 'administrator' => array( 'edit_usergroups'),144 'administrator' => array(apply_filters('pp_manage_roles_cap', 'pp_manage_roles')), 145 145 ); 146 146 147 147 foreach ($roles as $role => $caps) 148 148 { 149 PublishPress\ Util::add_caps_to_role($role, $caps);149 PublishPress\Legacy\Util::add_caps_to_role($role, $caps); 150 150 } 151 151 } … … 222 222 if (!class_exists('PP_Module')) 223 223 { 224 require_once(PUBLISHPRESS_ ROOT. '/common/php/class-module.php');224 require_once(PUBLISHPRESS_BASE_PATH . '/common/php/class-module.php'); 225 225 } 226 226 227 227 // Scan the modules directory and include any modules that exist there 228 // $module_dirs = scandir(PUBLISHPRESS_ ROOT. '/modules/');228 // $module_dirs = scandir(PUBLISHPRESS_BASE_PATH . '/modules/'); 229 229 $default_module_dirs = array( 230 'modules-settings' => PUBLISHPRESS_ROOT, 231 'calendar' => PUBLISHPRESS_ROOT, 232 'editorial-metadata' => PUBLISHPRESS_ROOT, 233 'notifications' => PUBLISHPRESS_ROOT, 234 'content-overview' => PUBLISHPRESS_ROOT, 235 'custom-status' => PUBLISHPRESS_ROOT, 236 'user-groups' => PUBLISHPRESS_ROOT, 237 'improved-notifications' => PUBLISHPRESS_ROOT, 238 'async-notifications' => PUBLISHPRESS_ROOT, 230 'modules-settings' => PUBLISHPRESS_BASE_PATH, 231 'calendar' => PUBLISHPRESS_BASE_PATH, 232 'editorial-metadata' => PUBLISHPRESS_BASE_PATH, 233 'notifications' => PUBLISHPRESS_BASE_PATH, 234 'content-overview' => PUBLISHPRESS_BASE_PATH, 235 'custom-status' => PUBLISHPRESS_BASE_PATH, 236 'roles' => PUBLISHPRESS_BASE_PATH, 237 'improved-notifications' => PUBLISHPRESS_BASE_PATH, 238 'async-notifications' => PUBLISHPRESS_BASE_PATH, 239 'user-groups' => PUBLISHPRESS_BASE_PATH, 239 240 240 241 // @TODO: Move for settings, and remove after cleanup 241 'dashboard' => PUBLISHPRESS_ ROOT,242 'editorial-comments' => PUBLISHPRESS_ ROOT,243 'settings' => PUBLISHPRESS_ ROOT,244 'efmigration' => PUBLISHPRESS_ ROOT,242 'dashboard' => PUBLISHPRESS_BASE_PATH, 243 'editorial-comments' => PUBLISHPRESS_BASE_PATH, 244 'settings' => PUBLISHPRESS_BASE_PATH, 245 'efmigration' => PUBLISHPRESS_BASE_PATH, 245 246 ); 246 247 … … 249 250 250 251 // Add add-ons as the last tab 251 $module_dirs['addons'] = PUBLISHPRESS_ ROOT;252 $module_dirs['addons'] = PUBLISHPRESS_BASE_PATH; 252 253 253 254 $class_names = array(); … … 280 281 281 282 // Other utils 282 require_once(PUBLISHPRESS_ ROOT. '/common/php/util.php');283 require_once(PUBLISHPRESS_BASE_PATH . '/common/php/util.php'); 283 284 284 285 // Instantiate all of our classes onto the PublishPress object … … 288 289 if (class_exists($class_name)) 289 290 { 290 $slug = PublishPress\ Util::sanitize_module_name($slug);291 $slug = PublishPress\Legacy\Util::sanitize_module_name($slug); 291 292 $this->$slug = new $class_name(); 292 293 } -
publishpress/trunk/readme.txt
r1843103 r1843718 7 7 Requires PHP: 5.4 8 8 Tested up to: 4.9.4 9 Stable tag: 1.11. 29 Stable tag: 1.11.3 10 10 License: GPLv2 or later 11 11 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 133 133 The format is based on [Keep a Changelog](http://keepachangelog.com/) 134 134 and this project adheres to [Semantic Versioning](http://semver.org/). 135 136 = [1.11.3] - 2018-03-20 = 137 138 *Fixed:* 139 140 * Fixed roles editing form, denying to remove current user from the administrator role; 141 * Fixed error in the dashboard widget "My Content Notifications" 142 * Fixed default permissions for administrators for being able to see the Roles menu item; 143 144 *Changed:* 145 146 * Removed option to delete the administrator role; 147 * Improved some text; 135 148 136 149 = [1.11.2] - 2018-03-19 = -
publishpress/trunk/twig/workflow_help.twig
r1839780 r1843718 1 <p>{{ labels.validation_help }}</p> 1 2 <h3>Content</h3> 2 3 <p>{{ labels.pre_text }}</p> -
publishpress/trunk/twig/workflow_metabox.twig
r1839780 r1843718 1 1 <div id="psppno-workflow-metabox" class="pure-g"> 2 <!-- Events --> 2 3 <!-- Events --> 3 4 {{ section_event|raw }} 4 5 -
publishpress/trunk/twig/workflow_receiver_user_field.twig
r1839780 r1843718 7 7 8 8 {% if users %} 9 <select multiple="multiple" class="{{ list_class }}" name="{{ input_name }}" >9 <select multiple="multiple" class="{{ list_class }}" name="{{ input_name }}" id="{{ input_id }}"> 10 10 {% for user in users %} 11 11 <option value="{{ user.ID }}" {{ selected( user.selected, true ) }}>{{ user.display_name }}</option> -
publishpress/trunk/vendor/composer/installed.json
r1839664 r1843718 109 109 "source": { 110 110 "type": "git", 111 "url": "https://github.com/OSTraining/WordPress-Plugin-Builder .git",111 "url": "https://github.com/OSTraining/WordPress-Plugin-Builder", 112 112 "reference": "6658ad5e35ec32877ee941e3680702bfb86986e5" 113 113 }, 114 "dist": {115 "type": "zip",116 "url": "https://api.github.com/repos/OSTraining/WordPress-Plugin-Builder/zipball/6658ad5e35ec32877ee941e3680702bfb86986e5",117 "reference": "6658ad5e35ec32877ee941e3680702bfb86986e5",118 "shasum": ""119 },120 114 "time": "2018-03-01T22:09:46+00:00", 121 115 "type": "library", 122 "installation-source": " dist",116 "installation-source": "source", 123 117 "autoload": { 124 118 "psr-4": { … … 136 130 } 137 131 ], 138 "description": "Base class for WordPress plugin builder", 139 "support": { 140 "source": "https://github.com/OSTraining/WordPress-Plugin-Builder/tree/2.1.4", 141 "issues": "https://github.com/OSTraining/WordPress-Plugin-Builder/issues" 142 } 132 "description": "Base class for WordPress plugin builder" 143 133 }, 144 134 {
Note: See TracChangeset
for help on using the changeset viewer.