public function ruleExists($name) { try { Templates::get($name); return true; } catch (\Exception $e) { return false; } }
} $ADK_MESSAGES = new Messages(); $ADK_MESSAGES->userid = $ADK_USER_ID; $ADK_MESSAGES->foldername = 'Inbox'; $ADK_MESSAGES->get($con); switch ($ADK_USERGROUP_CDE) { case 'ADM': require_once 'includes/classes/Template.php'; $ADK_MSG_TMPLS = new Templates(); $ADK_MSG_TMPLS->get($con, $_SESSION['ADK_USER_ID']); $ADK_HIKERS = new Hikers(); $ADK_HIKERS->get($con, $ADK_USER_ID); break; case 'COR': require_once 'includes/classes/Template.php'; $ADK_MSG_TMPLS = new Templates(); $ADK_MSG_TMPLS->get($con, $_SESSION['ADK_USER_ID']); $ADK_HIKERS = new Hikers(); $ADK_HIKERS->get($con, $ADK_USER_ID); break; case 'HIK': require_once 'includes/classes/Correspondent.php'; $ADK_HIKER = new Hiker(); $ADK_HIKER->id = $ADK_USER_ID; $ADK_HIKER->get($con); $ADK_CORRESPONDENT = new Correspondent(); $ADK_CORRESPONDENT->id = $ADK_HIKER->corrid; $ADK_CORRESPONDENT->get($con); break; } $con->close();
public function toCode($input, $parent = NULL) { $self = $this; $args = (array) $this->args; $type = $this->type; $scalar = $this->testScalar; $this->msg = str_replace('$value', $input, $this->msg); $code = "\n/* {$this->type} {{{ */\n"; $code .= Templates::get('rule')->render(compact('self', 'input', 'args', 'parent', 'type', 'scalar'), true); $code .= Templates::get('error')->render(compact('self', 'parent'), true); $code .= "/* }}} */\n"; return $code; }