-
Notifications
You must be signed in to change notification settings - Fork 135
Scope module assets #441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Scope module assets #441
Changes from all commits
Commits
Show all changes
150 commits
Select commit
Hold shift + click to select a range
319a8fe
Adds field to the comment form to display notification info
goodguyry da675a5
Feedback updates as users are selected/deselected
goodguyry d42f421
Save the notification message info for display in the comment
goodguyry 343adce
Display the saved notification feedback in the comment
goodguyry 09857fa
Styles notification message in the form and comments
goodguyry c8c0c39
Slight formatting adjustment
goodguyry 07d9133
Updated message creation to be more robust
goodguyry 13dcc0e
Set up strings for localization
goodguyry de8b4c7
Build home_url() previews with trailing slash
jeremyfelt 6d6cf81
Using PHPDoc to generate accesible Edit Flow documentation.
e429115
fix get_beginning_of_week comments
1c2d85a
fix get_ending_of_week returning wrong date after DST changes
f87ba61
Added usergroup obj filter for better flexibility
tcrsavage 8f2fef2
Changed the way that the status on the calendar is made
806a99a
Support adding non-post data into days of calendar #417
cklosowski 435447b
Add method `is_module_view`
970c89e
Deprecate `is_whitelisted_settings_view()` in favor of `is_module_set…
89206dc
Add style & script interfaces to improve method name consistency
e0c2aef
Add `Edit_Flow_Module_With_View` interface
bf67dcb
Accept $module_name in `is_module_settings_view`
9b2698a
Refactor calendar asset enqueuing
a46ed47
Refactor custom-status asset enqueuing
ab8bdef
Deprecate `is_whitelisted_functional_view()` method
49b7a9b
Pull method up & rename it to `is_module_edit_view()` for reusability
3785a7f
Refactor notification asset enqueuing
55d435b
Use `is_module_settings_view()` instead of `is_whitelisted_settings_v…
8a0ca71
Improve function naming: `is_module_edit_view` -> `is_active_view`
b70164f
Add `is_current_module_settings_view` to help easily target the curre…
bd4885d
Rename `is_current_module_view` to `is_calendar_view`
4e17907
Remove `is_module_view()` method because it’s no longer used
64abafa
Improve custom status `is_current_module_view` method
98aabcd
Refactor editorial metadata asset enqueuing
e938ca2
Notification assets are only needed in settings and active editor view
65aca1e
Refactor user groups asset enqueuing
cdce333
Improve comment at `is_whitelisted_functional_view` method
eecb486
Move deprecated methods down
bb31689
Rename `is_current_module_view()` to `is_custom_status_view()`
f8fd8f1
Remove unused Edit_Flow_Module_With_View interface
3ce044f
Use is_current_module_settings_view method instead of is_module_setti…
ec35e5b
Merge branch 'master' of https://github.com/Automattic/Edit-Flow into…
496ce93
Use `is_custom_status_view` to check if is active view
9c9da87
Extract a EF_Module_With_View trait
accc76c
Utilize trait `EF_Module_With_View`
23a6a3c
Refactor story budget asset enqueuing
d9862ef
Rename Edit_Flow_**** to EF_****_Interface
dac767f
Update comments
79eda84
Call a Trait a Trait
96387f0
Add more comments
dc9bf6b
Remove Trait, use regular Classes instead
235ae9e
Check for module settings view in EF_Custom_Status
b470e94
Refactor editorial comments asset enqueuing
cfbca15
Set the post_type to post if edit.php OR post-new.php
a38177c
Merge branch 'master' of https://github.com/Automattic/Edit-Flow into…
2de212d
Merge branch 'master' of https://github.com/Automattic/Edit-Flow into…
2f86e89
Add pre-html filter, to avoid doing WP_Post checks #417
cklosowski d29799d
Update filter name to follow naming convention #417
cklosowski 56cb009
Fix status list to show custom post statuses
mikeyarce 3efb837
Get post status label directly
mikeyarce 42f9f9d
Get custom post status in Calendar
mikeyarce ef8eee1
Get custom post status in the Story Budget
mikeyarce 6a3b167
Clean up get_post_status_friendly_name function
mikeyarce 659cd6a
Add back old get_post_status_friendly_name function
mikeyarce b1ce1fb
Remove dependency on get_post_status_friendly_name function
mikeyarce 4f04c48
Remove get_post_status_friendly_name function
mikeyarce 29fd882
Add support for custom statuses in the Calendar
mikeyarce 5fecd95
Add custom status support to Story Budget
mikeyarce 3ea309a
Show Post States if they are not also a post status
mikeyarce 2295d9c
Update to yoda conditions
mikeyarce 98abbdd
Escaping
mikeyarce 98ab0e1
Get object property correctly
mikeyarce f077e02
Get objects first, then their properties
mikeyarce ab29a0f
Check of old_status is an object before getting the object property
mikeyarce 80ec263
Fix conditional for $old_status
mikeyarce 02c29cf
Improve getting object parameter
mikeyarce ec1a0b2
Fix Spacing
mikeyarce 071791d
Return a value for $old_status_friendly_name earlier
mikeyarce 351bf62
Ensure user_group_ids is in post request
WPprodigy adc9600
Ensure all values are posted before accessing them
WPprodigy 11ad4bc
Coding standards and cleanup
WPprodigy e2043ef
Merge pull request #446 from Automattic/fix/custom-post-status-post-list
sboisvert 0ce2b64
Code cleanup - make conditional more verbose
WPprodigy 6fc7cb1
Merge pull request #448 from Automattic/fix/undefined-index-subscript…
sboisvert 6e6523d
Merge PR and fix conflicts
WPprodigy 9f69bc8
Sanitize and escape
WPprodigy ade5a36
Conditionally output comment meta
WPprodigy 71f833b
Formatting & Code Standards
WPprodigy 02ebd65
Refactor notify method
WPprodigy f883b76
Trigger custom event when subscribers are updated
WPprodigy a42a44d
Localize text strings
WPprodigy 231776d
Only save comment meta if necessary
WPprodigy ca9ca23
Update CSS
WPprodigy aad6fa1
Introduce filter to disable showing notified users
WPprodigy c220c60
Use WP core colors
WPprodigy 9c1ea92
Update doc block
WPprodigy ee17d13
Capabilities: add capabilities via filters on VIP Go sites.
jeherve 494499a
Made the changes discussed in PR #409
2b5491f
Add a “no access” badge to subscribers
WPprodigy ba9dcd7
Localize text string
WPprodigy 6f4b5e8
Spacing / reduce indentation
WPprodigy 3be71d6
Merge pull request #357 from jeremyfelt/bug/home-url-344
rinatkhaziev fb006c0
Update story-budget.js
rinatkhaziev 29cdfae
Fix missing escaping in story-budget.php
rinatkhaziev fd4a5ff
Merge pull request #456 from jeherve/add/cap-filters-vipgo
rinatkhaziev 0f29b93
Supply an empty string as a filter arg for ef_pre_calendar_single_dat…
rinatkhaziev 4a04769
Merge pull request #418 from cklosowski/issue/417
rinatkhaziev 9243655
Move out add_screen_options_panel from init to admin_init. It has no …
rinatkhaziev 484012a
Merge pull request #463 from Automattic/issues/354
rinatkhaziev 830f559
Merge pull request #401 from humanmade/add-user-group-object-filter
rinatkhaziev 342a784
Merge pull request #460 from raduconst/story-budget-columns
rinatkhaziev b76c844
Remove generated phpdoc.json - there's been many changes to the codeb…
rinatkhaziev c87f3b7
Merge pull request #353 from Automattic/documentation
rinatkhaziev 0121284
Merge pull request #410 from raduconst/calendar-status
rinatkhaziev b8ad6a4
Displaying updated time instead of creation time in Notepad Dashboard…
TheCrowned dd59460
Notepad dashboard widget method changed to POST, update function twea…
TheCrowned 5864f7d
Removed whitespace changes with respect to previous commit.
TheCrowned 363d272
Removed whitespaces introduced in last commit
TheCrowned 0d69708
Changed $_REQUEST references to $_POST references in handle_notepad_u…
TheCrowned 69af79b
Merge pull request #470 from TheCrowned/update/dashboard-notepad-supe…
sboisvert aab8337
Merge pull request #469 from TheCrowned/fix/466-notepad-widget-post-form
rinatkhaziev 31c2903
Merge pull request #380 from FewKinG/master
rinatkhaziev a4537ad
Merge pull request #452 from Automattic/feature/270-comments-notifica…
rinatkhaziev ed3c71d
Revert "Display who was notified for an editorial comment"
rinatkhaziev 179abf7
Merge pull request #472 from Automattic/revert-452-feature/270-commen…
rinatkhaziev 11d7db8
Revert "Revert "Display who was notified for an editorial comment""
rinatkhaziev 72c7b9f
Merge pull request #473 from Automattic/revert-472-revert-452-feature…
rinatkhaziev 4e5bd20
Merge pull request #468 from TheCrowned/fix/465-notepad-updated-time
rinatkhaziev faa9ac3
Update Changelog and Upgrade Notice sections for 0.8.3
rinatkhaziev 155d5a9
Bump 'Tested up to' to 4.9.6
rinatkhaziev 0edd15c
Mirror readme updates to README.md
rinatkhaziev d5368a3
Bump version to 0.8.3
rinatkhaziev 4724a3c
Merge pull request #474 from Automattic/readme-updates-0.8.3
rinatkhaziev 8f3fabe
settings.css - remove green color on module-enabling button-primary b…
jerclarke bff9f4e
Enlarged modules box up to 250px, so that buttons don't overlap anymore
TheCrowned d5a8545
Removing min-width in module boxes containers, so that the layout can…
TheCrowned 3c5728f
Added flexbox directives
TheCrowned af87de4
Implement caps check before sending notifications
WPprodigy 0da9067
Remove unused and empty author array
WPprodigy d9b4a11
Coding standards and cleanup
WPprodigy a5a7558
Remove empty email addresses from recipients list
WPprodigy 667a071
Rename variables for clarity
WPprodigy de13159
Return array or string always
WPprodigy bd49802
Add doc blocks for filters, and some typecasting
WPprodigy f6e5408
Merge branch 'master' into feature/451-notification-visibility
rinatkhaziev d281317
Merge pull request #461 from Automattic/feature/451-notification-visi…
rinatkhaziev e222adc
Fix regression due to duplicate method declaration
rinatkhaziev 0316295
Update EF_Notifications->notification_comment() to insert the list of…
jerclarke 975fa15
notifications.php - notification_comment() move the notification list…
jerclarke b7f172f
Update modules/notifications/notifications.php
WPprodigy 94d968a
Update modules/notifications/notifications.php
WPprodigy 9da539a
Merge branch 'fix-351-scope-assets' of github.com:justnorris/Edit-Flo…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,181 @@ | ||
| <?php | ||
|
|
||
|
|
||
| class EF_Module_With_View extends EF_Module { | ||
|
|
||
|
|
||
| /** | ||
| * Whether or not the current page is an Edit Flow settings view (either main or module) | ||
| * Determination is based on $pagenow, $_GET['page'], and the module's $settings_slug | ||
| * If there's no module name specified, it will return true against all Edit Flow settings views | ||
| * | ||
| * @since 0.8.3 | ||
| * | ||
| * @param string $slug (Optional) Module name to check against | ||
| * @return bool true if is module settings view | ||
| */ | ||
| public function is_module_settings_view( $slug = false ) { | ||
| global $pagenow, $edit_flow; | ||
|
|
||
| // All of the settings views are based on admin.php and a $_GET['page'] parameter | ||
| if ( $pagenow !== 'admin.php' || ! isset( $_GET['page'] ) ) | ||
| return false; | ||
|
|
||
| $settings_view_slugs = array(); | ||
| // Load all of the modules that have a settings slug/ callback for the settings page | ||
| foreach ( $edit_flow->modules as $mod_name => $mod_data ) { | ||
| if ( isset( $mod_data->options->enabled ) && $mod_data->options->enabled == 'on' && $mod_data->configure_page_cb ) | ||
|
pyronaur marked this conversation as resolved.
pyronaur marked this conversation as resolved.
|
||
| $settings_view_slugs[] = $mod_data->settings_slug; | ||
| } | ||
|
|
||
| // The current page better be in the array of registered settings view slugs | ||
| if ( empty( $settings_view_slugs ) || ! in_array( $_GET['page'], $settings_view_slugs ) ) { | ||
|
pyronaur marked this conversation as resolved.
|
||
| return false; | ||
| } | ||
|
|
||
| if ( $slug && $edit_flow->modules->{$slug}->settings_slug !== $_GET['page'] ) { | ||
| return false; | ||
| } | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| /** | ||
| * Check whether if we're at module settings view | ||
| * for the current module based on `is_module_settings_view` method | ||
| * | ||
| * @return bool | ||
| */ | ||
| public function is_current_module_settings_view() { | ||
| return $this->is_module_settings_view( $this->module->name ); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * Check for admin page and whether the current post type is supported | ||
| * @param array $allowed_pages | ||
| * | ||
| * @return bool | ||
| */ | ||
| function is_active_view( $allowed_pages = array( 'edit.php', 'post.php', 'post-new.php' ) ) { | ||
| return ( $this->is_admin_page( $allowed_pages ) && $this->is_supported_post_type() ); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * Check whether the current post type is supported for $this module | ||
| * | ||
| * @return bool | ||
| */ | ||
| public function is_supported_post_type() { | ||
| $post_type = $this->get_current_post_type(); | ||
|
|
||
| return ( | ||
| $post_type | ||
| && | ||
| in_array( $post_type, $this->get_post_types_for_module( $this->module ), true ) | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * Checks for the current post type | ||
| * | ||
| * @since 0.7 | ||
| * @return string|null $post_type The post type we've found, or null if no post type | ||
| */ | ||
| function get_current_post_type() { | ||
| global $post, $typenow, $pagenow, $current_screen; | ||
| //get_post() needs a variable | ||
| $post_id = isset( $_REQUEST['post'] ) ? (int) $_REQUEST['post'] : false; | ||
|
pyronaur marked this conversation as resolved.
|
||
|
|
||
| if ( $post && $post->post_type ) { | ||
| $post_type = $post->post_type; | ||
| } elseif ( $typenow ) { | ||
| $post_type = $typenow; | ||
| } elseif ( $current_screen && ! empty( $current_screen->post_type ) ) { | ||
| $post_type = $current_screen->post_type; | ||
| } elseif ( isset( $_REQUEST['post_type'] ) ) { | ||
|
pyronaur marked this conversation as resolved.
|
||
| $post_type = sanitize_key( $_REQUEST['post_type'] ); | ||
|
pyronaur marked this conversation as resolved.
|
||
| } elseif ( 'post.php' == $pagenow | ||
| && $post_id | ||
| && ! empty( get_post( $post_id )->post_type ) ) { | ||
| $post_type = get_post( $post_id )->post_type; | ||
| } elseif ( in_array( $pagenow, array('edit.php', 'post-new.php' ) ) && empty( $_REQUEST['post_type'] ) ) { | ||
|
pyronaur marked this conversation as resolved.
pyronaur marked this conversation as resolved.
|
||
| $post_type = 'post'; | ||
| } else { | ||
| $post_type = null; | ||
| } | ||
|
|
||
| return $post_type; | ||
| } | ||
|
|
||
| /** | ||
| * Check whether currently viewing the desired admin page | ||
| * | ||
| * @param array $allowed_pages | ||
| * | ||
| * @return bool | ||
| */ | ||
| public function is_admin_page( $allowed_pages = array( 'edit.php', 'post.php', 'post-new.php' ) ) { | ||
| global $pagenow; | ||
|
|
||
| return ( $pagenow && in_array( $pagenow, $allowed_pages, true ) ); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * Shorthand for `is_active_view` to check for list type views ( list of posts pages, custom post types ) | ||
| * | ||
| * @see is_active_view | ||
| * @return bool | ||
| */ | ||
| public function is_active_list_view() { | ||
| return $this->is_active_view( array( 'edit.php' ) ); | ||
| } | ||
|
|
||
| /** | ||
| * Shorthand for `is_active_view` to check for editor mode | ||
| * | ||
| * @see is_active_view | ||
| * @return bool | ||
| */ | ||
| public function is_active_editor_view() { | ||
| return $this->is_active_view( array( 'post.php', 'posts-new.php' ) ); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * This method was supposed to check whether or not the current page is a user-facing Edit Flow View | ||
| * But it was never implemented | ||
| * | ||
| * It is now deprecated in favor of `$this->is_active_view` | ||
| * @see EF_Module::is_active_view() | ||
| * @since 0.7 | ||
| * @deprecated 0.8.3 | ||
| * | ||
| * @param string $module_name (Optional) Module name to check against | ||
| */ | ||
| public function is_whitelisted_functional_view( $module_name = null ) { | ||
| _deprecated_function( __FUNCTION__, '0.8.3', 'is_active_view' ); | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| /** | ||
| * Whether or not the current page is an Edit Flow settings view (either main or module) | ||
| * Determination is based on $pagenow, $_GET['page'], and the module's $settings_slug | ||
| * If there's no module name specified, it will return true against all Edit Flow settings views | ||
| * | ||
| * @since 0.7 | ||
| * @deprecated 0.8.3 | ||
| * | ||
| * @param string $module_name (Optional) Module name to check against | ||
| * @return bool $is_settings_view Return true if it is | ||
| */ | ||
| public function is_whitelisted_settings_view( $module_name = null ) { | ||
| _deprecated_function( 'is_whitelisted_settings_view', '0.8.3', 'is_module_settings_view' ); | ||
|
|
||
| return $this->is_module_settings_view( $module_name ); | ||
| } | ||
|
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.