当前位置: 首页>>代码示例>>PHP>>正文


PHP Str::inString方法代码示例

本文整理汇总了PHP中Str::inString方法的典型用法代码示例。如果您正苦于以下问题:PHP Str::inString方法的具体用法?PHP Str::inString怎么用?PHP Str::inString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Str的用法示例。


在下文中一共展示了Str::inString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: url

 /**
  * Generates a full readable url.
  *
  * @param string $url				The url parameters
  * @param boolean $appendSession	Append session id to url
  *
  * @return string
  */
 public static function url($url, $appendSession = false)
 {
     $session = Core::getRequest()->getGET("sid");
     if (!COOKIE_SESSION && $appendSession && $session) {
         if (Str::inString("?", $url)) {
             $url .= "?sid=" . $session;
         } else {
             $url .= "&sid=" . $session;
         }
     }
     $lang = Core::getRequest()->getPOST("lang") ? Core::getRequest()->getPOST("lang") : Core::getRequest()->getGET("lang");
     if (self::APPEND_LANG_TO_URL && $lang) {
         if (Str::inString("?", $url)) {
             $url = $url . "?lang=" . $lang;
         } else {
             $url = $url . "&lang=" . $lang;
         }
     } else {
         if (!Link::isExternal($url) && !preg_match("~^" . BASE_URL . "~si", $url) && self::APPEND_HOST_PATH) {
             $url = BASE_URL . $url;
         }
     }
     return $url;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:32,代码来源:Link.util.php

示例2: startSession

 /**
  * Start a new session and destroy old sessions.
  *
  * @return Login
  */
 public function startSession()
 {
     if (!$this->dataChecked) {
         $this->checkData();
     }
     // Disables old sessions.
     if ($this->cacheActive) {
         Core::getCache()->cleanUserCache($this->userid);
     }
     Core::getQuery()->update("sessions", array("logged" => 0), "userid = ?", array($this->userid));
     // Start new session.
     $sessionSeed = Str::encode((string) microtime(1));
     $this->sid = Str::substring($sessionSeed, 0, $this->getSessionLength());
     unset($sessionSeed);
     $spec = array("sessionid" => $this->sid, "userid" => $this->userid, "ipaddress" => IPADDRESS, "useragent" => isset($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : "", "time" => TIME, "logged" => 1);
     Core::getQuery()->insert("sessions", $spec);
     if ($this->canLogin) {
         if (COOKIE_SESSION) {
             Core::getRequest()->setCookie("sid", $this->sid, $this->getCookieExpire());
             $this->sessionUrl = $this->redirection;
         } else {
             if (Str::inString("?", $this->redirection)) {
                 $this->sessionUrl = $this->redirection . "&sid=" . $this->sid . "&login=true";
             } else {
                 $this->sessionUrl = $this->redirection . "?sid=" . $this->sid . "&login=true";
             }
         }
         if ($this->cacheActive) {
             Core::getCache()->buildUserCache($this->sid);
         }
         Hook::event("StartSession", array($this, $this->sessionUrl));
         if ($this->redirectOnSuccess) {
             doHeaderRedirection($this->sessionUrl, true);
         }
     } else {
         $this->loginFailed("CANNOT_LOGIN");
     }
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:44,代码来源:Login.util.php

示例3: redirect

 /**
  * Sets Location header and response code. Forces replacement of any prior
  * redirects.
  *
  * @param string $url				URL to redirect
  * @param boolean $appendSession	Append the session string
  *
  * @return void
  */
 public static function redirect($url, $appendSession = true)
 {
     if (Link::isExternal($url) || Str::inString("http://", $url)) {
         $path = $url;
     } else {
         if ($appendSession && !Str::inString("sid=", $url) && URL_SESSION) {
             !Str::inString("?", $url) ? $url .= "?sid=" . SID : ($url .= "&sid=" . SID);
         } else {
             $path = HTTP_HOST . REQUEST_DIR . $url;
         }
     }
     self::set("Location", $path);
     self::statusCode(302);
     self::send();
     return exit;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:25,代码来源:Header.php

示例4: checkEmail

/**
 * Checks a string for valid email address.
 *
 * @param string
 *
 * @return boolean
 */
function checkEmail($mail)
{
    if (!preg_match("#^[a-zA-Z0-9-]+([._a-zA-Z0-9.-]+)*@[a-zA-Z0-9.-]+\\.([a-zA-Z]{2,4})\$#is", $mail)) {
        return false;
    }
    $banned = Core::getConfig()->get("BANNED_EMAILS");
    if (!empty($banned)) {
        $banned = Arr::trim(explode(",", $banned));
        foreach ($banned as $expr) {
            if (Str::inString($expr, $mail)) {
                return false;
            }
        }
    }
    return true;
}
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:23,代码来源:Functions.inc.php

示例5: serialize

 /**
  * @param array $options
  * @return string
  */
 protected function serialize($options)
 {
     if (!empty($options)) {
         $hasKeys = Str::inString("=>", $options);
         $options = Arr::trim(explode(",", $options));
         $opts = $options;
         if ($hasKeys) {
             $opts = array();
             $size = count($options);
             for ($i = 0; $i < $size; $i++) {
                 $cell = Arr::trim(explode("=>", $options[$i]));
                 $opts[$cell[0]] = $cell[1];
             }
         }
         return serialize($opts);
     }
     return "";
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:22,代码来源:Config.php


注:本文中的Str::inString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。