| @@ -14,8 +14,9 @@ | ||
| 14 | 14 | * @property-read $cmb_id Current CMB2 instance ID |
| 15 | 15 | * @property-read $object_id Object ID |
| 16 | 16 | * @property-read $object_type Type of object being handled. (e.g., post, user, comment, or term) |
| 17 | 17 | */ |
| 18 | +#[AllowDynamicProperties] // phpcs:ignore PHPCompatibility.Attributes.NewAttributes -- Back-compat: allow dynamic props (PHP 8.2+) on this class + subclasses. | |
| 18 | 19 | abstract class CMB2_Base { |
| 19 | 20 | |
| 20 | 21 | /** |
| 21 | 22 | * Current CMB2 instance ID |
| @@ -419,12 +420,14 @@ | ||
| 419 | 420 | |
| 420 | 421 | switch ( $message ) { |
| 421 | 422 | |
| 422 | 423 | case self::DEPRECATED_PARAM: |
| 424 | + // translators: 1: deprecated field parameter name, 2: replacement parameter name. | |
| 423 | 425 | $message = sprintf( __( 'The "%1$s" field parameter has been deprecated in favor of the "%2$s" parameter.', 'cmb2' ), $args[3], $args[4] ); |
| 424 | 426 | break; |
| 425 | 427 | |
| 426 | 428 | case self::DEPRECATED_CB_PARAM: |
| 429 | + // translators: 1: deprecated callback parameter name, 2: replacement parameter name. | |
| 427 | 430 | $message = sprintf( __( 'Using the "%1$s" field parameter as a callback has been deprecated in favor of the "%2$s" parameter.', 'cmb2' ), $args[3], $args[4] ); |
| 428 | 431 | break; |
| 429 | 432 | |
| 430 | 433 | default: |
| @@ -453,10 +456,12 @@ | ||
| 453 | 456 | */ |
| 454 | 457 | if ( defined( 'WP_DEBUG' ) && WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) { |
| 455 | 458 | if ( function_exists( '__' ) ) { |
| 456 | 459 | if ( ! is_null( $message ) ) { |
| 460 | + // translators: 1: function name, 2: version number, 3: additional message. | |
| 457 | 461 | trigger_error( sprintf( __( '%1$s was called with a parameter that is <strong>deprecated</strong> since version %2$s! %3$s', 'cmb2' ), $function, $version, $message ) ); |
| 458 | 462 | } else { |
| 463 | + // translators: 1: function name, 2: version number. | |
| 459 | 464 | trigger_error( sprintf( __( '%1$s was called with a parameter that is <strong>deprecated</strong> since version %2$s with no alternative available.', 'cmb2' ), $function, $version ) ); |
| 460 | 465 | } |
| 461 | 466 | } else { |
| 462 | 467 | if ( ! is_null( $message ) ) { |
| @@ -481,8 +486,9 @@ | ||
| 481 | 486 | case 'meta_box': |
| 482 | 487 | if ( $field === $this->properties_name ) { |
| 483 | 488 | return $this->{$this->properties_name}; |
| 484 | 489 | } |
| 490 | + // no break | |
| 485 | 491 | case 'properties': |
| 486 | 492 | return $this->{$this->properties_name}; |
| 487 | 493 | case 'cmb_id': |
| 488 | 494 | case 'object_id': |
| @@ -488,8 +494,9 @@ | ||
| 488 | 494 | case 'object_id': |
| 489 | 495 | case 'object_type': |
| 490 | 496 | return $this->{$field}; |
| 491 | 497 | default: |
| 498 | + // translators: 1: class name, 2: property name. | |
| 492 | 499 | throw new Exception( sprintf( esc_html__( 'Invalid %1$s property: %2$s', 'cmb2' ), __CLASS__, $field ) ); |
| 493 | 500 | } |
| 494 | 501 | } |
| 495 | 502 | |
| @@ -506,8 +513,9 @@ | ||
| 506 | 513 | public function __call( $method, $args ) { |
| 507 | 514 | $object_class = strtolower( get_class( $this ) ); |
| 508 | 515 | |
| 509 | 516 | if ( ! has_filter( "{$object_class}_inherit_{$method}" ) ) { |
| 517 | + // translators: 1: class name, 2: method name. | |
| 510 | 518 | throw new Exception( sprintf( esc_html__( 'Invalid %1$s method: %2$s', 'cmb2' ), get_class( $this ), $method ) ); |
| 511 | 519 | } |
| 512 | 520 | |
| 513 | 521 | array_unshift( $args, $this ); |