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


PHP utf8::strcasecmp方法代码示例

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


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

示例1: invoke

 public function invoke(Validate $array, $field)
 {
     $value = $array[$field];
     if (!is_array($value)) {
         return TRUE;
     }
     $cache = Cache::instance();
     $surfix = Kohana::config('torn')->surfix->temp;
     $cached = $this->model->get($field . $surfix);
     $current = $this->model->get($field, FALSE);
     $used_cached = FALSE;
     $empty_check = FALSE;
     if (!Upload::not_empty($value) and empty($cached) and !empty($current)) {
         $this->model->set($field, $current);
         $array[$field] = $current;
         return TRUE;
     }
     if (!Upload::not_empty($value) and preg_match('/^[a-z0-9]{32}-[a-z0-9]{32}$/iD', $cached)) {
         $value = Arr::get($cache->get($cached), 'upload', $value);
         $used_cached = TRUE;
     }
     $modified_rules = $this->rules;
     foreach ($this->rules as $rule => $params) {
         if (!utf8::strcasecmp($rule, 'Upload::not_empty')) {
             unset($modified_rules[$rule]);
             $modified_rules['Torn_Uploader::not_empty'] = NULL;
             break;
         }
     }
     $validate = Validate::factory(array($field => $value))->filters($field, $this->filters)->rules($field, $modified_rules)->callbacks($field, $this->callbacks);
     if (!$validate->check()) {
         foreach ($validate->errors() as $v) {
             list($error, $params) = $v;
             $array->error($field, $error, $params);
         }
         return FALSE;
     }
     $validate = $array->as_array();
     $value = $validate[$field];
     if ($tmp_name = Torn_Uploader::upload_to_cache($value, $field) and !$used_cached) {
         $array[$field] = $tmp_name;
     } else {
         $array[$field] = Arr::get($_POST, $field . $surfix, $value);
     }
     $this->model->set($field, $array[$field]);
     return TRUE;
 }
开发者ID:TdroL,项目名称:kohana-jelly-torn,代码行数:47,代码来源:uploader.php

示例2: translate

 public function translate()
 {
     // Get URI vars
     $plugin = uri::segment(5);
     $language = uri::segment(6);
     // Get plugin
     if (!config::item('plugins', 'core', $plugin)) {
         view::setError(__('no_plugin', 'system_plugins'));
         router::redirect('cp/system/languages/plugins/' . $language);
     }
     // Is this a system language?
     if ($language == 'system') {
         $language = array('keyword' => 'system', 'name' => 'System');
     } elseif (!($language = $this->languages_model->getLanguage($language))) {
         view::setError(__('no_language', 'system_languages'));
         router::redirect('cp/system/languages');
     }
     // Get default language data
     if (!($default = $this->languages_model->getLanguageData('system', $plugin))) {
         view::setError(__('no_language', 'system_languages'));
         router::redirect('cp/system/languages');
     }
     // Get language data
     if (!($data = $this->languages_model->getLanguageData($language['keyword'], $plugin, true))) {
         view::setError(__('no_language', 'system_languages'));
         router::redirect('cp/system/languages');
     }
     // Set language sections
     $sections = array();
     foreach ($data as $section => $groups) {
         foreach ($groups as $group => $types) {
             $translated = $total = 0;
             foreach ($types as $type => $items) {
                 foreach ($items as $index => $value) {
                     if (utf8::strcasecmp($default[$section][$group][$type][$index], $value)) {
                         $translated++;
                     }
                     $total++;
                 }
             }
             $translated = $translated ? round($translated / $total * 100) : 0;
             $translated = $translated > 100 ? 100 : $translated;
             if (__('language_' . $group, $plugin . '_config') !== false) {
                 $name = __('language_' . $group, $plugin . '_config');
             } elseif (__('language_' . $group, 'users_config') !== false) {
                 $name = __('language_' . $group, 'users_config');
             } elseif (__('language_' . $group, 'system_config') !== false) {
                 $name = __('language_' . $group, 'system_config');
             } elseif ($section == $group) {
                 $name = __('language_system', 'system_config');
             } else {
                 $name = '!' . $group;
             }
             $sections[$section . '_' . $group] = '[' . config::item('plugins', 'core', $section, 'name') . '] ' . $name . ($language['keyword'] != 'english' ? ' - ' . $translated . '%' : '') . (config::item('devmode', 'system') == 2 ? ' [' . $group . ']' : '');
         }
     }
     asort($sections);
     // Assign vars
     view::assign(array('plugin' => $plugin, 'default' => $default, 'sections' => $sections, 'language' => $data));
     // Process form values
     if (input::post('do_save_language')) {
         $this->_saveLanguageData($plugin, $language['keyword'], $default);
     }
     // Set title
     view::setTitle(__('language_translate', 'system_languages'));
     // Set trail
     view::setTrail('cp/system/languages/plugins/' . $language['keyword'], __('language_translate', 'system_languages') . ' - ' . text_helper::entities($language['name']));
     view::setTrail('cp/system/languages/translate/' . $plugin . '/' . $language['keyword'], text_helper::entities(config::item('plugins', 'core', $plugin, 'name')));
     // Load view
     view::load('cp/system/languages/translate');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:71,代码来源:languages.php

示例3: strcasecmp

 /**
  * Tests the tutf8::strcasecmp() function.
  * @dataProvider strcasecmp_provider
  * @group core.helpers.utf8.strcasecmp
  * @test
  */
 public function strcasecmp($str, $str2, $expected_result)
 {
     $result = utf8::strcasecmp($str, $str2);
     $this->assertEquals($expected_result, $result);
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:11,代码来源:Helper_UTF8_Test.php

示例4: isset

_<?php 
                echo $keyword;
                ?>
">
									<?php 
                echo isset($default[$section][$group][$type][$keyword]) ? $default[$section][$group][$type][$keyword] : "!{$section}-{$group}-{$keyword}!";
                ?>
								</label>
								<div class="field" <?php 
                echo config::item('devmode', 'system') == 2 ? 'style="position:relative"' : '';
                ?>
>

									<div class="input-wrap">
										<?php 
                echo form_helper::text($group . '_' . $keyword, form_helper::setValue($group . '_' . $keyword, isset($value) ? $value : ''), array('class' => 'text input-wide ' . (uri::segment(6) == 'english' || isset($default[$section][$group][$type][$keyword]) && utf8::strcasecmp($default[$section][$group][$type][$keyword], $value) ? 'translated' : 'untranslated'), 'id' => 'input_edit_' . $group . '_' . $keyword));
                ?>
										<?php 
                if (config::item('devmode', 'system') == 2) {
                    ?>
											<?php 
                    echo form_helper::text($group . '_' . $keyword . '___key', $keyword, array('class' => 'text', 'style' => 'width:130px;position:absolute;right:-160px;top:0;'));
                    ?>
										<?php 
                }
                ?>
									</div>

									<?php 
                if (form_helper::error($group . '_' . $keyword)) {
                    ?>
开发者ID:soremi,项目名称:tutornavi,代码行数:31,代码来源:translate.php


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