????JFIF??x?x????'
| Server IP : 172.67.174.47 / Your IP : 216.73.216.145 Web Server : LiteSpeed System : Linux premium151.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 User : tempvsty ( 647) PHP Version : 8.0.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /././proc/self/cwd/wp-content/plugins/motopress-content-editor/includes/ce/ |
Upload File : |
<?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;
}
}