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/Widgets/Image/Classes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/moncbefd/www.moneta.at/GXModules/Gambio/Widgets/Image/Classes/ImageWidget.php
<?php
/*--------------------------------------------------------------------------------------------------
    ImageWidgetProducer.php 2019-10-24
    Gambio GmbH
    http://www.gambio.de
    Copyright (c) 2016 Gambio GmbH
    Released under the GNU General Public License (Version 2)
    [http://www.gnu.org/licenses/gpl-2.0.html]
    --------------------------------------------------------------------------------------------------
 */

use Gambio\StyleEdit\Core\Components\Checkbox\Entities\CheckboxOption;
use Gambio\StyleEdit\Core\Components\DropdownSelect\Entities\DropdownSelectOption;
use Gambio\StyleEdit\Core\Components\TextBox\Entities\TextBox;
use Gambio\StyleEdit\Core\Language\Entities\Language;
use Gambio\StyleEdit\Core\Options\Entities\FieldSet;
use Gambio\StyleEdit\Core\Widgets\Abstractions\AbstractWidget;
use Gambio\StyleEdit\Core\Widgets\Abstractions\Interfaces\ContentGeneratorInterface;

/**
 * Class ImageWidget
 */
class ImageWidget extends AbstractWidget
{
    protected const FALLBACK_IMAGE = '//www.gambio-shop.de/shop1/images/logos/logo-ihr-shop_logo.png';
    
    /**
     * @var string
     */
    protected $image;
    
    /**
     * @var TextBox
     */
    protected $name;
    
    /**
     * @var TextBox
     */
    protected $class;
    
    /**
     * @var TextBox
     */
    protected $width;
    
    /**
     * @var TextBox
     */
    protected $height;
    
    /**
     * @var string
     */
    protected $type = 'image';
    
    /**
     * @var CheckboxOption
     */
    protected $responsive;
    
    /**
     * @var CheckboxOption
     */
    protected $link;
    
    /**
     * @var DropdownSelectOption
     */
    protected $target;
    
    
    /**
     * {@inheritdoc}
     */
    protected static function validateJsonObject(stdClass $jsonObject) : bool
    {
        if (!isset($jsonObject->fieldsets)) {
            throw new InvalidArgumentException('JSON object has no fieldsets');
        }
        
        return parent::validateJsonObject($jsonObject);
    }
    
    
    /**
     * @param Language|null $currentLanguage
     *
     * @return string
     */
    public function htmlContent(?Language $currentLanguage) : string
    {
        $html = $this->htmlTemplate();
        
        $target = $this->target->value($currentLanguage);
        
        $html = str_replace(
            ['{{link begin}}', '{{link end}}'],
            ($link = $this->link->value($currentLanguage)) ? [
                "<a href=\"$link\" target=\"$target\">",
                '</a>'
            ] : [
                '',
                ''
            ],
            $html
        );
        $html = str_replace(
            ['{{link begin}}', '{{link end}}'],
            ($link = $this->link->value($currentLanguage)) ? ['<a href="' . $link . '">', '</a>'] : [
                '',
                ''
            ],
            $html
        );
        
        // searches for all wildcard parameters into the widget template
        preg_match_all('/{{(\w+)}}/', $html, $matches);
        
        if ($matches) {
            [$wildcards, $properties] = $matches;
            
            foreach ($properties as $index => $property) {
                // if the property exists, then we replace every found parameter by the class' property
                $replaceWith = property_exists(
                    self::class,
                    $property
                ) ? $this->{$property}->value($currentLanguage) : '';
                $html        = str_replace($wildcards[$index], $replaceWith, $html);
            }
        }
        
        return $html;
    }
    
    
    /**
     * @return string
     */
    private function htmlTemplate() : string
    {
        return '{{link begin}}<img src="{{image}}" id="{{id}}" class="{{class}} img-responsive"'
               . ' width="{{width}}" height="{{height}}" />{{link end}}';
    }
    
    
    /**
     * Specify data which should be serialized to JSON
     * @link  https://php.net/manual/en/jsonserializable.jsonserialize.php
     * @return mixed data which can be serialized by <b>json_encode</b>,
     * which is a value of any type other than a resource.
     * @since 5.4.0
     */
    public function jsonSerialize()
    {
        $result            = $this->jsonObject;
        $result->type      = 'image';
        $result->id        = $this->static_id;
        $result->fieldsets = $this->fieldsets;
        
        return $result;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit