|
Server IP : 168.119.101.163 / Your IP : 216.73.217.54 Web Server : Apache/2 System : Linux web02.webzuiver.nl 4.18.0-553.126.2.lve.el8.x86_64 #1 SMP Thu May 28 14:12:30 UTC 2026 x86_64 User : equine ( 1027) PHP Version : 8.1.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF Directory (0755) : /home/equine/public_html/wp-content/plugins/elementor-pro/core/utils/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
namespace ElementorPro\Core\Utils;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Basic items registrar.
*
* TODO: Move to Core.
*/
class Registrar {
/**
* @var array
*/
private $items;
/**
* Registrar constructor.
*
* @return void
*/
public function __construct() {
$this->items = [];
}
/**
* Register a new item.
*
* @param $instance - Item instance.
* @param string $id - Optional - For BC - Deprecated.
*
* @return boolean - Whether the item was registered.
*/
public function register( $instance, $id = null ) {
// TODO: For BC. Remove in the future.
if ( ! $id ) {
// Get the ID or default to the class name.
$id = ( method_exists( $instance, 'get_id' ) ) ? $instance->get_id() : get_class( $instance );
}
if ( $this->get( $id ) ) {
return false;
}
$this->items[ $id ] = $instance;
return true;
}
/**
* Get an item by ID.
*
* @param string $id
*
* @return array|null
*/
public function get( $id = null ) {
if ( ! $id ) {
return $this->items;
}
return isset( $this->items[ $id ] ) ? $this->items[ $id ] : null;
}
}