Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties -->
<config name="minimum_supported_wp_version" value="6.1" />

<config name="text_domain" value="content-control, default" />
<config name="text_domain" value="content-control" />

<!-- Force short syntax arrays. -->
<rule ref="CodeAtlantic" />
Expand All @@ -45,4 +45,4 @@
<exclude-pattern>tests/*</exclude-pattern>
</rule>

</ruleset>
</ruleset>
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## v2.7.4 - 09/20/2026

- Maintenance: Removed legacy APIs deprecated since version 2.0.

## v2.7.3 - 09/01/2026

- Fix: Direct Content Control Pro customers to the appropriate product review form.
Expand Down
1 change: 0 additions & 1 deletion bin/psalm-autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@

require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/inc/functions.php';
require_once __DIR__ . '/inc/deprecated.php';
6 changes: 2 additions & 4 deletions classes/Plugin/Prerequisites.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,7 @@ public function get_php_message( $failed_check_args ) {
$message = __( 'This plugin requires <b>%1$s %2$s</b> or higher in order to run.', 'content-control' );
return sprintf(
$message,
// phpcs:ignore WordPress.WP.I18n.TextDomainMismatch -- Reuse the WordPress Core translation.
__( 'PHP', 'default' ),
__( 'PHP', 'content-control' ),
$failed_check_args['version'] );
}

Expand All @@ -328,8 +327,7 @@ public function get_wp_message( $failed_check_args ) {
$message = __( 'This plugin requires <b>%1$s %2$s</b> or higher in order to run.', 'content-control' );
return sprintf(
$message,
// phpcs:ignore WordPress.WP.I18n.TextDomainMismatch -- Reuse the WordPress Core translation.
__( 'WordPress', 'default' ),
__( 'WordPress', 'content-control' ),
$failed_check_args['version']
);
}
Expand Down
5 changes: 2 additions & 3 deletions content-control.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Content Control
* Plugin URI: https://contentcontrolplugin.com/?utm_campaign=plugin-info&utm_source=php-file-header&utm_medium=plugin-ui&utm_content=plugin-uri
* Description: Restrict content to logged in/out users or specific user roles. Restrict access to certain parts of a page/post. Control the visibility of widgets.
* Version: 2.7.3
* Version: 2.7.4
* Author: Code Atlantic
* Author URI: https://code-atlantic.com/?utm_campaign=plugin-info&utm_source=php-file-header&utm_medium=plugin-ui&utm_content=author-uri
* Donate link: https://code-atlantic.com/donate/?utm_campaign=donations&utm_source=php-file-header&utm_medium=plugin-ui&utm_content=donate-link
Expand Down Expand Up @@ -32,7 +32,7 @@ function get_plugin_config() {
return [
'name' => 'Content Control',
'slug' => 'content-control',
'version' => '2.7.3',
'version' => '2.7.4',
'option_prefix' => 'content_control',
// Maybe remove this and simply prefix `name` with `'Popup Maker'`.
'text_domain' => 'content-control',
Expand Down Expand Up @@ -129,7 +129,6 @@ function plugin_instance() {

if ( ! $plugin instanceof \ContentControl\Plugin\Core ) {
require_once __DIR__ . '/inc/functions.php';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Regenerate the API stub after removing legacy declarations

Removing the deprecated loader here leaves bin/stubs/content-control.php inconsistent with the runtime: it still declares JP_Content_Control, JP\CC\Is, JP\CC\Site\Restrictions, and jp_content_control() (for example at lines 4256–4323 and 5757–5764). IDEs and static-analysis consumers using this tracked generated stub will therefore accept calls that now fail at runtime, so the stub should be regenerated as part of this API removal.

Useful? React with 👍 / 👎.

require_once __DIR__ . '/inc/deprecated.php';
$plugin = new Plugin\Core( get_plugin_config() );
}

Expand Down
116 changes: 0 additions & 116 deletions inc/deprecated.php

This file was deleted.

49 changes: 0 additions & 49 deletions inc/deprecated/class.is.php

This file was deleted.

36 changes: 0 additions & 36 deletions inc/deprecated/class.restrictions.php

This file was deleted.

39 changes: 4 additions & 35 deletions inc/functions/query.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ) {
Expand All @@ -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 ) );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the recently deprecated term global synchronized

When an extension still reads the global $cc_term while Content Control evaluates a term query, this now leaves that global unset or pointing at a previous term while only the managed term value is updated, so custom conditions can evaluate against the wrong taxonomy term. This compatibility global was only deprecated in 2.7.1, whereas the 2.7.4 release notes say only APIs deprecated since 2.0 are being removed; retain the synchronization until a suitably announced breaking release.

Useful? React with 👍 / 👎.

}

return $overload_term;
Expand Down Expand Up @@ -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 ) );
}

/**
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions inc/functions/rule-callbacks.php
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ function content_is_selected_term() {
}

case 'terms':
$term = get_global( 'term' ); // Used instead of global $cc_term.
$term = get_global( 'term' );

// Check if we have a term object from the term query.
if ( $term && $term->term_id > 0 ) {
Expand All @@ -756,7 +756,7 @@ function content_is_selected_term() {
case 'restapi':
case 'restapi/terms':
$rest_intent = get_rest_api_intent();
$term = get_global( 'term' ); // Used instead of global $cc_term.
$term = get_global( 'term' );

if ( 'unknown' === $rest_intent['type'] ) {
return false;
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "content-control",
"version": "2.7.3",
"version": "2.7.4",
"description": "",
"author": "Code Atlantic LLC",
"license": "GPL-2.0-or-later",
Expand Down
Loading
Loading