HEX
Server: Apache
System: Linux web2213.uni5.net 5.4.282-1.el8.elrepo.x86_64 #1 SMP Mon Aug 19 18:33:22 EDT 2024 x86_64
User: clinicamaciel (596848)
PHP: 7.3.33
Disabled: apache_child_terminate,c99_buff_prepare,c99_sess_put,dl,eval,exec,leak,link,myshellexec,openlog,passthru,pclose,pcntl_exec,php_check_syntax,php_strip_whitespace,popen,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,symlink,system,socket_listen,socket_create_listen,putenv
Upload Files
File: /home/clinicamaciel/www/wp-content/plugins/motopress-content-editor/includes/ce/Template.php
<?php
/**
 * Class MPCETemplate
 */
class MPCETemplate extends MPCEBaseElement {
    public $content;
    protected $errors = array(
        'id' => array(),
        'name' => array(),
        'icon' => array(),
        'content' => array()
    );

    const ICON_DIR = 'template';

    /**
     * @param $id
     * @param $name
     * @param $content
     * @param string $icon [optional]
     */
    function __construct($id, $name, $content, $icon = 'no-template.png') {
        $this->setId($id);
        $this->setName($name);
        if (empty($icon)) {
            $icon = 'no-template.png';
        }
        $this->setIcon($icon); //size 85x142 px
        $this->setContent($content);
    }

    /**
     * @param string $icon
     */
    public function setIcon($icon) {
        parent::icon($icon, self::ICON_DIR);
    }

    /**
     * @return string
     */
    public function getContent() {
        return $this->content;
    }

    /**
     * @param string $content
     */
    public function setContent($content) {
        global $motopressCELang;

        if (is_string($content)) {
            $content = trim($content);
            if (!empty($content)) {
                $content = filter_var($content, FILTER_UNSAFE_RAW);
                $this->content = $content;
            } else {
                $this->addError('content', $motopressCELang->CEEmpty);
            }
        } else {
            $this->addError('content', strtr($motopressCELang->CEInvalidArgumentType, array('%name%' => gettype($content))));
        }
    }

    /**
     * @return boolean
     */
    public function isValid() {
        return (
            empty($this->errors['id']) &&
            empty($this->errors['name']) &&
            empty($this->errors['icon']) &&
            empty($this->errors['content'])
        ) ? true : false;
    }

    /**
     * @return string
     */
    public function __toString() {
        $str = 'id: ' . $this->getId() . ', ';
        $str .= 'name: ' . $this->getName() . ', ';
        $str .= 'icon: ' . $this->getIcon();
        return $str;
    }
}