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


PHP _mb_substr函数代码示例

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


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

示例1: test_mb_substr

 function test_mb_substr()
 {
     $this->assertEquals('баб', _mb_substr('баба', 0, 3));
     $this->assertEquals('баб', _mb_substr('баба', 0, -1));
     $this->assertEquals('баб', _mb_substr('баба', 0, -1));
     $this->assertEquals('I am your б', _mb_substr('I am your баба', 0, 11));
 }
开发者ID:rmccue,项目名称:wordpress-unit-tests,代码行数:7,代码来源:compat.php

示例2: mb_substr

 function mb_substr($str, $start, $length = null, $encoding = null)
 {
     return _mb_substr($str, $start, $length, $encoding);
 }
开发者ID:AndreyLanko,项目名称:perevorot-prozorro-wp,代码行数:4,代码来源:compat.php

示例3: _mb_substr

/**
 * @package		CleverStyle CMS
 * @subpackage	System module
 * @category	modules
 * @author		Nazar Mokrynskyi <nazar@mokrynskyi.com>
 * @copyright	Copyright (c) 2011-2014, Nazar Mokrynskyi
 * @license		MIT License, see license.txt
 */
namespace cs\modules\System;

use h, cs\Config, cs\Core, cs\Index, cs\Language;
$Config = Config::instance();
$L = Language::instance();
$Config->reload_languages();
$translate_engines = _mb_substr(get_files_list(ENGINES . '/Text', '/^[^_].*?\\.php$/i', 'f'), 0, -4);
$translate_engines_settings = [];
$current_engine_settings = '';
foreach ($translate_engines as $engine) {
    $parameters = file_get_json(ENGINES . '/Text/' . $engine . '.json');
    if (is_array($parameters) && !empty($parameters)) {
        $table = '';
        foreach ($parameters as $paremeter => $description) {
            $table .= h::{'tr td'}([$description, h::input(['name' => 'core[auto_translation_engine][' . $paremeter . ']', 'value' => isset($Config->core['auto_translation_engine'][$paremeter]) ? $Config->core['auto_translation_engine'][$paremeter] : ''])]);
        }
        $translate_engines_settings[] = base64_encode(h::table($table));
    } else {
        $translate_engines_settings[] = base64_encode($parameters ?: $L->no_settings_found);
    }
    if ($engine == $Config->core['auto_translation_engine']['name']) {
        $current_engine_settings = base64_decode(array_slice($translate_engines_settings, -1)[0]);
开发者ID:hypnomez,项目名称:opir.org,代码行数:30,代码来源:languages.php

示例4: array_map

     break;
 case 'edit':
     if (!isset($rc[3], $Config->components['blocks'][$rc[3]])) {
         break;
     }
     $form = false;
     $a->apply_button = false;
     $a->cancel_button_back = true;
     $a->form_atributes[] = 'formnovalidate';
     $block =& $Config->components['blocks'][$rc[3]];
     $Page->title($L->editing_a_block(get_block_title($rc[3])));
     $a->content(h::{'p.lead.cs-center'}($L->editing_a_block(get_block_title($rc[3]))) . h::{'table.cs-table-borderless.cs-center-all tr'}(\cs\modules\System\form_rows_to_cols([array_map(function ($in) {
         return h::{'th info'}($in);
     }, ['block_title', 'block_active', 'block_template', 'block_start', 'block_expire']), array_map(function ($in) {
         return h::td($in);
     }, [h::input(['name' => 'block[title]', 'value' => get_block_title($rc[3])]), h::{'div input[type=radio]'}(['name' => 'block[active]', 'checked' => $block['active'], 'value' => [1, 0], 'in' => [$L->yes, $L->no]]), h::select(['in' => _mb_substr(get_files_list(TEMPLATES . '/blocks', '/^block\\..*?\\.(php|html)$/i', 'f'), 6)], ['name' => 'block[template]', 'selected' => $block['template'], 'size' => 5]), h::{'input[type=datetime-local]'}(['name' => 'block[start]', 'value' => date('Y-m-d\\TH:i', $block['start'] ?: TIME)]), h::{'input[type=radio]'}(['name' => 'block[expire][state]', 'checked' => $block['expire'] != 0, 'value' => [0, 1], 'in' => [$L->never, $L->as_specified]]) . h::br(2) . h::{'input[type=datetime-local]'}(['name' => 'block[expire][date]', 'value' => date('Y-m-d\\TH:i', $block['expire'] ?: TIME)])])]), $block['type'] == 'html' ? h::{'td[colspan=5] textarea.EDITOR'}(get_block_content($rc[3]), ['name' => 'block[html]']) : ($block['type'] == 'raw_html' ? h::{'td[colspan=5] textarea'}(get_block_content($rc[3]), ['name' => 'block[raw_html]']) : '')) . h::{'input[type=hidden]'}([[['name' => 'block[id]', 'value' => $rc[3]]], [['name' => 'mode', 'value' => $rc[2]]]]));
     break;
 case 'permissions':
     if (!isset($rc[3], $Config->components['blocks'][$rc[3]])) {
         break;
     }
     $form = false;
     $a->apply_button = false;
     $a->cancel_button_back = true;
     $permission = Permission::instance()->get(null, 'Block', $Config->components['blocks'][$rc[3]]['index'])[0]['id'];
     $groups = Group::instance()->get_all();
     $groups_content = [];
     foreach ($groups as $group) {
         $group_permission = $User->db()->qfs(["SELECT `value`\n\t\t\t\t\tFROM `[prefix]groups_permissions`\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t`id`\t\t\t= '%s' AND\n\t\t\t\t\t\t`permission`\t= '%s'", $group['id'], $permission]);
         $groups_content[] = h::th($group['title'], ['data-title' => $group['description']]) . h::{'td input[type=radio]'}(['name' => "groups[{$group['id']}]", 'checked' => $group_permission === false ? -1 : $group_permission, 'value' => [-1, 0, 1], 'in' => [$L->inherited, $L->deny, $L->allow]]);
     }
开发者ID:hypnomez,项目名称:opir.org,代码行数:31,代码来源:blocks.php

示例5: _mb_substr

/**
 * Like system function, but accept arrays of strings
 *
 * @param string|string[]	$string
 * @param int				$start
 * @param int				$length
 *
 * @return string|string[]
 */
function _mb_substr($string, $start, $length = null)
{
    if (is_array($string)) {
        foreach ($string as &$s) {
            $s = _mb_substr($s, $start, $length);
        }
        return $string;
    }
    if ($length) {
        return mb_substr($string, $start, $length);
    } else {
        return mb_substr($string, $start);
    }
}
开发者ID:YaroslavB,项目名称:Useful-PHP-Functions,代码行数:23,代码来源:upf.php

示例6: unset

         }
         unset($i, $db);
     }
     $a->action = "admin/System/{$rc['0']}/{$rc['1']}";
     /**
      * @var array $dbsname
      * @var array $dbs
      * @var array $database
      * @var string $name
      */
     $Page->title($rc[2] == 'edit' ? $L->editing_the_database($name) : $L->addition_of_db);
     $a->content(h::{'p.lead.cs-center'}($rc[2] == 'edit' ? $L->editing_the_database($name) : $L->addition_of_db) . h::{'table.cs-table.cs-center-all tr'}(\cs\modules\System\form_rows_to_cols([array_map(function ($in) {
         return h::{'th info'}($in);
     }, [$rc[2] == 'add' ? 'db_mirror' : false, 'db_host', 'db_type', 'db_prefix', 'db_name', 'db_user', 'db_password', 'db_charset']), array_map(function ($in) {
         return h::td($in);
     }, [$rc[2] == 'add' ? h::select(['in' => $dbsname, 'value' => $dbs], ['name' => 'db[mirror]', 'selected' => isset($rc[3]) ? $rc[3] : -1, 'size' => 5]) : false, h::input(['name' => 'db[host]', 'value' => $rc[2] == 'edit' ? $database['host'] : $Core->db_host]), h::select(['in' => _mb_substr(get_files_list(ENGINES . '/DB', '/^[^_].*?\\.php$/i', 'f'), 0, -4)], ['name' => 'db[type]', 'selected' => $rc[2] == 'edit' ? $database['type'] : $Core->db_type, 'size' => 5]), h::input(['name' => 'db[prefix]', 'value' => $rc[2] == 'edit' ? $database['prefix'] : $Core->db_prefix]), h::input(['name' => 'db[name]', 'value' => $rc[2] == 'edit' ? $database['name'] : '']), h::input(['name' => 'db[user]', 'value' => $rc[2] == 'edit' ? $database['user'] : '']), h::input(['name' => 'db[password]', 'value' => $rc[2] == 'edit' ? $database['password'] : '']), h::input(['name' => 'db[charset]', 'value' => $rc[2] == 'edit' ? $database['charset'] : $Core->db_charset]) . h::{'input[type=hidden]'}(['name' => 'mode', 'value' => $rc[2] == 'edit' ? 'edit' : 'add']) . (isset($rc[3]) ? h::{'input[type=hidden]'}(['name' => 'database', 'value' => $rc[3]]) : '') . (isset($rc[4]) ? h::{'input[type=hidden]'}(['name' => 'mirror', 'value' => $rc[4]]) : '')])])) . h::{'p button'}($L->test_connection, ['onMouseDown' => "cs.db_test('{$a->action}/test');"]));
     break;
 case 'delete':
     $a->buttons = false;
     $content = [];
     if (!isset($rc[4])) {
         foreach ($Config->components['modules'] as $module => &$mdata) {
             if (isset($mdata['db']) && is_array($mdata['db'])) {
                 foreach ($mdata['db'] as $db_name) {
                     if ($db_name == $rc[3]) {
                         $content[] = h::b($module);
                         break;
                     }
                 }
             }
         }
开发者ID:hypnomez,项目名称:opir.org,代码行数:31,代码来源:databases.php

示例7: switch

 switch ($rc[2]) {
     case 'add':
     case 'edit':
         if ($rc[2] == 'edit' && isset($rc[3])) {
             $storage =& $Config->storage[$rc[3]];
         }
         /**
          * @var array $storage
          */
         $a->action = "admin/System/{$rc['0']}/{$rc['1']}";
         $Page->title($rc[2] == 'edit' ? $L->editing_of_storage($Config->storage[$rc[3]]['host'] . '/' . $Config->storage[$rc[3]]['connection']) : $L->adding_of_storage);
         $a->content(h::{'p.lead.cs-center'}($rc[2] == 'edit' ? $L->editing_of_storage($Config->storage[$rc[3]]['host'] . '/' . $Config->storage[$rc[3]]['connection']) : $L->adding_of_storage) . h::{'table.cs-table-borderless.cs-center-all tr'}(\cs\modules\System\form_rows_to_cols([array_map(function ($in) {
             return h::{'th info'}($in);
         }, ['storage_url', 'storage_host', 'storage_connection', 'storage_user', 'storage_pass']), array_map(function ($in) {
             return h::td($in);
         }, [h::input(['name' => 'storage[url]', 'value' => $rc[2] == 'edit' ? $storage['url'] : '']), h::input(['name' => 'storage[host]', 'value' => $rc[2] == 'edit' ? $storage['host'] : '']), h::select(['in' => _mb_substr(get_files_list(ENGINES . '/Storage', '/^[^_].*?\\.php$/i', 'f'), 0, -4)], ['name' => 'storage[connection]', 'selected' => $rc[2] == 'edit' ? $storage['connection'] : '', 'size' => 5]), h::input(['name' => 'storage[user]', 'value' => $rc[2] == 'edit' ? $storage['user'] : '']), h::input(['name' => 'storage[password]', 'value' => $rc[2] == 'edit' ? $storage['password'] : '']) . h::{'input[type=hidden]'}(['name' => 'mode', 'value' => $rc[2] == 'edit' ? 'edit' : 'add']) . (isset($rc[3]) ? h::{'input[type=hidden]'}(['name' => 'storage_id', 'value' => $rc[3]]) : '')])])) . h::button($L->test_connection, ['onMouseDown' => "cs.storage_test('{$a->action}/test');"]));
         break;
     case 'delete':
         $a->buttons = false;
         $modules = [];
         foreach ($Config->components['modules'] as $module => &$mdata) {
             if (isset($mdata['storage']) && is_array($mdata['storage'])) {
                 foreach ($mdata['storage'] as $storage_name) {
                     if ($storage_name == $rc[3]) {
                         $modules[] = h::b($module);
                         break;
                     }
                 }
             }
         }
         unset($module, $mdata, $storage_name);
开发者ID:hypnomez,项目名称:opir.org,代码行数:31,代码来源:storages.php


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