示例#1
0
function locale($label, $lang = null)
{
    mb_internal_encoding("UTF-8");
    if (is_null($lang)) {
        $lang = sfContext::getInstance()->getUser()->getCulture();
    }
    $localeFile = sfConfig::get('sf_root_dir') . "/cache/locales.php";
    if (is_readable($localeFile)) {
        include $localeFile;
        $lbl = explode('.', $label);
        $ind = count($lbl) - 1;
        if ($lbl[$ind] == 'label' && $ind > 0) {
            unset($lbl[$ind]);
            $ind--;
            $add = ':';
            $labelStr = '.label';
        }
        $lbl[$ind] = ucfirst($lbl[$ind]);
        $upLabel = implode('.', $lbl);
        if ($upLabel . $labelStr == $label) {
            if ($lang == 'bg') {
                $str = mb_ucfirst($locales[strtolower($upLabel)][$lang]) . $add;
            } else {
                $str = ucfirst($locales[strtolower($upLabel)][$lang]) . $add;
            }
        } else {
            $str = $locales[strtolower($upLabel)][$lang] . $add;
        }
    }
    if ($str == $add) {
        $str = '*' . $upLabel . '*';
    }
    return $str;
}
示例#2
0
文件: Field.php 项目: burbuja/pluf
 /**
  * Get the form field for this field.
  *
  * We put this method at the field level as it allows us to easily
  * create a new DB field and a new Form field and use them without
  * the need to modify another place where the mapping would be
  * performed.
  *
  * @param array Definition of the field.
  * @param string Form field class.
  */
 function formField($def, $form_field = 'Pluf_Form_Field_Varchar')
 {
     Pluf::loadClass('Pluf_Form_BoundField');
     // To get mb_ucfirst
     $defaults = array('required' => !$def['blank'], 'label' => mb_ucfirst($def['verbose']), 'help_text' => $def['help_text']);
     unset($def['blank'], $def['verbose'], $def['help_text']);
     if (isset($def['default'])) {
         $defaults['initial'] = $def['default'];
         unset($def['default']);
     }
     if (isset($def['choices'])) {
         $defaults['widget'] = 'Pluf_Form_Widget_SelectInput';
         if (isset($def['widget_attrs'])) {
             $def['widget_attrs']['choices'] = $def['choices'];
         } else {
             $def['widget_attrs'] = array('choices' => $def['choices']);
         }
     }
     foreach (array_keys($def) as $key) {
         if (!in_array($key, array('widget', 'label', 'required', 'multiple', 'initial', 'choices', 'widget_attrs'))) {
             unset($def[$key]);
         }
     }
     $params = array_merge($defaults, $def);
     return new $form_field($params);
 }
示例#3
0
 public function testDSuccess()
 {
     $data = array(array('in' => '1 1', 'out' => '1 1'));
     foreach ($data as $num => $item) {
         $this->assertEquals($item['out'], mb_ucfirst($item['in']), 'Test #' . ($num + 1));
     }
 }
示例#4
0
 protected function modify_element($element)
 {
     if ($this->mb) {
         return mb_ucfirst($element);
     } else {
         return ucfirst($element);
     }
 }
示例#5
0
 protected function modify_paramvalue($from_value)
 {
     if ($this->mb) {
         return mb_ucfirst($from_value);
     } else {
         return ucfirst($from_value);
     }
 }
 function test_mb_ucfirst()
 {
     $this->assertEquals('Åäö', mb_ucfirst('åäö'));
     $this->assertEquals('Åäö öäå', mb_ucfirst('åäö öäå'));
     $this->assertEquals(ucfirst('H.G. Wells'), mb_ucfirst('H.G. Wells'));
     $this->assertEquals(ucfirst('h.g. wells'), mb_ucfirst('h.g. wells'));
     $this->assertEquals(ucfirst('H.G. WELLS'), mb_ucfirst('H.G. WELLS'));
 }
示例#7
0
 /**
  * Function form
  * @param $name
  * @param bool $path
  * @return object
  */
 public static function form($name, $path = false)
 {
     $name = mb_ucfirst(mb_strtolower($name));
     $className = $name . 'Form';
     if ($path === false) {
         $path = 'modules/' . CONTROLLER . '/system/form/' . $name . '.php';
     }
     incFile($path);
     return new $className();
 }
示例#8
0
文件: TXTGen.php 项目: pta/oes
 function randSentence($mark = null)
 {
     $count = mt_rand(1, 3);
     $sentence = mb_ucfirst($this->randPhrase());
     for ($i = 1; $i < $count; ++$i) {
         $sentence .= ', ' . $this->randPhrase();
     }
     $sentence .= $mark ? $mark : $this->randMark();
     return $sentence;
 }
示例#9
0
文件: Email.php 项目: niieani/nandu
	protected function assignViewVariables() {
		$this->_nickname = mb_ucfirst($this->_user->blip);
		switch ($this->_template) {
			case 'activation':
				$activationUrl = $this->_view->serverUrl($this->_view->url(array('token' => $this->_user->token), 'account-activate'));
				$this->_view->activationUrl = $activationUrl;
				$this->_view->nickname = $this->_nickname;
				break;
		}

	}
示例#10
0
function noteParserAddModel($note, $serial, $descript, $model, $time, $section)
{
    $a = range('a', 'z');
    $notes = explode('+', $note);
    $descripts = explode(',', $descript);
    foreach ($notes as $key => $value) {
        $serial = $serial . '.' . $a[$key];
        $descript = mb_ucfirst(trim($descripts[$key]));
        $model1 = mb_ucfirst(trim($model));
        $section = mb_ucfirst($section);
        $time1 = sumNotes($value);
        $tm->addTechmap($serial, $descript, $model1, $time1, $section);
        $i++;
    }
}
示例#11
0
 public function __construct($form, $field, $name)
 {
     $this->form = $form;
     $this->field = $field;
     $this->name = $name;
     $this->html_name = $this->form->addPrefix($name);
     if ($this->field->label == '') {
         $this->label = mb_ereg_replace('/\\_/', '/ /', mb_ucfirst($name));
     } else {
         $this->label = $this->field->label;
     }
     $this->help_text = $this->field->help_text ? $this->field->help_text : '';
     if (isset($this->form->errors[$name])) {
         $this->errors = $this->form->errors[$name];
     }
 }
示例#12
0
function smarty_function_lang($params, $smarty)
{
    if (!isset($params['code'])) {
        throw new rad_exception("lang: missing 'code' parameter", E_USER_WARNING);
    }
    $params['code'] = trim($params['code'], " \t\"'");
    if (isset($params['lang'])) {
        $val = call_user_func_array(array(rad_config::getParam('loader_class'), 'lang'), array($params['code'], $params['lang']));
    } else {
        $val = call_user_func_array(array(rad_config::getParam('loader_class'), 'lang'), array($params['code']));
    }
    if (isset($params['find']) && isset($params['replace'])) {
        if (!is_array($params['find'])) {
            $params['find'] = array($params['find']);
        }
        if (!is_array($params['replace'])) {
            $params['replace'] = array($params['replace']);
        }
        if (count($params['find']) != count($params['replace'])) {
            throw new rad_exception('lang: find/replace params should either be both scalar or be arrays of the same size');
        }
        $find = reset($params['find']);
        $replace = reset($params['replace']);
        while ($find) {
            $val = mb_str_replace($val, $find, $replace);
            $find = next($params['find']);
            $replace = next($params['replace']);
        }
    }
    if (!empty($params['htmlchars'])) {
        $val = mb_str_replace($val, '"', '&quot;');
    }
    if (!empty($params['ucf'])) {
        $val = mb_ucfirst($val);
    }
    if (isset($params['assign'])) {
        $smarty->assign($params['assign'], $val);
    } else {
        return $val;
    }
}
示例#13
0
文件: functions.php 项目: Honvid/HCMS
/**
 * mvc路由解析器,负责从参数中提取url路由信息
 */
function getMvcRoute()
{
    //控制器
    $c = getUrlString("_c");
    //执行方法
    $a = getUrlString("_a");
    //url rewrite 读取路由,如 teacher_center/profile解析为$c=teacher_center,$a=profile
    $s = getUrlString("_url");
    if (!empty($s)) {
        $s = trim(str_replace("/", " ", $s));
        $urls = explode(" ", $s);
        if (isset($urls[0])) {
            $c = $urls[0];
        }
        if (isset($urls[1])) {
            $a = $urls[1];
        }
    }
    //默认访问方法为 index
    if (empty($a)) {
        $a = "index";
    }
    //默认控制器为 index
    if (empty($c)) {
        $c = "index";
    }
    //路由
    $route = array("_a" => $a, "_c" => $c);
    //转换 _c = 'ab_cd' 为 _c='AbCd'
    $cs = explode("_", $c);
    for ($index = 0; $index < count($cs); $index++) {
        $cs[$index] = mb_ucfirst($cs[$index]);
    }
    $c = implode("", $cs);
    $route["a"] = $a;
    $route["c"] = $c;
    return $route;
}
 private function mb_ucfirst($str, $encoding = "UTF-8", $lower_str_end = false)
 {
     if (!function_exists('mb_ucfirst')) {
         $first_letter = mb_strtoupper(mb_substr($str, 0, 1, $encoding), $encoding);
         $str_end = "";
         if ($lower_str_end) {
             $str_end = mb_strtolower(mb_substr($str, 1, mb_strlen($str, $encoding), $encoding), $encoding);
         } else {
             $str_end = mb_substr($str, 1, mb_strlen($str, $encoding), $encoding);
         }
         $str = $first_letter . $str_end;
         return $str;
     } else {
         return mb_ucfirst($str);
     }
 }
示例#15
0
 /**
  * Get event name.
  *
  * @param $action
  * @param string $position
  * @return string
  */
 protected function _getEventName($action, $position = 'bulkAfter')
 {
     $eventName = ['Controller.'];
     if ($requestPrefix = $this->request->param('prefix')) {
         $eventName[] = mb_ucfirst($requestPrefix) . '.';
     }
     $eventName[] = $this->_controller->name . '.';
     $eventName[] = $position;
     $eventName[] = mb_ucfirst($action);
     return implode('', $eventName);
 }
示例#16
0
     }
     // Lang trick
     $a = __('1day') . __('1week') . __('1month');
     if (!isset($datam['misc'])) {
         break;
     }
     if (is_null($datam['misc']['sum_rain'])) {
         break;
     }
     echo '<tr><th valign="top">' . __('Rain Sum') . ' (' . __($scales['module']) . ')' . '</th><td valign="top" class="mm">';
     echo sprintf(__('%smm'), floor((double) $datam['misc']['sum_rain'] * 10) / 10);
     echo '</td></tr>';
     $this_device_disp--;
     if ($mm_display_when) {
         echo '<tr><td class="mmd" colspan="2">';
         echo sprintf(__('on %1$s %2$s at %5$s:%6$s'), mb_ucfirst(strftime('%A', $datam['misc']['date_sum_rain'])), strftime('%e', $datam['misc']['date_sum_rain']), mb_ucfirst(strftime('%B', $datam['misc']['date_sum_rain'])), strftime('%Y', $datam['misc']['date_sum_rain']), strftime('%H', $datam['misc']['date_sum_rain']), strftime('%M', $datam['misc']['date_sum_rain']));
         echo '</td></tr>';
         $this_device_disp--;
     }
     break;
 case 'sum_rain_24':
     if ($type !== 'rain') {
         break;
     }
     if (!isset($datam['dashboard']['sum_rain_24'])) {
         break;
     }
     if (is_null($datam['dashboard']['sum_rain_24'])) {
         break;
     }
     echo '<tr><th valign="top">' . __('Rain Sum (24h)') . '</th><td valign="top" class="mm">';
/**
 * This function design for return a string of the post format with the appropriate text
 */
function display_post_format()
{
    if (has_post_format()) {
        return 'Post Format: ' . mb_ucfirst(get_post_format());
    }
}
示例#18
0
 public function getImport()
 {
     $xsdstring = $_SERVER['DOCUMENT_ROOT'] . "/import.xml";
     $excel = new XML2003Parser($xsdstring);
     $table = $excel->getTableData();
     function mb_ucfirst($str, $enc = 'utf-8')
     {
         return mb_strtoupper(mb_substr($str, 0, 1, $enc), $enc) . mb_substr($str, 1, mb_strlen($str, $enc), $enc);
     }
     foreach ($table["table_contents"] as $row) {
         if (isset($row["row_contents"][2]) && isset($row["row_contents"][0])) {
             $id = $row["row_contents"][0]['value'];
             $value = trim(mb_ucfirst(mb_strtolower($row["row_contents"][2]['value'])));
             $postlang = PostLang::find($id);
             if ($postlang) {
                 $postlang->title = $value;
                 $postlang->uri = PostLang::uniqURI($id, $value);
                 $postlang->save();
             } else {
                 echo "undefined {$id} <br>";
             }
             //echo  "$id  $value<br><br><br>";
         }
     }
     return [];
 }
示例#19
0
 /**
  * Convenience method to add a single validation rule
  *
  * @param  string                    $rule
  * @param  array                     $fields
  * @return $this
  * @throws \InvalidArgumentException
  */
 public function rule($rule, $fields)
 {
     if (!isset(static::$_rules[$rule])) {
         $ruleMethod = 'validate' . ucfirst($rule);
         if (!method_exists($this, $ruleMethod)) {
             throw new \InvalidArgumentException("Rule '" . $rule . "' has not been registered with " . __CLASS__ . "::addRule().");
         }
     }
     // Ensure rule has an accompanying message
     $message = isset(static::$_ruleMessages[$rule]) ? static::$_ruleMessages[$rule] : self::ERROR_DEFAULT;
     // Get any other arguments passed to function
     $params = array_slice(func_get_args(), 2);
     $this->_validations[] = array('rule' => $rule, 'fields' => (array) $fields, 'params' => (array) $params, 'message' => mb_ucfirst($message, 'UTF-8'));
     return $this;
 }
示例#20
0
 public function work($money, $kopnum = false)
 {
     $kop = substr($money, -2);
     $rub = substr($money, 0, -3);
     if (!$rub) {
         $this->out[] = 'ноль';
     } else {
         $this->out[] = $this->num2str->work($rub, $this->names[1]['sem']);
     }
     $this->out[] = $this->num2str->semantic($rub, $this->names[1]);
     if (!$kopnum) {
         if (!$kop) {
             $this->out[] = 'ноль';
         } else {
             $this->out[] = $this->num2str->work($kop, $this->names[2]['sem']);
         }
     } else {
         $this->out[] = $kop;
     }
     $this->out[] = $this->num2str->semantic($kop, $this->names[2]);
     $temp = trim(implode(' ', $this->out), '	');
     $temp = trim($temp);
     $this->out = array();
     return mb_ucfirst($temp, 'UTF-8');
 }
		<div class="col-md-8">
<section class="dnpb_block">
<h3>
<?php 
function mb_ucfirst($string, $encoding)
{
    $strlen = mb_strlen($string, $encoding);
    $firstChar = mb_substr($string, 0, 1, $encoding);
    $then = mb_substr($string, 1, $strlen - 1, $encoding);
    return mb_strtoupper($firstChar, $encoding) . $then;
}
if (is_tax()) {
    global $wp_query;
    $term = $wp_query->get_queried_object();
    $title = $term->name;
    echo mb_ucfirst($title, "UTF-8");
} else {
    post_type_archive_title('', true);
}
?>
</h3>
<br/>
<?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        get_template_part('blocks/content/list', 'index');
    }
} else {
    ?>
	<p><?php 
示例#22
0
<?php

defined('SYSPATH') or die('No direct script access.');
?>
<div class="page-header" id="crud-<?php 
echo __($name);
?>
">
    <h1><?php 
echo __('New');
?>
 <?php 
echo mb_ucfirst(__($name));
?>
</h1>
</div>
<div class="row">
    <div class="col-md-6">
        <div class="panel panel-default">
            <div class="panel-body">
                <?php 
echo $form->render();
?>
            </div>
        </div>
    </div>
</div>
示例#23
0
require_once "classes/TestsDB2.php";
$filename = $_REQUEST['file'];
//file_put_contents('./test2.json', $_REQUEST);
//получить данные теста
$testsDB = new TestsDB();
$testsDB::$file = '../math_test/tests/' . $filename;
$testData = $testsDB->getTestsData();
$testData = json_decode($testData, true);
$testData['tasks'] = array_values($testData['tasks']);
//helper: первая заглавная буква для utf-8 строки
function mb_ucfirst($text)
{
    return mb_strtoupper(mb_substr($text, 0, 1)) . mb_substr($text, 1);
}
//set view_number & max_points
foreach ($testData['tasks'] as $key => $task) {
    $testData['tasks'][$key]['view_number'] = $key + 1;
    $testData['tasks'][$key]['type'] = mb_ucfirst($task['type']);
    $taskPoints = 0;
    foreach ($task['answer_points'] as $answerPoints) {
        $taskPoints += $answerPoints;
    }
    $testData['tasks'][$key]['max_points'] = $taskPoints;
    //timer data timestamp to array
    if (isset($task['taskTimerData'])) {
        $testData['tasks'][$key]['taskTimerData'] = $testsDB->timestampToArray($task['taskTimerData']);
    }
}
//подключить шаблон центральный шаблон админки
require_once 'views/adminMain.php';
示例#24
0
   }
}
alert('Выберите способ оплаты');
return false;
}
</script>
<link rel="stylesheet" type="text/css" href="components/com_pay/css/pay.css">

<?php 
if (isset($_POST['bill'])) {
    ?>

<div class="text"> 
<h2>Оплата</h2>
<p>Стоимость размещения украшения <?php 
    echo mb_ucfirst($this->item->title);
    ?>
 на позиции  <?php 
    echo $this->profile->name;
    ?>
 : <?php 
    echo $this->profile->price;
    ?>
 р.</p>
<p>Обратите внимание, что зачисленные средства не возвращаются. В случае спорных вопросов обращайтесь на info@zazki-pezki.ru </p>

<p>Для оплаты сформирован счет №<?php 
    echo $this->bill->id;
    ?>
. Отслеживать статус счета вы можете в разделе <?php 
    $url = JURI::root() . 'index.php?option=com_bill&view=bill';
示例#25
0
    ?>
	<div class="row">
		<div class="thumbnail col-xs-6 col-xs-offset-3" message-id="<?php 
    echo $message["ID"];
    ?>
">
			<div class="message-title"><?php 
    echo $message["name"];
    ?>
:  <?php 
    echo $message["subject"];
    ?>
</h1></div>
			<hr>
			<div class="message-text"><?php 
    echo mb_ucfirst($message["text"]);
    ?>
</div>
			<hr>
			<div class="message-time"><?php 
    echo $message["time"];
    ?>
 <a href="mailto:<?php 
    echo $message["email"];
    ?>
">(<?php 
    echo $message["email"];
    ?>
)</a></div>
		</div>
	</div>
示例#26
0
<?php

$data = Modules::run('menus/menus_result/get_trees_place_data', 'top');
dd($data);
if (is_array($data)) {
    echo '<table cellspacing="0" cellpadding="0" border="0">';
    echo '<tbody><tr>';
    foreach ($data as $items) {
        foreach ($items as $item) {
            foreach ($item as $page) {
                if (isset($page['data']) && $page['data']['active'] == 1 && isset($contents)) {
                    echo '<td class="hmenu_td">';
                    if ($contents['id_page'] !== $page['name']) {
                        echo '<a href="/' . trim($page['data']['uri'], '/') . '/">';
                    }
                    //print_r($page);
                    echo mb_ucfirst(mb_strtolower($page['data']['content'][0]->name));
                    if ($contents['id_page'] !== $page['id']) {
                        echo '</a>';
                    }
                    echo '</td>';
                }
            }
        }
    }
    echo '</tr></tbody>';
    echo '</table>';
}
示例#27
0
function u_ucfirst($string)
{
    return mb_ucfirst($string, 'utf-8');
}
示例#28
0
文件: view.php 项目: nellka/mebel
Yii::app()->clientScript->registerPackage('lightbox');
Yii::app()->params['body_class'] = 'inner-page';
if (!function_exists('mb_ucfirst') && function_exists('mb_substr')) {
    function mb_ucfirst($string, $enc = 'utf-8')
    {
        $string = mb_strtoupper(mb_substr($string, 0, 1, $enc), $enc) . mb_substr($string, 1, 100, $enc);
        return $string;
    }
}
$desc1 = explode("\n", $model->description);
$desc1 = array_intersect($desc1, array('ищу спонсора', 'стану спонсором'));
$desc1 = implode(' ', $desc1);
setlocale(LC_ALL, "ru_RU.UTF-8");
if ($desc1) {
    $desc1 = mb_ucfirst($desc1, 'utf-8') . '.';
}
$this->pageTitle = "{$desc1} ";
$this->pageTitle .= $model->name;
$this->pageTitle .= ', ' . $model->age . ' ' . Yii::t('app', 'год|года|лет|года', $model->age);
$this->pageTitle .= ', ' . $model->city;
if ($model->about) {
    $about = trim($model->about);
    $pos = min(mb_strpos($about, "\n", 'utf-8'), mb_strpos($about, ".", 'utf-8'));
    if ($pos <= 0) {
        $pos = 250;
    }
    $about = mb_substr($about, 0, $pos, 'utf-8');
    if ($about) {
        $this->pageTitle .= '. ' . $about;
    }
示例#29
0
function getquestion()
{
    global $questionlist;
    $one = explode('*', $questionlist[array_rand($questionlist)]);
    $one[0] = mb_ucfirst($one[0]);
    $one[1] = trim($one[1]);
    return $one;
}
示例#30
0
文件: exam_modules.php 项目: pta/oes
        }
        if ($i++ & 1) {
            $style .= ' alt';
        }
        echo "<tr class='{$style}' onClick='loader.load (\"exam_modules.php?action=detail&exam={$ex}\")'>";
        for ($f = 0; $f < $nof; ++$f) {
            echo '<td>' . $row[$f];
        }
        echo '<td>';
        if ($row['EndTime']) {
            echo '<span class=finished>Đã kết thúc</span>';
        } else {
            if ($row['StartTime']) {
                echo '<span class=running>Đang thi</span>';
            } else {
                echo mb_ucfirst(relative_time(strtotime($row['Schedule'])));
            }
        }
    }
    echo '</table>';
    echo '</div>';
    mysql_free_result($result);
}
if (isset($update['detail'])) {
    echo '<div id=detail>';
    $result = $db->query("select\n\t\t\t\t\tLastName,\n\t\t\t\t\tFirstName,\n\t\t\t\t\tDuration,\n\t\t\t\t\tSchedule,\n\t\t\t\t\tStartTime,\n\t\t\t\t\tEndTime,\n\t\t\t\t\tNoQ\n\t\t\t\tfrom (select * from oes_Exam where ID = {$exam}) as E\n\t\t\t\t\tjoin oes_Teacher on E.Teacher = oes_Teacher.ID");
    $row = mysql_fetch_array($result);
    echo '<table class=web20>';
    $c = 0;
    echo '<tr' . ($c++ & 1 ? ' class=odd' : null) . '><td>Giáo viên<td>' . $row['LastName'] . ' ' . $row['FirstName'];
    echo '<tr' . ($c++ & 1 ? ' class=odd' : null) . '><td>Thời gian<td>' . $row['Duration'] . ' phút';