Skip to content
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

Deprecate the define method #22

Merged
merged 5 commits into from
Mar 5, 2025
Merged
Changes from 1 commit
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
Next Next commit
Deprecate the define method
kraftbj committed Dec 23, 2024
commit 1d1fb4d675142fe381e21053967553738388bded
21 changes: 10 additions & 11 deletions secure-custom-fields.php
Original file line number Diff line number Diff line change
@@ -28,8 +28,6 @@
*/
#[AllowDynamicProperties]
class ACF {


/**
* The plugin version number.
*
@@ -77,14 +75,14 @@ public function __construct() {
public function initialize() {

// Define constants.
$this->define( 'ACF', true );
$this->define( 'ACF_PATH', plugin_dir_path( __FILE__ ) );
$this->define( 'ACF_BASENAME', plugin_basename( __FILE__ ) );
$this->define( 'ACF_VERSION', $this->version );
$this->define( 'ACF_MAJOR_VERSION', 6 );
$this->define( 'ACF_FIELD_API_VERSION', 5 );
$this->define( 'ACF_UPGRADE_VERSION', '5.5.0' ); // Highest version with an upgrade routine. See upgrades.php.
$this->define( 'ACF_PRO', true );
defined( 'ACF' ) || define( 'ACF', true );
defined( 'ACF_PATH' ) || define( 'ACF_PATH', plugin_dir_path( __FILE__ ) );
defined( 'ACF_BASENAME' ) || define( 'ACF_BASENAME', plugin_basename( __FILE__ ) );
defined( 'ACF_VERSION' ) || define( 'ACF_VERSION', $this->version );
defined( 'ACF_MAJOR_VERSION' ) || define( 'ACF_MAJOR_VERSION', 6 );
defined( 'ACF_FIELD_API_VERSION' ) || define( 'ACF_FIELD_API_VERSION', 5 );
defined( 'ACF_UPGRADE_VERSION' ) || define( 'ACF_UPGRADE_VERSION', '5.5.0' ); // Highest version with an upgrade routine. See upgrades.php.
defined( 'ACF_PRO' ) || define( 'ACF_PRO', true );

// Register activation hook.
register_activation_hook( __FILE__, array( $this, 'acf_plugin_activated' ) );
@@ -582,14 +580,15 @@ public function posts_where( $where, $wp_query ) {
/**
* Defines a constant if doesnt already exist.
*
* @date 3/5/17
* @since ACF 5.5.13
* @deprecated 6.4.1 -- Use vanilla PHP defined() || define() instead.
*
* @param string $name The constant name.
* @param mixed $value The constant value.
* @return void
*/
public function define( $name, $value = true ) {
_deprecated_function( __METHOD__, '6.4.1', 'defined() || define()' );
if ( ! defined( $name ) ) {
define( $name, $value );
}