Changeset 1839664
- Timestamp:
- 03/13/2018 10:53:59 PM (8 years ago)
- Location:
- publishpress/trunk
- Files:
-
- 151 added
- 7 deleted
- 63 edited
-
.babelrc (deleted)
-
.idea (deleted)
-
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 (added)
-
composer.lock (added)
-
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 (added)
-
modules/improved-notifications/libs/opentip (added)
-
modules/improved-notifications/libs/opentip/.gitignore (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/.gitignore (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/notifications/notifications.php (modified) (51 diffs)
-
modules/roles (added)
-
modules/roles/assets (added)
-
modules/roles/assets/css (added)
-
modules/roles/assets/css/admin.css (added)
-
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 (added)
-
modules/roles/lib/list_table.php (added)
-
modules/roles/roles.php (added)
-
modules/roles/twig (added)
-
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 (added)
-
modules/settings/settings.php (modified) (2 diffs)
-
modules/user-groups/lib/user-groups.css (modified) (4 diffs)
-
modules/user-groups/user-groups.php (modified) (5 diffs)
-
publishpress.php (modified) (6 diffs)
-
readme.txt (modified) (6 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/a5hleyrich (deleted)
-
vendor/bin (added)
-
vendor/composer/autoload_classmap.php (modified) (1 diff)
-
vendor/composer/autoload_psr4.php (modified) (1 diff)
-
vendor/composer/autoload_static.php (modified) (4 diffs)
-
vendor/composer/installed.json (modified) (5 diffs)
-
vendor/pimple/pimple/.gitignore (added)
-
vendor/pimple/pimple/ext/pimple/.gitignore (added)
-
vendor/psr/container/.gitignore (added)
-
vendor/publishpress/wordpress-plugin-builder (added)
-
vendor/publishpress/wordpress-plugin-builder/.gitignore (added)
-
vendor/publishpress/wordpress-plugin-builder/LICENSE (added)
-
vendor/publishpress/wordpress-plugin-builder/build.xml (added)
-
vendor/publishpress/wordpress-plugin-builder/composer.json (added)
-
vendor/publishpress/wordpress-plugin-builder/src (added)
-
vendor/publishpress/wordpress-plugin-builder/src/AbstractTask.php (added)
-
vendor/publishpress/wordpress-plugin-builder/targets (added)
-
vendor/publishpress/wordpress-plugin-builder/targets/build.xml (added)
-
vendor/publishpress/wordpress-plugin-builder/targets/plugin.xml (added)
-
vendor/publishpress/wordpress-plugin-builder/tasks (added)
-
vendor/publishpress/wordpress-plugin-builder/tasks/GetPluginName.php (added)
-
vendor/publishpress/wordpress-plugin-builder/tasks/GetPluginVersion.php (added)
-
vendor/publishpress/wordpress-plugin-builder/tasks/SetPluginVersion.php (added)
-
vendor/twig/twig/.gitignore (added)
-
vendor/twig/twig/.travis.yml (modified) (3 diffs)
-
vendor/twig/twig/CHANGELOG (modified) (1 diff)
-
vendor/twig/twig/LICENSE (modified) (1 diff)
-
vendor/twig/twig/doc/advanced.rst (modified) (2 diffs)
-
vendor/twig/twig/doc/filters/length.rst (modified) (1 diff)
-
vendor/twig/twig/doc/filters/replace.rst (modified) (1 diff)
-
vendor/twig/twig/doc/functions/block.rst (modified) (1 diff)
-
vendor/twig/twig/ext/twig/.gitignore (added)
-
vendor/twig/twig/ext/twig/php_twig.h (modified) (1 diff)
-
vendor/twig/twig/ext/twig/twig.c (modified) (2 diffs)
-
vendor/twig/twig/lib/Twig/Compiler.php (modified) (3 diffs)
-
vendor/twig/twig/lib/Twig/Environment.php (modified) (5 diffs)
-
vendor/twig/twig/lib/Twig/ExpressionParser.php (modified) (4 diffs)
-
vendor/twig/twig/lib/Twig/Extension/Core.php (modified) (6 diffs)
-
vendor/twig/twig/lib/Twig/Lexer.php (modified) (2 diffs)
-
vendor/twig/twig/lib/Twig/Loader/Filesystem.php (modified) (1 diff)
-
vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php (modified) (2 diffs)
-
vendor/twig/twig/lib/Twig/Parser.php (modified) (5 diffs)
-
vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php (modified) (1 diff)
-
vendor/twig/twig/lib/Twig/Template.php (modified) (2 diffs)
-
vendor/twig/twig/lib/Twig/TokenParser/For.php (modified) (1 diff)
-
vendor/twig/twig/lib/Twig/TokenParserBroker.php (modified) (1 diff)
-
vendor/twig/twig/lib/Twig/TokenStream.php (modified) (1 diff)
-
vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php (modified) (1 diff)
-
vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/child_contents_outside_blocks.test (modified) (2 diffs)
-
vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/strict_comparison_operator.test (added)
-
vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test (modified) (3 diffs)
-
vendor/twig/twig/test/Twig/Tests/IntegrationTest.php (modified) (1 diff)
-
vendor/twig/twig/test/Twig/Tests/TemplateTest.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
publishpress/trunk/common/css/pressshack-admin.css
r1827070 r1839664 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
r1827070 r1839664 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
r1827070 r1839664 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.1 0.0');45 define('PUBLISHPRESS_ ROOT', dirname(__FILE__));46 define('PUBLISHPRESS_FILE_PATH', PUBLISHPRESS_ ROOT. '/' . basename(__FILE__));43 define('PUBLISHPRESS_VERSION', '1.11.0'); 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
r1827070 r1839664 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
r1827070 r1839664 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
r1827070 r1839664 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
r1827070 r1839664 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
r1827070 r1839664 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
r1827070 r1839664 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
r1827070 r1839664 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
r1827070 r1839664 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
r1827070 r1839664 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
r1827070 r1839664 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
r1827070 r1839664 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
r1827070 r1839664 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
r1827070 r1839664 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
r1827070 r1839664 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
r1827070 r1839664 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
r1827070 r1839664 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
r1827070 r1839664 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
r1827070 r1839664 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
r1827070 r1839664 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
r1827070 r1839664 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/notifications/notifications.php
r1827070 r1839664 43 43 { 44 44 45 // Taxonomy name used to store users following posts46 public $ following_users_taxonomy = 'following_users';47 48 // Taxonomy name used to store user groups following posts49 public $ following_usergroups_taxonomy = PP_User_Groups::taxonomy_key;45 // Taxonomy name used to store users which will be notified for changes in the posts. 46 public $notify_user_taxonomy = 'pp_notify_user'; 47 48 // Taxonomy name used to store roles which will be notified for changes in the posts. 49 public $notify_role_taxonomy = 'pp_notify_role'; 50 50 51 51 public $module; … … 64 64 'title' => __('Default Notifications', 'publishpress'), 65 65 'short_description' => __('With notifications, you can keep everyone updated about what’s happening with your content.', 'publishpress'), 66 'extended_description' => __('With notifications, you can keep everyone updated about what’s happening with a given content. Each status change or editorial comment sends out a message to users subscribed to a post. User groups can be used to manage who receives notifications on what.', 'publishpress'),66 'extended_description' => __('With notifications, you can keep everyone updated about what’s happening with a given content. Each status change or editorial comment sends out a message to users subscribed to a post. Roles can be used to manage who receives notifications on what.', 'publishpress'), 67 67 'module_url' => $this->module_url, 68 68 'icon_class' => 'dashicons dashicons-email', … … 83 83 'id' => 'pp-notifications-overview', 84 84 'title' => __('Overview', 'publishpress'), 85 'content' => __('<p>Notifications ensure you keep up to date with progress your most important content. Users can be subscribed to notifications on a post one by one or by selecting user groups.</p><p>When enabled, notifications can be sent when a post changes status or an editorial comment is left by a writer or an editor.</p>', 'publishpress'),85 'content' => __('<p>Notifications ensure you keep up to date with progress your most important content. Users can be subscribed to notifications on a post one by one or by selecting roles.</p><p>When enabled, notifications can be sent when a post changes status or an editorial comment is left by a writer or an editor.</p>', 'publishpress'), 86 86 ), 87 87 'settings_help_sidebar' => __('<p><strong>For more information:</strong></p><p><a href="https://publishpress.com/features/notifications/">Notifications Documentation</a></p><p><a href="https://github.com/ostraining/PublishPress">PublishPress on Github</a></p>', 'publishpress'), … … 107 107 108 108 // Saving post actions 109 // self::save_post_subscriptions() is hooked into transition_post_status so we can ensure usergroupdata109 // self::save_post_subscriptions() is hooked into transition_post_status so we can ensure role data 110 110 // is properly saved before sending notifs 111 add_action('transition_post_status', array($this, 'save_post_subscriptions'), 0, 3);112 111 add_action('transition_post_status', array($this, 'notification_status_change'), PP_NOTIFICATION_PRIORITY_STATUS_CHANGE, 3); 113 112 add_action('pp_post_insert_editorial_comment', array($this, 'notification_comment')); … … 121 120 add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles')); 122 121 123 // Add a " Follow" link to posts124 if (apply_filters('pp_notifications_show_ follow_link', true))125 { 126 // A little extra JS for the followbutton127 add_action('admin_head', array($this, 'action_admin_head_ follow_js'));122 // Add a "Notify" link to posts 123 if (apply_filters('pp_notifications_show_notify_link', true)) 124 { 125 // A little extra JS for the Notify button 126 add_action('admin_head', array($this, 'action_admin_head_notify_js')); 128 127 // Manage Posts 129 128 add_filter('post_row_actions', array($this, 'filter_post_row_actions'), 10, 2); … … 137 136 add_filter('pp_notification_auto_subscribe_current_user', array($this, 'filter_pp_notification_auto_subscribe_current_user'), 10, 2); 138 137 138 add_action('save_post', array($this, 'action_save_post'), 10); 139 139 140 // Ajax for saving notification updates 140 add_action('wp_ajax_save_notifications', array($this, 'ajax_save_post_subscriptions'));141 141 add_action('wp_ajax_pp_notifications_user_post_subscription', array($this, 'handle_user_post_subscription')); 142 142 … … 152 152 public function install() 153 153 { 154 154 // Considering we could be moving from Edit Flow, we need to migrate the following users. 155 $this->migrateLegacyFollowingTerms(); 155 156 } 156 157 … … 192 193 $publishpress->update_module_option($this->module->name, 'loaded_once', true); 193 194 } 195 196 if (version_compare($previous_version, '1.10', '<=')) { 197 $this->migrateLegacyFollowingTerms(); 198 } 199 } 200 201 202 protected function migrateLegacyFollowingTerms() 203 { 204 global $wpdb; 205 206 // Migrate Following Users 207 $query = "UPDATE {$wpdb->prefix}term_taxonomy SET taxonomy = '{$this->notify_user_taxonomy}' WHERE taxonomy = 'following_users'"; 208 $wpdb->query($query); 194 209 } 195 210 … … 216 231 ); 217 232 218 register_taxonomy($this->following_users_taxonomy, $supported_post_types, $args); 233 register_taxonomy($this->notify_user_taxonomy, $supported_post_types, $args); 234 register_taxonomy($this->notify_role_taxonomy, $supported_post_types, $args); 219 235 } 220 236 … … 230 246 if ($this->is_whitelisted_functional_view()) 231 247 { 232 wp_enqueue_script('jquery-listfilterizer');233 wp_enqueue_script('jquery-quicksearch');234 248 wp_enqueue_script( 235 249 'publishpress-notifications-js', … … 237 251 array( 238 252 'jquery', 239 'jquery-listfilterizer',240 'jquery-quicksearch',241 253 ), 242 254 PUBLISHPRESS_VERSION, 243 255 true 244 256 ); 257 258 wp_enqueue_script('publishpress-chosen-js', PUBLISHPRESS_URL . '/common/libs/chosen/chosen.jquery.js', 259 ['jquery'], PUBLISHPRESS_VERSION); 245 260 } 246 261 } … … 264 279 PUBLISHPRESS_VERSION 265 280 ); 266 } 267 } 268 269 /** 270 * JS required for the Follow link to work 281 282 wp_enqueue_style('publishpress-chosen-css', PUBLISHPRESS_URL . '/common/libs/chosen/chosen.css', false, 283 PUBLISHPRESS_VERSION); 284 } 285 } 286 287 /** 288 * JS required for the Notify link to work 271 289 * 272 290 * @since 0.8 273 291 */ 274 public function action_admin_head_ follow_js()292 public function action_admin_head_notify_js() 275 293 { 276 294 ?> … … 279 297 $(document).ready(function ($) { 280 298 /** 281 * Action to Follow / Unfollowposts on the manage posts screen299 * Action to Notify / Stop Notifying posts on the manage posts screen 282 300 */ 283 $('.wp-list-table, #pp-calendar-view, #pp-story-budget-wrap').on('click', '.pp_ follow_link a', function (e) {301 $('.wp-list-table, #pp-calendar-view, #pp-story-budget-wrap').on('click', '.pp_notify_link a', function (e) { 284 302 285 303 e.preventDefault(); … … 309 327 310 328 /** 311 * Add a " Follow" link to supported post types Manage Posts view329 * Add a "Notify" link to supported post types Manage Posts view 312 330 * 313 331 * @since 0.8 … … 331 349 } 332 350 333 $parts = $this->get_ follow_action_parts($post);334 $actions['pp_ follow_link'] = '<a title="' . esc_attr($parts['title']) . '" href="' . esc_url($parts['link']) . '">' . $parts['text'] . '</a>';351 $parts = $this->get_notify_action_parts($post); 352 $actions['pp_notify_link'] = '<a title="' . esc_attr($parts['title']) . '" href="' . esc_url($parts['link']) . '">' . $parts['text'] . '</a>'; 335 353 336 354 return $actions; … … 338 356 339 357 /** 340 * Get an action parts for a user to follow or unfollowa post358 * Get an action parts for a user to set Notify or Stop Notify for a post 341 359 * 342 360 * @since 0.8 343 361 */ 344 private function get_ follow_action_parts($post)362 private function get_notify_action_parts($post) 345 363 { 346 364 $args = array( … … 349 367 ); 350 368 351 $ following_users = $this->get_following_users($post->ID);352 353 if (in_array(wp_get_current_user()->user_login, $ following_users))354 { 355 $args['method'] = ' unfollow';369 $user_to_notify = $this->get_users_to_notify($post->ID); 370 371 if (in_array(wp_get_current_user()->user_login, $user_to_notify)) 372 { 373 $args['method'] = 'stop_notifying'; 356 374 $title_text = __('Click to stop being notified on updates for this post', 'publishpress'); 357 $ follow_text= __('Stop notifying me', 'publishpress');375 $link_text = __('Stop notifying me', 'publishpress'); 358 376 } else 359 377 { 360 $args['method'] = ' follow';378 $args['method'] = 'start_notifying'; 361 379 $title_text = __('Click to start being notified on updates for this post', 'publishpress'); 362 $ follow_text= __('Notify me', 'publishpress');380 $link_text = __('Notify me', 'publishpress'); 363 381 } 364 382 … … 368 386 return array( 369 387 'title' => $title_text, 370 'text' => $ follow_text,388 'text' => $link_text, 371 389 'link' => add_query_arg($args, admin_url('admin-ajax.php')), 372 390 ); … … 383 401 } 384 402 385 $ usergroup_post_types = $this->get_post_types_for_module($this->module);386 foreach ($ usergroup_post_types as $post_type)403 $role_post_types = $this->get_post_types_for_module($this->module); 404 foreach ($role_post_types as $post_type) 387 405 { 388 406 add_meta_box( … … 391 409 array($this, 'notifications_meta_box'), 392 410 $post_type, 393 'advanced' 411 'side', 412 'high' 394 413 ); 395 414 } … … 397 416 398 417 /** 399 * Outputs box used to subscribe users and usergroups to Posts418 * Outputs box used to subscribe users and roles to Posts 400 419 * 401 420 * @todo add_cap to set subscribers for posts; default to Admin and editors … … 406 425 407 426 ?> 408 <div id="pp -post_following_box">427 <div id="pp_post_notify_box"> 409 428 <a name="subscriptions"></a> 410 429 411 <p><?php _e('Select the users and user groups that should receive notifications when the status of this post is updated or when an editorial comment is added.', 'publishpress'); ?> 430 <p> 431 <?php _e('Select the users and roles that should receive notifications by workflows.', 'publishpress'); ?> 412 432 </p> 413 <div id="pp-post_following_users_box"> 414 <h4><?php _e('Users', 'publishpress'); ?></h4>433 434 <div id="pp_post_notify_users_box"> 415 435 <?php 416 $followers = $this->get_following_users($post->ID, 'id'); 436 $users_to_notify = $this->get_users_to_notify($post->ID, 'id'); 437 $roles_to_notify = $this->get_roles_to_notify($post->ID, 'slugs'); 438 439 $selected = array_merge($users_to_notify, $roles_to_notify); 440 417 441 $select_form_args = array( 418 'list_class' => 'pp -post_following_list',442 'list_class' => 'pp_post_notify_list', 419 443 ); 420 $this->users_select_form($ followers, $select_form_args);444 $this->users_select_form($selected , $select_form_args); 421 445 ?> 446 447 422 448 </div> 423 449 424 <?php if ($this->module_enabled('user_groups') && in_array($this->get_current_post_type(), $this->get_post_types_for_module($publishpress->user_groups->module))): ?> 425 <div id="pp-post_following_usergroups_box"> 426 <h4><?php _e('User Groups', 'publishpress') ?></h4> 427 <?php 428 $following_usergroups = $this->get_following_usergroups($post->ID, 'ids'); 429 $publishpress->user_groups->usergroups_select_form($following_usergroups); 430 ?> 431 </div> 432 <?php endif; ?> 450 <p> 451 <a href="https://publishpress.com/docs/notifications/"><?php _e('Click here to read more about notifications...', 'publishpress'); ?></a> 452 </p> 433 453 434 454 <div class="clear"></div> 435 455 436 <input type="hidden" name="pp -save_followers" value="1"/> <?php // Extra protection against autosaves456 <input type="hidden" name="pp_save_notify" value="1"/> <?php // Extra protection against autosaves 437 457 ?> 438 458 439 <?php wp_nonce_field('save_ user_usergroups', 'pp_notifications_nonce', false); ?>459 <?php wp_nonce_field('save_roles', 'pp_notifications_nonce', false); ?> 440 460 </div> 441 461 … … 443 463 } 444 464 445 /** 446 * Called when a notification editorial metadata checkbox is checked. Handles saving of a user/usergroup to a post. 447 */ 448 public function ajax_save_post_subscriptions() 449 { 450 global $publishpress; 451 452 // Verify nonce 453 if (!wp_verify_nonce($_POST['_nonce'], 'save_user_usergroups')) 454 { 455 die(__("Nonce check failed. Please ensure you can add users or user groups to a post.", 'publishpress')); 456 } 457 458 $post_id = (int )$_POST['post_id']; 459 $post = get_post($post_id); 460 $user_usergroup_ids = array_map('intval', $_POST['user_group_ids']); 461 if ((!wp_is_post_revision($post_id) && !wp_is_post_autosave($post_id)) && current_user_can($this->edit_post_subscriptions_cap)) 462 { 463 if ($_POST['pp_notifications_name'] === 'pp-selected-users[]') 464 { 465 $this->save_post_following_users($post, $user_usergroup_ids); 466 } else if ($_POST['pp_notifications_name'] == 'following_usergroups[]') 467 { 468 if ($this->module_enabled('user_groups') && in_array(get_post_type($post_id), $this->get_post_types_for_module($publishpress->user_groups->module))) 469 { 470 $this->save_post_following_usergroups($post, $user_usergroup_ids); 465 public function action_save_post($postId) 466 { 467 if (!isset($_POST['pp_notifications_nonce']) || !wp_verify_nonce($_POST['pp_notifications_nonce'], 'save_roles')) { 468 return; 469 } 470 471 if (isset($_POST['to_notify'])) { 472 // Remove current users 473 $terms = get_the_terms($postId, $this->notify_user_taxonomy); 474 $users = array(); 475 if (!empty($terms)) { 476 foreach ($terms as $term) { 477 $users[] = $term->term_id; 471 478 } 472 479 } 473 } 474 die(); 480 wp_remove_object_terms($postId, $users, $this->notify_user_taxonomy); 481 482 // Remove current roles 483 $terms = get_the_terms($postId, $this->notify_role_taxonomy); 484 $roles = array(); 485 if (!empty($terms)) { 486 foreach ($terms as $term) { 487 $roles[] = $term->term_id; 488 } 489 } 490 wp_remove_object_terms($postId, $roles, $this->notify_role_taxonomy); 491 492 foreach ($_POST['to_notify'] as $id) { 493 if (is_numeric($id)) { 494 // User id 495 $this->post_set_users_to_notify($postId, (int)$id, true); 496 } else { 497 // Role name 498 $this->post_set_roles_to_notify($postId, $id, true); 499 } 500 } 501 } 475 502 } 476 503 … … 499 526 } 500 527 501 if (' follow'== $_GET['method'])502 { 503 $retval = $this-> follow_post_user($post, get_current_user_id());528 if ('start_notifying' === $_GET['method']) 529 { 530 $retval = $this->post_set_users_to_notify($post, get_current_user_id()); 504 531 } else 505 532 { 506 $retval = $this-> unfollow_post_user($post, get_current_user_id());533 $retval = $this->post_set_users_stop_notify($post, get_current_user_id()); 507 534 } 508 535 … … 512 539 } 513 540 514 $this->print_ajax_response('success', (object )$this->get_ follow_action_parts($post));541 $this->print_ajax_response('success', (object )$this->get_notify_action_parts($post)); 515 542 } 516 543 … … 545 572 } 546 573 547 548 /** 549 * Called when post is saved. Handles saving of user/usergroup followers 574 /** 575 * Sets users to be notified for the specified post 550 576 * 551 577 * @param int $post ID of the post 552 578 */ 553 public function save_post_subscriptions($new_status, $old_status, $post) 554 { 555 global $publishpress; 556 // only if has edit_post_subscriptions cap 557 if ((!wp_is_post_revision($post) && !wp_is_post_autosave($post)) && isset($_POST['pp-save_followers']) && current_user_can($this->edit_post_subscriptions_cap)) 558 { 559 $users = isset($_POST['pp-selected-users']) ? $_POST['pp-selected-users'] : array(); 560 $usergroups = isset($_POST['following_usergroups']) ? $_POST['following_usergroups'] : array(); 561 $this->save_post_following_users($post, $users); 562 if ($this->module_enabled('user_groups') && in_array($this->get_current_post_type(), $this->get_post_types_for_module($publishpress->user_groups->module))) 563 { 564 $this->save_post_following_usergroups($post, $usergroups); 565 } 566 } 567 } 568 569 /** 570 * Sets users to follow specified post 571 * 572 * @param int $post ID of the post 573 */ 574 public function save_post_following_users($post, $users = null) 579 public function save_post_notify_users($post, $users = null) 575 580 { 576 581 if (!is_array($users)) … … 579 584 } 580 585 581 // Add current user to following users586 // Add current user to notify list 582 587 $user = wp_get_current_user(); 583 588 if ($user && apply_filters('pp_notification_auto_subscribe_current_user', true, 'subscription_action')) … … 586 591 } 587 592 588 // Add post author to following users593 // Add post author to notify list 589 594 if (apply_filters('pp_notification_auto_subscribe_post_author', true, 'subscription_action')) 590 595 { … … 594 599 $users = array_unique(array_map('intval', $users)); 595 600 596 $ follow = $this->follow_post_user($post, $users, false);597 } 598 599 /** 600 * Sets usergroups to followspecified post601 $this->post_set_users_to_notify($post, $users, false); 602 } 603 604 /** 605 * Sets roles to be notified for the specified post 601 606 * 602 607 * @param int $post ID of the post 603 * @param array $ usergroups Usergroups to followposts604 */ 605 public function save_post_ following_usergroups($post, $usergroups = null)606 { 607 if (!is_array($ usergroups))608 { 609 $ usergroups = array();610 } 611 $ usergroups = array_map('intval', $usergroups);612 613 $ follow = $this->follow_post_usergroups($post, $usergroups, false);608 * @param array $roles Roles to be notified for posts 609 */ 610 public function save_post_notify_roles($post, $roles = null) 611 { 612 if (!is_array($roles)) 613 { 614 $roles = array(); 615 } 616 $roles = array_map('intval', $roles); 617 618 $this->add_role_to_notify($post, $roles, false); 614 619 } 615 620 … … 620 625 { 621 626 global $publishpress; 627 622 628 623 629 // Kill switch for notification … … 678 684 //if( $parent_ID ) $parent = get_comment( $parent_ID ); 679 685 680 // Set user to followpost, but make it filterable686 // Set user to be notified for a post, but make it filterable 681 687 if (apply_filters('pp_notification_auto_subscribe_current_user', true, 'comment')) 682 688 { 683 $this-> follow_post_user($post, (int )$current_user->ID);684 } 685 686 // Set the post author to followthe post but make it filterable689 $this->post_set_users_to_notify($post, (int )$current_user->ID); 690 } 691 692 // Set the post author to be notified for the post but make it filterable 687 693 if (apply_filters('pp_notification_auto_subscribe_post_author', true, 'comment')) 688 694 { 689 $this-> follow_post_user($post, (int )$post->post_author);695 $this->post_set_users_to_notify($post, (int )$post->post_author); 690 696 } 691 697 … … 807 813 $recipients = array(); 808 814 809 $usergroup_users = array(); 810 if ($this->module_enabled('user_groups')) 811 { 812 // Get following users and usergroups 813 $usergroups = $this->get_following_usergroups($post_id, 'ids'); 814 foreach ((array )$usergroups as $usergroup_id) 815 { 816 $usergroup = $publishpress->user_groups->get_usergroup_by('id', $usergroup_id); 817 foreach ((array )$usergroup->user_ids as $user_id) 815 $role_users = array(); 816 817 // Get users and roles to notify 818 $roles = $this->get_roles_to_notify($post_id, 'slugs'); 819 foreach ((array )$roles as $role_id) 820 { 821 $users = get_users( 822 [ 823 'role' => $role_id, 824 ] 825 ); 826 827 if (!empty($users)) { 828 foreach ($users as $user) 818 829 { 819 $usergroup_user = get_user_by('id', $user_id); 820 if ($usergroup_user && is_user_member_of_blog($user_id)) 830 if (is_user_member_of_blog($user->ID)) 821 831 { 822 $ usergroup_users[] = $usergroup_user->user_email;832 $role_users[] = $user->user_email; 823 833 } 824 834 } … … 826 836 } 827 837 828 $users = $this->get_ following_users($post_id, 'user_email');838 $users = $this->get_users_to_notify($post_id, 'user_email'); 829 839 830 840 // Merge arrays and filter any duplicates 831 $recipients = array_merge($authors, $admins, $users, $ usergroup_users);841 $recipients = array_merge($authors, $admins, $users, $role_users); 832 842 $recipients = array_unique($recipients); 833 843 … … 841 851 } 842 852 // Don't send the email to the current user unless we've explicitly indicated they should receive it 843 if (false === apply_filters('p p_notification_email_current_user', false) && wp_get_current_user()->user_email == $user_email)853 if (false === apply_filters('publishpress_notify_current_user', false) && wp_get_current_user()->user_email == $user_email) 844 854 { 845 855 unset($recipients[$key]); … … 861 871 862 872 /** 863 * Set a user or users to followa post873 * Set a user or users to be notified for a post 864 874 * 865 875 * @param int|object $post Post object or ID 866 876 * @param string|array $users User or users to subscribe to post updates 867 * @param bool $append Whether users should be added to following_userslist or replace existing list877 * @param bool $append Whether users should be added to pp_notify_user list or replace existing list 868 878 * 869 879 * @return true|WP_Error $response True on success, WP_Error on failure 870 880 */ 871 public function follow_post_user($post, $users, $append = true)881 public function post_set_users_to_notify($post, $users, $append = true) 872 882 { 873 883 $post = get_post($post); … … 883 893 884 894 $user_terms = array(); 895 885 896 foreach ($users as $user) 886 897 { … … 901 912 902 913 // Add user as a term if they don't exist 903 $term = $this->add_term_if_not_exists($name, $this-> following_users_taxonomy);914 $term = $this->add_term_if_not_exists($name, $this->notify_user_taxonomy); 904 915 905 916 if (!is_wp_error($term)) … … 908 919 } 909 920 } 910 $set = wp_set_object_terms($post->ID, $user_terms, $this->following_users_taxonomy, $append); 921 922 $set = wp_set_object_terms($post->ID, $user_terms, $this->notify_user_taxonomy, $append); 911 923 912 924 if (is_wp_error($set)) … … 920 932 921 933 /** 922 * Removes user from following_users taxonomy for the given Post, 923 * so they no longer receive future notifications. 924 * 925 * @param object $post Post object or ID 926 * @param int|string|array $users One or more users to unfollow from the post 934 * Set a role or roles to be notified for a post 935 * 936 * @param int|object $post Post object or ID 937 * @param string|array $roles Role or roles to subscribe to post updates 938 * @param bool $append Whether roles should be added to pp_notify_role list or replace existing list 939 * 927 940 * @return true|WP_Error $response True on success, WP_Error on failure 928 941 */ 929 public function unfollow_post_user($post, $users)942 public function post_set_roles_to_notify($post, $roles, $append = true) 930 943 { 931 944 $post = get_post($post); … … 935 948 } 936 949 950 if (!is_array($roles)) 951 { 952 $roles = array($roles); 953 } 954 955 $role_terms = array(); 956 957 foreach ($roles as $role) 958 { 959 $role = get_role($role); 960 961 if (!is_object($role)) 962 { 963 continue; 964 } 965 966 // Add user as a term if they don't exist 967 $term = $this->add_term_if_not_exists($role->name, $this->notify_role_taxonomy); 968 969 if (!is_wp_error($term)) 970 { 971 $role_terms[] = $role->name; 972 } 973 } 974 975 $set = wp_set_object_terms($post->ID, $role_terms, $this->notify_role_taxonomy, $append); 976 977 if (is_wp_error($set)) 978 { 979 return $set; 980 } else 981 { 982 return true; 983 } 984 } 985 986 /** 987 * Removes user from pp_notify_user taxonomy for the given Post, 988 * so they no longer receive future notifications. 989 * 990 * @param object $post Post object or ID 991 * @param int|string|array $users One or more users to stop being notified for the post 992 * @return true|WP_Error $response True on success, WP_Error on failure 993 */ 994 public function post_set_users_stop_notify($post, $users) 995 { 996 $post = get_post($post); 997 if (!$post) 998 { 999 return new WP_Error('missing-post', $this->module->messages['missing-post']); 1000 } 1001 937 1002 if (!is_array($users)) 938 1003 { … … 940 1005 } 941 1006 942 $terms = get_the_terms($post->ID, $this-> following_users_taxonomy);1007 $terms = get_the_terms($post->ID, $this->notify_user_taxonomy); 943 1008 if (is_wp_error($terms)) 944 1009 { … … 968 1033 } 969 1034 } 970 $set = wp_set_object_terms($post->ID, $user_terms, $this-> following_users_taxonomy, false);1035 $set = wp_set_object_terms($post->ID, $user_terms, $this->notify_user_taxonomy, false); 971 1036 972 1037 if (is_wp_error($set)) … … 980 1045 981 1046 /** 982 * follow_post_usergroups() 983 * 984 */ 985 public function follow_post_usergroups($post, $usergroups = 0, $append = true) 986 { 987 if (!$this->module_enabled('user_groups')) 988 { 989 return; 990 } 991 1047 * add_role_to_notify() 1048 * 1049 */ 1050 public function add_role_to_notify($post, $roles = 0, $append = true) 1051 { 992 1052 $post_id = (is_int($post)) ? $post : $post->ID; 993 if (!is_array($ usergroups))994 { 995 $ usergroups = array($usergroups);996 } 997 998 // make sure each usergroupid is an integer and not a number stored as a string999 foreach ($ usergroups as $key => $usergroup)1000 { 1001 $ usergroups[$key] = intval($usergroup);1002 } 1003 1004 wp_set_object_terms($post_id, $ usergroups, $this->following_usergroups_taxonomy, $append);1053 if (!is_array($roles)) 1054 { 1055 $roles = array($roles); 1056 } 1057 1058 // make sure each role id is an integer and not a number stored as a string 1059 foreach ($roles as $key => $role) 1060 { 1061 $roles[$key] = intval($role); 1062 } 1063 1064 wp_set_object_terms($post_id, $roles, $this->notify_role_taxonomy, $append); 1005 1065 1006 1066 return; … … 1008 1068 1009 1069 /** 1010 * Removes users that are deleted from receiving future notifications (i.e. makes them unfollowposts FOREVER! )1070 * Removes users that are deleted from receiving future notifications (i.e. makes them out of notify list for posts FOREVER! ) 1011 1071 * 1012 1072 * @param $id int ID of the user … … 1024 1084 if ($user) 1025 1085 { 1026 // Delete term from the following_userstaxonomy1027 $ user_following_term = get_term_by('name', $user->user_login, $this->following_users_taxonomy);1028 if ($ user_following_term)1029 { 1030 wp_delete_term($ user_following_term->term_id, $this->following_users_taxonomy);1086 // Delete term from the pp_notify_user taxonomy 1087 $notify_user_term = get_term_by('name', $user->user_login, $this->notify_user_taxonomy); 1088 if ($notify_user_term) 1089 { 1090 wp_delete_term($notify_user_term->term_id, $this->notify_user_taxonomy); 1031 1091 } 1032 1092 } … … 1055 1115 1056 1116 /** 1057 * Gets a list of the users followingthe specified post1117 * Gets a list of the users to be notified for the specified post 1058 1118 * 1059 1119 * @param int $post_id The ID of the post 1060 1120 * @param string $return The field to return 1061 * @return array $users Users following the specified posts 1062 */ 1063 public function get_following_users($post_id, $return = 'user_login') 1064 { 1065 1066 // Get following_users terms for the post 1067 $users = wp_get_object_terms($post_id, $this->following_users_taxonomy, array('fields' => 'names')); 1068 1069 // Don't have any following users 1121 * @return array $users Users to notify for the specified posts 1122 */ 1123 public function get_users_to_notify($post_id, $return = 'user_login') 1124 { 1125 // Get pp_notify_user terms for the post 1126 $users = wp_get_object_terms($post_id, $this->notify_user_taxonomy, array('fields' => 'names')); 1127 1128 // Don't have any users to notify 1070 1129 if (!$users || is_wp_error($users)) 1071 1130 { … … 1124 1183 1125 1184 /** 1126 * Gets a list of the usergroups that are followingspecified post1185 * Gets a list of the roles that should be notified for the specified post 1127 1186 * 1128 1187 * @param int $post_id 1129 * @return array $ usergroups All of the usergroupslugs1130 */ 1131 public function get_ following_usergroups($post_id, $return = 'all')1188 * @return array $roles All of the role slugs 1189 */ 1190 public function get_roles_to_notify($post_id, $return = 'all') 1132 1191 { 1133 1192 global $publishpress; … … 1142 1201 } 1143 1202 1144 $ usergroups = wp_get_object_terms($post_id, $this->following_usergroups_taxonomy, array('fields' => $fields));1203 $roles = wp_get_object_terms($post_id, $this->notify_role_taxonomy, array('fields' => $fields)); 1145 1204 1146 1205 if ($return == 'slugs') 1147 1206 { 1148 1207 $slugs = array(); 1149 foreach ($ usergroups as $usergroup)1150 { 1151 $slugs[] = $ usergroup->slug;1152 } 1153 $ usergroups = $slugs;1154 } 1155 1156 return $ usergroups;1157 } 1158 1159 /** 1160 * Gets a list of posts that a user is following1208 foreach ($roles as $role) 1209 { 1210 $slugs[] = $role->slug; 1211 } 1212 $roles = $slugs; 1213 } 1214 1215 return $roles; 1216 } 1217 1218 /** 1219 * Gets a list of posts that a user is selected to be notified 1161 1220 * 1162 1221 * @param string|int $user user_login or id of user 1163 1222 * @param array $args 1164 * @return array $posts Posts a user is following1165 */ 1166 public function get_user_ following_posts($user = 0, $args = null)1223 * @return array $posts Posts a user is selected to be notified 1224 */ 1225 public function get_user_to_notify_posts($user = 0, $args = null) 1167 1226 { 1168 1227 if (!$user) … … 1179 1238 'tax_query' => array( 1180 1239 array( 1181 'taxonomy' => $this-> following_users_taxonomy,1240 'taxonomy' => $this->notify_user_taxonomy, 1182 1241 'field' => 'slug', 1183 1242 'terms' => $user, … … 1189 1248 'post_status' => 'any', 1190 1249 ); 1191 $post_args = apply_filters('pp_user_ following_posts_query_args', $post_args);1250 $post_args = apply_filters('pp_user_to_notify_posts_query_args', $post_args); 1192 1251 $posts = get_posts($post_args); 1193 1252 … … 1528 1587 public function send_notification_comment($args) 1529 1588 { 1530 1531 1532 1589 /* translators: 1: blog name, 2: post title */ 1533 1590 $subject = sprintf(__('[%1$s] New Editorial Comment: "%2$s"', 'publishpress'), $args['blogname'], $args['post_title']); -
publishpress/trunk/modules/settings/settings.php
r1827070 r1839664 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
r1827070 r1839664 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/modules/user-groups/user-groups.php
r1827070 r1839664 32 32 * class PP_User_Groups 33 33 * 34 * @todo all of them PHPdocs 35 * @todo Resolve whether the notifications component of this class should be moved to "subscriptions" 36 * @todo Decide whether it's functional to store user_ids in the term description array 37 * - Argument against: it's going to be expensive to look up usergroups for a user 38 * 34 * @todo Remove this module. It is deprecated. 39 35 */ 40 36 41 37 if (!class_exists('PP_User_Groups')) 42 38 { 39 /** 40 * Class PP_User_Groups 41 * 42 * @deprecated 43 */ 43 44 class PP_User_Groups extends PP_Module 44 45 { … … 593 594 <?php 594 595 $select_form_args = array( 595 'list_class' => 'pp -post_following_list',596 'list_class' => 'pp_post_notify_list', 596 597 'input_id' => 'usergroup_users', 597 598 ); … … 882 883 // before <tag>, after <tag>, class, id names? 883 884 $defaults = array( 884 'list_class' => 'pp -post_following_list',885 'list_class' => 'pp_post_notify_list', 885 886 'list_id' => 'pp-following_usergroups', 886 887 'input_id' => 'following_usergroups', … … 948 949 public function get_usergroups($args = array()) 949 950 { 950 951 951 // We want empty terms by default 952 952 if (!isset($args['hide_empty'])) … … 1259 1259 foreach ($all_usergroups as $usergroup) 1260 1260 { 1261 // Not in this usergroup, so keep going 1261 // Not in this user group, so keep going 1262 if (!isset($usergroup->user_ids) || empty($usergroup->user_ids || !is_array($usergroup->user_ids))) { 1263 continue; 1264 } 1265 1262 1266 if (!in_array($user_id, $usergroup->user_ids)) 1263 1267 { -
publishpress/trunk/publishpress.php
r1827070 r1839664 6 6 * Author: PublishPress 7 7 * Author URI: https://publishpress.com 8 * Version: 1.1 0.08 * Version: 1.11.0 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 239 240 240 // @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,241 'dashboard' => PUBLISHPRESS_BASE_PATH, 242 'editorial-comments' => PUBLISHPRESS_BASE_PATH, 243 'settings' => PUBLISHPRESS_BASE_PATH, 244 'efmigration' => PUBLISHPRESS_BASE_PATH, 245 245 ); 246 246 … … 249 249 250 250 // Add add-ons as the last tab 251 $module_dirs['addons'] = PUBLISHPRESS_ ROOT;251 $module_dirs['addons'] = PUBLISHPRESS_BASE_PATH; 252 252 253 253 $class_names = array(); … … 280 280 281 281 // Other utils 282 require_once(PUBLISHPRESS_ ROOT. '/common/php/util.php');282 require_once(PUBLISHPRESS_BASE_PATH . '/common/php/util.php'); 283 283 284 284 // Instantiate all of our classes onto the PublishPress object … … 288 288 if (class_exists($class_name)) 289 289 { 290 $slug = PublishPress\ Util::sanitize_module_name($slug);290 $slug = PublishPress\Legacy\Util::sanitize_module_name($slug); 291 291 $this->$slug = new $class_name(); 292 292 } -
publishpress/trunk/readme.txt
r1827070 r1839664 1 === PublishPress – WordPress Content Calendar and Notification Workflows===1 === PublishPress – PublishPress helps WordPress teams create great content === 2 2 Contributors: publishpress, andergmartins, stevejburge, pressshack 3 3 Author: PublishPress, PressShack 4 4 Author URI: https://publishpress.com 5 Tags: Content Calendar, Editorial Calendar, workflow, checklist, p re-publish5 Tags: Content Calendar, Editorial Calendar, workflow, checklist, permissions 6 6 Requires at least: 4.6 7 7 Requires PHP: 5.4 8 8 Tested up to: 4.9.4 9 Stable tag: 1.1 0.09 Stable tag: 1.11.0 10 10 License: GPLv2 or later 11 11 License URI: http://www.gnu.org/licenses/gpl-2.0.html 12 12 13 PublishPress is the collaboration tool WordPress teams. You get a beautiful editorial calendar and powerfulnotification workflows.13 PublishPress is the plugin for WordPress teams. Your team gets an editorial calendar, flexible permissions and notification workflows. 14 14 15 15 == Description == … … 19 19 PublishPress is the essential plugin for any WordPress site with multiple team members. 20 20 21 [Click here to try a free demo of PublishPress](http://publishpress.com/demo) 22 23 PublishPress has multiple tools that help your team stay organized: 24 25 * Use the [Editorial Calendar](https://publishpress.com/docs/calendar/) and [Content Overview](https://publishpress.com/docs/calendar/) to get a clear picture of all your planned and published content. 26 * You can create [Comments](https://publishpress.com/docs/editorial-comments/) and [Notifications](https://publishpress.com/docs/notifications/) to leave feedback and keep your team in the loop. 21 PublishPress has multiple tools that help your team stay organized when creating content: 22 23 * Use the [Editorial Calendar](https://publishpress.com/docs/calendar/) and [Content Overview](https://publishpress.com/docs/content-overview/) to get a clear picture of all your planned and published content. 24 * You can write [Comments](https://publishpress.com/docs/editorial-comments/) to leave feedback. 25 * Set up [Notification Workflows](https://publishpress.com/docs/notifications/) to keep your team up-to-date with what’s happening. 27 26 * You can add [Metadata](https://publishpress.com/docs/editorial-metadata/) to give your team extra information about each post. 28 27 * Create [Custom Statuses](https://publishpress.com/docs/custom-statuses/) so that WordPress matches your team’s workflow. 29 28 29 Interested in finding out more? 30 31 [Click here to try a free demo of PublishPress](https://publishpress.com/demo/). 32 [Check out premium add-ons](https://publishpress.com/pricing/) for access to all the PublishPress features. 33 34 30 35 = WHO SHOULD USE PUBLISHPRESS? = 31 36 … … 34 39 = PREMIUM ADD-ONS FOR PUBLISHPRESS = 35 40 36 [Content Checklist](https://publishpress.com/addons/content-checklist/): Set high standards for all your published content 37 [Multiple Authors](https://publishpress.com/addons/multiple-authors/): Easily assign multiple authors to one content item 38 [Permissions](https://publishpress.com/addons/publishpress-permissions/): Control who gets the click the “Publish” button 39 [WooCommerce Checklist](https://publishpress.com/addons/woocommerce-checklist/): Set high standards for all your WooCommerce products 40 [Slack Notifications](https://publishpress.com/addons/publishpress-slack/): Get Slack updates for all content changes 41 [YouTube](https://publishpress.com/addons/embedpress-youtube/): More features and design options for your YouTube videos 42 [Wistia](https://publishpress.com/addons/embedpress-wistia/): More features and design options for your Wistia videos 43 [Vimeo](https://publishpress.com/addons/embedpress-vimeo/): More features and design options for your Vimeo videos 44 45 [Check out the PublishPress Everything Club](https://publishpress.com/addons/publishpress-club/) for access to all the PublishPress add-ons. 46 47 = EDITORIAL CONTENT CALENDAR = 41 * [Content Checklist](https://publishpress.com/addons/content-checklist/): Set high standards for all your published content 42 * [Multiple Authors](https://publishpress.com/addons/multiple-authors-publishpress/): Easily assign multiple authors to one content item 43 * [Permissions](https://publishpress.com/addons/publishpress-permissions/): Control who gets the click the “Publish” button 44 * [WooCommerce Checklist](https://publishpress.com/addons/woocommerce-checklist/): Set high standards for all your WooCommerce products 45 * [Slack Notifications](https://publishpress.com/addons/publishpress-slack/): Get Slack updates for all content changes 46 47 [Check out premium add-ons](https://publishpress.com/pricing/) for access to all the PublishPress features. 48 49 = EDITORIAL CALENDAR = 48 50 49 51 The calendar gives you a powerful overview of your publishing schedule. Using the Editorial Calendar, you can easily see when content is planned, and when it was published. You can also drag-and-drop content to a new publication date. By default, you see all the WordPress content you have planned for the next six weeks. If you need to drill down, you can filter the calendar by post status, categories, users or post types. … … 91 93 To find the user settings, go to the PublishPress link in your WordPress admin area, and click the “User Groups” tab. By default, PublishPress provides four user groups: Copy Editors, Photographers, Reporters and Section Editors. 92 94 93 Currently, the most important user of user groups is [Email Notifications](http://publishpress.com/docs/notifications/), but we intend to expand the capabilities of user groups in future PublishPress releases.94 95 95 * [Click here for more on PublishPress User Groups](https://publishpress.com/docs/user-groups/) 96 96 … … 103 103 = I FOUND A BUG, OR WANT TO CONTRIBUTE CODE = 104 104 105 Great! PublishPress [is available on Github](https://github.com/OSTraining/PublishPress), and we welcome contributions from everyone. 106 107 = ALSO CHECK OUT THE EMBEDPRESS PLUGIN = 108 109 If you like PublishPress, then consider checking out [EmbedPress](https://publishpress.com/embedpress/). The EmbedPress plugin allows you to embed anything in WordPress. Here are some video examples: 110 111 * [How to embed YouTube Videos in WordPress](http://publishpress.com/embedpress/docs/youtube-wordpress/) 112 * [How to embed Vimeo Videos in WordPress](http://publishpress.com/embedpress/docs/embed-vimeo-video-wordpress/) 113 * [How to embed Wistia videos in WordPress](https://publishpress.com/embedpress/docs/add-wistia-videos-wordpress/) 114 115 EmbedPress also supports all the Google Drive formats, including these: 116 117 * [How to embed Google Docs in WordPress](http://publishpress.com/embedpress/docs/google-docs-embed-wordpress/) 118 * [How to embed Google Maps in WordPress](http://publishpress.com/embedpress/docs/google-maps-embed-wordpress/) 119 * [How to embed Google Sheets in WordPress](http://publishpress.com/embedpress/docs/embed-google-sheets-wordpress/) 120 121 = WORDPRESS TRAINING = 122 123 Visit [OSTraining](https://www.ostraining.com/) to learn from our [WordPress Training](https://www.ostraining.com/wordpress-training/) and read our [best WordPress blog posts](https://www.ostraining.com/blog/wordpress). If you’re interested in a specific WordPress topic, try specific topic areas such as these: 124 125 * [WordPress Development Classes - learn to build plugins](https://www.ostraining.com/classes/wordpress-development) 126 * [WordPress Theme Design Classes - create your first theme](https://www.ostraining.com/classes/wordpress-themes) 127 * [WordPress eCommerce Classes - set up a WordPress store](https://www.ostraining.com/classes/wordpress-ecommerce) 105 Great! We’d love to hear from you! PublishPress [is available on Github](https://github.com/OSTraining/PublishPress), and we welcome contributions from everyone. 128 106 129 107 == Frequently Asked Questions == … … 155 133 The format is based on [Keep a Changelog](http://keepachangelog.com/) 156 134 and this project adheres to [Semantic Versioning](http://semver.org/). 135 136 = [1.11.0] - 2018-03-13 = 137 138 *Fixed:* 139 140 * Fixed workflows and notifications for new posts; 141 * Fixed issue when installed from composer, related to the vendor dir not being found; 142 * Fixed style for icons in the buttons of the popup for iCal subscriptions in the calendar; 143 * Fixed hidden submenus adding basic capabilities after installing for the first time; 144 145 *Changed:* 146 147 * Changed the workflow form, adding all fields as required; 148 * Removed support for User Groups - they are deprecated in favor of Roles, in PublishPress; 149 * Moved Notifications metabox to the sidebar with high priority for posts; 150 * Cleaned up UI removing logo from the title in the admin; 151 152 *Added:* 153 154 * Added new "From" status: New. Allowing to create workflows specifically from new posts; 155 * Added new submenu for managing Roles; 156 * Added new receiver option for notification workflows to reach Roles; 157 * Added support for multiple Roles per user. A new field is displayed in the user's profile allowing to select multiple roles; 157 158 158 159 = [1.10.0] - 2018-02-21 = -
publishpress/trunk/twig/workflow_help.twig
r1805300 r1839664 1 <p>{{ labels.validation_help }}</p> 1 2 <h3>Content</h3> 2 3 <p>{{ labels.pre_text }}</p> -
publishpress/trunk/twig/workflow_metabox.twig
r1762253 r1839664 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
r1827070 r1839664 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/autoload_classmap.php
r1827070 r1839664 7 7 8 8 return array( 9 'WP_Async_Request' => $vendorDir . '/a5hleyrich/wp-background-processing/classes/wp-async-request.php',10 'WP_Background_Process' => $vendorDir . '/a5hleyrich/wp-background-processing/classes/wp-background-process.php',11 9 ); -
publishpress/trunk/vendor/composer/autoload_psr4.php
r1827070 r1839664 8 8 return array( 9 9 'Twig\\' => array($vendorDir . '/twig/twig/src'), 10 'PublishPress\\Core\\' => array($baseDir . '/core'), 10 11 'PublishPress\\Builder\\' => array($vendorDir . '/publishpress/wordpress-plugin-builder/src'), 11 12 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), -
publishpress/trunk/vendor/composer/autoload_static.php
r1827070 r1839664 14 14 'P' => 15 15 array ( 16 'PublishPress\\Core\\' => 18, 16 17 'PublishPress\\Builder\\' => 21, 17 18 'Psr\\Container\\' => 14, … … 23 24 array ( 24 25 0 => __DIR__ . '/..' . '/twig/twig/src', 26 ), 27 'PublishPress\\Core\\' => 28 array ( 29 0 => __DIR__ . '/../..' . '/core', 25 30 ), 26 31 'PublishPress\\Builder\\' => … … 51 56 ); 52 57 53 public static $classMap = array (54 'WP_Async_Request' => __DIR__ . '/..' . '/a5hleyrich/wp-background-processing/classes/wp-async-request.php',55 'WP_Background_Process' => __DIR__ . '/..' . '/a5hleyrich/wp-background-processing/classes/wp-background-process.php',56 );57 58 58 public static function getInitializer(ClassLoader $loader) 59 59 { … … 62 62 $loader->prefixDirsPsr4 = ComposerStaticInit07ee49dc1d4d96922078443d4192a8c4::$prefixDirsPsr4; 63 63 $loader->prefixesPsr0 = ComposerStaticInit07ee49dc1d4d96922078443d4192a8c4::$prefixesPsr0; 64 $loader->classMap = ComposerStaticInit07ee49dc1d4d96922078443d4192a8c4::$classMap;65 64 66 65 }, null, ClassLoader::class); -
publishpress/trunk/vendor/composer/installed.json
r1827070 r1839664 1 1 [ 2 {3 "name": "a5hleyrich/wp-background-processing",4 "version": "1.0.1",5 "version_normalized": "1.0.1.0",6 "source": {7 "type": "git",8 "url": "https://github.com/A5hleyRich/wp-background-processing.git",9 "reference": "1f070aab5058dbaf45d5435a343033ddd8a641b1"10 },11 "dist": {12 "type": "zip",13 "url": "https://api.github.com/repos/A5hleyRich/wp-background-processing/zipball/1f070aab5058dbaf45d5435a343033ddd8a641b1",14 "reference": "1f070aab5058dbaf45d5435a343033ddd8a641b1",15 "shasum": ""16 },17 "require": {18 "php": ">=5.2"19 },20 "time": "2018-02-12T09:24:05+00:00",21 "type": "library",22 "installation-source": "dist",23 "autoload": {24 "classmap": [25 "classes/"26 ]27 },28 "notification-url": "https://packagist.org/downloads/",29 "license": [30 "GPL-2.0-only"31 ],32 "authors": [33 {34 "name": "Ashley Rich",35 "email": "[email protected]"36 }37 ],38 "description": "WP Background Processing can be used to fire off non-blocking asynchronous requests or as a background processing tool, allowing you to queue tasks."39 },40 2 { 41 3 "name": "pimple/pimple", … … 143 105 { 144 106 "name": "publishpress/wordpress-plugin-builder", 145 "version": "2.1. 1",146 "version_normalized": "2.1. 1.0",107 "version": "2.1.4", 108 "version_normalized": "2.1.4.0", 147 109 "source": { 148 110 "type": "git", 149 111 "url": "https://github.com/OSTraining/WordPress-Plugin-Builder.git", 150 "reference": " cde0010cf4aab656db6b7764dcd0d482290718a7"151 }, 152 "dist": { 153 "type": "zip", 154 "url": "https://api.github.com/repos/OSTraining/WordPress-Plugin-Builder/zipball/ cde0010cf4aab656db6b7764dcd0d482290718a7",155 "reference": " cde0010cf4aab656db6b7764dcd0d482290718a7",156 "shasum": "" 157 }, 158 "time": "2018-0 2-13T23:06:08+00:00",112 "reference": "6658ad5e35ec32877ee941e3680702bfb86986e5" 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 "time": "2018-03-01T22:09:46+00:00", 159 121 "type": "library", 160 122 "installation-source": "dist", … … 176 138 "description": "Base class for WordPress plugin builder", 177 139 "support": { 178 "source": "https://github.com/OSTraining/WordPress-Plugin-Builder/tree/2.1. 1",140 "source": "https://github.com/OSTraining/WordPress-Plugin-Builder/tree/2.1.4", 179 141 "issues": "https://github.com/OSTraining/WordPress-Plugin-Builder/issues" 180 142 } … … 182 144 { 183 145 "name": "twig/twig", 184 "version": "v1.35. 0",185 "version_normalized": "1.35. 0.0",146 "version": "v1.35.2", 147 "version_normalized": "1.35.2.0", 186 148 "source": { 187 149 "type": "git", 188 150 "url": "https://github.com/twigphp/Twig.git", 189 "reference": " daa657073e55b0a78cce8fdd22682fddecc6385f"190 }, 191 "dist": { 192 "type": "zip", 193 "url": "https://api.github.com/repos/twigphp/Twig/zipball/ daa657073e55b0a78cce8fdd22682fddecc6385f",194 "reference": " daa657073e55b0a78cce8fdd22682fddecc6385f",151 "reference": "9c24f2cd39dc1906b76879e099970b7e53724601" 152 }, 153 "dist": { 154 "type": "zip", 155 "url": "https://api.github.com/repos/twigphp/Twig/zipball/9c24f2cd39dc1906b76879e099970b7e53724601", 156 "reference": "9c24f2cd39dc1906b76879e099970b7e53724601", 195 157 "shasum": "" 196 158 }, … … 203 165 "symfony/phpunit-bridge": "~3.3@dev" 204 166 }, 205 "time": "201 7-09-27T18:06:46+00:00",167 "time": "2018-03-03T16:21:29+00:00", 206 168 "type": "library", 207 169 "extra": { -
publishpress/trunk/vendor/twig/twig/.travis.yml
r1744962 r1839664 9 9 10 10 php: 11 - 5.312 11 - 5.4 13 12 - 5.5 … … 15 14 - 7.0 16 15 - 7.1 16 - 7.2 17 17 - nightly 18 18 19 19 env: 20 20 - TWIG_EXT=no 21 - TWIG_EXT=yes22 21 23 22 before_install: … … 41 40 matrix: 42 41 fast_finish: true 43 exclude: 44 - php: 7.0 42 include: 43 - php: 5.3 44 dist: precise 45 45 env: TWIG_EXT=yes 46 - php: 7.1 46 - php: 5.3 47 dist: precise 48 env: TWIG_EXT=no 49 - php: 5.4 47 50 env: TWIG_EXT=yes 48 - php: nightly51 - php: 5.5 49 52 env: TWIG_EXT=yes 53 - php: 5.6 54 env: TWIG_EXT=yes -
publishpress/trunk/vendor/twig/twig/CHANGELOG
r1744962 r1839664 1 * 1.35.2 (2018-03-03) 2 3 * fixed a regression in the way the profiler is registered in templates 4 5 * 1.35.1 (2018-03-02) 6 7 * added an exception when using "===" instead of "same as" 8 * fixed possible array to string conversion concealing actual error 9 * made variable names deterministic in compiled templates 10 * fixed length filter when passing an instance of IteratorAggregate 11 * fixed Environment::resolveTemplate to accept instances of TemplateWrapper 12 1 13 * 1.35.0 (2017-09-27) 2 14 -
publishpress/trunk/vendor/twig/twig/LICENSE
r1597614 r1839664 1 Copyright (c) 2009-201 7by the Twig Team.1 Copyright (c) 2009-2018 by the Twig Team. 2 2 3 3 Some rights reserved. -
publishpress/trunk/vendor/twig/twig/doc/advanced.rst
r1704384 r1839664 801 801 public function rot13($value) 802 802 { 803 return $ rot13Provider->rot13($value);803 return $this->rot13Provider->rot13($value); 804 804 } 805 805 } … … 850 850 public function rot13($value) 851 851 { 852 return $ rot13Provider->rot13($value);852 return $this->rot13Provider->rot13($value); 853 853 } 854 854 } -
publishpress/trunk/vendor/twig/twig/doc/filters/length.rst
r1704384 r1839664 15 15 it will return the length of the string provided by that method. 16 16 17 For objects that implement the ``IteratorAggregate`` interface, ``length`` will use the return value of the ``iterator_count()`` method. 18 17 19 .. code-block:: jinja 18 20 -
publishpress/trunk/vendor/twig/twig/doc/filters/replace.rst
r1704384 r1839664 12 12 if the foo parameter equals to the foo string. #} 13 13 14 {# using % as a delimiter is purely conventional and optional #} 15 16 {{ "I like this and --that--."|replace({'this': foo, '--that--': "bar"}) }} 17 18 {# outputs I like foo and bar #} 19 14 20 Arguments 15 21 --------- -
publishpress/trunk/vendor/twig/twig/doc/functions/block.rst
r1704384 r1839664 19 19 {% block body %}{% endblock %} 20 20 21 The ``block`` function can also be used to display one block ofanother21 The ``block`` function can also be used to display one block from another 22 22 template: 23 23 -
publishpress/trunk/vendor/twig/twig/ext/twig/php_twig.h
r1744962 r1839664 16 16 #define PHP_TWIG_H 17 17 18 #define PHP_TWIG_VERSION "1.35. 0"18 #define PHP_TWIG_VERSION "1.35.2" 19 19 20 20 #include "php.h" -
publishpress/trunk/vendor/twig/twig/ext/twig/twig.c
r1704384 r1839664 871 871 if (null === $object) { 872 872 $message = sprintf('Impossible to invoke a method ("%s") on a null variable', $item); 873 } elseif (is_array($object)) { 874 $message = sprintf('Impossible to invoke a method ("%s") on an array.', $item); 873 875 } else { 874 876 $message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s")', $item, gettype($object), $object); … … 886 888 Z_ADDREF_P(object); 887 889 if (Z_TYPE_P(object) == IS_NULL) { 888 convert_to_string_ex(&object);889 890 TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Impossible to invoke a method (\"%s\") on a %s variable.", item, type_name);890 TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Impossible to invoke a method (\"%s\") on a null variable.", item); 891 } else if (Z_TYPE_P(object) == IS_ARRAY) { 892 TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Impossible to invoke a method (\"%s\") on an array.", item); 891 893 } else { 892 894 convert_to_string_ex(&object); -
publishpress/trunk/vendor/twig/twig/lib/Twig/Compiler.php
r1704384 r1839664 26 26 protected $sourceLine; 27 27 protected $filename; 28 private $varNameSalt = 0; 28 29 29 30 public function __construct(Twig_Environment $env) … … 79 80 $this->sourceLine = 1; 80 81 $this->indentation = $indentation; 82 $this->varNameSalt = 0; 81 83 82 84 if ($node instanceof Twig_Node_Module) { … … 277 279 public function getVarName() 278 280 { 279 return sprintf('__internal_%s', hash('sha256', uniqid(mt_rand(), true), false));281 return sprintf('__internal_%s', hash('sha256', __METHOD__.$this->varNameSalt++)); 280 282 } 281 283 } -
publishpress/trunk/vendor/twig/twig/lib/Twig/Environment.php
r1744962 r1839664 17 17 class Twig_Environment 18 18 { 19 const VERSION = '1.35. 0';20 const VERSION_ID = 1350 0;19 const VERSION = '1.35.2'; 20 const VERSION_ID = 13501; 21 21 const MAJOR_VERSION = 1; 22 22 const MINOR_VERSION = 35; 23 const RELEASE_VERSION = 0;23 const RELEASE_VERSION = 1; 24 24 const EXTRA_VERSION = ''; 25 25 … … 133 133 if (is_string($this->originalCache)) { 134 134 $r = new ReflectionMethod($this, 'writeCacheFile'); 135 if ( $r->getDeclaringClass()->getName() !== __CLASS__) {135 if (__CLASS__ !== $r->getDeclaringClass()->getName()) { 136 136 @trigger_error('The Twig_Environment::writeCacheFile method is deprecated since version 1.22 and will be removed in Twig 2.0.', E_USER_DEPRECATED); 137 137 … … 140 140 141 141 $r = new ReflectionMethod($this, 'getCacheFilename'); 142 if ( $r->getDeclaringClass()->getName() !== __CLASS__) {142 if (__CLASS__ !== $r->getDeclaringClass()->getName()) { 143 143 @trigger_error('The Twig_Environment::getCacheFilename method is deprecated since version 1.22 and will be removed in Twig 2.0.', E_USER_DEPRECATED); 144 144 … … 563 563 * Tries to load a template consecutively from an array. 564 564 * 565 * Similar to loadTemplate() but it also accepts Twig_TemplateInterface instances and an array566 * of templates where each is tried to be loaded.567 * 568 * @param string|Twig_Template| array $names A template or an array of templates to try consecutively569 * 570 * @return Twig_Template 565 * Similar to loadTemplate() but it also accepts instances of Twig_Template and 566 * Twig_TemplateWrapper, and an array of templates where each is tried to be loaded. 567 * 568 * @param string|Twig_Template|Twig_TemplateWrapper|array $names A template or an array of templates to try consecutively 569 * 570 * @return Twig_Template|Twig_TemplateWrapper 571 571 * 572 572 * @throws Twig_Error_Loader When none of the templates can be found … … 581 581 foreach ($names as $name) { 582 582 if ($name instanceof Twig_Template) { 583 return $name; 584 } 585 586 if ($name instanceof Twig_TemplateWrapper) { 583 587 return $name; 584 588 } -
publishpress/trunk/vendor/twig/twig/lib/Twig/ExpressionParser.php
r1704384 r1839664 200 200 } 201 201 202 // no break 202 203 default: 203 204 if ($token->test(Twig_Token::PUNCTUATION_TYPE, '[')) { … … 205 206 } elseif ($token->test(Twig_Token::PUNCTUATION_TYPE, '{')) { 206 207 $node = $this->parseHashExpression(); 208 } elseif ($token->test(Twig_Token::OPERATOR_TYPE, '=') && ('==' === $this->parser->getStream()->look(-1)->getValue() || '!=' === $this->parser->getStream()->look(-1)->getValue())) { 209 throw new Twig_Error_Syntax(sprintf('Unexpected operator of value "%s". Did you try to use "===" or "!==" for strict comparison? Use "is same as(value)" instead.', $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()); 207 210 } else { 208 211 throw new Twig_Error_Syntax(sprintf('Unexpected token "%s" of value "%s".', Twig_Token::typeToEnglish($token->getType()), $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()); … … 314 317 while (true) { 315 318 $token = $this->parser->getCurrentToken(); 316 if ( $token->getType() == Twig_Token::PUNCTUATION_TYPE) {319 if (Twig_Token::PUNCTUATION_TYPE == $token->getType()) { 317 320 if ('.' == $token->getValue() || '[' == $token->getValue()) { 318 321 $node = $this->parseSubscriptExpression($node); … … 385 388 $arguments = new Twig_Node_Expression_Array(array(), $lineno); 386 389 $type = Twig_Template::ANY_CALL; 387 if ( $token->getValue() == '.') {390 if ('.' == $token->getValue()) { 388 391 $token = $stream->next(); 389 392 if ( 390 $token->getType() == Twig_Token::NAME_TYPE393 Twig_Token::NAME_TYPE == $token->getType() 391 394 || 392 $token->getType() == Twig_Token::NUMBER_TYPE395 Twig_Token::NUMBER_TYPE == $token->getType() 393 396 || 394 ( $token->getType() == Twig_Token::OPERATOR_TYPE&& preg_match(Twig_Lexer::REGEX_NAME, $token->getValue()))397 (Twig_Token::OPERATOR_TYPE == $token->getType() && preg_match(Twig_Lexer::REGEX_NAME, $token->getValue())) 395 398 ) { 396 399 $arg = new Twig_Node_Expression_Constant($token->getValue(), $lineno); -
publishpress/trunk/vendor/twig/twig/lib/Twig/Extension/Core.php
r1704384 r1839664 662 662 if ($start >= 0 && $length >= 0 && $item instanceof Iterator) { 663 663 try { 664 return iterator_to_array(new LimitIterator($item, $start, $length === null? -1 : $length), $preserveKeys);664 return iterator_to_array(new LimitIterator($item, $start, null === $length ? -1 : $length), $preserveKeys); 665 665 } catch (OutOfBoundsException $exception) { 666 666 return array(); … … 1217 1217 * hex entity for the Unicode replacement character. 1218 1218 */ 1219 if (($ord <= 0x1f && $chr != "\t" && $chr != "\n" && $chr != "\r") || ($ord >= 0x7f && $ord <= 0x9f)) {1219 if (($ord <= 0x1f && "\t" != $chr && "\n" != $chr && "\r" != $chr) || ($ord >= 0x7f && $ord <= 0x9f)) { 1220 1220 return '�'; 1221 1221 } … … 1225 1225 * replace it with while grabbing the hex value of the character. 1226 1226 */ 1227 if ( strlen($chr) == 1) {1227 if (1 == strlen($chr)) { 1228 1228 $hex = strtoupper(substr('00'.bin2hex($chr), -2)); 1229 1229 } else { … … 1272 1272 } 1273 1273 1274 if ($thing instanceof \IteratorAggregate) { 1275 return iterator_count($thing); 1276 } 1277 1274 1278 return 1; 1275 1279 } … … 1369 1373 if ($thing instanceof \Countable || is_array($thing)) { 1370 1374 return count($thing); 1375 } 1376 1377 if ($thing instanceof \IteratorAggregate) { 1378 return iterator_count($thing); 1371 1379 } 1372 1380 … … 1445 1453 * <pre> 1446 1454 * {# evaluates to true if the foo variable is an array or a traversable object #} 1447 * {% if foo is traversable %}1455 * {% if foo is iterable %} 1448 1456 * {# ... #} 1449 1457 * {% endif %} -
publishpress/trunk/vendor/twig/twig/lib/Twig/Lexer.php
r1704384 r1839664 236 236 237 237 if ($this->cursor >= $this->end) { 238 throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', $this->state === self::STATE_BLOCK? 'block' : 'variable'), $this->currentVarBlockLine, $this->source);238 throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', self::STATE_BLOCK === $this->state ? 'block' : 'variable'), $this->currentVarBlockLine, $this->source); 239 239 } 240 240 } … … 338 338 } elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, null, $this->cursor)) { 339 339 list($expect, $lineno) = array_pop($this->brackets); 340 if ( $this->code[$this->cursor] != '"') {340 if ('"' != $this->code[$this->cursor]) { 341 341 throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); 342 342 } -
publishpress/trunk/vendor/twig/twig/lib/Twig/Loader/Filesystem.php
r1704384 r1839664 280 280 return strspn($file, '/\\', 0, 1) 281 281 || (strlen($file) > 3 && ctype_alpha($file[0]) 282 && substr($file, 1, 1) === ':'282 && ':' === substr($file, 1, 1) 283 283 && strspn($file, '/\\', 2, 1) 284 284 ) -
publishpress/trunk/vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php
r1704384 r1839664 57 57 if ($this->inABody) { 58 58 if (!$node instanceof Twig_Node_Expression) { 59 if ( get_class($node) !== 'Twig_Node') {59 if ('Twig_Node' !== get_class($node)) { 60 60 array_unshift($this->prependedNodes, array()); 61 61 } … … 89 89 $this->inABody = false; 90 90 } elseif ($this->inABody) { 91 if (!$expression && get_class($node) !== 'Twig_Node'&& $prependedNodes = array_shift($this->prependedNodes)) {91 if (!$expression && 'Twig_Node' !== get_class($node) && $prependedNodes = array_shift($this->prependedNodes)) { 92 92 $nodes = array(); 93 93 foreach (array_unique($prependedNodes) as $name) { -
publishpress/trunk/vendor/twig/twig/lib/Twig/Parser.php
r1704384 r1839664 32 32 protected $traits; 33 33 protected $embeddedTemplates = array(); 34 private $varNameSalt = 0; 34 35 35 36 public function __construct(Twig_Environment $env) … … 50 51 public function getVarName() 51 52 { 52 return sprintf('__internal_%s', hash('sha256', uniqid(mt_rand(), true), false));53 return sprintf('__internal_%s', hash('sha256', __METHOD__.$this->varNameSalt++)); 53 54 } 54 55 … … 99 100 $this->importedSymbols = array(array()); 100 101 $this->embeddedTemplates = array(); 102 $this->varNameSalt = 0; 101 103 102 104 try { … … 154 156 $token = $this->getCurrentToken(); 155 157 156 if ( $token->getType() !== Twig_Token::NAME_TYPE) {158 if (Twig_Token::NAME_TYPE !== $token->getType()) { 157 159 throw new Twig_Error_Syntax('A block must start with a tag name.', $token->getLine(), $this->stream->getSourceContext()); 158 160 } … … 384 386 } 385 387 386 throw new Twig_Error_Syntax('A template that extends another one cannot include content s outside Twig blocks. Did you forget to put the contentsinside a {% block %} tag?', $node->getTemplateLine(), $this->stream->getSourceContext());388 throw new Twig_Error_Syntax('A template that extends another one cannot include content outside Twig blocks. Did you forget to put the content inside a {% block %} tag?', $node->getTemplateLine(), $this->stream->getSourceContext()); 387 389 } 388 390 -
publishpress/trunk/vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php
r1704384 r1839664 56 56 private function getVarName() 57 57 { 58 return sprintf('__internal_%s', hash('sha256', uniqid(mt_rand(), true), false));58 return sprintf('__internal_%s', hash('sha256', $this->extensionName)); 59 59 } 60 60 -
publishpress/trunk/vendor/twig/twig/lib/Twig/Template.php
r1704384 r1839664 569 569 if (null === $object) { 570 570 $message = sprintf('Impossible to invoke a method ("%s") on a null variable.', $item); 571 } elseif (is_array($object)) { 572 $message = sprintf('Impossible to invoke a method ("%s") on an array.', $item); 571 573 } else { 572 574 $message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s").', $item, gettype($object), $object); … … 697 699 @trigger_error($message, E_USER_DEPRECATED); 698 700 699 return $ret === ''? '' : new Twig_Markup($ret, $this->env->getCharset());701 return '' === $ret ? '' : new Twig_Markup($ret, $this->env->getCharset()); 700 702 } 701 703 -
publishpress/trunk/vendor/twig/twig/lib/Twig/TokenParser/For.php
r1704384 r1839664 41 41 $stream->expect(Twig_Token::BLOCK_END_TYPE); 42 42 $body = $this->parser->subparse(array($this, 'decideForFork')); 43 if ( $stream->next()->getValue() == 'else') {43 if ('else' == $stream->next()->getValue()) { 44 44 $stream->expect(Twig_Token::BLOCK_END_TYPE); 45 45 $else = $this->parser->subparse(array($this, 'decideForEnd'), true); -
publishpress/trunk/vendor/twig/twig/lib/Twig/TokenParserBroker.php
r1597614 r1839664 62 62 } 63 63 64 public function addTokenParserBroker( Twig_TokenParserBroker$broker)64 public function addTokenParserBroker(self $broker) 65 65 { 66 66 $this->brokers[] = $broker; 67 67 } 68 68 69 public function removeTokenParserBroker( Twig_TokenParserBroker$broker)69 public function removeTokenParserBroker(self $broker) 70 70 { 71 71 if (false !== $pos = array_search($broker, $this->brokers)) { -
publishpress/trunk/vendor/twig/twig/lib/Twig/TokenStream.php
r1704384 r1839664 140 140 public function isEOF() 141 141 { 142 return $this->tokens[$this->current]->getType() === Twig_Token::EOF_TYPE;142 return Twig_Token::EOF_TYPE === $this->tokens[$this->current]->getType(); 143 143 } 144 144 -
publishpress/trunk/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php
r1744962 r1839664 253 253 } catch (Exception $e) { 254 254 } 255 if ( $e === null) {255 if (null === $e) { 256 256 $this->fail('An exception should be thrown for this test to be valid.'); 257 257 } -
publishpress/trunk/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/child_contents_outside_blocks.test
r1704384 r1839664 1 1 --TEST-- 2 Exception for child templates defining content soutside blocks defined by parent2 Exception for child templates defining content outside blocks defined by parent 3 3 --TEMPLATE-- 4 4 {% extends 'base.twig' %} … … 13 13 {% endblock %} 14 14 --EXCEPTION-- 15 Twig_Error_Syntax: A template that extends another one cannot include content s outside Twig blocks. Did you forget to put the contentsinside a {% block %} tag in "index.twig" at line 3?15 Twig_Error_Syntax: A template that extends another one cannot include content outside Twig blocks. Did you forget to put the content inside a {% block %} tag in "index.twig" at line 3? -
publishpress/trunk/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test
r1704384 r1839664 7 7 {{ to_string_able|length }} 8 8 {{ countable|length }} 9 {{ iterator_aggregate|length }} 9 10 {{ null|length }} 10 11 {{ magic|length }} … … 17 18 'to_string_able' => new ToStringStub('foobar'), 18 19 'countable' => new CountableStub(42), /* also asserts we do *not* call __toString() */ 20 'iterator_aggregate' => new IteratorAggregateStub(array('a', 'b', 'c')), /* also asserts we do *not* call __toString() */ 19 21 'null' => null, 20 22 'magic' => new MagicCallStub(), /* used to assert we do *not* call __call */ … … 27 29 6 28 30 42 31 3 29 32 0 30 33 1 -
publishpress/trunk/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php
r1704384 r1839664 308 308 } 309 309 } 310 311 /** 312 * This class is used in tests for the length filter. 313 */ 314 class IteratorAggregateStub implements \IteratorAggregate 315 { 316 private $data; 317 318 public function __construct(array $data) 319 { 320 $this->data = $data; 321 } 322 323 public function getIterator() 324 { 325 return new ArrayIterator($this->data); 326 } 327 } -
publishpress/trunk/vendor/twig/twig/test/Twig/Tests/TemplateTest.php
r1744962 r1839664 59 59 array('{{ null.a }}', 'Impossible to access an attribute ("a") on a null variable in "%s" at line 1.'), 60 60 array('{{ null.a() }}', 'Impossible to invoke a method ("a") on a null variable in "%s" at line 1.'), 61 array('{{ array.a() }}', 'Impossible to invoke a method ("a") on an array in "%s" at line 1.'), 61 62 array('{{ empty_array.a }}', 'Key "a" does not exist as the array is empty in "%s" at line 1.'), 62 63 array('{{ array.a }}', 'Key "a" for array with keys "foo" does not exist in "%s" at line 1.'),
Note: See TracChangeset
for help on using the changeset viewer.