Пример #1
0
 /**
  * 在Scripts开头追加内容
  * @access public
  * @param string $str
  * @return XF_View_Helper_Header_Script
  */
 public function prependFile($str)
 {
     //防止与缓存中的路径重复
     $path = XF_View::getInstance()->getResourcePath();
     $str = str_replace($path, '', $str);
     array_unshift($this->_scripts, XF_String::text($path . $str));
     return $this;
 }
Пример #2
0
 /**
  * 设置$_POST请求资料
  * @access public
  * @param string|array $spec
  * @param null|mixed $value
  * @param bool $filtration 是否过滤内容 默认为true
  * @return XF_Controller_Request_Http
  */
 public function setPost($spec, $value = null, $filtration = true)
 {
     if (null === $value && is_array($spec)) {
         foreach ($spec as $key => $value) {
             $this->setPost($key, $value);
         }
         return $this;
     }
     $this->_post_params[(string) $spec] = XF_String::clearJs($value);
     $this->setParam((string) $spec, $value, $filtration);
     return $this;
 }
Пример #3
0
 /**
  * 追加查询条件
  * @access public
  * @param string | Array $var
  * @param string $where_type 条件类别 [ AND、OR  默认 AND]
  * @return XF_Db_Table_Select_Mysql
  */
 public function appendWhere($var, $where_type = 'AND')
 {
     if (XF_Functions::isEmpty($this->_adv_where)) {
         $this->setWhere($var);
     } else {
         if (XF_Functions::isEmpty($var) === false) {
             if ($where_type == 'AND') {
                 $this->_adv_where .= ' AND ' . XF_Db_Tool::whereFormat($var);
             } elseif ($where_type == 'OR') {
                 $this->_adv_where = XF_String::str_replace_once(' WHERE ', '', $this->_adv_where);
                 $this->_adv_where = ' WHERE ((' . $this->_adv_where . ') OR (' . XF_Db_Tool::whereFormat($var) . '))';
             }
         }
     }
     return $this;
 }
Пример #4
0
 /**
  * 在标题前方添加内容
  * @access public
  * @param string $str
  * @return View_Header_Title
  */
 public function prependTitle($str)
 {
     $this->_title = XF_String::text($str, false) . $this->_linkSymbol . $this->_title;
     return $this;
 }
Пример #5
0
 /**
  * 设置一个请求参数,如果设置的值为NULL,并且存在此参数key时,将删除该参数.
  * @access public
  * @param string $key
  * @param mixed $value
  * @param bool $filtration 是否过滤内容 默认为true
  * @return XF_Controller_Request_Abstract
  */
 public function setParam($key, $value, $filtration = true)
 {
     if (null === $value && isset($this->_params[$key])) {
         unset($this->_params[$key]);
     } elseif (null !== $value) {
         if (strpos($key, '[]') !== false) {
             $key = str_replace('[]', '', $key);
             $this->_params[$key][] = $filtration ? XF_String::clearJs($value) : $value;
         } else {
             $this->_params[$key] = $filtration ? XF_String::clearJs($value) : $value;
         }
     }
     return $this;
 }
Пример #6
0
 /**
  * 在Meta尾部追加内容
  * @access public
  * @param string $str
  * @return XF_View_Helper_Header_Meta
  */
 public function appendMeta($str)
 {
     $this->_metas[] = XF_String::text($str);
     return $this;
 }
Пример #7
0
 /**
  * 在Link尾部追加内容
  * @access public
  * @param string $str
  * @return XF_View_Helper_Header_Link
  */
 public function appendLink($str)
 {
     $this->_links[] = XF_String::text($str);
     return $this;
 }