Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by http://DeZender.Net
- * @ deZender (PHP7 Decoder for ionCube Encoder)
- *
- * @ Version : 4.0.8.9
- * @ Author : DeZender
- * @ Release on : 10.05.2019
- * @ Official site : http://DeZender.Net
- *
- */
- class JieqiObject
- {
- public $vars = [];
- public $errors = [];
- public function __construct()
- {
- }
- static public function getInstance($classname = '', $valarray = '')
- {
- static $instance = null;
- if (is_null($instance)) {
- if (empty($classname)) {
- $classname = get_called_class();
- }
- if (class_exists($classname)) {
- if ($valarray == '') {
- $instance = new $classname();
- }
- else {
- $instance = new $classname($valarray);
- }
- }
- else {
- return false;
- }
- }
- return $instance;
- }
- public function getVar($key, $format = 's')
- {
- if (isset($this->vars[$key])) {
- if (is_string($this->vars[$key])) {
- switch (strtolower($format)) {
- case 's':
- return jieqi_htmlstr($this->vars[$key]);
- case 'e':
- return jieqi_htmlchars($this->vars[$key], ENT_QUOTES);
- case 'q':
- return jieqi_dbslashes($this->vars[$key]);
- case 'n':
- }
- return $this->vars[$key];
- }
- else {
- return $this->vars[$key];
- }
- }
- else {
- return false;
- }
- }
- public function getVars()
- {
- return $this->vars;
- }
- public function setVar($key, $value)
- {
- $this->vars[$key] = $value;
- }
- public function setVars($var_arr)
- {
- foreach ($var_arr as $key => $value) {
- $this->setVar($key, $value);
- }
- }
- public function clearVars()
- {
- $this->vars = [];
- }
- public function raiseError($message = 'unknown error!', $mode = JIEQI_ERROR_DIE)
- {
- switch ($mode) {
- case JIEQI_ERROR_DIE:
- jieqi_printfail($message);
- break;
- case JIEQI_ERROR_RETURN:
- case JIEQI_ERROR_PRINT:
- $this->errors[$mode][] = $message;
- break;
- default:
- $this->errors[JIEQI_ERROR_RETURN][] = $message;
- break;
- }
- }
- public function isError($mode = 0)
- {
- if (($mode == 0) || (strlen($mode) == 0)) {
- return count($this->errors);
- }
- else {
- return jieqi_count($this->errors[$mode]);
- }
- }
- public function getErrors($mode = 0)
- {
- if (($mode == 0) || (strlen($mode) == 0)) {
- return $this->errors;
- }
- return $this->errors[$mode];
- }
- public function clearErrors($mode = 0)
- {
- if (($mode == 0) || (strlen($mode) == 0)) {
- $this->errors = [];
- }
- else {
- $this->errors[$mode] = [];
- }
- }
- }
- class JieqiBlock extends JieqiObject
- {
- public $blockvars = [];
- public $module = '';
- public $template = '';
- public $cachetype = 0;
- public $cachetime = JIEQI_CACHE_LIFETIME;
- public $vars = [];
- public $errors = [];
- public function __construct(&$vars)
- {
- global $jieqiTpl;
- $this->blockvars = $vars;
- if (empty($this->module)) {
- $this->module = (empty($this->blockvars['module']) ? 'system' : $this->blockvars['module']);
- }
- if (empty($this->blockvars['template'])) {
- $this->blockvars['template'] = $this->template;
- }
- if (!empty($this->blockvars['template'])) {
- $this->blockvars['tlpfile'] = jieqi_path_template('blocks/' . $this->blockvars['template'], $this->module);
- }
- else {
- $this->blockvars['tlpfile'] = '';
- }
- if ($this->blockvars['template'] == '-') {
- $this->cachetype = 1;
- }
- if ($this->cachetime == 0) {
- $this->cachetime = JIEQI_CACHE_LIFETIME;
- }
- if (empty($this->blockvars['cachetime'])) {
- $this->blockvars['cachetime'] = $this->cachetime;
- }
- if (empty($this->blockvars['overtime'])) {
- $this->blockvars['overtime'] = 0;
- }
- if (empty($this->blockvars['cacheid'])) {
- $this->blockvars['cacheid'] = NULL;
- }
- if (empty($this->blockvars['compileid'])) {
- $this->blockvars['compileid'] = NULL;
- }
- if (!empty($this->blockvars['template'])) {
- $this->template = $this->blockvars['template'];
- }
- if (isset($this->blockvars['bid']) && !is_numeric($this->blockvars['bid'])) {
- $this->blockvars['bid'] = intval($this->blockvars['bid']);
- }
- if (!is_object($jieqiTpl) && !empty($this->blockvars['tlpfile'])) {
- $jieqiTpl = Container::get('template');
- }
- $jieqiTpl->setCachType($this->cachetype);
- }
- public function getTitle()
- {
- return isset($this->blockvars['title']) ? $this->blockvars['title'] : '';
- }
- public function getContent()
- {
- global $jieqiApp;
- if (JIEQI_USE_CACHE) {
- if ((0 < $this->blockvars['custom']) && !empty($this->blockvars['bid'])) {
- $templatefile = jieqi_path_template('blocks/block_custom' . $this->blockvars['bid'] . '.html', $this->module);
- $cachefile = str_replace(JIEQI_ROOT_PATH, JIEQI_CACHE_PATH, $templatefile);
- if ($jieqiApp['cache']->iscached($cachefile)) {
- return $jieqiApp['cache']->get($cachefile);
- }
- }
- else if (!empty($this->blockvars['tlpfile']) && (0 < $this->blockvars['cachetime']) && $jieqiApp['template']->is_cached($this->blockvars['tlpfile'], $this->blockvars['cacheid'], $this->blockvars['compileid'], $this->blockvars['cachetime'], $this->blockvars['overtime'])) {
- $jieqiApp['template']->setCaching(1);
- $jieqiApp['template']->setCachType($this->cachetype);
- return $jieqiApp['template']->fetch($this->blockvars['tlpfile'], $this->blockvars['cacheid'], $this->blockvars['compileid'], $this->blockvars['cachetime'], $this->blockvars['overtime'], false);
- }
- }
- return $this->updateContent(true);
- }
- public function updateContent($isreturn = false)
- {
- global $jieqiApp;
- $this->setContent();
- if (!empty($this->blockvars['tlpfile'])) {
- if (JIEQI_USE_CACHE && (0 < $this->blockvars['cachetime'])) {
- $jieqiApp['template']->setCaching(2);
- $jieqiApp['template']->setCachType($this->cachetype);
- }
- else {
- $jieqiApp['template']->setCaching(0);
- }
- $tmpvar = $jieqiApp['template']->fetch($this->blockvars['tlpfile'], $this->blockvars['cacheid'], $this->blockvars['compileid'], $this->blockvars['cachetime'], $this->blockvars['overtime'], false);
- if ($isreturn) {
- return $tmpvar;
- }
- }
- }
- public function setContent($isreturn = false)
- {
- }
- static public function getInstance($classname = '', $valarray = '')
- {
- static $instance = null;
- if (is_null($instance)) {
- if (empty($classname)) {
- $classname = get_called_class();
- }
- if (class_exists($classname)) {
- if ($valarray == '') {
- $instance = new $classname();
- }
- else {
- $instance = new $classname($valarray);
- }
- }
- else {
- return false;
- }
- }
- return $instance;
- }
- public function getVar($key, $format = 's')
- {
- if (isset($this->vars[$key])) {
- if (is_string($this->vars[$key])) {
- switch (strtolower($format)) {
- case 's':
- return jieqi_htmlstr($this->vars[$key]);
- case 'e':
- return jieqi_htmlchars($this->vars[$key], ENT_QUOTES);
- case 'q':
- return jieqi_dbslashes($this->vars[$key]);
- case 'n':
- }
- return $this->vars[$key];
- }
- else {
- return $this->vars[$key];
- }
- }
- else {
- return false;
- }
- }
- public function getVars()
- {
- return $this->vars;
- ......................................................................
- ..............................................
- ....................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement