-
Notifications
You must be signed in to change notification settings - Fork 10
Resolve remaining WordPress.org review findings #126
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -266,21 +266,7 @@ function setup_post_globals( $post_id = null ) { | |
| * @since 2.4.0 - Added support for `terms` context. | ||
| */ | ||
| function setup_term_globals( $term_id = null ) { | ||
| /** | ||
| * Legacy term context global retained for backward compatibility. | ||
| * | ||
| * `$cc_term` predates the managed term-context service. It remains | ||
| * synchronized so existing integrations do not break, but Content Control | ||
| * itself reads the managed `term` value and new integrations should do the | ||
| * same. | ||
| * | ||
| * @deprecated 2.7.1 Use get_global( 'term' ) instead. | ||
| * @var \WP_Term|\WP_Error|false|null $cc_term | ||
| */ | ||
| // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Deprecated compatibility global. | ||
| global $cc_term; | ||
|
|
||
| $current_term = get_global( 'term' ); // Used instead of global $cc_term. | ||
| $current_term = get_global( 'term' ); | ||
|
|
||
| // Return early if we don't have a term ID. | ||
| if ( is_null( $term_id ) ) { | ||
|
|
@@ -302,9 +288,7 @@ function setup_term_globals( $term_id = null ) { | |
| push_to_global( 'overloaded_terms', $current_term_id ); | ||
|
|
||
| // Overload the globals so conditionals work properly. | ||
| $cc_term = get_term( $term_id ); | ||
| // Set the global term object (forward compatibility). | ||
| set_global( 'term', $cc_term ); | ||
| set_global( 'term', get_term( $term_id ) ); | ||
|
Comment on lines
290
to
+291
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a term restriction is evaluated, integrations that inspect the legacy Useful? React with 👍 / 👎. |
||
| } | ||
|
|
||
| return $overload_term; | ||
|
|
@@ -366,24 +350,9 @@ function reset_term_globals() { | |
| return; | ||
| } | ||
|
|
||
| /** | ||
| * Legacy term context global retained for backward compatibility. | ||
| * | ||
| * `$cc_term` predates the managed term-context service. It remains | ||
| * synchronized so existing integrations do not break, but Content Control | ||
| * itself reads the managed `term` value and new integrations should do the | ||
| * same. | ||
| * | ||
| * @deprecated 2.7.1 Use get_global( 'term' ) instead. | ||
| * @var \WP_Term|\WP_Error|false|null $cc_term | ||
| */ | ||
| // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Deprecated compatibility global. | ||
| global $cc_term; | ||
|
|
||
| $stored_term_id = pop_from_global( 'overloaded_terms' ); | ||
| // Reset global post object. | ||
| $cc_term = get_term( $stored_term_id ); | ||
| set_global( 'term', $cc_term ); | ||
| set_global( 'term', get_term( $stored_term_id ) ); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -397,7 +366,7 @@ function get_the_content_id() { | |
| switch ( $context ) { | ||
| case 'terms': | ||
| case 'restapi/terms': | ||
| $term = get_global( 'term' ); // Used instead of global $cc_term. | ||
| $term = get_global( 'term' ); | ||
| return $term->term_id ?? null; | ||
|
|
||
| default: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On sites with extensions or custom snippets that still call
jp_content_control(),JP\CC\Is, or thejp_cc_*hooks, omitting this loader causes fatal undefined-function/class errors or silently disables their restriction callbacks. These APIs were explicitly retained as compatibility shims, and the repository advertises SemVer while the plugin metadata remains at 2.7.3, so they should remain available until a major release.Useful? React with 👍 / 👎.