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


PHP Arr::trim方法代码示例

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


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

示例1: getRights

 /**
  * Loads the rights and check for access.
  *
  * @param array $rights Rights to check
  *
  * @return boolean
  */
 protected function getRights($rights)
 {
     $select = array("a.aid", "a.founder", "ar.CAN_MANAGE", "ar.CAN_SEE_MEMBERLIST", "ar.CAN_SEE_APPLICATIONS", "ar.CAN_BAN_MEMBER", "ar.CAN_SEE_ONLINE_STATE", "ar.CAN_WRITE_GLOBAL_MAILS");
     $joins = "LEFT JOIN " . PREFIX . "alliance a ON (a.aid = u2a.aid)";
     $joins .= "LEFT JOIN " . PREFIX . "allyrank ar ON (ar.rankid = u2a.rank)";
     $result = Core::getQuery()->select("user2ally u2a", $select, $joins, Core::getDB()->quoteInto("u2a.userid = ?", Core::getUser()->get("userid")));
     if ($_row = $result->fetchRow()) {
         $result->closeCursor();
         Hook::event("GetAllianceRights", array($rights, &$_row));
         if ($_row["founder"] == Core::getUser()->get("userid")) {
             return true;
         }
         if (!is_array($rights)) {
             $rights = Arr::trim(explode(",", $rights));
         }
         foreach ($rights as $right) {
             if ($_row[$right] == 0) {
                 return false;
             }
         }
         return true;
     } else {
         $result->closeCursor();
     }
     return false;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:33,代码来源:Alliance.php

示例2: ifPermissions

 /**
  * Checks if user has permissions.
  *
  * @param mixed $perms	The permissions; Splitted with commas
  *
  * @return boolean		True, if all permissions are valid, false, if not
  */
 public function ifPermissions($perms)
 {
     if (!is_array($perms)) {
         $perms = Arr::trim(explode(",", $perms));
     }
     Hook::event("USER_HAS_PERMISSIONS", array($perms));
     foreach ($perms as $p) {
         if (!isset($this->permissions[$p]) || $this->permissions[$p] == 0 || !$this->permissions[$p]) {
             return false;
         }
     }
     return true;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:20,代码来源:User.php

示例3: cachePhraseGroup

 /**
  * Caches only a group of language phrases.
  *
  * @param string $groupname	Phrase group
  * @param integer $langcode	Languageid
  * @param integer $lifetime	Life time [optional]
  *
  * @return Recipe_Cache
  */
 public function cachePhraseGroup($groupname, $langcode, $lifetime = self::DEFAULT_CACHE_LIFE_TIME)
 {
     if (!is_array($groupname)) {
         $groupname = explode(",", $groupname);
         $groupname = Arr::trim($groupname);
     }
     foreach ($groupname as $group) {
         $filename = $this->getLanguageCacheDir() . "lang." . $langcode . "." . $group . ".php";
         try {
             File::rmFile($filename);
         } catch (Exception $e) {
         }
         $cacheContent = $this->setCacheFileHeader("Language [" . $langcode . "] Cache File");
         $cacheContent .= "//### Variables for phrase group \"" . $group . "\" ###//\n";
         $cacheContent .= "\$lifetime=" . (TIME + $lifetime) . ";";
         $joins = "LEFT JOIN " . PREFIX . "languages l ON (l.languageid = p.languageid) ";
         $joins .= "LEFT JOIN " . PREFIX . "phrasesgroups pg ON (pg.phrasegroupid = p.phrasegroupid)";
         $where = Core::getDB()->quoteInto("l.langcode = ?", $langcode);
         $where .= Core::getDB()->quoteInto(" AND pg.title = ?", $group);
         $result = Core::getQuery()->select("phrases p", array("p.title AS phrasetitle", "p.content"), $joins, $where, "p.phrasegroupid ASC, p.title ASC");
         $compiler = new Recipe_Language_Compiler("");
         foreach ($result->fetchAll() as $row) {
             $compiler->setPhrase($row["content"]);
             $cacheContent .= "\$item[\"" . $group . "\"][\"" . $row["phrasetitle"] . "\"]=\"" . $compiler->getPhrase() . "\";";
         }
         $result->closeCursor();
         $compiler->shutdown();
         $cacheContent .= $this->cacheFileClose;
         try {
             $this->putCacheContent($filename, $cacheContent);
         } catch (Recipe_Exception_Generic $e) {
             $e->printError();
         }
     }
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:45,代码来源:Cache.php

示例4: load

 /**
  * Set phrases groups.
  *
  * @param string|array $groups	List of groups, separated by comma
  *
  * @return array	All language variables
  */
 public function load($groups = array())
 {
     if (!is_array($groups)) {
         $groups = Arr::trim(explode(",", $groups));
     }
     $this->grouplist = array_merge($this->grouplist, $groups);
     $this->grouplist = Arr::clean($this->grouplist);
     return $this->fetch();
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:16,代码来源:Language.php

示例5: trim

 /**
  * Applies trim() to each element.
  *
  * @return Map
  */
 public function trim()
 {
     $this->map = Arr::trim($this->map);
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:10,代码来源:Map.util.php

示例6: getArray

 /**
  * Returns the data of the XML element as an array.
  *
  * @param string $name	Element name [optional]
  *
  * @return array
  */
 public function getArray($name = null)
 {
     return Arr::trim(explode(",", $this->getString($name)));
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:11,代码来源:XMLObj.util.php

示例7: 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

示例8: select

 /**
  * Generates a select query.
  *
  * @param string $table
  * @param string|array $select
  * @param string $join
  * @param string $where
  * @param string $order
  * @param string $limit
  * @param string $groupby
  * @param string $other
  * @param array $bind
  *
  * @return Recipe_Database_Statement_Abstract
  */
 public function select($table, $select, $join = "", $where = "", $order = "", $limit = "", $groupby = "", $other = "", array $bind = null)
 {
     if (!is_array($select)) {
         $select = Arr::trim(explode(",", $select));
     }
     if (!empty($join)) {
         $join = " " . $join;
     }
     if (!empty($where)) {
         $where = " WHERE " . $where;
     }
     if (!empty($groupby)) {
         $groupby = " GROUP BY " . $groupby;
     }
     if (!empty($order)) {
         $order = " ORDER BY " . $order;
     }
     if (!empty($limit)) {
         $limit = " LIMIT " . $limit;
     }
     $other = !empty($other) ? " " . $other : "";
     $select = implode(", ", $select);
     $sql = "SELECT " . $select . " FROM " . PREFIX . $table . $join . $where . $groupby . $order . $limit . $other;
     return $this->send($sql, $bind);
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:40,代码来源:QueryParser.php

示例9: validate

 /**
  * Check incoming cron time data and put them into separate arrays.
  *
  * @param array $row	Database row to validate
  *
  * @return array	Validated row
  */
 protected function validate($row)
 {
     $row["minute"] = Arr::trim(explode(",", $row["minute"]));
     $row["hour"] = Arr::trim(explode(",", $row["hour"]));
     $row["day"] = Arr::trim(explode(",", $row["day"]));
     $row["weekday"] = Arr::trim(explode(",", $row["weekday"]));
     $row["month"] = Arr::trim(explode(",", $row["month"]));
     if (empty($row["xtime"])) {
         $row["xtime"] = TIME;
     }
     return $row;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:19,代码来源:Cron.php

示例10: 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

示例11: splitURL

 /**
  * Split the URL into arguments.
  *
  * @return Recipe_Request
  */
 protected function splitURL()
 {
     $requestedUrl = $this->getRequestedUrl();
     // Remove query string
     if (!empty($_SERVER["QUERY_STRING"])) {
         $requestedUrl = Str::replace("?" . $_SERVER["QUERY_STRING"], "", $requestedUrl);
     }
     $splitted = @parse_url($requestedUrl);
     // Sometimes the first slash causes errors
     if (!$splitted) {
         $splitted = parse_url(Str::substring($requestedUrl, 1));
     }
     // Remove real path from virtual path.
     if (MOD_REWRITE) {
         $path = Str::replace(dirname($_SERVER["SCRIPT_NAME"]) . "/", "", $splitted["path"]);
     } else {
         $path = Str::substring(Str::replace($_SERVER["SCRIPT_NAME"], "", $splitted["path"]), 1);
     }
     if (Str::length($path) > 0) {
         Hook::event("SplitUrlStart", array($this, &$path));
         $path = explode("/", $path);
         foreach ($path as $value) {
             if (strpos($value, ":") > 0) {
                 $value = explode(":", Str::replace(" ", "_", $value));
                 $this->args[] = Arr::trim($value);
             } else {
                 if ($value != "") {
                     $this->args[] = $value;
                 }
             }
         }
         Hook::event("SplitUrlClose", array($this, &$path));
     }
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:40,代码来源:Request.php


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