Changeset 1816382
- Timestamp:
- 02/06/2018 01:02:29 PM (8 years ago)
- Location:
- publishpress/trunk
- Files:
-
- 11 edited
-
common/css/publishpress-admin.css (modified) (1 diff)
-
common/php/class-module.php (modified) (1 diff)
-
includes.php (modified) (1 diff)
-
libraries/Notifications/Plugin.php (modified) (3 diffs)
-
libraries/Util.php (modified) (1 diff)
-
modules/calendar/calendar.php (modified) (2 diffs)
-
modules/content-overview/content-overview.php (modified) (1 diff)
-
modules/notifications/notifications.php (modified) (2 diffs)
-
modules/user-groups/user-groups.php (modified) (1 diff)
-
publishpress.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
publishpress/trunk/common/css/publishpress-admin.css
r1805300 r1816382 90 90 } 91 91 92 /* Admin icon customized per admin theme, excluding the default and light */ 93 .admin-color-blue #toplevel_page_pp-calendar .dashicons-before::before, 94 .admin-color-coffee #toplevel_page_pp-calendar .dashicons-before::before, 95 .admin-color-ectoplasm #toplevel_page_pp-calendar .dashicons-before::before, 96 .admin-color-midnight #toplevel_page_pp-calendar .dashicons-before::before, 97 .admin-color-ocean #toplevel_page_pp-calendar .dashicons-before::before, 98 .admin-color-sunrise #toplevel_page_pp-calendar .dashicons-before::before, 99 100 .admin-color-blue #toplevel_page_pp-calendar .wp-has-current-submenu .dashicons-before::before, 101 .admin-color-coffee #toplevel_page_pp-calendar .wp-has-current-submenu .dashicons-before::before, 102 .admin-color-ectoplasm #toplevel_page_pp-calendar .wp-has-current-submenu .dashicons-before::before, 103 .admin-color-midnight #toplevel_page_pp-calendar .wp-has-current-submenu .dashicons-before::before, 104 .admin-color-ocean #toplevel_page_pp-calendar .wp-has-current-submenu .dashicons-before::before, 105 .admin-color-sunrise #toplevel_page_pp-calendar .wp-has-current-submenu .dashicons-before::before, 106 107 .admin-color-blue #toplevel_page_pp-calendar:active .wp-not-current-submenu .dashicons-before::before, 108 .admin-color-coffee #toplevel_page_pp-calendar:active .wp-not-current-submenu .dashicons-before::before, 109 .admin-color-ectoplasm #toplevel_page_pp-calendar:active .wp-not-current-submenu .dashicons-before::before, 110 .admin-color-midnight #toplevel_page_pp-calendar:active .wp-not-current-submenu .dashicons-before::before, 111 .admin-color-ocean #toplevel_page_pp-calendar:active .wp-not-current-submenu .dashicons-before::before, 112 .admin-color-sunrise #toplevel_page_pp-calendar:active .wp-not-current-submenu .dashicons-before::before, 113 114 .admin-color-blue #toplevel_page_pp-calendar:hover .wp-not-current-submenu .dashicons-before::before, 115 .admin-color-coffee #toplevel_page_pp-calendar:hover .wp-not-current-submenu .dashicons-before::before, 116 .admin-color-ectoplasm #toplevel_page_pp-calendar:hover .wp-not-current-submenu .dashicons-before::before, 117 .admin-color-midnight #toplevel_page_pp-calendar:hover .wp-not-current-submenu .dashicons-before::before, 118 .admin-color-ocean #toplevel_page_pp-calendar:hover .wp-not-current-submenu .dashicons-before::before, 119 .admin-color-sunrise #toplevel_page_pp-calendar:hover .wp-not-current-submenu .dashicons-before::before 120 { 121 background-position: 0 -60px; 122 } 123 92 124 #toplevel_page_pp-calendar:active .wp-not-current-submenu .dashicons-before::before, 93 125 #toplevel_page_pp-calendar:hover .wp-not-current-submenu .dashicons-before::before { 94 126 background-position: 0 -26px; 127 } 128 129 /* Customize the icon for "Light" admin theme's hover and active states */ 130 .admin-color-light #toplevel_page_pp-calendar:active .wp-not-current-submenu .dashicons-before::before, 131 .admin-color-light #toplevel_page_pp-calendar:hover .wp-not-current-submenu .dashicons-before::before 132 { 133 background-position: 0 8px; 95 134 } 96 135 -
publishpress/trunk/common/php/class-module.php
r1813548 r1816382 616 616 } 617 617 618 /** 619 * Adds an array of capabilities to a role. 620 * 621 * @since 0.7 622 * 623 * @param string $role A standard WP user role like 'administrator' or 'author' 624 * @param array $caps One or more user caps to add 618 619 /** 620 * @param $role 621 * @param $caps 622 * @deprecated 1.9.8 Use PublishPress\Util class instead 625 623 */ 626 624 public function add_caps_to_role( $role, $caps ) { 627 625 628 // In some contexts, we don't want to add caps to roles 629 if ( apply_filters( 'pp_kill_add_caps_to_role', false, $role, $caps ) ) { 630 return; 631 } 632 633 global $wp_roles; 634 635 if ( $wp_roles->is_role( $role ) ) { 636 $role = get_role( $role ); 637 638 foreach ( $caps as $cap ) { 639 $role->add_cap( $cap ); 640 } 641 } 626 PublishPress\Util::add_caps_to_role($role, $caps); 642 627 } 643 628 -
publishpress/trunk/includes.php
r1813564 r1816382 41 41 42 42 // Define contants 43 define( 'PUBLISHPRESS_VERSION', '1.9. 7' );43 define( 'PUBLISHPRESS_VERSION', '1.9.8' ); 44 44 define( 'PUBLISHPRESS_ROOT', dirname( __FILE__ ) ); 45 45 define( 'PUBLISHPRESS_FILE_PATH', PUBLISHPRESS_ROOT . '/' . basename( __FILE__ ) ); -
publishpress/trunk/libraries/Notifications/Plugin.php
r1805300 r1816382 24 24 */ 25 25 public function init() { 26 add_action( 'init', array( $this, 'create_post_type' ) );27 28 26 add_action( 'load-edit.php', [ $this, 'add_load_edit_hooks' ] ); 29 27 30 28 add_filter( 'post_updated_messages', [ $this, 'filter_post_updated_messages' ] ); 31 29 add_filter( 'bulk_post_updated_messages', [ $this, 'filter_bulk_post_updated_messages' ], 10, 2 ); 32 }33 34 /**35 * Creates the custom post types for the notifications36 */37 public function create_post_type() {38 if ( $this->is_module_enabled( 'notifications' )39 && $this->is_module_enabled( 'improved_notifications' ) ) {40 // Notification Workflows41 register_post_type(42 PUBLISHPRESS_NOTIF_POST_TYPE_WORKFLOW,43 array(44 'labels' => array(45 'name' => __( 'Notification Workflows', 'publishpress' ),46 'singular_name' => __( 'Notification Workflow', 'publishpress' ),47 'add_new_item' => __( 'Add New Notification Workflow', 'publishpress' ),48 'edit_item' => __( 'Edit Notification Workflow', 'publishpress' ),49 'search_items' => __( 'Search Workflows', 'publishpress' ),50 'menu_name' => __( 'Notifications', 'publishpress' ),51 'name_admin_bar' => __( 'Notification Workflow', 'publishpress' ),52 'not_found' => __( 'No Workflow found', 'publishpress' ),53 'not_found_in_trash' => __( 'No Workflow found', 'publishpress' ),54 ),55 'public' => false,56 'publicly_queryable' => false,57 'has_archive' => false,58 'rewrite' => array( 'slug' => 'notification-workflows' ),59 'show_ui' => true,60 'query_var' => true,61 'capability_type' => 'post',62 'hierarchical' => false,63 'can_export' => true,64 'show_in_admin_bar' => true,65 'exclude_from_search' => true,66 'show_in_menu' => 'pp-calendar',67 'menu_position' => '20',68 'supports' => array(69 'title',70 )71 )72 );73 74 // Notifications75 register_post_type(76 PUBLISHPRESS_NOTIF_POST_TYPE_MESSAGE,77 array(78 'labels' => array(79 'name' => __( 'Notifications', 'publishpress' ),80 'singular_name' => __( 'Notification', 'publishpress' )81 ),82 'public' => false,83 'publicly_queryable' => false,84 'has_archive' => false,85 'rewrite' => array( 'slug' => 'notifications' ),86 'show_ui' => false,87 'query_var' => true,88 'hierarchical' => false,89 'can_export' => false,90 'show_in_admin_bar' => false,91 'exclude_from_search' => true,92 'supports' => array(93 'title',94 'editor',95 )96 )97 );98 }99 30 } 100 31 … … 117 48 118 49 public function filter_manage_post_columns( $post_columns ) { 119 $date_column = $post_columns['date'];50 // Remove the Date column. 120 51 unset( $post_columns['date'] ); 121 52 … … 123 54 $post_columns['filter'] = __( 'Filter the content?', 'publishpress' ); 124 55 $post_columns['receivers'] = __( 'Who to notify?', 'publishpress' ); 125 $post_columns['date'] = $date_column;126 56 127 57 return $post_columns; -
publishpress/trunk/libraries/Util.php
r1805300 r1816382 94 94 return str_replace( '-', '_', $name ); 95 95 } 96 97 /** 98 * Adds an array of capabilities to a role. 99 * 100 * @since 1.9.8 101 * 102 * @param string $role A standard WP user role like 'administrator' or 'author' 103 * @param array $caps One or more user caps to add 104 */ 105 public static function add_caps_to_role($role, $caps) { 106 // In some contexts, we don't want to add caps to roles 107 if ( apply_filters( 'pp_kill_add_caps_to_role', false, $role, $caps ) ) { 108 return; 109 } 110 111 global $wp_roles; 112 113 if ( $wp_roles->is_role( $role ) ) { 114 $role = get_role( $role ); 115 116 foreach ( $caps as $cap ) { 117 $role->add_cap( $cap ); 118 } 119 } 120 } 96 121 } -
publishpress/trunk/modules/calendar/calendar.php
r1805300 r1816382 162 162 * @uses add_action() 163 163 */ 164 public function init() { 165 // Can view the calendar? 166 if ( ! $this->check_capability() ) { 167 return false; 168 } 169 170 // Menu 171 add_action( 'publishpress_admin_menu', array( $this, 'action_admin_menu' ) ); 172 173 // .ics calendar subscriptions 174 add_action( 'wp_ajax_pp_calendar_ics_subscription', array( $this, 'handle_ics_subscription' ) ); 175 add_action( 'wp_ajax_nopriv_pp_calendar_ics_subscription', array( $this, 'handle_ics_subscription' ) ); 176 177 // Define the create-post capability 178 $this->create_post_cap = apply_filters( 'pp_calendar_create_post_cap', 'edit_posts' ); 179 180 require_once( PUBLISHPRESS_ROOT . '/common/php/' . 'screen-options.php' ); 181 182 add_action( 'admin_init', array( $this, 'register_settings' ) ); 183 add_action( 'admin_print_styles', array( $this, 'add_admin_styles' ) ); 184 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) ); 185 186 // Ajax manipulation for the calendar 187 add_action( 'wp_ajax_pp_calendar_drag_and_drop', array( $this, 'handle_ajax_drag_and_drop' ) ); 188 189 // Ajax insert post placeholder for a specific date 190 add_action( 'wp_ajax_pp_insert_post', array( $this, 'handle_ajax_insert_post' ) ); 191 192 // Update metadata 193 add_action( 'wp_ajax_pp_calendar_update_metadata', array( $this, 'handle_ajax_update_metadata' ) ); 194 195 // Clear li cache for a post when post cache is cleared 196 add_action( 'clean_post_cache', array( $this, 'action_clean_li_html_cache' ) ); 197 198 // Action to regenerate the calendar feed sekret 199 add_action( 'admin_init', array( $this, 'handle_regenerate_calendar_feed_secret' ) ); 200 201 add_filter( 'post_date_column_status', array( $this, 'filter_post_date_column_status' ), 12, 4 ); 164 public function init() 165 { 166 // Can view the calendar? 167 if (!$this->check_capability()) { 168 return false; 169 } 170 171 // Menu 172 add_action('publishpress_admin_menu', array($this, 'action_admin_menu')); 173 174 // .ics calendar subscriptions 175 add_action('wp_ajax_pp_calendar_ics_subscription', array($this, 'handle_ics_subscription')); 176 add_action('wp_ajax_nopriv_pp_calendar_ics_subscription', array($this, 'handle_ics_subscription')); 177 178 // Define the create-post capability 179 $this->create_post_cap = apply_filters('pp_calendar_create_post_cap', 'edit_posts'); 180 181 require_once(PUBLISHPRESS_ROOT . '/common/php/' . 'screen-options.php'); 182 183 add_action('admin_init', array($this, 'register_settings')); 184 add_action('admin_print_styles', array($this, 'add_admin_styles')); 185 add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts')); 186 187 // Ajax manipulation for the calendar 188 add_action('wp_ajax_pp_calendar_drag_and_drop', array($this, 'handle_ajax_drag_and_drop')); 189 190 // Ajax insert post placeholder for a specific date 191 add_action('wp_ajax_pp_insert_post', array($this, 'handle_ajax_insert_post')); 192 193 // Update metadata 194 add_action('wp_ajax_pp_calendar_update_metadata', array($this, 'handle_ajax_update_metadata')); 195 196 // Clear li cache for a post when post cache is cleared 197 add_action('clean_post_cache', array($this, 'action_clean_li_html_cache')); 198 199 // Action to regenerate the calendar feed sekret 200 add_action('admin_init', array($this, 'handle_regenerate_calendar_feed_secret')); 201 202 add_filter('post_date_column_status', array($this, 'filter_post_date_column_status'), 12, 4); 202 203 } 203 204 … … 223 224 */ 224 225 public function install() { 225 // Add necessary capabilities to allow management of calendar 226 // view_calendar - administrator --> contributor 227 $calendar_roles = array( 228 'administrator' => array( 'pp_view_calendar' ), 229 'editor' => array( 'pp_view_calendar' ), 230 'author' => array( 'pp_view_calendar' ), 231 'contributor' => array( 'pp_view_calendar' ), 232 ); 233 234 foreach ( $calendar_roles as $role => $caps ) { 235 $this->add_caps_to_role( $role, $caps ); 236 } 226 237 227 } 238 228 -
publishpress/trunk/modules/content-overview/content-overview.php
r1805300 r1816382 167 167 */ 168 168 public function install() { 169 $content_overview_roles = array( 170 'administrator' => array( 'pp_view_content_overview' ), 171 'editor' => array( 'pp_view_content_overview' ), 172 'author' => array( 'pp_view_content_overview' ), 173 'contributor' => array( 'pp_view_content_overview' ) 174 ); 175 176 foreach ( $content_overview_roles as $role => $caps ) { 177 $this->add_caps_to_role( $role, $caps ); 178 } 169 179 170 } 180 171 -
publishpress/trunk/modules/notifications/notifications.php
r1809658 r1816382 127 127 } 128 128 129 // Ajax for saving notifiction updates129 // Ajax for saving notification updates 130 130 add_action( 'wp_ajax_save_notifications', array( $this, 'ajax_save_post_subscriptions' ) ); 131 131 add_action( 'wp_ajax_pp_notifications_user_post_subscription', array( $this, 'handle_user_post_subscription' ) ); … … 142 142 public function install() { 143 143 144 // Add necessary capabilities to allow management of notifications145 $notifications_roles = array(146 'administrator' => array( 'edit_post_subscriptions' ),147 'editor' => array( 'edit_post_subscriptions' ),148 'author' => array( 'edit_post_subscriptions' ),149 );150 151 foreach ( $notifications_roles as $role => $caps ) {152 $this->add_caps_to_role( $role, $caps );153 }154 144 } 155 145 -
publishpress/trunk/modules/user-groups/user-groups.php
r1805300 r1816382 142 142 public function install() 143 143 { 144 145 // Add necessary capabilities to allow management of user groups146 $usergroup_roles = array(147 'administrator' => array('edit_usergroups'),148 );149 foreach ($usergroup_roles as $role => $caps) {150 $this->add_caps_to_role($role, $caps);151 }152 153 144 // Create our default usergroups 154 145 $default_usergroups = array( -
publishpress/trunk/publishpress.php
r1813564 r1816382 6 6 * Author: PublishPress 7 7 * Author URI: https://publishpress.com 8 * Version: 1.9. 78 * Version: 1.9.8 9 9 * Text Domain: publishpress 10 10 * Domain Path: /languages … … 39 39 */ 40 40 41 use PublishPress\Util as Util; 42 use PublishPress\Notifications\Traits\Dependency_Injector; 43 use PublishPress\Notifications\Traits\PublishPress_Module; 44 41 45 require_once 'includes.php'; 42 46 43 47 // Core class 44 48 class publishpress { 45 49 use Dependency_Injector, PublishPress_Module; 46 50 47 51 // Unique identified added as a prefix to all options … … 522 526 <?php 523 527 } 528 529 /** 530 * The capabilities need to be set before the modules are loaded, 531 * so the submenu items can be displayed correctly right after activate. 532 * Otherwise we only see the submenus after visiting the PublishPress settings 533 * menu for the first time. 534 * 535 */ 536 public static function activation_hook() { 537 // Add necessary capabilities to allow management of calendar, content overview, notifications 538 $genericCaps = array('pp_view_calendar', 'pp_view_content_overview', 'edit_post_subscriptions'); 539 540 $roles = array( 541 'administrator' => $genericCaps, 542 'editor' => $genericCaps, 543 'author' => $genericCaps, 544 'contributor' => $genericCaps, 545 ); 546 547 foreach ($roles as $role => $caps) { 548 PublishPress\Util::add_caps_to_role($role, $caps); 549 } 550 551 // User groups 552 $roles = array( 553 'administrator' => array('edit_usergroups'), 554 ); 555 556 foreach ($roles as $role => $caps) { 557 PublishPress\Util::add_caps_to_role($role, $caps); 558 } 559 } 524 560 } 525 561 526 562 function PublishPress() { 563 if ( ! defined( 'PUBLISHPRESS_NOTIF_LOADED' ) ) { 564 require __DIR__ . '/includes_notifications.php'; 565 566 // Load the improved notifications 567 if (defined('PUBLISHPRESS_NOTIF_LOADED')) { 568 $plugin = new PublishPress\Notifications\Plugin(); 569 $plugin->init(); 570 } 571 } 572 527 573 return publishpress::instance(); 528 574 } 529 add_action( 'plugins_loaded', 'PublishPress' ); 530 531 // Load the improved notifications 532 require 'includes_notifications.php'; 533 if ( defined( 'PUBLISHPRESS_NOTIF_LOADED' ) ) { 534 $plugin = new PublishPress\Notifications\Plugin(); 535 $plugin->init(); 575 576 /** 577 * Registered here so the Notifications submenu is displayed right after the 578 * plugin is activate. 579 * 580 * @since 1.9.8 581 */ 582 function publishPressRegisterCustomPostTypes() { 583 if (! post_type_exists(PUBLISHPRESS_NOTIF_POST_TYPE_WORKFLOW)) { 584 // Notification Workflows 585 register_post_type( 586 PUBLISHPRESS_NOTIF_POST_TYPE_WORKFLOW, 587 array( 588 'labels' => array( 589 'name' => __( 'Notification Workflows', 'publishpress' ), 590 'singular_name' => __( 'Notification Workflow', 'publishpress' ), 591 'add_new_item' => __( 'Add New Notification Workflow', 'publishpress' ), 592 'edit_item' => __( 'Edit Notification Workflow', 'publishpress' ), 593 'search_items' => __( 'Search Workflows', 'publishpress' ), 594 'menu_name' => __( 'Notifications', 'publishpress' ), 595 'name_admin_bar' => __( 'Notification Workflow', 'publishpress' ), 596 'not_found' => __( 'No Workflow found', 'publishpress' ), 597 'not_found_in_trash' => __( 'No Workflow found', 'publishpress' ), 598 ), 599 'public' => false, 600 'publicly_queryable' => false, 601 'has_archive' => false, 602 'rewrite' => array( 'slug' => 'notification-workflows' ), 603 'show_ui' => true, 604 'query_var' => true, 605 'capability_type' => 'post', 606 'hierarchical' => false, 607 'can_export' => true, 608 'show_in_admin_bar' => true, 609 'exclude_from_search' => true, 610 'show_in_menu' => 'pp-calendar', 611 'menu_position' => '20', 612 'supports' => array( 613 'title', 614 ) 615 ) 616 ); 617 618 // Notifications 619 register_post_type( 620 PUBLISHPRESS_NOTIF_POST_TYPE_MESSAGE, 621 array( 622 'labels' => array( 623 'name' => __( 'Notifications', 'publishpress' ), 624 'singular_name' => __( 'Notification', 'publishpress' ) 625 ), 626 'public' => false, 627 'publicly_queryable' => false, 628 'has_archive' => false, 629 'rewrite' => array( 'slug' => 'notifications' ), 630 'show_ui' => false, 631 'query_var' => true, 632 'hierarchical' => false, 633 'can_export' => false, 634 'show_in_admin_bar' => false, 635 'exclude_from_search' => true, 636 'supports' => array( 637 'title', 638 'editor', 639 ) 640 ) 641 ); 642 } 536 643 } 644 645 add_action('plugins_loaded', 'PublishPress'); 646 add_action('init', 'publishPressRegisterCustomPostTypes'); 647 register_activation_hook(__FILE__, array('publishpress', 'activation_hook')); -
publishpress/trunk/readme.txt
r1813564 r1816382 6 6 Requires at least: 4.6 7 7 Requires PHP: 5.4 8 Tested up to: 4.9 9 Stable tag: 1.9. 78 Tested up to: 4.9.3 9 Stable tag: 1.9.8 10 10 License: GPLv2 or later 11 11 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 156 156 and this project adheres to [Semantic Versioning](http://semver.org/). 157 157 158 = [1.9.8] - 2018-02-06 = 159 160 *Fixed:* 161 162 * Fixed icon styling issues in non-default themes; 163 * Fixed missed submenus after activating the plugin for the first time; 164 165 *Changed:* 166 167 * Removed Date column from the notification workflows list; 168 158 169 = [1.9.7] - 2018-02-01 = 159 170
Note: See TracChangeset
for help on using the changeset viewer.