本文整理汇总了PHP中mb_convert_kana函数的典型用法代码示例。如果您正苦于以下问题:PHP mb_convert_kana函数的具体用法?PHP mb_convert_kana怎么用?PHP mb_convert_kana使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mb_convert_kana函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: normalize
/**
* 事前処理関数をオーバーライド
*
* ハイフンと類似する文字をハイフンに変換
* 文字列をすべて半角に変換
* 空白は連続を除去する
*/
protected static function normalize($str = '')
{
$str = mb_convert_kana($str, 'anhks');
$str = self::unificate_hyphen($str, '-');
$str = parent::normalize($str);
return $str;
}
示例2: mailaddress_check
function mailaddress_check($form, $error = null)
{
if (isset($_POST['mailaddress1'])) {
$_POST['mailaddress1'] = mb_convert_kana($_POST['mailaddress1'], "a");
$emailcheck = $this->mail_check1($_POST['mailaddress1']);
if (empty($emailcheck)) {
$error['mailaddress1'] = "wrong";
//Form Data is wrong = ErrorMessage
}
}
if (isset($_POST['mailaddress2'])) {
$_POST['mailaddress2'] = mb_convert_kana($_POST['mailaddress2'], "a");
$emailcheck = $this->mail_check1($_POST['mailaddress2']);
if (empty($emailcheck)) {
$error['mailaddress2'] = "wrong";
//Form Data is "wrong" = ErrorMessage
}
}
if (isset($_POST['mailaddress1'], $_POST['mailaddress2'])) {
$emailcheck = $this->check2($_POST['mailaddress1'], $_POST['mailaddress2']);
if (empty($emailcheck)) {
$error['mailaddress2'] = "different";
//Form Data is "different" = ErrorMessage
}
}
return $error;
}
示例3: datetime_implode
function datetime_implode($year, $mon, $day, $hour, $min)
{
if (($year === "" || is_null($year)) && ($mon === "" || is_null($mon)) && ($day === "" || is_null($day)) && ($hour === "" || is_null($hour)) && ($min === "" || is_null($min))) {
return null;
}
return mb_convert_kana("{$year}-{$mon}-{$day} {$hour}:{$min}:0", "n", 'UTF-8');
}
示例4: get_nextBody
function get_nextBody($aTyp, $aCt)
{
$clsConst = new AppConst();
$ret = "";
$iCt = 0;
$buffTyp = "";
$buffCt = "";
if ($aTyp < $clsConst->mTYP_Date) {
$iCt = $aTyp + 1;
$buffTyp = getZeroStr($iCt, 2);
$buffCt = getZeroStr("00", 2);
switch ($aTyp) {
case 1:
$ret = $buffTyp . $buffCt . $clsConst->mMSG_Const;
break;
case 2:
$sHH = date("H");
$sMM = date("i");
$sHH = mb_convert_kana($sHH, 'KVRN', "UTF-8");
$sMM = mb_convert_kana($sMM, 'KVRN', "UTF-8");
$ret = $buffTyp . $buffCt . "じかん " . $sHH . ":" . $sMM;
break;
}
} else {
$sMM = date("m");
$sDD = date("d");
$sMM = mb_convert_kana($sMM, 'KVRN', "UTF-8");
$sDD = mb_convert_kana($sDD, 'KVRN', "UTF-8");
$buffTyp = getZeroStr($clsConst->mTYP_Kotei, 2);
$buffCt = getZeroStr("00", 2);
$ret = $buffTyp . $buffCt . "ひづけ " . $sMM . "ー" . $sDD;
}
return $ret;
}
示例5: convInt
public function convInt($arg)
{
// 全角数字や他文字を半角数字に変換
// mb_convert_kana($arg, 'a', 'UTF-8') 全角数字を半角数字に
// mb_ereg_replace('[^0-9]', '', foo) 半角数字以外を削除
return mb_ereg_replace('[^0-9]', '', mb_convert_kana($arg, 'a', 'UTF-8'));
}
示例6: createAvatarAutomatically
/**
* アバター自動生成処理
*
* @param Model $model ビヘイビア呼び出し元モデル
* @param array $user ユーザデータ配列
* @return mixed On success Model::$data, false on failure
* @throws InternalErrorException
*/
public function createAvatarAutomatically(Model $model, $user)
{
//imagickdraw オブジェクトを作成します
$draw = new ImagickDraw();
//文字色のセット
$draw->setfillcolor('white');
//フォントサイズを 160 に設定します
$draw->setFontSize(140);
//テキストを追加します
$draw->setFont(CakePlugin::path($model->plugin) . 'webroot' . DS . 'fonts' . DS . 'ipaexg.ttf');
$draw->annotation(19, 143, mb_substr(mb_convert_kana($user['User']['handlename'], 'KVA'), 0, 1));
//新しいキャンバスオブジェクトを作成する
$canvas = new Imagick();
//ランダムで背景色を指定する
$red1 = strtolower(dechex(mt_rand(3, 12)));
$red2 = strtolower(dechex(mt_rand(0, 15)));
$green1 = strtolower(dechex(mt_rand(3, 12)));
$green2 = strtolower(dechex(mt_rand(0, 15)));
$blue1 = strtolower(dechex(mt_rand(3, 12)));
$blue2 = strtolower(dechex(mt_rand(0, 15)));
$canvas->newImage(179, 179, '#' . $red1 . $red2 . $green1 . $green2 . $blue1 . $blue2);
//ImagickDraw をキャンバス上に描画します
$canvas->drawImage($draw);
//フォーマットを PNG に設定します
$canvas->setImageFormat('png');
App::uses('TemporaryFolder', 'Files.Utility');
$folder = new TemporaryFolder();
$filePath = $folder->path . DS . Security::hash($user['User']['handlename'], 'md5') . '.png';
$canvas->writeImages($filePath, true);
return $filePath;
}
示例7: beforeSave
public function beforeSave($options = array())
{
if (isset($this->data['Mypage']['password'])) {
$passwordHasher = new SimplePasswordHasher();
$this->data['Mypage']['password'] = $passwordHasher->hash($this->data['Mypage']['password']);
}
//nameを使わず、name_1_2に分ける場合、合体させる
if (isset($this->data['Mypage']['name_1'])) {
if (isset($this->data['Mypage']['name_2'])) {
$this->data['Mypage']['name'] = $this->data['Mypage']['name_1'] . ' ' . $this->data['Mypage']['name_2'];
} else {
$this->data['Mypage']['name'] = $this->data['Mypage']['name_1'];
}
}
//telを使わず、tel_1_2_3に分ける場合、合体させる
if (isset($this->data['Mypage']['tel_1'])) {
$tel = $this->data['Mypage']['tel_1'] . $this->data['Mypage']['tel_2'] . $this->data['Mypage']['tel_3'];
$tel = mb_convert_kana($tel, "n");
$tel = mb_ereg_replace('[^0-9]', '', $tel);
if (!empty($tel)) {
$this->data['Mypage']['tel'] = $tel;
}
}
return true;
}
示例8: tokenValidate
/**
* tokenチェック
*/
protected function tokenValidate($name = 'token')
{
$request = Request::getInstance();
$value = $request->get($name, '');
$value = mb_convert_kana($value, 'n');
return Session::remove($name) == $value ? null : __('Token authentication is invalid');
}
示例9: admin_index
/**
* [ADMIN] サジェスト設定
*
* @return void
* @access public
*/
public function admin_index()
{
$this->pageTitle = 'サジェスト設定';
if (!$this->request->data) {
$this->request->data['SuggestConfig'] = $this->SuggestConfig->findExpanded();
} else {
$this->request->data['SuggestConfig']['exclude_keywords'] = mb_convert_kana(strtolower($this->request->data['SuggestConfig']['exclude_keywords']), 'a', Configure::read('App.encoding'));
$this->SuggestConfig->set($this->request->data);
if ($this->SuggestConfig->validates()) {
$this->SuggestConfig->saveKeyValue($this->request->data);
// 除外キーワードを削除
if ($this->request->data['SuggestConfig']['exclude_keywords']) {
$excludeKeywords = array();
$excludeKeywords = explode(',', $this->request->data['SuggestConfig']['exclude_keywords']);
$conditions = array();
foreach ($excludeKeywords as $key => $value) {
$conditions['or'][$key] = array('SuggestKeyword.name LIKE' => "%{$value}%");
}
$suggestKeywords = $this->SuggestKeyword->find('all', array('fields' => array('SuggestKeyword.id'), 'conditions' => $conditions));
foreach ($suggestKeywords as $suggestKeyword) {
$this->SuggestKeyword->del($suggestKeyword['SuggestKeyword']['id']);
}
}
$this->setMessage('サジェスト設定を保存しました。');
$this->redirect('index');
} else {
$this->setMessage('入力エラーです。内容を修正してください。', true);
}
}
}
示例10: afterLayout
/**
* afterLayout
*
* @return void
*/
public function afterLayout($layoutFile)
{
/* 出力データをSJISに変換 */
$View = $this->_View;
if (isset($this->request->params['ext']) && $this->request->params['ext'] == 'rss') {
$rss = true;
} else {
$rss = false;
}
$site = BcSite::findCurrent(true);
if (!$rss && $site && $site->device == 'mobile' && $View->layoutPath != 'Emails' . DS . 'text') {
$View->output = str_replace('&', '&', $View->output);
$View->output = str_replace('<', '<', $View->output);
$View->output = str_replace('>', '>', $View->output);
$View->response->charset('Shift_JIS');
$View->output = mb_convert_kana($View->output, "rak", "UTF-8");
$View->output = mb_convert_encoding($View->output, "SJIS-win", "UTF-8");
// 内部リンクの自動変換
if ($site->autoLink) {
$currentAlias = $this->request->params['Site']['alias'];
// 一旦プレフィックスを除外
$reg = '/href="' . preg_quote(BC_BASE_URL, '/') . '(' . $currentAlias . '\\/([^\\"]*?))\\"/';
$View->output = preg_replace_callback($reg, array($this, '_removeMobilePrefix'), $View->output);
// プレフィックス追加
$reg = '/href=\\"' . preg_quote(BC_BASE_URL, '/') . '([^\\"]*?)\\"/';
$View->output = preg_replace_callback($reg, array($this, '_addMobilePrefix'), $View->output);
}
// XMLとして出力する場合、デバッグモードで出力する付加情報で、
// ブラウザによってはXMLパースエラーとなってしまうので強制的にデバッグモードをオフ
Configure::write('debug', 0);
}
}
示例11: makefuzzyexplist
/**
* あいまい検索用正規表現の集合体を取得する。
*
* @param string もとになるキーワード
* @return array(string) あいまい検索用正規表現を集めた配列
*/
static function makefuzzyexplist($key)
{
//仮名は全角カタカナに、英数字・空白文字は半角に、 濁点付きの文字を一文字に、記号は全角に。
$_key = mb_strtolower(mb_convert_kana($key, 'KVCas'));
foreach (self::$han2zen_mark_table as $han => $zen) {
$_key = mb_ereg_replace(mb_ereg_quote($han), $zen, $_key);
}
//2文字以上での表現を1文字にする
foreach (self::$two2one as $from => $to) {
$_key = mb_ereg_replace($from, $to, $_key);
}
//文字により削除(表記ゆれまたはごみ)
$_key = mb_ereg_replace('[ッー・゛゜、。]', '', $_key);
//異体文字に対応する。
$char = array();
$len = mb_strlen($_key);
for ($i = 0; $i < $len; $i++) {
$c = mb_substr($_key, $i, 1);
$char[] = isset($GLOBALS['itaimojitable'][$c]) ? $GLOBALS['itaimojitable'][$c] : mb_ereg_quote($c);
}
//ちょっと違う単語を許すようにする
$list = self::makeagrepexplist($char);
//表記ゆれになる文字を挟み込む
$ret = array();
foreach ($list as $a) {
$ret[] = join('[・ーー]?', $a);
}
return $ret;
}
示例12: get
public function get($zip = null, $ken_furi = null, $city_furi = null, $town_furi = null)
{
$addr = new Models\Address();
/** @var \Illuminate\Database\Query\Builder $q */
$q = $addr->newQuery();
$decoded_zip = Models\Address::processZip($zip);
$q->orWhere('zip', '=', $decoded_zip);
foreach (['ken_furi', 'city_furi', 'town_furi'] as $col) {
Models\Address::filterQueryFuri(${$col}, $q, $col);
}
/** @var \Illuminate\Database\Eloquent\Collection|static[] $results */
$columns = ['ken_id', 'zip', 'ken_name', 'ken_furi', 'city_name', 'city_furi', 'town_name', 'town_furi', 'kyoto_street', 'block_name', 'office_name', 'office_address'];
$results = $q->take(10)->get($columns);
// NULLのフィールドを省略
$resultsArray = array_map(function ($result) use($columns) {
foreach ($columns as $col) {
if (array_key_exists($col, $result) && ($result[$col] === 'NULL' || trim(mb_convert_kana($result[$col], 's')) === '')) {
unset($result[$col]);
}
}
return $result;
}, $results->toArray());
$date = date('Y/m/d H:i:s');
return $results->count() > 0 ? response()->json(['error' => 'success', 'date' => $date, 'count' => $results->count(), 'results' => $resultsArray]) : response()->json(['error' => 'error', 'date' => $date, 'count' => 0]);
}
示例13: afterLayout
function afterLayout()
{
$view =& ClassRegistry::getObject('view');
mb_internal_encoding('UTF-8');
$view->output = mb_convert_kana($view->output, 'k');
$view->output = mb_convert_encoding($view->output, 'SJIS', 'UTF-8');
}
示例14: normalize
/**
* 事前処理関数をオーバーライド
*
* 空白以外の文字列を全角に変換
* 空白は連続を除去して半角に変換
*/
protected static function normalize($str = '')
{
$str = mb_convert_kana($str, 'AKV');
$str = mb_convert_kana($str, 's');
$str = parent::normalize($str);
return $str;
}
示例15: mb_convert_kana_deep
function mb_convert_kana_deep($str, $option = 'sa', $encoding = 'utf-8')
{
if (is_array($str)) {
return array_map(__FUNCTION__, $str, array($option, $encoding));
}
return mb_convert_kana($str, $option, $encoding);
}