Sid Gifari File Manager
🏠 Root
/
home2
/
meumer25
/
meupet.app
/
wp-content
/
plugins
/
ultimate-addons-for-gutenberg
/
admin-core
/
api
/
Editing: api-init.php
<?php /** * Api Init. * * @package uag */ namespace UagAdmin\Api; // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Class Api_Init. */ class Api_Init { /** * Instance * * @access private * @var object Class object. * @since 1.0.0 */ private static $instance; /** * Dynamic properties container * * @since 2.7.10 * @var array */ private $dynamic_properties = array(); /** * Initiator * * @since 1.0.0 * @return object initialized object of class. */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Constructor * * @since 1.0.0 */ public function __construct() { $this->initialize_hooks(); } /** * Init Hooks. * * @since 1.0.0 * @return void */ public function initialize_hooks() { // REST API extensions init. add_action( 'rest_api_init', array( $this, 'register_routes' ) ); } /** * Init dynamic property setter * * @param string $name Property name. * @param mixed $value Property value. * * @since 2.7.10 * @return void */ public function __set( $name, $value ) { $this->dynamic_properties[ $name ] = $value; } /** * Init dynamic property getter * * @param string $name Property name. * * @since 2.7.10 * @return mixed Property value if set, null otherwise. */ public function __get( $name ) { return $this->dynamic_properties[ $name ] ? $this->dynamic_properties[ $name ] : null; } /** * Register API routes. */ public function register_routes() { $controllers = array( 'UagAdmin\Api\Common_Settings', ); foreach ( $controllers as $controller ) { $this->$controller = $controller::get_instance(); $this->{$controller}->register_routes(); } } } Api_Init::get_instance();
Save
Cancel