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


PHP _strtolower函数代码示例

本文整理汇总了PHP中_strtolower函数的典型用法代码示例。如果您正苦于以下问题:PHP _strtolower函数的具体用法?PHP _strtolower怎么用?PHP _strtolower使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: scan_aliases

 /**
  * Scanning of aliases for defining of current language
  *
  * @param array			$active_languages
  *
  * @return bool|string
  */
 protected function scan_aliases($active_languages)
 {
     if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
         return false;
     }
     $Cache = Cache::instance();
     if (($aliases = $Cache->{'languages/aliases'}) === false) {
         $aliases = [];
         $aliases_list = _strtolower(get_files_list(LANGUAGES . '/aliases'));
         foreach ($aliases_list as $alias) {
             $aliases[$alias] = file_get_contents(LANGUAGES . "/aliases/{$alias}");
         }
         unset($aliases_list, $alias);
         $Cache->{'languages/aliases'} = $aliases;
     }
     $accept_languages = str_replace('-', '_', explode(',', strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE'])));
     foreach (_strtolower($_SERVER) as $i => $v) {
         if (preg_match('/.*locale/i', $i)) {
             $accept_languages[] = strtolower($v);
         }
     }
     unset($i, $v);
     foreach ($accept_languages as $language) {
         $language = explode(';', $language, 2)[0];
         if (isset($aliases[$language]) && in_array($aliases[$language], $active_languages)) {
             return $aliases[$language];
         }
     }
     return false;
 }
开发者ID:hypnomez,项目名称:opir.org,代码行数:37,代码来源:Language.php

示例2: test_cases

 public function test_cases()
 {
     $sentence = 'пользователь должен быть у Вас в друзьях а Вы у него';
     $this->assertEquals('ПОЛЬЗОВАТЕЛЬ ДОЛЖЕН БЫТЬ У ВАС В ДРУЗЬЯХ А ВЫ У НЕГО', trim(_strtoupper($sentence)));
     $this->assertEquals('пользователь должен быть у вас в друзьях а вы у него', trim(_strtolower($sentence)));
     $this->assertNotEquals(strtoupper($sentence), _strtoupper($sentence));
     $this->assertNotEquals(strtolower($sentence), _strtolower($sentence));
     $this->assertNotEquals(ucfirst($sentence), _ucfirst($sentence));
     $this->assertNotEquals(ucwords($sentence), _ucwords($sentence));
 }
开发者ID:yfix,项目名称:yf,代码行数:10,代码来源:class_utf8.Test.php

示例3: prepare_str

 /**
  */
 function prepare_str($string)
 {
     $patrn = "/([\\[\\}\\]\\{\\%\"\\'\\<\\>\\~\\!\\@\\#\$\\%\\&\\*\\(\\)\\s\\-\\_\\:\\;\\+\\=\\|\\?\\№\\.\\/\\^\\,])+/iu";
     $patrn2 = ["<", ">"];
     $string = str_replace($patrn2, "", $string);
     $string = _strtolower(trim($string));
     $string = preg_replace($patrn, ",", $string);
     $string = trim($string, ",");
     $str_search = explode(",", $string);
     $rezult = $this->search_fast($str_search);
     return $rezult;
 }
开发者ID:yfix,项目名称:yf,代码行数:14,代码来源:yf_shop_search.class.php

示例4: save_locale_var

 /**
  * AJAX-based method save current locale variable
  */
 function save_locale_var()
 {
     no_graphics(true);
     if (!DEBUG_MODE && !$_SESSION['locale_vars_edit']) {
         return print 'Access denied';
     }
     $SOURCE_VAR_NAME = str_replace('%20', ' ', trim($_POST['source_var']));
     $EDITED_VALUE = str_replace('%20', ' ', trim($_POST['edited_value']));
     $CUR_LOCALE = conf('language');
     // First we need to check if such var exists
     if (!strlen($SOURCE_VAR_NAME)) {
         return print 'Empty source var';
     }
     if (!strlen($EDITED_VALUE)) {
         return print 'Empty edited value';
     }
     if ($this->_parent->VARS_IGNORE_CASE) {
         $SOURCE_VAR_NAME = str_replace(' ', '_', _strtolower($SOURCE_VAR_NAME));
         $sql = "SELECT * FROM " . db('locale_vars') . " WHERE REPLACE(CONVERT(value USING utf8), ' ', '_') = '" . _es($SOURCE_VAR_NAME) . "'";
     } else {
         $sql = "SELECT * FROM " . db('locale_vars') . " WHERE value='" . _es($SOURCE_VAR_NAME) . "'";
     }
     $var_info = db()->query_fetch($sql);
     // Create variable record if not found
     if (empty($var_info['id'])) {
         $sql = ['value' => _es($SOURCE_VAR_NAME)];
         db()->INSERT('locale_vars', $sql);
         $var_info['id'] = db()->INSERT_ID();
     }
     $sql_data = ['var_id' => intval($var_info['id']), 'value' => _es($EDITED_VALUE), 'locale' => _es($CUR_LOCALE)];
     // Check if record is already exists
     $Q = db()->query('SELECT * FROM ' . db('locale_translate') . ' WHERE var_id=' . intval($var_info['id']));
     while ($A = db()->fetch_assoc($Q)) {
         $var_tr[$A['locale']] = $A['value'];
     }
     if (isset($var_tr[$CUR_LOCALE])) {
         db()->UPDATE('locale_translate', $sql_data, 'var_id=' . intval($var_info['id']) . " AND locale='" . _es($CUR_LOCALE) . "'");
     } else {
         db()->INSERT('locale_translate', $sql_data);
     }
     $sql = db()->UPDATE('locale_translate', $sql_data, 'var_id=' . intval($var_info['id']) . " AND locale='" . _es($CUR_LOCALE) . "'", true);
     db()->INSERT('revisions', ['user_id' => intval(MAIN_TYPE_USER ? main()->USER_ID : main()->ADMIN_ID), 'object_name' => _es('locale_var'), 'object_id' => _es($var_info['id']), 'old_text' => _es($var_tr[$CUR_LOCALE]), 'new_text' => _es($EDITED_VALUE), 'date' => time(), 'ip' => common()->get_ip(), 'comment' => _es('locale: ' . $CUR_LOCALE)]);
     cache_del('locale_translate_' . $CUR_LOCALE);
     return print 'Save OK';
 }
开发者ID:yfix,项目名称:yf,代码行数:48,代码来源:yf_dynamic_edit.class.php

示例5: strtolower

 /**
  * Makes a UTF-8 string lowercase. This is a UTF8-aware version
  * of [strtolower](http://php.net/strtolower).
  *
  *     $str = UTF8::strtolower($str);
  *
  * @author  Andreas Gohr <andi@splitbrain.org>
  * @param   string   mixed case string
  * @return  string
  * @uses    UTF8::$server_utf8
  */
 public static function strtolower($str)
 {
     if (UTF8::$server_utf8) {
         return mb_strtolower($str, Kohana::$charset);
     }
     if (!isset(self::$called[__FUNCTION__])) {
         require SYSPATH . 'utf8' . DIRECTORY_SEPARATOR . __FUNCTION__ . EXT;
         // Function has been called
         self::$called[__FUNCTION__] = TRUE;
     }
     return _strtolower($str);
 }
开发者ID:gilyaev,项目名称:framework-bench,代码行数:23,代码来源:utf8.php

示例6: score_matches

/**
 * Takes all the relevant sql results and scores them to find the most likely match with the aiml
 *
 * @param array  $convoArr
 * @param array  $allrows
 * @param string $pattern
 * @internal param int $bot_parent_id
 * @internal param string $current_thatpattern
 * @internal param string $current_topic
 * @return array
 **/
function score_matches($convoArr, $allrows, $pattern)
{
    global $common_words_array;
    runDebug(__FILE__, __FUNCTION__, __LINE__, "Scoring the matches.", 4);
    # obtain some values to test
    $topic = get_topic($convoArr);
    $that = isset($convoArr['that'][1][1]) ? $convoArr['that'][1][1] : '';
    $default_pattern = $convoArr['conversation']['default_aiml_pattern'];
    $bot_parent_id = $convoArr['conversation']['bot_parent_id'];
    $bot_id = $convoArr['conversation']['bot_id'];
    # set the scores for each type of word or sentence to be used in this function
    # full pattern match scores:
    $this_bot_match = 250;
    $underscore_match = 100;
    $topic_underscore_match = 80;
    $topic_direct_match = 50;
    $topic_star_match = 10;
    $thatpattern_underscore_match = 45;
    $thatpattern_direct_match = 15;
    $thatpattern_star_match = 2;
    $direct_pattern_match = 10;
    $pattern_direct_match = 7;
    $pattern_star_match = 1;
    $default_pattern_match = 5;
    # individual word match scores:
    $uncommon_word_match = 8;
    $common_word_match = 1;
    $direct_word_match = 2;
    $underscore_word_match = 25;
    $star_word_match = 1;
    $rejected = -1000;
    # loop through all relevant results
    foreach ($allrows as $all => $subrow) {
        $category_bot_id = isset($subrow['bot_id']) ? $subrow['bot_id'] : 1;
        $category_topic = $subrow['topic'];
        $category_thatpattern = $subrow['thatpattern'];
        $category_pattern = $subrow['pattern'];
        $check_pattern_words = true;
        # make it all lower case, to make it easier to test, and do it using mbstring functions if possible
        $category_pattern_lc = _strtolower($category_pattern);
        $category_thatpattern_lc = _strtolower($category_thatpattern);
        $category_topic_lc = _strtolower($category_topic);
        $default_pattern_lc = _strtolower($default_pattern);
        $pattern_lc = _strtolower($pattern);
        $topic_lc = _strtolower($topic);
        $that_lc = _strtolower($that);
        // Start scoring here
        $current_score = 0;
        $track_matches = '';
        # 1.) Check for current bot, rather than parent
        if ($category_bot_id == $bot_id) {
            $current_score += $this_bot_match;
            $track_matches .= 'current bot, ';
        } elseif ($category_bot_id == $bot_parent_id) {
            $current_score += 0;
            $track_matches .= 'parent bot, ';
        } else {
            $current_score = $rejected;
            runDebug(__FILE__, __FUNCTION__, __LINE__, 'Found an error trying to identify the chatbot.', 1);
            unset($allrows[$all]);
            continue;
        }
        # 2.) test for a non-empty  current topic
        if (!empty($topic)) {
            # 2a.) test for a non-empty topic in the current category
            if (empty($category_topic) || $category_topic == '*') {
                // take no action, as we're not looking for a topic here
                $track_matches .= 'no topic to match, ';
            } else {
                # 2b.) create a RegEx to test for underscore matches
                if (strpos($category_topic, '_') !== false) {
                    $regEx = str_replace('_', '(.*)', $category_topic);
                    if ($regEx != $category_topic && preg_match("/{$regEx}/", $topic) === 1) {
                        $current_score += $topic_underscore_match;
                        $track_matches .= 'topic match with underscore, ';
                    }
                } elseif ($topic == $category_topic) {
                    $current_score += $topic_direct_match;
                    $track_matches .= 'direct topic match, ';
                } else {
                    $regEx = str_replace(array('*', '_'), '(.*)', $category_topic);
                    if (preg_match("/{$regEx}/", $topic)) {
                        $current_score += $topic_star_match;
                        $track_matches .= 'topic match with wildcards';
                    }
                }
            }
        }
        # end topic testing
//.........这里部分代码省略.........
开发者ID:ramdesh,项目名称:Program-O,代码行数:101,代码来源:find_aiml.php

示例7: strtolower

 public static function strtolower($str)
 {
     if (UTF8::$server_utf8) {
         return mb_strtolower($str, JsonApiApplication::$charset);
     }
     if (!isset(UTF8::$called[__FUNCTION__])) {
         require JsonApiApplication::find_file("utf8", __FUNCTION__);
         // Function has been called
         UTF8::$called[__FUNCTION__] = TRUE;
     }
     return _strtolower($str);
 }
开发者ID:benshez,项目名称:DreamWeddingCeremonies,代码行数:12,代码来源:UTF8.php

示例8: strtolower

 /**
  * Makes a UTF-8 string lowercase.
  * @see http://php.net/strtolower
  *
  * @author  Andreas Gohr <andi@splitbrain.org>
  *
  * @param   string   mixed case string
  * @return  string
  */
 public static function strtolower($str)
 {
     require_once dirname(__FILE__) . '/' . __FUNCTION__ . '.php';
     return _strtolower($str);
 }
开发者ID:abhinay100,项目名称:forma_app,代码行数:14,代码来源:lib.utf8.php

示例9: translate_string


//.........这里部分代码省略.........
     $input_string = trim($input_string);
     DEBUG_MODE && $this->_calls[$input_string]++;
     if ($this->USE_TRANSLATE_CACHE && empty($args)) {
         $CACHE_NAME = $lang . '#____#' . $input_string;
         if (isset($this->_LOCALE_CACHE[$CACHE_NAME])) {
             return $this->_LOCALE_CACHE[$CACHE_NAME];
         }
     }
     $is_translated = false;
     $_source = $input_string;
     $output_string = $input_string;
     // Try to find prefix (starts with '::')
     $_prefix = '';
     $_prefix_length = 0;
     if ($input_string[0] == ':' && $input_string[1] == ':') {
         $_prefix = substr($input_string, 0, strpos($input_string, '::', 2) + 2);
         $_prefix_length = strlen($_prefix);
         $input_string = substr($input_string, $_prefix_length);
     }
     if ($this->TRANSLATE_ENABLED) {
         // Prepare for case ignore
         if ($this->VARS_IGNORE_CASE) {
             $first_input_string = $input_string;
             $input_string = strtolower($input_string);
             if ($this->REPLACE_UNDERSCORE) {
                 $input_string = str_replace('&nbsp;', ' ', $input_string);
                 $input_string = str_replace(' ', '_', $input_string);
             }
         }
         // Try to find prefix (starts with '::') again
         if (!strlen($_prefix) && isset($this->TR_VARS[$lang]['::' . $_GET['object'] . '::' . $input_string])) {
             $_prefix = '::' . $_GET['object'] . '::';
         }
         // First try to translate var with prefix
         if (strlen($_prefix) && isset($this->TR_VARS[$lang][$_prefix . $input_string])) {
             $output_string = $this->TR_VARS[$lang][$_prefix . $input_string];
             $is_translated = true;
             // Then common var
         } elseif (isset($this->TR_VARS[$lang][$input_string])) {
             $output_string = $this->TR_VARS[$lang][$input_string];
             $is_translated = true;
             // Then try _un_html_entities
         } elseif (($var_un_html = $this->_un_html_entities($input_string)) && isset($this->TR_VARS[$lang][$var_un_html])) {
             $output_string = $this->TR_VARS[$lang][$var_un_html];
             $is_translated = true;
             // Last - is untranslated
         } else {
             $output_string = $input_string;
             if (DEBUG_MODE) {
                 if (!isset($this->_NOT_TRANSLATED)) {
                     $this->_NOT_TRANSLATED = [];
                 }
                 if (!isset($this->_NOT_TRANSLATED[$lang])) {
                     $this->_NOT_TRANSLATED[$lang] = [];
                 }
                 if (!isset($this->_NOT_TRANSLATED[$lang][$input_string])) {
                     $this->_NOT_TRANSLATED[$lang][$input_string] = 0;
                 }
                 $this->_NOT_TRANSLATED[$lang][$input_string]++;
                 // Check if such variable exists
                 if ($this->AUTO_FIND_VARS && !isset($this->TR_ALL_VARS[$input_string])) {
                     $this->insert_var($input_string);
                 }
             }
         }
     }
     if ($this->REPLACE_UNDERSCORE && !$is_translated) {
         $output_string = str_replace('_', ' ', $_source);
         if ($_prefix_length) {
             $output_string = substr($output_string, $_prefix_length);
         }
     }
     if (!empty($args) && is_array($args)) {
         $output_string = $this->_process_sub_patterns($output_string, $args);
         $output_string = strtr($output_string, $args);
     }
     if ($this->TRACK_FIRST_LETTER_CASE && $is_translated) {
         $input = $this->VARS_IGNORE_CASE ? $first_input_string : $input_string;
         $first_s = substr($input, 0, 1);
         $first_t = _substr($output_string, 0, 1);
         $first_s_lower = strtolower($first_s) == $first_s;
         $first_t_lower = _strtolower($first_t) == $first_t;
         if (!$first_s_lower && $first_t_lower) {
             $output_string = _strtoupper($first_t) . _substr($output_string, 1);
         }
     }
     if (DEBUG_MODE) {
         if ($this->WRAP_VARS_FOR_INLINE_EDIT && false === strpos($output_string, 'class=localetr')) {
             $r = [' ' => '%20', '=' => '&equals;', '<' => '&lt;', '>' => '&gt;'];
             $svar = _prepare_html(str_replace(array_keys($r), array_values($r), $_source));
             $output_string = '<span class=localetr svar=' . $svar . '>' . $output_string . '</span>';
         }
         debug('i18n[]', ['name_orig' => $_source, 'name' => $input_string, 'out' => $output_string, 'lang' => $lang, 'args' => $args ?: '', 'translated' => (int) $is_translated, 'time' => round(microtime(true) - $_start_time, 5), 'trace' => main()->trace_string()]);
     }
     // Put to cache
     if ($this->USE_TRANSLATE_CACHE && empty($args)) {
         $this->_LOCALE_CACHE[$CACHE_NAME] = $output_string;
     }
     return $output_string;
 }
开发者ID:yfix,项目名称:yf,代码行数:101,代码来源:yf_i18n.class.php

示例10: strtolower

 /**
  * Makes a UTF-8 string lowercase. This is a UTF8-aware version
  * of [strtolower](http://php.net/strtolower).
  *
  *     $str = UTF8::strtolower($str);
  *
  * @author  Andreas Gohr <andi@splitbrain.org>
  * @param   string  $str mixed case string
  * @return  string
  * @uses    UTF8::$server_utf8
  * @uses    Kohana::$charset
  */
 public static function strtolower($str)
 {
     if (UTF8::$server_utf8) {
         return mb_strtolower($str, Kohana::$charset);
     }
     if (!isset(UTF8::$called[__FUNCTION__])) {
         require Kohana::find_file('utf8', __FUNCTION__);
         // Function has been called
         UTF8::$called[__FUNCTION__] = TRUE;
     }
     return _strtolower($str);
 }
开发者ID:Chinese1904,项目名称:openclassifieds2,代码行数:24,代码来源:UTF8.php

示例11: change_email

/**
 * 会员修改邮箱地址
 *
 * 编写人:陈雷
 * 编写日期:2009-6-16
 * 修改日期:
 * @param int $uid 用户uid
 * @param string $oldname 老邮箱地址
 * @param string $newname 新邮箱地址
 * @param string $password 原密码
 * @param string $validate_code 验证码
 * @param string $errorinfo 错误信息,引用
 * @return 1表示失败,0表示成功
 */
function change_email($uid, $oldname, $newname, $password, $validate_code, &$errorinfo)
{
    global $SDB, $DC, $SESSION, $MDB, $MDB_LY;
    $obj_user = $DC->get_user($uid);
    if ($obj_user->validate_email == 1) {
        $errorinfo = '您的邮箱已经通过验证,不能再次修改';
        $result = 0;
        return $result;
    }
    if (!strstr($newname, '@')) {
        $errorinfo = '新邮箱格式错误';
        $result = 0;
        return $result;
    }
    $validate_code = addslashes($validate_code);
    $code_hash = $_COOKIE['GFCH'];
    if (!verify_antispam_v2($code_hash, $validate_code)) {
        $errorinfo = '验证码错误';
        $result = 0;
        return $result;
    }
    $sql = "select uid from user where name = '{$newname}'";
    $temp_uid = $SDB->result($sql);
    if ($temp_uid > 0) {
        $errorinfo = '您要修改的新邮箱已经存在';
        $result = 0;
        return $result;
    }
    $raw_hash = 'Love21cn.com' . sha1(_strtolower($oldname)) . sha1($password);
    $login_hash = sha1($raw_hash);
    $user_obj = $DC->get_userlog_from_uidhash(md5($uid));
    if ($user_obj->login_hash == $login_hash) {
        $new_raw_hash = 'Love21cn.com' . sha1(_strtolower($newname)) . sha1($password);
        $new_login_hash = sha1($new_raw_hash);
        $arr = array('name' => $newname, 'login_hash' => $new_login_hash);
        $blogin = $DC->update_userlogin($uid, $arr);
        $buser = $DC->update_user($uid, $arr);
        v_send_email($newname, 1, $uid);
        $DC->set_cache('post_email_num_chenlei_' . $uid, 1, 3600 * 24);
        $errorinfo = '邮箱修改成功,验证邮件已发至新邮箱(' . $newname . ')请使用新邮箱地址重新登录世纪佳缘。';
        $result = 1;
        /**
         * 更新直邮推荐表
         */
        $sql = "update subscribe set email='" . $newname . "' where uid=" . $uid;
        $MDB_LY->query($sql);
        $USER = $SDB->result("SELECT * FROM user WHERE `uid`='" . $uid . "'");
        if (is_object($USER) && $USER->uid > 0) {
            write_session($USER, 0, 0, $new_login_hash);
        }
        $DC->set_cache('post_email_num_chenlei_' . $USER->uid, 0, 3600 * 24);
    } else {
        $errorinfo = '密码错误';
        $result = 0;
    }
    return $result;
}
开发者ID:pbchen,项目名称:dns-cache,代码行数:71,代码来源:function.inc.php

示例12: function

<?php

return function () {
    $data = [];
    foreach ((array) db()->select('id, name')->from('static_pages')->where('active', '1')->get_2d() as $id => $name) {
        $name = _strtolower($name);
        if (strlen($name)) {
            $data[$name] = $name;
        }
    }
    return $data;
};
开发者ID:yfix,项目名称:yf,代码行数:12,代码来源:static_pages_names.php

示例13: user_var_push

 /**
  * Push user var into main traslation table
  */
 function user_var_push($FORCE_ID = false)
 {
     $_GET['id'] = intval($FORCE_ID ? $FORCE_ID : $_GET['id']);
     $A = db()->query_fetch('SELECT * FROM ' . db('locale_user_tr') . ' WHERE id=' . intval($_GET['id']));
     if (!$A) {
         return _e('No id');
     }
     $VAR_NAME = $A['name'];
     if ($this->VARS_IGNORE_CASE) {
         $VAR_NAME = str_replace(' ', '_', _strtolower($VAR_NAME));
     }
     if (!strlen($VAR_NAME)) {
         return _e('Empty var name');
     }
     $CUR_LOCALE = $A['locale'];
     if (!$CUR_LOCALE) {
         return _e('Empty var locale');
     }
     $EDITED_VALUE = $A['translation'];
     if (!strlen($EDITED_VALUE)) {
         return _e('Empty var translation');
     }
     // Get main translation var (if exists)
     $var_info = db()->query_fetch('SELECT * FROM ' . db('locale_vars') . ' WHERE value="' . _es($VAR_NAME) . '"');
     if (!$var_info) {
         $var_info = ['value' => _es($VAR_NAME), 'location' => ''];
         db()->INSERT('locale_vars', $var_info);
         $var_id = db()->INSERT_ID();
         if ($var_id) {
             $var_info['id'] = $var_id;
         }
     }
     if (!$var_info['id']) {
         return _e('No locale var id');
     }
     $sql_data = ['var_id' => intval($var_info['id']), 'value' => _es($EDITED_VALUE), 'locale' => _es($CUR_LOCALE)];
     // Get translation for the current locale
     $Q = db()->query('SELECT * FROM ' . db('locale_translate') . ' WHERE var_id=' . intval($var_info['id']));
     while ($A = db()->fetch_assoc($Q)) {
         $var_tr[$A['locale']] = $A['value'];
     }
     if (isset($var_tr[$CUR_LOCALE])) {
         db()->UPDATE('locale_translate', $sql_data, 'var_id=' . intval($var_info['id']) . ' AND locale="' . _es($CUR_LOCALE) . '"');
     } else {
         db()->INSERT('locale_translate', $sql_data);
     }
     return $FORCE_ID ? '' : js_redirect('./?object=' . $_GET['object'] . '&action=user_vars');
 }
开发者ID:yfix,项目名称:yf,代码行数:51,代码来源:yf_locale_editor_user_vars.class.php

示例14: _get_page_from_db

 /**
  */
 function _get_page_from_db($id = null)
 {
     $id = $id ?: $_GET['id'];
     if (empty($id)) {
         return [];
     }
     $cache_name = $id . '|' . $lang;
     $a = $this->_cache[$cache_name];
     if (!is_null($a)) {
         return $a;
     }
     $q = db()->from(self::table)->where('active', '1');
     if (is_numeric($id)) {
         $q->where('id', (int) $id);
     } else {
         $q->where('name', _strtolower($id));
     }
     $lang = conf('language');
     $q->where('locale', $lang);
     $a = $q->get();
     $this->_cache[$cache_name] = $a;
     return $a;
 }
开发者ID:yfix,项目名称:yf,代码行数:25,代码来源:yf_static_pages.class.php

示例15: strtolower

 /**
  * Makes a UTF-8 string lowercase. This is a UTF8-aware version
  * of [strtolower](http://php.net/strtolower).
  *
  *     $str = UTF8::strtolower($str);
  *
  * @author  Andreas Gohr <andi@splitbrain.org>
  * @param   string  $str mixed case string
  * @return  string
  * @uses    UTF8::$server_utf8
  * @uses    Phalcana\Phalcana::$charset
  */
 public static function strtolower($str)
 {
     if (UTF8::$server_utf8) {
         return mb_strtolower($str, Phalcana::$charset);
     }
     if (!isset(UTF8::$called[__FUNCTION__])) {
         require Phalcana::$di->get('fs')->findFile('utf8', __FUNCTION__);
         // Function has been called
         UTF8::$called[__FUNCTION__] = true;
     }
     return _strtolower($str);
 }
开发者ID:braf,项目名称:phalcana-core,代码行数:24,代码来源:UTF8.php


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