403Webshell
Server IP : 85.158.181.41  /  Your IP : 216.73.217.12
Web Server : Apache
System : Linux cloud9-vm129 6.1.178+1-ph #ph SMP PREEMPT_DYNAMIC Wed Jul 29 09:00:54 UTC 2026 x86_64
User : moncbefd ( 1024)
PHP Version : 7.3.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/moncbefd/www.moneta.at/GXModules/Gambio/StyleEdit/Core/Components/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/moncbefd/www.moneta.at/GXModules/Gambio/StyleEdit/Core/Components/BasicController.php
<?php
/* --------------------------------------------------------------
   BasicElementController.inc.php 2019-10-14
   Gambio GmbH
   http://www.gambio.de
   Copyright (c) 2018 Gambio GmbH
   Released under the GNU General Public License (Version 2)
   [http://www.gnu.org/licenses/gpl-2.0.html]
   --------------------------------------------------------------
*/

namespace Gambio\StyleEdit\Core\Components;

use Exception;
use Gambio\StyleEdit\Core\Components\Theme\Entities\Interfaces\CurrentThemeInterface;
use Gambio\StyleEdit\Core\Components\Theme\Entities\ThemeConfiguration;
use Gambio\StyleEdit\Core\Components\Theme\Entities\ThemeConfigurationCollection;
use Gambio\StyleEdit\Core\Components\Theme\PreviewSettingsService;
use Gambio\StyleEdit\Core\Components\Theme\StyleEditThemeService;
use Gambio\StyleEdit\Core\SingletonPrototype;

/**
 * Class BasicElementController
 * @package Gambio\StyleEdit\Core\Elements
 */
abstract class BasicController
{
    
    /**
     * @var bool
     */
    protected $previewSettingsService;
    /**
     * @var null | ThemeConfigurationCollection
     */
    protected $themesList;
    /**
     * @var bool | ThemeConfiguration
     */
    private $theme = false;
    /**
     * @var null | StyleEditThemeService
     */
    private $themeService;
    
    
    /**
     * @param array $uri
     *
     * @return mixed
     */
    abstract public function get(array $uri);
    
    
    /**
     * @param array $uri
     * @param       $data
     *
     * @return mixed
     */
    abstract public function put(array $uri, $data);
    
    
    /**
     * @param array $uri
     * @param       $data
     *
     * @return mixed
     */
    abstract public function post(array $uri, $data);
    
    
    /**
     * @param array $uri
     * @param       $data
     *
     * @return mixed
     */
    abstract public function delete(array $uri, $data);
    
    
    /**
     * @param array $uri
     * @param       $data
     *
     * @return mixed
     */
    abstract public function patch(array $uri, $data);
    
    
    /**
     * @return BasicController
     */
    abstract public function __clone();
    
    
    /**
     * @return bool
     */
    public function requiresAuthentication(): bool
    {
        return true;
    }
    
    
    protected function updateThemeList()
    {
        
        $this->themeService()->updateThemeList();
        $this->themesList = null;
    }
    
    
    /**
     * @return bool|StyleEditThemeService
     * @throws Exception
     */
    protected function themeService()
    {
        if ($this->themeService === null) {
            $this->themeService = SingletonPrototype::instance()->get(StyleEditThemeService::class);
            if (!$this->themeService) {
                throw new Exception('ThemeService not published');
            }
        }
        
        return $this->themeService;
    }
    
    
    /**
     * @return bool|PreviewSettingsService|mixed|null
     * @throws Exception
     */
    protected function previewSettingsService()
    {
        if ($this->previewSettingsService === null) {
            $this->previewSettingsService = SingletonPrototype::instance()->get(PreviewSettingsService::class);
            if (!$this->previewSettingsService) {
                throw new Exception('PreviewSettingsService not published');
            }
        }
        
        return $this->previewSettingsService;
    }
    
    
    /**
     * @param ThemeConfiguration $value
     */
    protected function outputJson($value): void
    {
        header('Content-type: application/json');
        echo json_encode($value);
    }
    
    
    /**
     * @return string
     * @throws Exception
     */
    protected function currentThemeId(): string
    {
        try {
            return $this->currentTheme()->id();
        } catch (\Exception $e) {
            throw new Exception ('Theme ID is invalid or not supplied');
        }
    }
    
    
    /**
     * @return CurrentThemeInterface|null
     * @throws Exception
     */
    protected function currentTheme(): ?CurrentThemeInterface
    {
        if (!$this->theme) {
            $this->theme = SingletonPrototype::instance()->get(CurrentThemeInterface::class);
        }
        
        return $this->theme ? : null;
    }
    
    
    /**
     * @return ThemeConfigurationCollection
     * @throws Exception
     */
    protected function getThemesList(): ThemeConfigurationCollection
    {
        if ($this->themesList === null) {
            $this->themesList = SingletonPrototype::instance()->get(ThemeConfigurationCollection::class);
        }
        
        return $this->themesList;
    }
    
}

Youez - 2016 - github.com/yon3zu
LinuXploit