@@ -39,854 +39,854 @@ |
||
| 39 | 39 | // Don't duplicate me! |
| 40 | 40 | if ( ! class_exists( 'ReduxFramework', false ) ) { |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Main ReduxFramework class |
|
| 44 | - * |
|
| 45 | - * @since 1.0.0 |
|
| 46 | - */ |
|
| 47 | - class ReduxFramework { |
|
| 48 | - |
|
| 49 | - /** |
|
| 50 | - * ReduxFramework instance storage. |
|
| 51 | - * |
|
| 52 | - * @var null|ReduxFramework |
|
| 53 | - * @access public |
|
| 54 | - */ |
|
| 55 | - public static ?ReduxFramework $instance; |
|
| 56 | - |
|
| 57 | - /** |
|
| 58 | - * Redux current version. |
|
| 59 | - * |
|
| 60 | - * @var string |
|
| 61 | - * @access public |
|
| 62 | - * |
|
| 63 | - * @deprecated 4.0.0 |
|
| 64 | - */ |
|
| 65 | - public static string $_version = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * Absolute directory of the Redux instance. |
|
| 69 | - * |
|
| 70 | - * @var string |
|
| 71 | - * @access public |
|
| 72 | - * |
|
| 73 | - * @deprecated 4.0.0 |
|
| 74 | - */ |
|
| 75 | - public static string $_dir = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * Full URL of the Redux instance. |
|
| 79 | - * |
|
| 80 | - * @var string |
|
| 81 | - * @access public |
|
| 82 | - * |
|
| 83 | - * @deprecated 4.0.0 |
|
| 84 | - */ |
|
| 85 | - public static string $_url = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * Current WordPress upload directory. |
|
| 89 | - * |
|
| 90 | - * @var string |
|
| 91 | - * @access public |
|
| 92 | - * |
|
| 93 | - * @deprecated 4.0.0 |
|
| 94 | - */ |
|
| 95 | - public static string $_upload_dir = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * Current WordPress upload URL |
|
| 99 | - * |
|
| 100 | - * @var string |
|
| 101 | - * @access public |
|
| 102 | - * |
|
| 103 | - * @deprecated 4.0.0 |
|
| 104 | - */ |
|
| 105 | - public static string $_upload_url; // phpcs:ignore PSR2.Classes.PropertyDeclaration |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * Init |
|
| 109 | - * |
|
| 110 | - * Backward compatibility for previous versions of Redux. |
|
| 111 | - */ |
|
| 112 | - public static function init() { |
|
| 113 | - |
|
| 114 | - // Backward compatibility for extensions. |
|
| 115 | - self::$_version = Redux_Core::$version; |
|
| 116 | - self::$_dir = Redux_Core::$dir; |
|
| 117 | - self::$_url = Redux_Core::$url; |
|
| 118 | - self::$_upload_dir = Redux_Core::$upload_dir; |
|
| 119 | - self::$_upload_url = Redux_Core::$upload_url; |
|
| 120 | - self::$_as_plugin = Redux_Core::$as_plugin; |
|
| 121 | - self::$_is_plugin = Redux_Core::$is_plugin; |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - /** |
|
| 125 | - * Array of field arrays. |
|
| 126 | - * |
|
| 127 | - * @var null|array |
|
| 128 | - */ |
|
| 129 | - public ?array $fields = array(); |
|
| 130 | - |
|
| 131 | - /** |
|
| 132 | - * Array of field sections. |
|
| 133 | - * |
|
| 134 | - * @var null|array |
|
| 135 | - */ |
|
| 136 | - public ?array $field_sections = array(); |
|
| 137 | - |
|
| 138 | - /** |
|
| 139 | - * Array of field types. |
|
| 140 | - * |
|
| 141 | - * @var null|array |
|
| 142 | - */ |
|
| 143 | - public ?array $field_types = array(); |
|
| 144 | - |
|
| 145 | - /** |
|
| 146 | - * Array of field heads. |
|
| 147 | - * |
|
| 148 | - * @var null|array |
|
| 149 | - */ |
|
| 150 | - public ?array $field_head = array(); |
|
| 151 | - |
|
| 152 | - /** |
|
| 153 | - * Array of extensions by type used in the panel. |
|
| 154 | - * |
|
| 155 | - * @var null|array |
|
| 156 | - */ |
|
| 157 | - public ?array $extensions = array(); |
|
| 158 | - |
|
| 159 | - /** |
|
| 160 | - * Array of sections and fields arrays. |
|
| 161 | - * |
|
| 162 | - * @var null|array |
|
| 163 | - */ |
|
| 164 | - public ?array $sections = array(); |
|
| 165 | - |
|
| 166 | - /** |
|
| 167 | - * Array of generated errors from the panel for localization. |
|
| 168 | - * |
|
| 169 | - * @var null|array |
|
| 170 | - */ |
|
| 171 | - public ?array $errors = array(); |
|
| 172 | - |
|
| 173 | - /** |
|
| 174 | - * Array of generated warnings from the panel for localization. |
|
| 175 | - * |
|
| 176 | - * @var null|array |
|
| 177 | - */ |
|
| 178 | - public ?array $warnings = array(); |
|
| 179 | - |
|
| 180 | - /** |
|
| 181 | - * Array of generated sanitize notices from the panel for localization. |
|
| 182 | - * |
|
| 183 | - * @var null|array |
|
| 184 | - */ |
|
| 185 | - public ?array $sanitize = array(); |
|
| 186 | - |
|
| 187 | - /** |
|
| 188 | - * Array of current option values. |
|
| 189 | - * |
|
| 190 | - * @var null|array |
|
| 191 | - */ |
|
| 192 | - public ?array $options = array(); |
|
| 193 | - |
|
| 194 | - /** |
|
| 195 | - * Array of option defaults. |
|
| 196 | - * |
|
| 197 | - * @var null|array |
|
| 198 | - */ |
|
| 199 | - public ?array $options_defaults = null; |
|
| 200 | - |
|
| 201 | - /** |
|
| 202 | - * Array of fields set to trigger the compiler hook. |
|
| 203 | - * |
|
| 204 | - * @var null|array |
|
| 205 | - */ |
|
| 206 | - public ?array $compiler_fields = array(); |
|
| 207 | - |
|
| 208 | - /** |
|
| 209 | - * Array of fields with CSS output selectors. |
|
| 210 | - * |
|
| 211 | - * @var null|array |
|
| 212 | - */ |
|
| 213 | - public ?array $output = array(); |
|
| 214 | - |
|
| 215 | - /** |
|
| 216 | - * Autogenerated CSS appended to the header (snake case maintained for backward compatibility). |
|
| 217 | - * |
|
| 218 | - * @var null|string |
|
| 219 | - */ |
|
| 220 | - public ?string $outputCSS = ''; // phpcs:ignore WordPress.NamingConventions.ValidVariableName |
|
| 221 | - |
|
| 222 | - /** |
|
| 223 | - * Autogenerated variables appended to dynamic output. |
|
| 224 | - * |
|
| 225 | - * @var null|array |
|
| 226 | - */ |
|
| 227 | - public ?array $output_variables = array(); |
|
| 228 | - |
|
| 229 | - /** |
|
| 230 | - * CSS sent to the compiler hook (snake case maintained for backward compatibility). |
|
| 231 | - * |
|
| 232 | - * @var null|string |
|
| 233 | - */ |
|
| 234 | - public ?string $compilerCSS = ''; // phpcs:ignore WordPress.NamingConventions.ValidVariableName |
|
| 235 | - |
|
| 236 | - /** |
|
| 237 | - * Array of global arguments. |
|
| 238 | - * |
|
| 239 | - * @var array|null |
|
| 240 | - */ |
|
| 241 | - public ?array $args = array(); |
|
| 242 | - |
|
| 243 | - /** |
|
| 244 | - * Used in customizer hooks. |
|
| 245 | - * |
|
| 246 | - * @var null|string |
|
| 247 | - */ |
|
| 248 | - public ?string $old_opt_name = ''; |
|
| 249 | - |
|
| 250 | - /** |
|
| 251 | - * Pointer to the Redux_Options_Default class. |
|
| 252 | - * |
|
| 253 | - * @var null|Redux_Options_Defaults |
|
| 254 | - */ |
|
| 255 | - public ?Redux_Options_Defaults $options_defaults_class = null; |
|
| 256 | - |
|
| 257 | - /** |
|
| 258 | - * Pointer to the Redux_Options class. |
|
| 259 | - * |
|
| 260 | - * @var null|Redux_Options_Constructor |
|
| 261 | - */ |
|
| 262 | - public ?Redux_Options_Constructor $options_class = null; |
|
| 263 | - |
|
| 264 | - /** |
|
| 265 | - * Pointer to the Redux_Required class |
|
| 266 | - * |
|
| 267 | - * @var null|Redux_Required |
|
| 268 | - */ |
|
| 269 | - public ?Redux_Required $required_class = null; |
|
| 270 | - |
|
| 271 | - /** |
|
| 272 | - * Pointer to the Redux_Output class. |
|
| 273 | - * |
|
| 274 | - * @var null|Redux_Output |
|
| 275 | - */ |
|
| 276 | - public ?Redux_Output $output_class = null; |
|
| 277 | - |
|
| 278 | - /** |
|
| 279 | - * Pointer to the Redux_Page_Render class. |
|
| 280 | - * |
|
| 281 | - * @var null|Redux_Page_Render |
|
| 282 | - */ |
|
| 283 | - public ?Redux_Page_Render $render_class = null; |
|
| 284 | - |
|
| 285 | - /** |
|
| 286 | - * Pointer to the Redux_Enqueue class. |
|
| 287 | - * |
|
| 288 | - * @var null|Redux_Enqueue |
|
| 289 | - */ |
|
| 290 | - public ?Redux_Enqueue $enqueue_class = null; |
|
| 291 | - |
|
| 292 | - /** |
|
| 293 | - * Pointer to the Redux_Transients class. |
|
| 294 | - * |
|
| 295 | - * @var null|Redux_Transients |
|
| 296 | - */ |
|
| 297 | - public ?Redux_Transients $transient_class = null; |
|
| 298 | - |
|
| 299 | - /** |
|
| 300 | - * Pointer to the Redux_wordPress_Data class. |
|
| 301 | - * |
|
| 302 | - * @var null|Redux_WordPress_Data |
|
| 303 | - */ |
|
| 304 | - public ?Redux_WordPress_Data $wordpress_data = null; |
|
| 305 | - |
|
| 306 | - /** |
|
| 307 | - * Pointer to the Redux_Validation class. |
|
| 308 | - * |
|
| 309 | - * @var null|Redux_Validation |
|
| 310 | - */ |
|
| 311 | - public ?Redux_Validation $validate_class = null; |
|
| 312 | - |
|
| 313 | - /** |
|
| 314 | - * Pointer to the Redux_Sanitize class. |
|
| 315 | - * |
|
| 316 | - * @var null|Redux_Sanitize |
|
| 317 | - */ |
|
| 318 | - public ?Redux_Sanitize $sanitize_class = null; |
|
| 319 | - |
|
| 320 | - /** |
|
| 321 | - * Pointer to the Redux_Args class. |
|
| 322 | - * |
|
| 323 | - * @var null|Redux_Args |
|
| 324 | - */ |
|
| 325 | - public ?Redux_Args $args_class = null; |
|
| 326 | - |
|
| 327 | - /** |
|
| 328 | - * Array of active transients used by Redux. |
|
| 329 | - * |
|
| 330 | - * @var null|mixed |
|
| 331 | - */ |
|
| 332 | - public $transients = array(); |
|
| 333 | - |
|
| 334 | - /** |
|
| 335 | - * Array of localized repeater data. |
|
| 336 | - * |
|
| 337 | - * @var null|array |
|
| 338 | - */ |
|
| 339 | - public ?array $repeater_data = array(); |
|
| 340 | - |
|
| 341 | - /** |
|
| 342 | - * Array of localized data. |
|
| 343 | - * |
|
| 344 | - * @var null|array |
|
| 345 | - */ |
|
| 346 | - public ?array $localize_data = array(); |
|
| 347 | - |
|
| 348 | - /** |
|
| 349 | - * Array of checked transients used by Redux. |
|
| 350 | - * |
|
| 351 | - * @var null|mixed |
|
| 352 | - */ |
|
| 353 | - public $transients_check = array(); |
|
| 354 | - |
|
| 355 | - /** |
|
| 356 | - * Never save to DB flag for metaboxes. |
|
| 357 | - * |
|
| 358 | - * @var bool |
|
| 359 | - */ |
|
| 360 | - public bool $never_save_to_db; |
|
| 361 | - |
|
| 362 | - /** |
|
| 363 | - * File system object used for I/O file operations. Done the WordPress way. |
|
| 364 | - * |
|
| 365 | - * @var null|object |
|
| 366 | - * |
|
| 367 | - * @deprecated 4.5.1 |
|
| 368 | - */ |
|
| 369 | - public ?object $filesystem; |
|
| 370 | - |
|
| 371 | - /** |
|
| 372 | - * Deprecated shim for v3 templates. |
|
| 373 | - * |
|
| 374 | - * @var null|array |
|
| 375 | - * |
|
| 376 | - * @deprecated 4.0.0 |
|
| 377 | - */ |
|
| 378 | - public ?array $hidden_perm_sections = array(); |
|
| 379 | - |
|
| 380 | - /** |
|
| 381 | - * Deprecated shim for v3 as plugin check. |
|
| 382 | - * |
|
| 383 | - * @var bool |
|
| 384 | - * |
|
| 385 | - * @deprecated 4.0.0 |
|
| 386 | - */ |
|
| 387 | - public static bool $_as_plugin = false; // phpcs:ignore PSR2.Classes.PropertyDeclaration |
|
| 388 | - |
|
| 389 | - /** |
|
| 390 | - * Deprecated shim for v3 as plugin check. |
|
| 391 | - * |
|
| 392 | - * @var bool |
|
| 393 | - * |
|
| 394 | - * @deprecated 4.0.0 |
|
| 395 | - */ |
|
| 396 | - public static bool $_is_plugin = false; // phpcs:ignore PSR2.Classes.PropertyDeclaration |
|
| 397 | - |
|
| 398 | - /** |
|
| 399 | - * Cloning is forbidden. |
|
| 400 | - * |
|
| 401 | - * @since 4.0.0 |
|
| 402 | - */ |
|
| 403 | - public function __clone() { |
|
| 404 | - _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ eh?', 'redux-framework' ), '4.0' ); |
|
| 405 | - } |
|
| 406 | - |
|
| 407 | - /** |
|
| 408 | - * Un-serializing instances of this class are forbidden. |
|
| 409 | - * |
|
| 410 | - * @since 4.0.0 |
|
| 411 | - */ |
|
| 412 | - public function __wakeup() { |
|
| 413 | - _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ eh?', 'redux-framework' ), '4.0' ); |
|
| 414 | - } |
|
| 415 | - |
|
| 416 | - /** |
|
| 417 | - * Add a deprecating notice for all the old themes that still use this method.. |
|
| 418 | - * |
|
| 419 | - * @param object $filesystem Filesystem object. |
|
| 420 | - * |
|
| 421 | - * @since 4.0.0 |
|
| 422 | - */ |
|
| 423 | - private function deprecated_filesystem( $filesystem ) { |
|
| 424 | - // _deprecated_function( esc_html__( 'The global variable "$filesystem" of the ReduxFramework object', 'redux-framework' ), '4.5.1', 'Redux_Core::$filesystem' ); |
|
| 425 | - |
|
| 426 | - return $filesystem; |
|
| 427 | - } |
|
| 428 | - |
|
| 429 | - /** |
|
| 430 | - * Class Constructor. Defines the args for the theme options class |
|
| 431 | - * |
|
| 432 | - * @param array $sections Panel sections. |
|
| 433 | - * @param array $args Class constructor arguments. |
|
| 434 | - * |
|
| 435 | - * @throws ReflectionException Exception. |
|
| 436 | - * @since 1.0.0 |
|
| 437 | - */ |
|
| 438 | - public function __construct( array $sections = array(), array $args = array() ) { |
|
| 439 | - global $pagenow; |
|
| 440 | - |
|
| 441 | - if ( Redux_Core::is_heartbeat() ) { |
|
| 442 | - return; |
|
| 443 | - } |
|
| 444 | - |
|
| 445 | - $args['load_on_cron'] = $args['load_on_cron'] ?? false; |
|
| 446 | - |
|
| 447 | - if ( false === $args['load_on_cron'] && 'wp-cron.php' === $pagenow ) { |
|
| 448 | - return; |
|
| 449 | - } |
|
| 450 | - |
|
| 451 | - if ( empty( $args ) || ( empty( $args['opt_name'] ) ) ) { |
|
| 452 | - return; |
|
| 453 | - } |
|
| 454 | - |
|
| 455 | - if ( ! isset( Redux::$init[ $args['opt_name'] ] ) ) { |
|
| 456 | - // Let's go back to the Redux API instead of having it run directly. |
|
| 457 | - Redux_Functions_Ex::record_caller( $args['opt_name'] ); |
|
| 458 | - Redux::set_args( $args['opt_name'], $args ); |
|
| 459 | - if ( ! empty( $sections ) ) { |
|
| 460 | - Redux::set_sections( $args['opt_name'], $sections ); |
|
| 461 | - } |
|
| 462 | - $sections = Redux::construct_sections( $args['opt_name'] ); |
|
| 463 | - $args = Redux::construct_args( $args['opt_name'] ); |
|
| 464 | - Redux::set_defaults( $args['opt_name'] ); |
|
| 465 | - Redux::$init[ $args['opt_name'] ] = 1; |
|
| 466 | - } |
|
| 467 | - |
|
| 468 | - $args = new Redux_Args( $this, $args ); |
|
| 469 | - $this->args_class = $args; |
|
| 470 | - $this->args = $args->get; |
|
| 471 | - |
|
| 472 | - Redux_Core::core_construct( $this ); |
|
| 473 | - |
|
| 474 | - new Redux_Admin_Notices( $this ); |
|
| 475 | - |
|
| 476 | - if ( ! empty( $this->args['opt_name'] ) ) { |
|
| 477 | - new Redux_Instances( $this ); |
|
| 478 | - |
|
| 479 | - Redux_Core::$filesystem = Redux_Filesystem::get_instance( $this ); |
|
| 480 | - |
|
| 481 | - $this->filesystem = $this->deprecated_filesystem( Redux_Core::$filesystem ); |
|
| 482 | - |
|
| 483 | - /** |
|
| 484 | - * Filter 'redux/options/{opt_name}/sections' |
|
| 485 | - * |
|
| 486 | - * @param array $sections field option sections |
|
| 487 | - */ |
|
| 488 | - |
|
| 489 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 490 | - $this->sections = apply_filters( "redux/options/{$this->args['opt_name']}/sections", $sections ); |
|
| 491 | - |
|
| 492 | - /** |
|
| 493 | - * Construct hook |
|
| 494 | - * action 'redux/construct' |
|
| 495 | - * |
|
| 496 | - * @param object $this ReduxFramework |
|
| 497 | - */ |
|
| 498 | - |
|
| 499 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 500 | - do_action( 'redux/construct', $this ); |
|
| 501 | - |
|
| 502 | - // Internationalization. |
|
| 503 | - new Redux_I18n( $this, __FILE__ ); |
|
| 504 | - |
|
| 505 | - $this->required_class = new Redux_Required( $this ); |
|
| 506 | - $this->transient_class = new Redux_Transients( $this ); |
|
| 507 | - $this->wordpress_data = new Redux_WordPress_Data( $this ); |
|
| 508 | - $this->validate_class = new Redux_Validation( $this ); |
|
| 509 | - $this->sanitize_class = new Redux_Sanitize( $this ); |
|
| 510 | - |
|
| 511 | - // Register extra extensions. |
|
| 512 | - new Redux_Extensions( $this ); |
|
| 513 | - |
|
| 514 | - // Grab database values. |
|
| 515 | - $this->options_defaults_class = new Redux_Options_Defaults(); |
|
| 516 | - $this->options_class = new Redux_Options_Constructor( $this ); |
|
| 517 | - $this->options_class->get(); |
|
| 518 | - |
|
| 519 | - $this->output_class = new Redux_Output( $this ); |
|
| 520 | - $this->render_class = new Redux_Page_Render( $this ); |
|
| 521 | - $this->enqueue_class = new Redux_Enqueue( $this ); |
|
| 522 | - |
|
| 523 | - new Redux_AJAX_Save( $this ); |
|
| 524 | - new Redux_AJAX_Typography( $this ); |
|
| 525 | - new Redux_AJAX_Select2( $this ); |
|
| 526 | - } |
|
| 527 | - |
|
| 528 | - /** |
|
| 529 | - * Loaded hook |
|
| 530 | - * action 'redux/loaded' |
|
| 531 | - * |
|
| 532 | - * @param object $this ReduxFramework |
|
| 533 | - */ |
|
| 534 | - |
|
| 535 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 536 | - do_action( 'redux/loaded', $this ); |
|
| 537 | - } |
|
| 538 | - |
|
| 539 | - /** |
|
| 540 | - * Begin backward compatibility shims for Redux v3 configs and extensions. |
|
| 541 | - */ |
|
| 542 | - |
|
| 543 | - /** |
|
| 544 | - * SHIM: _register_settings |
|
| 545 | - * |
|
| 546 | - * @deprecated 4.0.0 |
|
| 547 | - */ |
|
| 548 | - public function _register_settings() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
|
| 549 | - _deprecated_function( __FUNCTION__, '4.0.0', 'options_class->register()' ); |
|
| 550 | - |
|
| 551 | - $this->options_class->register(); |
|
| 552 | - } |
|
| 553 | - |
|
| 554 | - /** |
|
| 555 | - * SHIM: _field_input |
|
| 556 | - * |
|
| 557 | - * @param array $field Field array. |
|
| 558 | - * @param string|array $v Field values. |
|
| 559 | - * |
|
| 560 | - * @deprecated 4.0.0 |
|
| 561 | - */ |
|
| 562 | - public function _field_input( array $field, $v = null ) { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
|
| 563 | - _deprecated_function( __FUNCTION__, '4.0.0', 'render_class->field_input( $field, $value )' ); |
|
| 564 | - |
|
| 565 | - $this->render_class->field_input( $field, $v ); |
|
| 566 | - } |
|
| 567 | - |
|
| 568 | - /** |
|
| 569 | - * SHIM: field_default_values |
|
| 570 | - * |
|
| 571 | - * @param array $field Field array. |
|
| 572 | - * |
|
| 573 | - * @deprecated 4.0.0 |
|
| 574 | - */ |
|
| 575 | - public function field_default_values( array $field ) { |
|
| 576 | - _deprecated_function( __FUNCTION__, '4.0.0', 'options_defaults_class->field_default_values( $opt_name, $field )' ); |
|
| 577 | - |
|
| 578 | - $this->options_defaults_class->field_default_values( '', $field ); |
|
| 579 | - } |
|
| 580 | - |
|
| 581 | - /** |
|
| 582 | - * SHIM: set_options |
|
| 583 | - * |
|
| 584 | - * @param string|array $value Option values. |
|
| 585 | - * |
|
| 586 | - * @deprecated 4.0.0 |
|
| 587 | - */ |
|
| 588 | - public function set_options( $value ) { |
|
| 589 | - _deprecated_function( __FUNCTION__, '4.0.0', 'options_class->set( $value )' ); |
|
| 590 | - |
|
| 591 | - $this->options_class->set( $value ); |
|
| 592 | - } |
|
| 593 | - |
|
| 594 | - /** |
|
| 595 | - * SHIM: get_options |
|
| 596 | - * |
|
| 597 | - * @deprecated 4.0.0 |
|
| 598 | - */ |
|
| 599 | - public function get_options() { |
|
| 600 | - _deprecated_function( __FUNCTION__, '4.0.0', 'options_class->get()' ); |
|
| 601 | - |
|
| 602 | - $this->options_class->get(); |
|
| 603 | - } |
|
| 604 | - |
|
| 605 | - /** |
|
| 606 | - * SHIM: _default_values |
|
| 607 | - * |
|
| 608 | - * @return array |
|
| 609 | - * |
|
| 610 | - * @deprecated 4.0.0 |
|
| 611 | - */ |
|
| 612 | - public function _default_values() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
|
| 613 | - _deprecated_function( __FUNCTION__, '4.0.0', 'options_class->default_values()' ); |
|
| 614 | - |
|
| 615 | - return $this->default_values(); |
|
| 616 | - } |
|
| 617 | - |
|
| 618 | - /** |
|
| 619 | - * Get default values. |
|
| 620 | - * |
|
| 621 | - * @return array |
|
| 622 | - */ |
|
| 623 | - public function default_values() { |
|
| 624 | - if ( ! isset( $this->options_class ) ) { |
|
| 625 | - $this->options_defaults_class = new Redux_Options_Defaults(); |
|
| 626 | - $this->options_class = new Redux_Options_Constructor( $this ); |
|
| 627 | - } |
|
| 628 | - |
|
| 629 | - return $this->options_class->default_values(); |
|
| 630 | - } |
|
| 631 | - |
|
| 632 | - /** |
|
| 633 | - * SHIM: check_dependencies |
|
| 634 | - * |
|
| 635 | - * @param array $field Field array. |
|
| 636 | - * |
|
| 637 | - * @deprecated 4.0.0 |
|
| 638 | - */ |
|
| 639 | - public function check_dependencies( array $field ) { |
|
| 640 | - _deprecated_function( __FUNCTION__, '4.0.0', 'required_class->check_dependencies( $field )' ); |
|
| 641 | - |
|
| 642 | - $this->required_class->check_dependencies( $field ); |
|
| 643 | - } |
|
| 644 | - |
|
| 645 | - /** |
|
| 646 | - * SHIM: _enqueue_output |
|
| 647 | - * |
|
| 648 | - * @throws ReflectionException Exception. |
|
| 649 | - * |
|
| 650 | - * @deprecated 4.0.0 |
|
| 651 | - */ |
|
| 652 | - public function _enqueue_output() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
|
| 653 | - _deprecated_function( __FUNCTION__, '4.0.0', 'output_class->enqueue()' ); |
|
| 654 | - |
|
| 655 | - if ( empty( $this->output_class ) ) { |
|
| 656 | - $obj = new ReduxFramework( $this->sections, $this->args ); |
|
| 657 | - $obj->options = $this->options; |
|
| 658 | - $obj->output_class->enqueue(); |
|
| 659 | - $this->outputCSS = $obj->outputCSS; // phpcs:ignore WordPress.NamingConventions.ValidVariableName |
|
| 660 | - } else { |
|
| 661 | - $this->output_class->enqueue(); |
|
| 662 | - } |
|
| 663 | - } |
|
| 664 | - |
|
| 665 | - /** |
|
| 666 | - * SHIM: _enqueue |
|
| 667 | - * |
|
| 668 | - * @deprecated 4.0.0 |
|
| 669 | - */ |
|
| 670 | - public function _enqueue() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
|
| 671 | - _deprecated_function( __FUNCTION__, '4.0.0', 'enqueue_class->init()' ); |
|
| 672 | - |
|
| 673 | - $this->enqueue_class->init(); |
|
| 674 | - } |
|
| 675 | - |
|
| 676 | - /** |
|
| 677 | - * _enqueue replacement. |
|
| 678 | - * |
|
| 679 | - * @return void |
|
| 680 | - */ |
|
| 681 | - public function init_enqueue() { |
|
| 682 | - $this->enqueue_class->init(); |
|
| 683 | - } |
|
| 684 | - |
|
| 685 | - /** |
|
| 686 | - * SHIM: generate_panel |
|
| 687 | - * |
|
| 688 | - * @since 1.0.0 |
|
| 689 | - * @access public |
|
| 690 | - * @return void |
|
| 691 | - * |
|
| 692 | - * @deprecated 4.0.0 |
|
| 693 | - */ |
|
| 694 | - public function generate_panel() { |
|
| 695 | - _deprecated_function( __FUNCTION__, '4.0.0', 'render_class->generate_panel()' ); |
|
| 696 | - |
|
| 697 | - $this->render_class->generate_panel(); |
|
| 698 | - } |
|
| 699 | - |
|
| 700 | - /** |
|
| 701 | - * SHIM: get_default_values |
|
| 702 | - * |
|
| 703 | - * @param string $key Key value. |
|
| 704 | - * @param bool $array_key Flag to determine array status. |
|
| 705 | - * |
|
| 706 | - * @return array |
|
| 707 | - * |
|
| 708 | - * @deprecated 4.0.0 |
|
| 709 | - */ |
|
| 710 | - public function get_default_values( $key, $array_key = false ) { |
|
| 711 | - _deprecated_function( __FUNCTION__, '4.0.0', 'options_class->get_default_value( $key, $array_key )' ); |
|
| 712 | - |
|
| 713 | - if ( ! isset( $this->options_class ) ) { |
|
| 714 | - $this->options_defaults_class = new Redux_Options_Defaults(); |
|
| 715 | - $this->options_class = new Redux_Options_Constructor( $this ); |
|
| 716 | - } |
|
| 717 | - |
|
| 718 | - return $this->options_class->get_default_value( $key, $array_key ); |
|
| 719 | - } |
|
| 720 | - |
|
| 721 | - /** |
|
| 722 | - * SHIM: get_default_value |
|
| 723 | - * |
|
| 724 | - * @param string $key Key value. |
|
| 725 | - * @param bool $array_key Flag to determine array status. |
|
| 726 | - * |
|
| 727 | - * @return array |
|
| 728 | - * |
|
| 729 | - * @deprecated 4.0.0 |
|
| 730 | - */ |
|
| 731 | - public function get_default_value( $key, $array_key = false ) { |
|
| 732 | - _deprecated_function( __FUNCTION__, '4.0.0', 'options_class->get_default_value( $key, $array_key )' ); |
|
| 733 | - |
|
| 734 | - if ( ! isset( $this->options_class ) ) { |
|
| 735 | - $this->options_defaults_class = new Redux_Options_Defaults(); |
|
| 736 | - $this->options_class = new Redux_Options_Constructor( $this ); |
|
| 737 | - } |
|
| 738 | - |
|
| 739 | - return $this->options_class->get_default_value( $key, $array_key ); |
|
| 740 | - } |
|
| 741 | - |
|
| 742 | - /** |
|
| 743 | - * SHIM: get_wordpress_data |
|
| 744 | - * |
|
| 745 | - * @param bool $type data type. |
|
| 746 | - * @param array $args args to pass to WordPress API. |
|
| 747 | - * @param string|array $current_value Current value. |
|
| 748 | - * |
|
| 749 | - * @return array|mixed|string|void |
|
| 750 | - * |
|
| 751 | - * @deprecated 4.0.0 |
|
| 752 | - */ |
|
| 753 | - public function get_wordpress_data( $type = false, $args = array(), $current_value = null ) { |
|
| 754 | - _deprecated_function( __FUNCTION__, '4.0.0', 'wordpress_data->get( $type, $args, $opt_name, $value )' ); |
|
| 755 | - |
|
| 756 | - return $this->wordpress_data->get( $type, $args, $this->args['opt_name'], $current_value ); |
|
| 757 | - } |
|
| 758 | - |
|
| 759 | - /** |
|
| 760 | - * SHIM: _validate_values |
|
| 761 | - * |
|
| 762 | - * @param array $plugin_options Current panel options. |
|
| 763 | - * @param array $options Options to validate. |
|
| 764 | - * @param array $sections Sections array. |
|
| 765 | - * |
|
| 766 | - * @return array |
|
| 767 | - * |
|
| 768 | - * @deprecated 4.0.0 |
|
| 769 | - */ |
|
| 770 | - public function _validate_values( $plugin_options, $options, $sections ) { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
|
| 771 | - _deprecated_function( __FUNCTION__, '4.0.0', 'validate_class->validate( $plugin_options, $options, $sections )' ); |
|
| 772 | - |
|
| 773 | - if ( ! isset( $this->validate_class ) ) { |
|
| 774 | - $this->validate_class = new Redux_Validation( $this ); |
|
| 775 | - } |
|
| 776 | - |
|
| 777 | - return $this->validate_class->validate( $plugin_options, $options, $sections ); |
|
| 778 | - } |
|
| 779 | - |
|
| 780 | - /** |
|
| 781 | - * SHIM: set_transients |
|
| 782 | - * |
|
| 783 | - * @return void |
|
| 784 | - * |
|
| 785 | - * @deprecated 4.0.0 |
|
| 786 | - */ |
|
| 787 | - public function set_transients() { |
|
| 788 | - _deprecated_function( __FUNCTION__, '4.0.0', 'Please update the extension that uses this deprecated function.' ); |
|
| 789 | - } |
|
| 790 | - |
|
| 791 | - /** |
|
| 792 | - * SHIM: section_menu |
|
| 793 | - * |
|
| 794 | - * @param int $k Array Key. |
|
| 795 | - * @param array $section Section array. |
|
| 796 | - * @param string $suffix Unique string. |
|
| 797 | - * @param array $sections Section array. |
|
| 798 | - * |
|
| 799 | - * @return string |
|
| 800 | - * |
|
| 801 | - * @deprecated 4.0.0 |
|
| 802 | - */ |
|
| 803 | - public function section_menu( $k, $section, $suffix = '', $sections = array() ) { |
|
| 804 | - _deprecated_function( __FUNCTION__, '4.0.0', 'render_class->section_menu( $index, $section, $suffix, $sections )' ); |
|
| 805 | - |
|
| 806 | - return $this->render_class->section_menu( $k, $section, $suffix, $sections ); |
|
| 807 | - } |
|
| 808 | - |
|
| 809 | - /** |
|
| 810 | - * SHIM: get_header_html |
|
| 811 | - * |
|
| 812 | - * @param array $field Field array. |
|
| 813 | - * |
|
| 814 | - * @return string |
|
| 815 | - * |
|
| 816 | - * @deprecated 4.0.0 |
|
| 817 | - */ |
|
| 818 | - public function get_header_html( $field ) { |
|
| 819 | - _deprecated_function( __FUNCTION__, '4.0.0', 'render_class->get_header_html( $field )' ); |
|
| 820 | - |
|
| 821 | - return $this->render_class->get_header_html( $field ); |
|
| 822 | - } |
|
| 823 | - |
|
| 824 | - /** |
|
| 825 | - * SHIM: current_user_can |
|
| 826 | - * |
|
| 827 | - * @param string $permission User permission. |
|
| 828 | - * |
|
| 829 | - * @return bool |
|
| 830 | - * |
|
| 831 | - * @deprecated 4.0.0 |
|
| 832 | - */ |
|
| 833 | - public function current_user_can( $permission ) { |
|
| 834 | - _deprecated_function( __FUNCTION__, '4.0.0', 'Redux_Helpers::current_user_can' ); |
|
| 835 | - |
|
| 836 | - return Redux_Helpers::current_user_can( $permission ); |
|
| 837 | - } |
|
| 838 | - |
|
| 839 | - /** |
|
| 840 | - * End backward compatibility shims for Redux v3 configs and extensions. |
|
| 841 | - */ |
|
| 842 | - |
|
| 843 | - /** |
|
| 844 | - * Pointer to the ReduxFramework instance. |
|
| 845 | - * |
|
| 846 | - * @return ReduxFramework|null |
|
| 847 | - */ |
|
| 848 | - public function get_instance(): ?ReduxFramework { |
|
| 849 | - return self::$instance; |
|
| 850 | - } |
|
| 851 | - |
|
| 852 | - /** |
|
| 853 | - * →get(); This is used to return and option value from the option array |
|
| 854 | - * |
|
| 855 | - * @since 1.0.0 |
|
| 856 | - * @access public |
|
| 857 | - * |
|
| 858 | - * @param string $opt_name The option name to return. |
|
| 859 | - * @param mixed $defaults (null) The value to return if an option isn't set. |
|
| 860 | - * |
|
| 861 | - * @return mixed |
|
| 862 | - */ |
|
| 863 | - public function get( string $opt_name, $defaults = null ) { |
|
| 864 | - return ( ! empty( $this->options[ $opt_name ] ) ) ? $this->options[ $opt_name ] : $this->options_class->get_default( $opt_name, $defaults ); |
|
| 865 | - } |
|
| 866 | - |
|
| 867 | - /** |
|
| 868 | - * →set(); This is used to set an arbitrary option in the option array |
|
| 869 | - * |
|
| 870 | - * @since 1.0.0 |
|
| 871 | - * @access public |
|
| 872 | - * |
|
| 873 | - * @param string $opt_name The name of the option being added. |
|
| 874 | - * @param mixed $values The value of the option being added. |
|
| 875 | - * |
|
| 876 | - * @return void |
|
| 877 | - */ |
|
| 878 | - public function set( string $opt_name = '', $values = array() ) { |
|
| 879 | - if ( ! empty( $opt_name ) && is_array( $values ) ) { |
|
| 880 | - $this->options[ $opt_name ] = $values; |
|
| 881 | - $this->options_class->set( $values ); |
|
| 882 | - } |
|
| 883 | - } |
|
| 884 | - } |
|
| 885 | - |
|
| 886 | - ReduxFramework::init(); |
|
| 887 | - |
|
| 888 | - /** |
|
| 889 | - * Action 'redux/init' |
|
| 890 | - */ |
|
| 891 | - do_action( 'redux/init' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 42 | + /** |
|
| 43 | + * Main ReduxFramework class |
|
| 44 | + * |
|
| 45 | + * @since 1.0.0 |
|
| 46 | + */ |
|
| 47 | + class ReduxFramework { |
|
| 48 | + |
|
| 49 | + /** |
|
| 50 | + * ReduxFramework instance storage. |
|
| 51 | + * |
|
| 52 | + * @var null|ReduxFramework |
|
| 53 | + * @access public |
|
| 54 | + */ |
|
| 55 | + public static ?ReduxFramework $instance; |
|
| 56 | + |
|
| 57 | + /** |
|
| 58 | + * Redux current version. |
|
| 59 | + * |
|
| 60 | + * @var string |
|
| 61 | + * @access public |
|
| 62 | + * |
|
| 63 | + * @deprecated 4.0.0 |
|
| 64 | + */ |
|
| 65 | + public static string $_version = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * Absolute directory of the Redux instance. |
|
| 69 | + * |
|
| 70 | + * @var string |
|
| 71 | + * @access public |
|
| 72 | + * |
|
| 73 | + * @deprecated 4.0.0 |
|
| 74 | + */ |
|
| 75 | + public static string $_dir = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * Full URL of the Redux instance. |
|
| 79 | + * |
|
| 80 | + * @var string |
|
| 81 | + * @access public |
|
| 82 | + * |
|
| 83 | + * @deprecated 4.0.0 |
|
| 84 | + */ |
|
| 85 | + public static string $_url = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * Current WordPress upload directory. |
|
| 89 | + * |
|
| 90 | + * @var string |
|
| 91 | + * @access public |
|
| 92 | + * |
|
| 93 | + * @deprecated 4.0.0 |
|
| 94 | + */ |
|
| 95 | + public static string $_upload_dir = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * Current WordPress upload URL |
|
| 99 | + * |
|
| 100 | + * @var string |
|
| 101 | + * @access public |
|
| 102 | + * |
|
| 103 | + * @deprecated 4.0.0 |
|
| 104 | + */ |
|
| 105 | + public static string $_upload_url; // phpcs:ignore PSR2.Classes.PropertyDeclaration |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * Init |
|
| 109 | + * |
|
| 110 | + * Backward compatibility for previous versions of Redux. |
|
| 111 | + */ |
|
| 112 | + public static function init() { |
|
| 113 | + |
|
| 114 | + // Backward compatibility for extensions. |
|
| 115 | + self::$_version = Redux_Core::$version; |
|
| 116 | + self::$_dir = Redux_Core::$dir; |
|
| 117 | + self::$_url = Redux_Core::$url; |
|
| 118 | + self::$_upload_dir = Redux_Core::$upload_dir; |
|
| 119 | + self::$_upload_url = Redux_Core::$upload_url; |
|
| 120 | + self::$_as_plugin = Redux_Core::$as_plugin; |
|
| 121 | + self::$_is_plugin = Redux_Core::$is_plugin; |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * Array of field arrays. |
|
| 126 | + * |
|
| 127 | + * @var null|array |
|
| 128 | + */ |
|
| 129 | + public ?array $fields = array(); |
|
| 130 | + |
|
| 131 | + /** |
|
| 132 | + * Array of field sections. |
|
| 133 | + * |
|
| 134 | + * @var null|array |
|
| 135 | + */ |
|
| 136 | + public ?array $field_sections = array(); |
|
| 137 | + |
|
| 138 | + /** |
|
| 139 | + * Array of field types. |
|
| 140 | + * |
|
| 141 | + * @var null|array |
|
| 142 | + */ |
|
| 143 | + public ?array $field_types = array(); |
|
| 144 | + |
|
| 145 | + /** |
|
| 146 | + * Array of field heads. |
|
| 147 | + * |
|
| 148 | + * @var null|array |
|
| 149 | + */ |
|
| 150 | + public ?array $field_head = array(); |
|
| 151 | + |
|
| 152 | + /** |
|
| 153 | + * Array of extensions by type used in the panel. |
|
| 154 | + * |
|
| 155 | + * @var null|array |
|
| 156 | + */ |
|
| 157 | + public ?array $extensions = array(); |
|
| 158 | + |
|
| 159 | + /** |
|
| 160 | + * Array of sections and fields arrays. |
|
| 161 | + * |
|
| 162 | + * @var null|array |
|
| 163 | + */ |
|
| 164 | + public ?array $sections = array(); |
|
| 165 | + |
|
| 166 | + /** |
|
| 167 | + * Array of generated errors from the panel for localization. |
|
| 168 | + * |
|
| 169 | + * @var null|array |
|
| 170 | + */ |
|
| 171 | + public ?array $errors = array(); |
|
| 172 | + |
|
| 173 | + /** |
|
| 174 | + * Array of generated warnings from the panel for localization. |
|
| 175 | + * |
|
| 176 | + * @var null|array |
|
| 177 | + */ |
|
| 178 | + public ?array $warnings = array(); |
|
| 179 | + |
|
| 180 | + /** |
|
| 181 | + * Array of generated sanitize notices from the panel for localization. |
|
| 182 | + * |
|
| 183 | + * @var null|array |
|
| 184 | + */ |
|
| 185 | + public ?array $sanitize = array(); |
|
| 186 | + |
|
| 187 | + /** |
|
| 188 | + * Array of current option values. |
|
| 189 | + * |
|
| 190 | + * @var null|array |
|
| 191 | + */ |
|
| 192 | + public ?array $options = array(); |
|
| 193 | + |
|
| 194 | + /** |
|
| 195 | + * Array of option defaults. |
|
| 196 | + * |
|
| 197 | + * @var null|array |
|
| 198 | + */ |
|
| 199 | + public ?array $options_defaults = null; |
|
| 200 | + |
|
| 201 | + /** |
|
| 202 | + * Array of fields set to trigger the compiler hook. |
|
| 203 | + * |
|
| 204 | + * @var null|array |
|
| 205 | + */ |
|
| 206 | + public ?array $compiler_fields = array(); |
|
| 207 | + |
|
| 208 | + /** |
|
| 209 | + * Array of fields with CSS output selectors. |
|
| 210 | + * |
|
| 211 | + * @var null|array |
|
| 212 | + */ |
|
| 213 | + public ?array $output = array(); |
|
| 214 | + |
|
| 215 | + /** |
|
| 216 | + * Autogenerated CSS appended to the header (snake case maintained for backward compatibility). |
|
| 217 | + * |
|
| 218 | + * @var null|string |
|
| 219 | + */ |
|
| 220 | + public ?string $outputCSS = ''; // phpcs:ignore WordPress.NamingConventions.ValidVariableName |
|
| 221 | + |
|
| 222 | + /** |
|
| 223 | + * Autogenerated variables appended to dynamic output. |
|
| 224 | + * |
|
| 225 | + * @var null|array |
|
| 226 | + */ |
|
| 227 | + public ?array $output_variables = array(); |
|
| 228 | + |
|
| 229 | + /** |
|
| 230 | + * CSS sent to the compiler hook (snake case maintained for backward compatibility). |
|
| 231 | + * |
|
| 232 | + * @var null|string |
|
| 233 | + */ |
|
| 234 | + public ?string $compilerCSS = ''; // phpcs:ignore WordPress.NamingConventions.ValidVariableName |
|
| 235 | + |
|
| 236 | + /** |
|
| 237 | + * Array of global arguments. |
|
| 238 | + * |
|
| 239 | + * @var array|null |
|
| 240 | + */ |
|
| 241 | + public ?array $args = array(); |
|
| 242 | + |
|
| 243 | + /** |
|
| 244 | + * Used in customizer hooks. |
|
| 245 | + * |
|
| 246 | + * @var null|string |
|
| 247 | + */ |
|
| 248 | + public ?string $old_opt_name = ''; |
|
| 249 | + |
|
| 250 | + /** |
|
| 251 | + * Pointer to the Redux_Options_Default class. |
|
| 252 | + * |
|
| 253 | + * @var null|Redux_Options_Defaults |
|
| 254 | + */ |
|
| 255 | + public ?Redux_Options_Defaults $options_defaults_class = null; |
|
| 256 | + |
|
| 257 | + /** |
|
| 258 | + * Pointer to the Redux_Options class. |
|
| 259 | + * |
|
| 260 | + * @var null|Redux_Options_Constructor |
|
| 261 | + */ |
|
| 262 | + public ?Redux_Options_Constructor $options_class = null; |
|
| 263 | + |
|
| 264 | + /** |
|
| 265 | + * Pointer to the Redux_Required class |
|
| 266 | + * |
|
| 267 | + * @var null|Redux_Required |
|
| 268 | + */ |
|
| 269 | + public ?Redux_Required $required_class = null; |
|
| 270 | + |
|
| 271 | + /** |
|
| 272 | + * Pointer to the Redux_Output class. |
|
| 273 | + * |
|
| 274 | + * @var null|Redux_Output |
|
| 275 | + */ |
|
| 276 | + public ?Redux_Output $output_class = null; |
|
| 277 | + |
|
| 278 | + /** |
|
| 279 | + * Pointer to the Redux_Page_Render class. |
|
| 280 | + * |
|
| 281 | + * @var null|Redux_Page_Render |
|
| 282 | + */ |
|
| 283 | + public ?Redux_Page_Render $render_class = null; |
|
| 284 | + |
|
| 285 | + /** |
|
| 286 | + * Pointer to the Redux_Enqueue class. |
|
| 287 | + * |
|
| 288 | + * @var null|Redux_Enqueue |
|
| 289 | + */ |
|
| 290 | + public ?Redux_Enqueue $enqueue_class = null; |
|
| 291 | + |
|
| 292 | + /** |
|
| 293 | + * Pointer to the Redux_Transients class. |
|
| 294 | + * |
|
| 295 | + * @var null|Redux_Transients |
|
| 296 | + */ |
|
| 297 | + public ?Redux_Transients $transient_class = null; |
|
| 298 | + |
|
| 299 | + /** |
|
| 300 | + * Pointer to the Redux_wordPress_Data class. |
|
| 301 | + * |
|
| 302 | + * @var null|Redux_WordPress_Data |
|
| 303 | + */ |
|
| 304 | + public ?Redux_WordPress_Data $wordpress_data = null; |
|
| 305 | + |
|
| 306 | + /** |
|
| 307 | + * Pointer to the Redux_Validation class. |
|
| 308 | + * |
|
| 309 | + * @var null|Redux_Validation |
|
| 310 | + */ |
|
| 311 | + public ?Redux_Validation $validate_class = null; |
|
| 312 | + |
|
| 313 | + /** |
|
| 314 | + * Pointer to the Redux_Sanitize class. |
|
| 315 | + * |
|
| 316 | + * @var null|Redux_Sanitize |
|
| 317 | + */ |
|
| 318 | + public ?Redux_Sanitize $sanitize_class = null; |
|
| 319 | + |
|
| 320 | + /** |
|
| 321 | + * Pointer to the Redux_Args class. |
|
| 322 | + * |
|
| 323 | + * @var null|Redux_Args |
|
| 324 | + */ |
|
| 325 | + public ?Redux_Args $args_class = null; |
|
| 326 | + |
|
| 327 | + /** |
|
| 328 | + * Array of active transients used by Redux. |
|
| 329 | + * |
|
| 330 | + * @var null|mixed |
|
| 331 | + */ |
|
| 332 | + public $transients = array(); |
|
| 333 | + |
|
| 334 | + /** |
|
| 335 | + * Array of localized repeater data. |
|
| 336 | + * |
|
| 337 | + * @var null|array |
|
| 338 | + */ |
|
| 339 | + public ?array $repeater_data = array(); |
|
| 340 | + |
|
| 341 | + /** |
|
| 342 | + * Array of localized data. |
|
| 343 | + * |
|
| 344 | + * @var null|array |
|
| 345 | + */ |
|
| 346 | + public ?array $localize_data = array(); |
|
| 347 | + |
|
| 348 | + /** |
|
| 349 | + * Array of checked transients used by Redux. |
|
| 350 | + * |
|
| 351 | + * @var null|mixed |
|
| 352 | + */ |
|
| 353 | + public $transients_check = array(); |
|
| 354 | + |
|
| 355 | + /** |
|
| 356 | + * Never save to DB flag for metaboxes. |
|
| 357 | + * |
|
| 358 | + * @var bool |
|
| 359 | + */ |
|
| 360 | + public bool $never_save_to_db; |
|
| 361 | + |
|
| 362 | + /** |
|
| 363 | + * File system object used for I/O file operations. Done the WordPress way. |
|
| 364 | + * |
|
| 365 | + * @var null|object |
|
| 366 | + * |
|
| 367 | + * @deprecated 4.5.1 |
|
| 368 | + */ |
|
| 369 | + public ?object $filesystem; |
|
| 370 | + |
|
| 371 | + /** |
|
| 372 | + * Deprecated shim for v3 templates. |
|
| 373 | + * |
|
| 374 | + * @var null|array |
|
| 375 | + * |
|
| 376 | + * @deprecated 4.0.0 |
|
| 377 | + */ |
|
| 378 | + public ?array $hidden_perm_sections = array(); |
|
| 379 | + |
|
| 380 | + /** |
|
| 381 | + * Deprecated shim for v3 as plugin check. |
|
| 382 | + * |
|
| 383 | + * @var bool |
|
| 384 | + * |
|
| 385 | + * @deprecated 4.0.0 |
|
| 386 | + */ |
|
| 387 | + public static bool $_as_plugin = false; // phpcs:ignore PSR2.Classes.PropertyDeclaration |
|
| 388 | + |
|
| 389 | + /** |
|
| 390 | + * Deprecated shim for v3 as plugin check. |
|
| 391 | + * |
|
| 392 | + * @var bool |
|
| 393 | + * |
|
| 394 | + * @deprecated 4.0.0 |
|
| 395 | + */ |
|
| 396 | + public static bool $_is_plugin = false; // phpcs:ignore PSR2.Classes.PropertyDeclaration |
|
| 397 | + |
|
| 398 | + /** |
|
| 399 | + * Cloning is forbidden. |
|
| 400 | + * |
|
| 401 | + * @since 4.0.0 |
|
| 402 | + */ |
|
| 403 | + public function __clone() { |
|
| 404 | + _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ eh?', 'redux-framework' ), '4.0' ); |
|
| 405 | + } |
|
| 406 | + |
|
| 407 | + /** |
|
| 408 | + * Un-serializing instances of this class are forbidden. |
|
| 409 | + * |
|
| 410 | + * @since 4.0.0 |
|
| 411 | + */ |
|
| 412 | + public function __wakeup() { |
|
| 413 | + _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ eh?', 'redux-framework' ), '4.0' ); |
|
| 414 | + } |
|
| 415 | + |
|
| 416 | + /** |
|
| 417 | + * Add a deprecating notice for all the old themes that still use this method.. |
|
| 418 | + * |
|
| 419 | + * @param object $filesystem Filesystem object. |
|
| 420 | + * |
|
| 421 | + * @since 4.0.0 |
|
| 422 | + */ |
|
| 423 | + private function deprecated_filesystem( $filesystem ) { |
|
| 424 | + // _deprecated_function( esc_html__( 'The global variable "$filesystem" of the ReduxFramework object', 'redux-framework' ), '4.5.1', 'Redux_Core::$filesystem' ); |
|
| 425 | + |
|
| 426 | + return $filesystem; |
|
| 427 | + } |
|
| 428 | + |
|
| 429 | + /** |
|
| 430 | + * Class Constructor. Defines the args for the theme options class |
|
| 431 | + * |
|
| 432 | + * @param array $sections Panel sections. |
|
| 433 | + * @param array $args Class constructor arguments. |
|
| 434 | + * |
|
| 435 | + * @throws ReflectionException Exception. |
|
| 436 | + * @since 1.0.0 |
|
| 437 | + */ |
|
| 438 | + public function __construct( array $sections = array(), array $args = array() ) { |
|
| 439 | + global $pagenow; |
|
| 440 | + |
|
| 441 | + if ( Redux_Core::is_heartbeat() ) { |
|
| 442 | + return; |
|
| 443 | + } |
|
| 444 | + |
|
| 445 | + $args['load_on_cron'] = $args['load_on_cron'] ?? false; |
|
| 446 | + |
|
| 447 | + if ( false === $args['load_on_cron'] && 'wp-cron.php' === $pagenow ) { |
|
| 448 | + return; |
|
| 449 | + } |
|
| 450 | + |
|
| 451 | + if ( empty( $args ) || ( empty( $args['opt_name'] ) ) ) { |
|
| 452 | + return; |
|
| 453 | + } |
|
| 454 | + |
|
| 455 | + if ( ! isset( Redux::$init[ $args['opt_name'] ] ) ) { |
|
| 456 | + // Let's go back to the Redux API instead of having it run directly. |
|
| 457 | + Redux_Functions_Ex::record_caller( $args['opt_name'] ); |
|
| 458 | + Redux::set_args( $args['opt_name'], $args ); |
|
| 459 | + if ( ! empty( $sections ) ) { |
|
| 460 | + Redux::set_sections( $args['opt_name'], $sections ); |
|
| 461 | + } |
|
| 462 | + $sections = Redux::construct_sections( $args['opt_name'] ); |
|
| 463 | + $args = Redux::construct_args( $args['opt_name'] ); |
|
| 464 | + Redux::set_defaults( $args['opt_name'] ); |
|
| 465 | + Redux::$init[ $args['opt_name'] ] = 1; |
|
| 466 | + } |
|
| 467 | + |
|
| 468 | + $args = new Redux_Args( $this, $args ); |
|
| 469 | + $this->args_class = $args; |
|
| 470 | + $this->args = $args->get; |
|
| 471 | + |
|
| 472 | + Redux_Core::core_construct( $this ); |
|
| 473 | + |
|
| 474 | + new Redux_Admin_Notices( $this ); |
|
| 475 | + |
|
| 476 | + if ( ! empty( $this->args['opt_name'] ) ) { |
|
| 477 | + new Redux_Instances( $this ); |
|
| 478 | + |
|
| 479 | + Redux_Core::$filesystem = Redux_Filesystem::get_instance( $this ); |
|
| 480 | + |
|
| 481 | + $this->filesystem = $this->deprecated_filesystem( Redux_Core::$filesystem ); |
|
| 482 | + |
|
| 483 | + /** |
|
| 484 | + * Filter 'redux/options/{opt_name}/sections' |
|
| 485 | + * |
|
| 486 | + * @param array $sections field option sections |
|
| 487 | + */ |
|
| 488 | + |
|
| 489 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 490 | + $this->sections = apply_filters( "redux/options/{$this->args['opt_name']}/sections", $sections ); |
|
| 491 | + |
|
| 492 | + /** |
|
| 493 | + * Construct hook |
|
| 494 | + * action 'redux/construct' |
|
| 495 | + * |
|
| 496 | + * @param object $this ReduxFramework |
|
| 497 | + */ |
|
| 498 | + |
|
| 499 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 500 | + do_action( 'redux/construct', $this ); |
|
| 501 | + |
|
| 502 | + // Internationalization. |
|
| 503 | + new Redux_I18n( $this, __FILE__ ); |
|
| 504 | + |
|
| 505 | + $this->required_class = new Redux_Required( $this ); |
|
| 506 | + $this->transient_class = new Redux_Transients( $this ); |
|
| 507 | + $this->wordpress_data = new Redux_WordPress_Data( $this ); |
|
| 508 | + $this->validate_class = new Redux_Validation( $this ); |
|
| 509 | + $this->sanitize_class = new Redux_Sanitize( $this ); |
|
| 510 | + |
|
| 511 | + // Register extra extensions. |
|
| 512 | + new Redux_Extensions( $this ); |
|
| 513 | + |
|
| 514 | + // Grab database values. |
|
| 515 | + $this->options_defaults_class = new Redux_Options_Defaults(); |
|
| 516 | + $this->options_class = new Redux_Options_Constructor( $this ); |
|
| 517 | + $this->options_class->get(); |
|
| 518 | + |
|
| 519 | + $this->output_class = new Redux_Output( $this ); |
|
| 520 | + $this->render_class = new Redux_Page_Render( $this ); |
|
| 521 | + $this->enqueue_class = new Redux_Enqueue( $this ); |
|
| 522 | + |
|
| 523 | + new Redux_AJAX_Save( $this ); |
|
| 524 | + new Redux_AJAX_Typography( $this ); |
|
| 525 | + new Redux_AJAX_Select2( $this ); |
|
| 526 | + } |
|
| 527 | + |
|
| 528 | + /** |
|
| 529 | + * Loaded hook |
|
| 530 | + * action 'redux/loaded' |
|
| 531 | + * |
|
| 532 | + * @param object $this ReduxFramework |
|
| 533 | + */ |
|
| 534 | + |
|
| 535 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 536 | + do_action( 'redux/loaded', $this ); |
|
| 537 | + } |
|
| 538 | + |
|
| 539 | + /** |
|
| 540 | + * Begin backward compatibility shims for Redux v3 configs and extensions. |
|
| 541 | + */ |
|
| 542 | + |
|
| 543 | + /** |
|
| 544 | + * SHIM: _register_settings |
|
| 545 | + * |
|
| 546 | + * @deprecated 4.0.0 |
|
| 547 | + */ |
|
| 548 | + public function _register_settings() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
|
| 549 | + _deprecated_function( __FUNCTION__, '4.0.0', 'options_class->register()' ); |
|
| 550 | + |
|
| 551 | + $this->options_class->register(); |
|
| 552 | + } |
|
| 553 | + |
|
| 554 | + /** |
|
| 555 | + * SHIM: _field_input |
|
| 556 | + * |
|
| 557 | + * @param array $field Field array. |
|
| 558 | + * @param string|array $v Field values. |
|
| 559 | + * |
|
| 560 | + * @deprecated 4.0.0 |
|
| 561 | + */ |
|
| 562 | + public function _field_input( array $field, $v = null ) { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
|
| 563 | + _deprecated_function( __FUNCTION__, '4.0.0', 'render_class->field_input( $field, $value )' ); |
|
| 564 | + |
|
| 565 | + $this->render_class->field_input( $field, $v ); |
|
| 566 | + } |
|
| 567 | + |
|
| 568 | + /** |
|
| 569 | + * SHIM: field_default_values |
|
| 570 | + * |
|
| 571 | + * @param array $field Field array. |
|
| 572 | + * |
|
| 573 | + * @deprecated 4.0.0 |
|
| 574 | + */ |
|
| 575 | + public function field_default_values( array $field ) { |
|
| 576 | + _deprecated_function( __FUNCTION__, '4.0.0', 'options_defaults_class->field_default_values( $opt_name, $field )' ); |
|
| 577 | + |
|
| 578 | + $this->options_defaults_class->field_default_values( '', $field ); |
|
| 579 | + } |
|
| 580 | + |
|
| 581 | + /** |
|
| 582 | + * SHIM: set_options |
|
| 583 | + * |
|
| 584 | + * @param string|array $value Option values. |
|
| 585 | + * |
|
| 586 | + * @deprecated 4.0.0 |
|
| 587 | + */ |
|
| 588 | + public function set_options( $value ) { |
|
| 589 | + _deprecated_function( __FUNCTION__, '4.0.0', 'options_class->set( $value )' ); |
|
| 590 | + |
|
| 591 | + $this->options_class->set( $value ); |
|
| 592 | + } |
|
| 593 | + |
|
| 594 | + /** |
|
| 595 | + * SHIM: get_options |
|
| 596 | + * |
|
| 597 | + * @deprecated 4.0.0 |
|
| 598 | + */ |
|
| 599 | + public function get_options() { |
|
| 600 | + _deprecated_function( __FUNCTION__, '4.0.0', 'options_class->get()' ); |
|
| 601 | + |
|
| 602 | + $this->options_class->get(); |
|
| 603 | + } |
|
| 604 | + |
|
| 605 | + /** |
|
| 606 | + * SHIM: _default_values |
|
| 607 | + * |
|
| 608 | + * @return array |
|
| 609 | + * |
|
| 610 | + * @deprecated 4.0.0 |
|
| 611 | + */ |
|
| 612 | + public function _default_values() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
|
| 613 | + _deprecated_function( __FUNCTION__, '4.0.0', 'options_class->default_values()' ); |
|
| 614 | + |
|
| 615 | + return $this->default_values(); |
|
| 616 | + } |
|
| 617 | + |
|
| 618 | + /** |
|
| 619 | + * Get default values. |
|
| 620 | + * |
|
| 621 | + * @return array |
|
| 622 | + */ |
|
| 623 | + public function default_values() { |
|
| 624 | + if ( ! isset( $this->options_class ) ) { |
|
| 625 | + $this->options_defaults_class = new Redux_Options_Defaults(); |
|
| 626 | + $this->options_class = new Redux_Options_Constructor( $this ); |
|
| 627 | + } |
|
| 628 | + |
|
| 629 | + return $this->options_class->default_values(); |
|
| 630 | + } |
|
| 631 | + |
|
| 632 | + /** |
|
| 633 | + * SHIM: check_dependencies |
|
| 634 | + * |
|
| 635 | + * @param array $field Field array. |
|
| 636 | + * |
|
| 637 | + * @deprecated 4.0.0 |
|
| 638 | + */ |
|
| 639 | + public function check_dependencies( array $field ) { |
|
| 640 | + _deprecated_function( __FUNCTION__, '4.0.0', 'required_class->check_dependencies( $field )' ); |
|
| 641 | + |
|
| 642 | + $this->required_class->check_dependencies( $field ); |
|
| 643 | + } |
|
| 644 | + |
|
| 645 | + /** |
|
| 646 | + * SHIM: _enqueue_output |
|
| 647 | + * |
|
| 648 | + * @throws ReflectionException Exception. |
|
| 649 | + * |
|
| 650 | + * @deprecated 4.0.0 |
|
| 651 | + */ |
|
| 652 | + public function _enqueue_output() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
|
| 653 | + _deprecated_function( __FUNCTION__, '4.0.0', 'output_class->enqueue()' ); |
|
| 654 | + |
|
| 655 | + if ( empty( $this->output_class ) ) { |
|
| 656 | + $obj = new ReduxFramework( $this->sections, $this->args ); |
|
| 657 | + $obj->options = $this->options; |
|
| 658 | + $obj->output_class->enqueue(); |
|
| 659 | + $this->outputCSS = $obj->outputCSS; // phpcs:ignore WordPress.NamingConventions.ValidVariableName |
|
| 660 | + } else { |
|
| 661 | + $this->output_class->enqueue(); |
|
| 662 | + } |
|
| 663 | + } |
|
| 664 | + |
|
| 665 | + /** |
|
| 666 | + * SHIM: _enqueue |
|
| 667 | + * |
|
| 668 | + * @deprecated 4.0.0 |
|
| 669 | + */ |
|
| 670 | + public function _enqueue() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
|
| 671 | + _deprecated_function( __FUNCTION__, '4.0.0', 'enqueue_class->init()' ); |
|
| 672 | + |
|
| 673 | + $this->enqueue_class->init(); |
|
| 674 | + } |
|
| 675 | + |
|
| 676 | + /** |
|
| 677 | + * _enqueue replacement. |
|
| 678 | + * |
|
| 679 | + * @return void |
|
| 680 | + */ |
|
| 681 | + public function init_enqueue() { |
|
| 682 | + $this->enqueue_class->init(); |
|
| 683 | + } |
|
| 684 | + |
|
| 685 | + /** |
|
| 686 | + * SHIM: generate_panel |
|
| 687 | + * |
|
| 688 | + * @since 1.0.0 |
|
| 689 | + * @access public |
|
| 690 | + * @return void |
|
| 691 | + * |
|
| 692 | + * @deprecated 4.0.0 |
|
| 693 | + */ |
|
| 694 | + public function generate_panel() { |
|
| 695 | + _deprecated_function( __FUNCTION__, '4.0.0', 'render_class->generate_panel()' ); |
|
| 696 | + |
|
| 697 | + $this->render_class->generate_panel(); |
|
| 698 | + } |
|
| 699 | + |
|
| 700 | + /** |
|
| 701 | + * SHIM: get_default_values |
|
| 702 | + * |
|
| 703 | + * @param string $key Key value. |
|
| 704 | + * @param bool $array_key Flag to determine array status. |
|
| 705 | + * |
|
| 706 | + * @return array |
|
| 707 | + * |
|
| 708 | + * @deprecated 4.0.0 |
|
| 709 | + */ |
|
| 710 | + public function get_default_values( $key, $array_key = false ) { |
|
| 711 | + _deprecated_function( __FUNCTION__, '4.0.0', 'options_class->get_default_value( $key, $array_key )' ); |
|
| 712 | + |
|
| 713 | + if ( ! isset( $this->options_class ) ) { |
|
| 714 | + $this->options_defaults_class = new Redux_Options_Defaults(); |
|
| 715 | + $this->options_class = new Redux_Options_Constructor( $this ); |
|
| 716 | + } |
|
| 717 | + |
|
| 718 | + return $this->options_class->get_default_value( $key, $array_key ); |
|
| 719 | + } |
|
| 720 | + |
|
| 721 | + /** |
|
| 722 | + * SHIM: get_default_value |
|
| 723 | + * |
|
| 724 | + * @param string $key Key value. |
|
| 725 | + * @param bool $array_key Flag to determine array status. |
|
| 726 | + * |
|
| 727 | + * @return array |
|
| 728 | + * |
|
| 729 | + * @deprecated 4.0.0 |
|
| 730 | + */ |
|
| 731 | + public function get_default_value( $key, $array_key = false ) { |
|
| 732 | + _deprecated_function( __FUNCTION__, '4.0.0', 'options_class->get_default_value( $key, $array_key )' ); |
|
| 733 | + |
|
| 734 | + if ( ! isset( $this->options_class ) ) { |
|
| 735 | + $this->options_defaults_class = new Redux_Options_Defaults(); |
|
| 736 | + $this->options_class = new Redux_Options_Constructor( $this ); |
|
| 737 | + } |
|
| 738 | + |
|
| 739 | + return $this->options_class->get_default_value( $key, $array_key ); |
|
| 740 | + } |
|
| 741 | + |
|
| 742 | + /** |
|
| 743 | + * SHIM: get_wordpress_data |
|
| 744 | + * |
|
| 745 | + * @param bool $type data type. |
|
| 746 | + * @param array $args args to pass to WordPress API. |
|
| 747 | + * @param string|array $current_value Current value. |
|
| 748 | + * |
|
| 749 | + * @return array|mixed|string|void |
|
| 750 | + * |
|
| 751 | + * @deprecated 4.0.0 |
|
| 752 | + */ |
|
| 753 | + public function get_wordpress_data( $type = false, $args = array(), $current_value = null ) { |
|
| 754 | + _deprecated_function( __FUNCTION__, '4.0.0', 'wordpress_data->get( $type, $args, $opt_name, $value )' ); |
|
| 755 | + |
|
| 756 | + return $this->wordpress_data->get( $type, $args, $this->args['opt_name'], $current_value ); |
|
| 757 | + } |
|
| 758 | + |
|
| 759 | + /** |
|
| 760 | + * SHIM: _validate_values |
|
| 761 | + * |
|
| 762 | + * @param array $plugin_options Current panel options. |
|
| 763 | + * @param array $options Options to validate. |
|
| 764 | + * @param array $sections Sections array. |
|
| 765 | + * |
|
| 766 | + * @return array |
|
| 767 | + * |
|
| 768 | + * @deprecated 4.0.0 |
|
| 769 | + */ |
|
| 770 | + public function _validate_values( $plugin_options, $options, $sections ) { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
|
| 771 | + _deprecated_function( __FUNCTION__, '4.0.0', 'validate_class->validate( $plugin_options, $options, $sections )' ); |
|
| 772 | + |
|
| 773 | + if ( ! isset( $this->validate_class ) ) { |
|
| 774 | + $this->validate_class = new Redux_Validation( $this ); |
|
| 775 | + } |
|
| 776 | + |
|
| 777 | + return $this->validate_class->validate( $plugin_options, $options, $sections ); |
|
| 778 | + } |
|
| 779 | + |
|
| 780 | + /** |
|
| 781 | + * SHIM: set_transients |
|
| 782 | + * |
|
| 783 | + * @return void |
|
| 784 | + * |
|
| 785 | + * @deprecated 4.0.0 |
|
| 786 | + */ |
|
| 787 | + public function set_transients() { |
|
| 788 | + _deprecated_function( __FUNCTION__, '4.0.0', 'Please update the extension that uses this deprecated function.' ); |
|
| 789 | + } |
|
| 790 | + |
|
| 791 | + /** |
|
| 792 | + * SHIM: section_menu |
|
| 793 | + * |
|
| 794 | + * @param int $k Array Key. |
|
| 795 | + * @param array $section Section array. |
|
| 796 | + * @param string $suffix Unique string. |
|
| 797 | + * @param array $sections Section array. |
|
| 798 | + * |
|
| 799 | + * @return string |
|
| 800 | + * |
|
| 801 | + * @deprecated 4.0.0 |
|
| 802 | + */ |
|
| 803 | + public function section_menu( $k, $section, $suffix = '', $sections = array() ) { |
|
| 804 | + _deprecated_function( __FUNCTION__, '4.0.0', 'render_class->section_menu( $index, $section, $suffix, $sections )' ); |
|
| 805 | + |
|
| 806 | + return $this->render_class->section_menu( $k, $section, $suffix, $sections ); |
|
| 807 | + } |
|
| 808 | + |
|
| 809 | + /** |
|
| 810 | + * SHIM: get_header_html |
|
| 811 | + * |
|
| 812 | + * @param array $field Field array. |
|
| 813 | + * |
|
| 814 | + * @return string |
|
| 815 | + * |
|
| 816 | + * @deprecated 4.0.0 |
|
| 817 | + */ |
|
| 818 | + public function get_header_html( $field ) { |
|
| 819 | + _deprecated_function( __FUNCTION__, '4.0.0', 'render_class->get_header_html( $field )' ); |
|
| 820 | + |
|
| 821 | + return $this->render_class->get_header_html( $field ); |
|
| 822 | + } |
|
| 823 | + |
|
| 824 | + /** |
|
| 825 | + * SHIM: current_user_can |
|
| 826 | + * |
|
| 827 | + * @param string $permission User permission. |
|
| 828 | + * |
|
| 829 | + * @return bool |
|
| 830 | + * |
|
| 831 | + * @deprecated 4.0.0 |
|
| 832 | + */ |
|
| 833 | + public function current_user_can( $permission ) { |
|
| 834 | + _deprecated_function( __FUNCTION__, '4.0.0', 'Redux_Helpers::current_user_can' ); |
|
| 835 | + |
|
| 836 | + return Redux_Helpers::current_user_can( $permission ); |
|
| 837 | + } |
|
| 838 | + |
|
| 839 | + /** |
|
| 840 | + * End backward compatibility shims for Redux v3 configs and extensions. |
|
| 841 | + */ |
|
| 842 | + |
|
| 843 | + /** |
|
| 844 | + * Pointer to the ReduxFramework instance. |
|
| 845 | + * |
|
| 846 | + * @return ReduxFramework|null |
|
| 847 | + */ |
|
| 848 | + public function get_instance(): ?ReduxFramework { |
|
| 849 | + return self::$instance; |
|
| 850 | + } |
|
| 851 | + |
|
| 852 | + /** |
|
| 853 | + * →get(); This is used to return and option value from the option array |
|
| 854 | + * |
|
| 855 | + * @since 1.0.0 |
|
| 856 | + * @access public |
|
| 857 | + * |
|
| 858 | + * @param string $opt_name The option name to return. |
|
| 859 | + * @param mixed $defaults (null) The value to return if an option isn't set. |
|
| 860 | + * |
|
| 861 | + * @return mixed |
|
| 862 | + */ |
|
| 863 | + public function get( string $opt_name, $defaults = null ) { |
|
| 864 | + return ( ! empty( $this->options[ $opt_name ] ) ) ? $this->options[ $opt_name ] : $this->options_class->get_default( $opt_name, $defaults ); |
|
| 865 | + } |
|
| 866 | + |
|
| 867 | + /** |
|
| 868 | + * →set(); This is used to set an arbitrary option in the option array |
|
| 869 | + * |
|
| 870 | + * @since 1.0.0 |
|
| 871 | + * @access public |
|
| 872 | + * |
|
| 873 | + * @param string $opt_name The name of the option being added. |
|
| 874 | + * @param mixed $values The value of the option being added. |
|
| 875 | + * |
|
| 876 | + * @return void |
|
| 877 | + */ |
|
| 878 | + public function set( string $opt_name = '', $values = array() ) { |
|
| 879 | + if ( ! empty( $opt_name ) && is_array( $values ) ) { |
|
| 880 | + $this->options[ $opt_name ] = $values; |
|
| 881 | + $this->options_class->set( $values ); |
|
| 882 | + } |
|
| 883 | + } |
|
| 884 | + } |
|
| 885 | + |
|
| 886 | + ReduxFramework::init(); |
|
| 887 | + |
|
| 888 | + /** |
|
| 889 | + * Action 'redux/init' |
|
| 890 | + */ |
|
| 891 | + do_action( 'redux/init' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 892 | 892 | } |
@@ -13,45 +13,45 @@ discard block |
||
| 13 | 13 | // Don't duplicate me! |
| 14 | 14 | if ( ! class_exists( 'Redux_Ace_Editor', false ) ) { |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * Class Redux_Ace_Editor |
|
| 18 | - */ |
|
| 19 | - class Redux_Ace_Editor extends Redux_Field { |
|
| 16 | + /** |
|
| 17 | + * Class Redux_Ace_Editor |
|
| 18 | + */ |
|
| 19 | + class Redux_Ace_Editor extends Redux_Field { |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * Field Render Function. |
|
| 23 | - * Takes the vars and outputs the HTML for the field in the settings |
|
| 24 | - * |
|
| 25 | - * @since ReduxFramework 1.0.0 |
|
| 26 | - */ |
|
| 27 | - public function render() { |
|
| 28 | - if ( is_array( $this->value ) ) { |
|
| 29 | - $this->value = ''; |
|
| 30 | - } else { |
|
| 31 | - $this->value = trim( $this->value ); |
|
| 32 | - } |
|
| 21 | + /** |
|
| 22 | + * Field Render Function. |
|
| 23 | + * Takes the vars and outputs the HTML for the field in the settings |
|
| 24 | + * |
|
| 25 | + * @since ReduxFramework 1.0.0 |
|
| 26 | + */ |
|
| 27 | + public function render() { |
|
| 28 | + if ( is_array( $this->value ) ) { |
|
| 29 | + $this->value = ''; |
|
| 30 | + } else { |
|
| 31 | + $this->value = trim( $this->value ); |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - if ( ! empty( $this->field['options'] ) ) { |
|
| 35 | - $this->field['args'] = $this->field['options']; |
|
| 36 | - unset( $this->field['options'] ); |
|
| 37 | - } |
|
| 34 | + if ( ! empty( $this->field['options'] ) ) { |
|
| 35 | + $this->field['args'] = $this->field['options']; |
|
| 36 | + unset( $this->field['options'] ); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - if ( ! isset( $this->field['mode'] ) ) { |
|
| 40 | - $this->field['mode'] = 'javascript'; |
|
| 41 | - } |
|
| 42 | - if ( ! isset( $this->field['theme'] ) ) { |
|
| 43 | - $this->field['theme'] = 'monokai'; |
|
| 44 | - } |
|
| 39 | + if ( ! isset( $this->field['mode'] ) ) { |
|
| 40 | + $this->field['mode'] = 'javascript'; |
|
| 41 | + } |
|
| 42 | + if ( ! isset( $this->field['theme'] ) ) { |
|
| 43 | + $this->field['theme'] = 'monokai'; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - $params = array( |
|
| 47 | - 'minLines' => 10, |
|
| 48 | - 'maxLines' => 30, |
|
| 49 | - ); |
|
| 46 | + $params = array( |
|
| 47 | + 'minLines' => 10, |
|
| 48 | + 'maxLines' => 30, |
|
| 49 | + ); |
|
| 50 | 50 | |
| 51 | - if ( isset( $this->field['args'] ) && ! empty( $this->field['args'] ) && is_array( $this->field['args'] ) ) { |
|
| 52 | - $params = wp_parse_args( $this->field['args'], $params ); |
|
| 53 | - } |
|
| 54 | - ?> |
|
| 51 | + if ( isset( $this->field['args'] ) && ! empty( $this->field['args'] ) && is_array( $this->field['args'] ) ) { |
|
| 52 | + $params = wp_parse_args( $this->field['args'], $params ); |
|
| 53 | + } |
|
| 54 | + ?> |
|
| 55 | 55 | <div class="ace-wrapper"> |
| 56 | 56 | <input |
| 57 | 57 | type="hidden" |
@@ -70,46 +70,46 @@ discard block |
||
| 70 | 70 | class="ace-editor-area"><?php echo esc_html( $this->value ); ?></pre> |
| 71 | 71 | </div> |
| 72 | 72 | <?php |
| 73 | - } |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * Enqueue Function. |
|
| 77 | - * If this field requires any scripts, or css define this function and register/enqueue the scripts/css |
|
| 78 | - * |
|
| 79 | - * @since 1.0.0 |
|
| 80 | - * @access public |
|
| 81 | - * @return void |
|
| 82 | - */ |
|
| 83 | - public function enqueue() { |
|
| 84 | - if ( $this->parent->args['dev_mode'] ) { |
|
| 85 | - wp_enqueue_style( |
|
| 86 | - 'redux-field-ace-editor', |
|
| 87 | - Redux_Core::$url . 'inc/fields/ace_editor/redux-ace-editor.css', |
|
| 88 | - array(), |
|
| 89 | - $this->timestamp |
|
| 90 | - ); |
|
| 91 | - } |
|
| 75 | + /** |
|
| 76 | + * Enqueue Function. |
|
| 77 | + * If this field requires any scripts, or css define this function and register/enqueue the scripts/css |
|
| 78 | + * |
|
| 79 | + * @since 1.0.0 |
|
| 80 | + * @access public |
|
| 81 | + * @return void |
|
| 82 | + */ |
|
| 83 | + public function enqueue() { |
|
| 84 | + if ( $this->parent->args['dev_mode'] ) { |
|
| 85 | + wp_enqueue_style( |
|
| 86 | + 'redux-field-ace-editor', |
|
| 87 | + Redux_Core::$url . 'inc/fields/ace_editor/redux-ace-editor.css', |
|
| 88 | + array(), |
|
| 89 | + $this->timestamp |
|
| 90 | + ); |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - if ( ! wp_script_is( 'ace-editor-js' ) ) { |
|
| 94 | - wp_enqueue_script( |
|
| 95 | - 'ace-editor-js', |
|
| 96 | - // phpcs:ignore Generic.Strings.UnnecessaryStringConcat, WordPress.NamingConventions.ValidHookName |
|
| 97 | - apply_filters( 'redux/' . $this->parent->args['opt_name'] . 'fields/ace/script', '//' . 'cdnjs' . '.cloudflare' . '.com/ajax/libs/ace/1.43.0/ace.min.js' ), |
|
| 98 | - array( 'jquery' ), |
|
| 99 | - '1.43.0', |
|
| 100 | - true |
|
| 101 | - ); |
|
| 102 | - } |
|
| 93 | + if ( ! wp_script_is( 'ace-editor-js' ) ) { |
|
| 94 | + wp_enqueue_script( |
|
| 95 | + 'ace-editor-js', |
|
| 96 | + // phpcs:ignore Generic.Strings.UnnecessaryStringConcat, WordPress.NamingConventions.ValidHookName |
|
| 97 | + apply_filters( 'redux/' . $this->parent->args['opt_name'] . 'fields/ace/script', '//' . 'cdnjs' . '.cloudflare' . '.com/ajax/libs/ace/1.43.0/ace.min.js' ), |
|
| 98 | + array( 'jquery' ), |
|
| 99 | + '1.43.0', |
|
| 100 | + true |
|
| 101 | + ); |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - wp_enqueue_script( |
|
| 105 | - 'redux-field-ace-editor', |
|
| 106 | - Redux_Core::$url . 'inc/fields/ace_editor/redux-ace-editor' . Redux_Functions::is_min() . '.js', |
|
| 107 | - array( 'jquery', 'ace-editor-js', 'redux-js' ), |
|
| 108 | - $this->timestamp, |
|
| 109 | - true |
|
| 110 | - ); |
|
| 111 | - } |
|
| 112 | - } |
|
| 104 | + wp_enqueue_script( |
|
| 105 | + 'redux-field-ace-editor', |
|
| 106 | + Redux_Core::$url . 'inc/fields/ace_editor/redux-ace-editor' . Redux_Functions::is_min() . '.js', |
|
| 107 | + array( 'jquery', 'ace-editor-js', 'redux-js' ), |
|
| 108 | + $this->timestamp, |
|
| 109 | + true |
|
| 110 | + ); |
|
| 111 | + } |
|
| 112 | + } |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | class_alias( 'Redux_Ace_Editor', 'ReduxFramework_Ace_Editor' ); |