Example #1
0
 /**
  * Get route string as mixed url string
  * @return string
  */
 public function toMixedUrl()
 {
     $arr = array();
     if (!empty($this->m_path->module)) {
         $arr[] = $this->m_path->module;
     }
     if (!empty($this->m_path->controller)) {
         $arr[] = $this->m_path->controller;
     }
     if (!empty($this->m_path->action)) {
         $arr[] = $this->m_path->action;
     }
     foreach ($this->m_param->getData() as $d) {
         $arr[] = $d;
     }
     $o = implode(Zoombi::SS, $arr);
     if ($this->m_query->count() < 1) {
         return strval($o);
     }
     $arr = array();
     foreach ($this->m_query->getData() as $k => $v) {
         $arr[] = "{$k}={$v}";
     }
     return $o . Zoombi::SS . '?' . implode('&', $arr);
 }
Example #2
0
 /**
  * Get query string
  * @return string
  */
 public function queryString()
 {
     $arr = array();
     foreach ($this->m_query->getData() as $k => $v) {
         $arr[] = $k . '=' . $v;
     }
     if (count($arr) > 0) {
         return '?' . implode('&', $arr);
     }
 }
Example #3
0
 /**
  * To string conversion
  * @return string
  */
 public function __toString()
 {
     $o = implode(Zoombi::SS, $this->m_segments);
     $arr = array();
     foreach ($this->m_query->getData() as $k => $v) {
         $arr[] = $k . '=' . $v;
     }
     if (count($arr) > 0) {
         $o .= '?' . implode('&', $arr);
     }
     return $o;
 }
Example #4
0
 /**
  * Render file
  * @param string $a___file
  * @param array $a___data
  * @param bool $a___return
  * @return mixed
  */
 protected function renderFile($a___file, $a___data = array(), $a___return = false)
 {
     $___file___ = (string) $a___file;
     if (empty($___file___)) {
         if ($this->application->isMode(ZApplication::MODE_DEBUG)) {
             throw new ZViewException('File to render "' . $___file___ . '" is not found.', ZViewException::EXC_EMPTY);
         }
         return;
     }
     if (!file_exists($___file___)) {
         if ($this->application->isMode(ZApplication::MODE_DEBUG)) {
             throw new ZViewException('File to render "' . $___file___ . '" is not found.', ZViewException::EXC_NOFILE);
         }
         return;
     }
     if (!is_readable($___file___)) {
         if ($this->application->isMode(ZApplication::MODE_DEBUG)) {
             throw new ZViewException('File to render "' . $___file___ . '" is not readable.', ZViewException::EXC_NOREAD);
         }
         return;
     }
     if ($a___data) {
         $this->setDataRef($a___data);
     }
     if ($this->m_data->count()) {
         extract($this->m_data->getData(), EXTR_REFS | EXTR_OVERWRITE);
     }
     ob_start();
     include $___file___;
     if ($a___return) {
         $___echo___ = ob_get_contents();
         ob_end_clean();
         return $___echo___;
     }
     ob_end_flush();
 }
Example #5
0
 /**
  * Get data to render
  * @return array
  */
 public function getData()
 {
     return $this->m_data->getData();
 }