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/www/wp-content/plugins/eltd-core/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/infrafs/www/wp-content/plugins/eltd-core/lib/shortcode-loader.php
<?php
namespace ElatedCore\Lib;

/**
 * Class ShortcodeLoader
 * @package ElatedCore\Lib
 */
class ShortcodeLoader {
    /**
     * @var private instance of current class
     */
    private static $instance;
    /**
     * @var array
     */
    private $loadedShortcodes = array();

    /**
     * Private constuct because of Singletone
     */
    private function __construct() {}

    /**
     * Returns current instance of class
     * @return ShortcodeLoader
     */
    public static function getInstance() {
        if(self::$instance == null) {
            return new self;
        }

        return self::$instance;
    }

    /**
     * Adds new shortcode. Object that it takes must implement ShortcodeInterface
     * @param ShortcodeInterface $shortcode
     */
    private function addShortcode(ShortcodeInterface $shortcode) {
        if(!array_key_exists($shortcode->getBase(), $this->loadedShortcodes)) {
            $this->loadedShortcodes[$shortcode->getBase()] = $shortcode;
        }
    }

    /**
     * Adds all shortcodes.
     *
     * @see ShortcodeLoader::addShortcode()
     */
    private function addShortcodes() {
	    $shortcodes_class_name = apply_filters('eltd_core_filter_add_vc_shortcode', $shortcodes_class_name = array());
		sort($shortcodes_class_name);
        
		if(!empty($shortcodes_class_name)) {
			foreach($shortcodes_class_name as $shortcode_class_name) {
				$this->addShortcode(new $shortcode_class_name);
			}
		}
    }

    /**
     * Calls ShortcodeLoader::addShortcodes and than loops through added shortcodes and calls render method
     * of each shortcode object
     */
    public function load() {
    	if(eltd_core_theme_installed()) {
		    $this->addShortcodes();
		
		    foreach ($this->loadedShortcodes as $shortcode) {
			    add_shortcode($shortcode->getBase(), array($shortcode, 'render'));
		    }
	    }
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit