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


PHP translit函数代码示例

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


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

示例1: actionCreate

 public function actionCreate()
 {
     $model = new FormDesigner();
     $model->scenario = 'advanced';
     $model->type = FormDesigner::TYPE_TEXT;
     $translate = new TranslateMessage();
     if (isset($_POST['FormDesigner'])) {
         $model->attributes = $_POST['FormDesigner'];
         if ($model->validate()) {
             // magic begin
             $this->fieldName = translit($model->getStrByLang('label'), '_', true);
             $this->fieldName = substr($this->fieldName, 0, 12);
             if ($this->setFieldInTable($_POST['FormDesigner']['type'])) {
                 $model->field = $this->fieldName;
                 $translate->attributes = $_POST['TranslateMessage'];
                 $translate->category = 'common';
                 $translate->message = 'Search by ' . $this->fieldName;
                 if ($translate->save()) {
                     $model->save();
                     Yii::app()->cache->flush();
                     Yii::app()->user->setFlash('success', tt('The new field is successfully created.'));
                     $this->redirect(Yii::app()->createUrl('/formdesigner/backend/main/admin'));
                 }
             } else {
                 $model->addError('', tt('Failed to create field'));
             }
         }
     }
     $this->render('create', array('model' => $model, 'translate' => $translate));
 }
开发者ID:barricade86,项目名称:raui,代码行数:30,代码来源:MainController.php

示例2: notify

function notify(&$evt, $date, $daysDue)
{
    global $emlStyle, $set, $xx, $ax;
    $todayD = date("Y-m-d", time() + 43200);
    //today 12:00
    //compose email message
    $dateTime = IDtoDD($date) . ' ' . $xx['at_time'] . ' ' . (($evt['sti'] or $evt['eti']) ? ITtoDT($evt['sti']) : $ax['cro_all_day']);
    if ($evt['eti']) {
        $dateTime .= " - " . ITtoDT($evt['eti']);
    }
    $status = '';
    if ($evt['cbx']) {
        $status .= $evt['clb'] . ': ' . (strpos($evt['chd'], $date) ? $evt['cmk'] : '- -');
    }
    $subject = translit($set['calendarTitle'] . " - " . ($daysDue ? "{$ax['cro_due_in']} {$daysDue} {$ax['cro_days']}" : $ax['cro_due_today']) . ": " . $evt['tit']);
    if ($set['eventColor']) {
        $eStyle = ($evt['cco'] ? "color:{$evt['cco']};" : '') . ($evt['cbg'] ? "background-color:{$evt['cbg']};" : '');
    } else {
        $eStyle = $evt['uco'] ? "background-color:{$evt['uco']};" : '';
    }
    $eStyle = $eStyle ? " style=\"{$eStyle}\"" : '';
    $calUrl = $set['calendarUrl'] . (strpos($set['calendarUrl'], '?', 6) ? '&' : '?') . 'cD=' . $date;
    $evtText = makeE($evt, $set['evtTemplGen'], 'td', '', '12345');
    $msgText = "\n<html>\n<head>\n<title>{$set['calendarTitle']} {$ax['cro_mailer']}</title>\n<style type='text/css'>\nbody, p, table {{$emlStyle}}\ntd {vertical-align:top;}\n</style>\n</head>\n<body>\n<p>{$set['calendarTitle']} {$ax['cro_mailer']} " . IDtoDD($todayD) . "</p>\n<p>" . ($daysDue ? "{$ax['cro_event_due_in']} {$daysDue} {$ax['cro_days']}" : $ax['cro_event_due_today']) . ":</p>\n<table>\n\t<tr><td>{$ax['cro_title']}:</td><td><b><span{$eStyle}>{$evt['tit']}</span></b></td></tr>\n\t" . ($evt['cbx'] ? "<tr><td>{$ax['cro_status']}:</td><td>{$status}</td></tr>" : '') . "\n\t<tr><td>{$ax['cro_date_time']}:</td><td>{$dateTime}</td></tr>\n\t{$evtText}\n</table>\n<p><a href='{$calUrl}'>{$ax['cro_open_calendar']}</a></p>\n</body>\n</html>\n";
    //send notification
    $sender = $set['notifSender'] ? $evt['uid'] : 0;
    $sent = sendMail($subject, $msgText, $evt['rml'], $sender);
    $sentTo = $sent ? "{$sent} - {$ax['cro_subject']}: {$subject}" : "Sending mail failed. See logs/luxcal.log for details";
    return $sentTo;
}
开发者ID:krievley,项目名称:schedule,代码行数:30,代码来源:notify.php

示例3: RFGetCitysByCid

/**
 * Возвращает select со списком городов указанной страны в для фильтра регионов в каталоге фрилансеров.
 * 
 * @param int   $country название страны транслит
 * @param array $attr    опционально. атрибуты select например: array('name'=>'pf_city', 'class'=>'flt-p-sel',...);
 *
 * @return unknown
 */
function RFGetCitysByCid($country, $attr = array())
{
    $objResponse = new xajaxResponse();
    if (!$attr) {
        $attr = array('name' => 'pf_city', 'class' => 'b-select__select');
    }
    $sAttr = '';
    foreach ($attr as $key => $val) {
        $sAttr .= ' ' . $key . '="' . $val . '"';
    }
    if ($country) {
        $cities = city::GetCities(country::getCountryIDByTranslit($country));
    }
    $objResponse->script('$("b-select__city").set("html","");');
    $objResponse->script('new Element("option", { value: "0", text: "Все города" }).inject($("b-select__city"));');
    $js = '';
    if ($cities) {
        foreach ($cities as $cityid => $city) {
            $js .= 'new Element("option", { value: "' . translit(strtolower($city)) . '", text: "' . $city . '" }).inject($("b-select__city"));' . "\n";
        }
    }
    if ($js) {
        $objResponse->script($js);
    }
    return $objResponse;
}
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:34,代码来源:countrys.server.php

示例4: stringToAlias

 /**
  * @param $str
  * @return string
  */
 function stringToAlias($str)
 {
     if (preg_match('/[^A-Za-z0-9_\\-]/', $str)) {
         $str = translit($str);
         $str = preg_replace('/[^A-Za-z0-9_\\-]/', '', $str);
     }
     return $str;
 }
开发者ID:la2ha,项目名称:pixfile,代码行数:12,代码来源:Helper.php

示例5: sendSum

function sendSum($sumReport)
{
    global $cmlStyle, $set, $ax;
    $subject = translit("{$set['calendarTitle']} {$ax['cro_sum_header']}");
    //create cronjob summary header
    $msgText = "\n<html>\n<head>\n<title>{$set['calendarTitle']} {$ax['cro_sum_header']}</title>\n<style type='text/css'>\n* {padding:0; margin:0;}\nbody, p {{$cmlStyle}}\nh3 {font-size:14px; font-weight:bold; margin:20px 0px; }\nh4 {font-size:12px; font-weight:bold; margin-top:20px;}\n</style>\n</head>\n<body>\n<h3>{$set['calendarTitle']}</h3>\n<p>=== {$ax['cro_sum_header']} ~ " . IDtoDD(date("Y-m-d")) . " {$ax['at_time']} " . date("H:i") . " ===</p>\n{$sumReport}\n<br>\n<p>=== {$ax['cro_sum_trailer']}  ===</p>\n<br>\n<p><a href='{$set['calendarUrl']}'>{$ax['cro_open_calendar']}</a></p>\n</body>\n</html>\n";
    sendMail($subject, $msgText, $set['calendarEmail']);
}
开发者ID:krievley,项目名称:schedule,代码行数:8,代码来源:lcalcron.php

示例6: create_file

function create_file()
{
    $file_name = $_POST['input_first_name'] . '_' . $_POST['input_last_name'] . '.txt';
    $file_location = 'users_info/' . translit($file_name);
    $str = implode("\r\n", $_POST);
    $fp = fopen("{$file_location}", "wb");
    fwrite($fp, $str);
    fclose($fp);
}
开发者ID:sfedorenko,项目名称:geekhub_frontend,代码行数:9,代码来源:form_result.php

示例7: translit_url

function translit_url($urlstr)
{
    if (preg_match('/[^A-Za-z0-9_\\-]/', $urlstr)) {
        $urlstr = str_replace(' ', '-', $urlstr);
        $urlstr = translit($urlstr);
        $urlstr = preg_replace('/[^A-Za-z0-9_\\-]/', '', $urlstr);
    }
    return strtolower(url_title($urlstr));
}
开发者ID:NaszvadiG,项目名称:ImageCMS,代码行数:9,代码来源:translit_helper.php

示例8: normalize

function normalize($str)
{
    // Approximate accents
    //$trans = iconv("UTF-8", "ASCII//TRANSLIT", trim($str));
    $trans = translit(trim($str));
    // Remove approximation of accents
    $ascii = preg_replace("/[^a-zA-Z0-9\\s]/", "", $trans);
    // Normalize spaces
    $norm = preg_replace('!\\s+!', ' ', $ascii);
    return strtolower($norm);
}
开发者ID:stefda,项目名称:decimill-web-frontend,代码行数:11,代码来源:str.php

示例9: convert

/**
 * convert array with needle instructions
 * @param array &$arr
 * @return nothing
 */
function convert(&$arr)
{
    foreach ($arr as $key => $value) {
        $arr[$key] = iconv('CP866', 'utf-8', $value);
    }
    deleteOnceFromArray($arr, 'comment');
    deleteOnceFromArray($arr, 'MNEM', 'MEST');
    translit($arr, array('FLD ', 'COMP', 'NAME'));
    changeDescText($arr, 'NAME', 'Компания оцифровщик каротажа');
    foreach ($arr as $key => $value) {
        $arr[$key] = iconv('utf-8', 'CP866', $value);
    }
}
开发者ID:READYTOMASSACRE,项目名称:testTask,代码行数:18,代码来源:script.php

示例10: notifyReg

function notifyReg($uName, $eMail)
{
    //notify a new user registration
    global $ax, $set, $emlStyle, $emlHeader, $emlTrailer;
    //compose email message
    $dDate = IDtoDD(date('Y-m-d'));
    //current date in display format
    $noteText = $ax['log_new_reg'];
    $subject = translit("{$set['calendarTitle']} - {$noteText}: {$uName}");
    $msgText = $emlHeader . "\n<p>{$set['calendarTitle']} {$ax['cro_mailer']} {$dDate}</p>\n<p>{$noteText}:</p>\n<table>\n\t<tr><td>{$ax['log_un']}:</td><td>{$uName}</td></tr>\n\t<tr><td>{$ax['log_em']}:</td><td>{$eMail}</td></tr>\n\t<tr><td>{$ax['log_date_time']}:</td><td>{$dDate} {$ax['at_time']} " . ITtoDT(date("H:i")) . "</td></tr>\n</table>\n<p><a href='{$set['calendarUrl']}'>{$ax['cro_open_calendar']}</a></p>\n{$emlTrailer}";
    //send email
    sendMail($subject, $msgText, $set['calendarEmail']);
}
开发者ID:krievley,项目名称:schedule,代码行数:13,代码来源:login.php

示例11: actionRegenSeo

 public function actionRegenSeo()
 {
     $modelsAll = SeoFriendlyUrl::model()->findAll();
     $activeLangs = Lang::getActiveLangs();
     foreach ($modelsAll as $model) {
         foreach ($activeLangs as $lang) {
             $field = 'url_' . $lang;
             $model->{$field} = translit($model->{$field});
         }
         $model->save();
     }
     echo 'end';
 }
开发者ID:barricade86,项目名称:raui,代码行数:13,代码来源:MainController.php

示例12: notifyNow

function notifyNow(&$evt, $what)
{
    //notify added/edited/deleted event
    global $xx, $set, $nml, $apd, $app, $tit, $cid, $sda, $eda, $sti, $eti, $r_t, $ald, $chd, $uid, $repTxt;
    $emlStyle = "background:#FFFFDD; color:#000099; font:12px arial, sans-serif;";
    //email body style definition
    //get category
    $rSet = dbQuery("SELECT name,color,background,chbox,chlabel,chmark FROM [db]categories WHERE category_id = {$cid}");
    $row = mysql_fetch_assoc($rSet);
    //compose email message
    $noteText = $what == 'add_exe' ? $xx['evt_event_added'] : ($what == 'upd_exe' ? $xx['evt_event_edited'] : $xx['evt_event_deleted']);
    $dateTime = $sda;
    if ($sti) {
        $dateTime .= ' ' . $xx['at_time'] . ' ' . $sti;
    }
    if ($eda or $eti) {
        $dateTime .= ' -';
    }
    if ($eda) {
        $dateTime .= ' ' . $eda;
    }
    if ($eda and $eti) {
        $dateTime .= ' ' . $xx['at_time'];
    }
    if ($eti) {
        $dateTime .= ' ' . $eti;
    }
    $dateTime .= ($ald == 'all' ? ' ' . $xx['evt_all_day'] : '') . ($r_t ? ' (' . $repTxt . ')' : '');
    $evD = DDtoID($sda);
    $status = '';
    if (!$eda and !$r_t) {
        //no multi-day and not repeating
        if ($row['chbox']) {
            $status .= $row['chlabel'] . ': ' . (strpos($chd, $evD) ? $row['chmark'] : '- -');
        }
    }
    $subject = translit("{$set['calendarTitle']} - {$noteText}: {$tit}");
    $catColor = ($row['color'] ? "color:{$row['color']};" : "") . ($row['background'] ? "background-color:{$row['background']};" : "");
    $eStyle = $catColor ? " style=\"{$catColor}\"" : "";
    $eBoxStyle = ' style="padding-left:5px;' . (($app and !$apd) ? ' border-left:2px solid #ff0000;' : '') . '"';
    $calUrl = $set['calendarUrl'] . (strpos($set['calendarUrl'], '?', 6) ? '&amp;' : '?') . 'cD=' . $evD;
    $evtText .= makeE($evt, $set['evtTemplGen'], 'td', '', '12345');
    $msgText = "\n<html>\n<head>\n<title>{$set['calendarTitle']} {$xx['evt_mailer']}</title>\n<style type='text/css'>\nbody, p, table {{$emlStyle}}\ntd {vertical-align:top;}\n</style>\n</head>\n<body>\n<p>{$set['calendarTitle']} {$xx['evt_mailer']} " . IDtoDD(date("Y-m-d")) . "</p>\n<p>{$noteText}:</p>\n<table{$eBoxStyle}>\n\t<tr><td>{$xx['evt_title']}:</td><td><b><span{$eStyle}>{$tit}</span></b></td></tr>\n\t" . ($status ? "<tr><td>{$xx['evt_status']}:</td><td>{$status}</td></tr>" : '') . "\n\t<tr><td>{$xx['evt_date_time']}:</td><td>{$dateTime}</td></tr>\n\t{$evtText}\n</table>\n<p><a href='{$calUrl}'>{$xx['evt_open_calendar']}</a></p>\n</body>\n</html>\n";
    //send notifications
    if ($nml) {
        //email address(es) to notify
        $sender = $set['notifSender'] ? $uid : 0;
        sendMail($subject, $msgText, $nml, $sender);
    }
}
开发者ID:krievley,项目名称:schedule,代码行数:50,代码来源:event.php

示例13: dav_file_upload_createDestName

/**
* @desc Транслитирует отображаемое имя файла ($_POST['filename']) и возвращает его с расширением загружаемого файла
* @param CFile $cfile
* @return string 
*/
function dav_file_upload_createDestName($cfile)
{
    $uploadFileName = $cfile->name;
    $ext = preg_replace("#.*(\\.[0-9a-zA-Z]*)\$#", "\$1", $uploadFileName);
    //ext = .*
    $filename = __paramInit("string", null, "filename");
    $pattern = '#\\' . $ext . '#';
    $filename = preg_replace($pattern, '', $filename);
    if (strlen($filename) == 0) {
        $filename = preg_replace($pattern, '', $uploadFileName);
    }
    $filename = translit($filename) . $ext;
    return $filename;
}
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:19,代码来源:index.php

示例14: updateItem

 public function updateItem()
 {
     $id = $_REQUEST['id'];
     $item = array();
     if ($id > 0) {
         $item = $this->GetItem($id, 'bg_image');
     }
     $save = $_POST['record'];
     $save['id'] = $id;
     $pid = $this->pid;
     if (trim($save['translit']) == '') {
         $save['translit'] = translit($save['title']);
     }
     # delete background image
     if ((isset($_POST['bg_image_delete']) || !empty($_FILES['record']['tmp_name']['bg_image'])) && $item['bg_image'] > 0) {
         $this->dsp->i->clearByIDX($item['bg_image']);
         $save['bg_image'] = 0;
     }
     $this->errors = $this->checkUpdate($save);
     if (count($this->errors) > 0) {
         return;
     }
     if (!empty($_FILES['record']['tmp_name']['bg_image'])) {
         $f = $this->dsp->i->getFileFromArray($_FILES['record'], 'bg_image');
         list($save['bg_image'], ) = $this->dsp->i->putToPlace($f);
     }
     if ($id > 0) {
         if (!isset($save['bg_image'])) {
             $save['bg_image'] = $item['bg_image'];
         }
         $sql = "update `" . $this->__tablename__ . "` set\n                `title` = ?,\n                `description` = ?,\n                `translit` = ?,\n                `url` = ?,\n                `text` = ?,\n                `status` = ?,\n                `bg_image` = ?\n                where `id` = ?\n            " . '';
         $r = $this->dsp->db->Execute($sql, $save['title'], $save['description'], $save['translit'], $save['url'], $save['text'], !empty($save['status']) ? 1 : 0, $save['bg_image'], $id);
         Redirect('/admin/?op=' . $this->__tablename__ . '&act=edit&id=' . $id);
     } else {
         $pos = $this->dsp->db->SelectValue("select `pos` from `" . $this->__tablename__ . "` where `pid` = ? order by `pos` desc limit 1" . '', $pid);
         if (!$pos) {
             $pos = 0;
         } else {
             $pos++;
         }
         $sql = "insert into `" . $this->__tablename__ . "` (`id`, `pid`, `title`, `description`, `translit`, `url`, `text`, `status`, `pos`, `bg_image`) values (0, ?, ?, ?, ?, ?, ?, ?, ?, ?)" . '';
         $this->dsp->db->Execute($sql, $pid, $save['title'], $save['description'], $save['translit'], $save['url'], $save['text'], !empty($save['status']) ? 1 : 0, $pos, $save['bg_image']);
         Redirect('/admin/?op=' . $this->__tablename__ . '&act=edit&id=' . $this->dsp->db->LastInsertId());
     }
 }
开发者ID:kerranswell,项目名称:s3,代码行数:45,代码来源:lists_admin_class.php

示例15: after_processing_html

    function after_processing_html($orderID)
    {
        $order = ordGetOrder($orderID);
        $order_amount = $order["order_amount"];
        $is_MSIE = isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false ? true : false;
        $res = "";
        $description = str_replace("[orderID]", $orderID, $this->_getSettingValue('CONF_PAYMENTMODULE_ARSENALPAY_PAYMENTS_DESC'));
        if ($is_MSIE) {
            $description = translit($description);
        }
        $pay_type = 'card';
        $token = trim($this->_getSettingValue('CONF_PAYMENTMODULE_ARSENALPAY_TOKEN'));
        $order_key = $this->_getSettingValue('CONF_PAYMENTMODULE_ARSENALPAY_SHARED_SECRET');
        $hash_key = sha1(sha1($orderID) . sha1($order_amount) . sha1($token) . sha1($order_key));
        $framecss = $this->_getSettingValue('CONF_PAYMENTMODULE_ARSENALPAY_FRAME_CSS');
        $frameopen = $this->_getSettingValue('CONF_PAYMENTMODULE_ARSENALPAY_FRAME_OPEN_MODE');
        $frameborder = $this->_getSettingValue('CONF_PAYMENTMODULE_ARSENALPAY_FRAME_BORDER');
        $frameborder = ' frameborder="' . $frameborder . '" ';
        $framescroll = $this->_getSettingValue('CONF_PAYMENTMODULE_ARSENALPAY_FRAME_SCROLLING');
        $framescroll = ' scrolling="' . $framescroll . '" ';
        $url = 'https://arsenalpay.ru/payframe/pay.php?
			src=' . $pay_type . '&t=' . $token . '&n=' . $orderID . '&a=' . $order_amount . '&key=' . $hash_key . '&css=' . $framecss . '&frame=' . $frameopen;
        $frame_w = trim($this->_getSettingValue('CONF_PAYMENTMODULE_ARSENALPAY_FRAME_WIDTH'));
        if ($frame_w < 200) {
            $frame_w = 200;
        }
        $frame_h = trim($this->_getSettingValue('CONF_PAYMENTMODULE_ARSENALPAY_FRAME_HEIGHT'));
        if ($frame_h < 200) {
            $frame_h = 200;
        }
        $res .= '<br>
			<h3>' . $description . '</h3>
			<h3>Оплата пластиковой картой</h3>

			<iframe src="' . $url . '"  width="' . $frame_w . 'px" height="' . $frame_h . 'px" ' . $framescroll . ' ' . $frameborder . '>
			</iframe>';
        return $res;
    }
开发者ID:ArsenalPay,项目名称:WebAsyst-Shop-Script-ArsenalPay-CMS,代码行数:38,代码来源:class.arsenalpay.php


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