403Webshell
Server IP : 146.59.209.152  /  Your IP : 216.73.216.46
Web Server : Apache
System : Linux webm005.cluster131.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
User : infrafs ( 43850)
PHP Version : 8.2.29
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/infrafs/bike/wp-content/themes/colibri-wp/inc/src/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/infrafs/bike/wp-content/themes/colibri-wp/inc/src//ComponentsRepository.php
<?php


namespace ColibriWP\Theme;

use ColibriWP\Theme\Core\ComponentInterface;
use ColibriWP\Theme\Core\Hooks;

class ComponentsRepository {

    private $entities = array();

    public function load() {
        $components = Hooks::colibri_apply_filters( 'components', array() );

        foreach ( $components as $key => $class ) {

            $this->add( $key, $class );
        }
    }


    /**
     * @param $id
     *
     * @return null|ComponentInterface
     */
    private function getInstance( $id ) {

        if ( ! $this->entities[ $id ] ['instance'] ) {
            $class = $this->entities[ $id ]['class'];

            $this->entities[ $id ] = array(
                'class'    => $this->entities[ $id ]['class'],
                'instance' => new $class,
            );
        }

        return $this->entities[ $id ]['instance'];
    }

    /**
     * @param $id
     *
     * @return ComponentInterface|null
     */
    public function getByName( $id ) {


        if ( array_key_exists( $id, $this->entities ) ) {
            return $this->getInstance( $id );
        }

        return null;
    }


    /**
     * @return array
     */
    public function getAllDefinitions() {
        $result = array();

        foreach ( $this->entities as $key => $entity ) {
            $result[ $key ] = $entity['class'];
        }

        return $result;
    }

    /**
     * @param $component_name
     * @param $class
     */
    public function add( $component_name, $class ) {
        $this->entities[ $component_name ] = array(
            'class'    => $class,
            'instance' => null,
        );
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit