• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP translit函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: page_search

function page_search($search = "")
{
    mb_internal_encoding("UTF-8");
    $s = $search;
    if (!$s) {
        $s = form_post("s");
    }
    $o = "";
    if ($s) {
        $rr = db_fetch_objects(db_query("SELECT * FROM pages WHERE content_search like '%%%s%%' LIMIT 10", $s));
        if (count($rr) == 0) {
            $o .= "Под запрос <strong>{$s}</strong> не подходит ни одна страница.";
        } else {
            foreach ($rr as $r) {
                $r->content = fld_trans(strip_for_search($r->content));
                $r->content_search = fld_trans($r->content_search);
                $p = 0;
                if (mb_strpos($r->content_search, mb_strtolower($s)) !== FALSE) {
                    $p = mb_strpos($r->content_search, mb_strtolower($s), 0);
                    $r->content = mb_substr($r->content, 0, $p) . "<strong>" . mb_substr($r->content, $p, mb_strlen($s)) . "</strong>" . mb_substr($r->content, $p + mb_strlen($s), mb_strlen($r->content));
                }
                $start = $p - 200;
                if ($start < 0) {
                    $start = 0;
                }
                $r->span = mb_substr($r->content, $start, 400);
                $r->url = translit(fld_trans($r->short, "ru"));
                $r->short = fld_trans($r->short);
                $GLOBALS['r'] = $r;
                $o .= template("search");
            }
        }
    }
    $o .= "<div style='padding-top:20px'><a href=search/google&s=" . urlencode($s) . ">Использовать google поиск по сайту</a></div>";
    return $o;
}
开发者ID:NazarK,项目名称:sqp,代码行数:36,代码来源:search.php


示例17: array

    $rus = array(' ', 'А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ё', 'Ж', 'З', 'И', 'Й', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Т', 'У', 'Ф', 'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ь', 'Э', 'Ю', 'Я', 'а', 'б', 'в', 'г', 'д', 'е', 'ё', 'ж', 'з', 'и', 'й', 'к', 'л', 'м', 'н', 'о', 'п', 'р', 'с', 'т', 'у', 'ф', 'х', 'ц', 'ч', 'ш', 'щ', 'ъ', 'ы', 'ь', 'э', 'ю', 'я');
    $lat = array('_', 'a', 'b', 'v', 'g', 'd', 'e', 'e', 'zh', 'z', 'i', 'y', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'f', 'h', 'c', 'ch', 'sh', 'sch', 'y', 'y', 'y', 'e', 'yu', 'ya', 'a', 'b', 'v', 'g', 'd', 'e', 'e', 'gh', 'z', 'i', 'y', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'f', 'h', 'c', 'ch', 'sh', 'sch', 'y', 'y', 'y', 'e', 'yu', 'ya');
    return str_replace($rus, $lat, $str);
}
$mysqli = new mysqli($configs['host'], $configs['username'], $configs['password'], $configs['db_name']);
$uploaddir = '../../infocenter/gallery/';
echo '<h1>' . $_FILES['userfile']['type'] . '</h1>';
echo '<h1>' . $_FILES['userfile']['name'] . '</h1>';
echo '<h1>' . $_FILES['userfile']['tmp_name'] . '</h1>';
echo '<h1>' . $_FILES['userfile']['size'] . '</h1>';
echo '<h1>' . $_FILES['userfile']['error'] . '</h1>';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
if (trim($_POST['short_text']) == "") {
    $pre_short_text = translit($_POST['header_input']);
} else {
    $pre_short_text = translit($_POST['short_text']);
}
if (strlen($pre_short_text) > 72) {
    $short_text = substr($pre_short_text, 0, 72);
} else {
    $short_text = $pre_short_text;
}
echo '<p>' . $pre_short_text . '</p>';
echo '<p>' . $short_text . '</p>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
    echo "Файл корректен и был успешно загружен.\n";
} else {
    echo "Возможно, атака с помощью заливания файла!\n";
}
echo '<h1>Type:' . $_POST['newstype'] . '</h1>';
if ($mysqli->connect_errno) {
开发者ID:gitromand,项目名称:armalex,代码行数:31,代码来源:add_news.php


示例18: array

{
    $tr = array("А" => "A", "Б" => "B", "В" => "V", "Г" => "G", "Д" => "D", "Е" => "E", "Ё" => "E", "Ж" => "ZH", "З" => "Z", "И" => "I", "Й" => "Y", "К" => "K", "Л" => "L", "М" => "M", "Н" => "N", "О" => "O", "П" => "P", "Р" => "R", "С" => "S", "Т" => "T", "У" => "U", "Ф" => "F", "Х" => "H", "Ц" => "TS", "Ч" => "CH", "Ш" => "SH", "Щ" => "SCH", "Ъ" => "", "Ы" => "YI", "Ь" => "", "Э" => "E", "Ю" => "YU", "Я" => "YA", "а" => "a", "б" => "b", "в" => "v", "г" => "g", "д" => "d", "е" => "e", "ё" => "e", "ж" => "zh", "з" => "z", "и" => "i", "й" => "y", "к" => "k", "л" => "l", "м" => "m", "н" => "n", "о" => "o", "п" => "p", "р" => "r", "с" => "s", "т" => "t", "у" => "u", "ф" => "f", "х" => "h", "ц" => "ts", "ч" => "ch", "ш" => "sh", "щ" => "sch", "ъ" => "y", "ы" => "yi", "ь" => "", "э" => "e", "ю" => "yu", "я" => "ya");
    return strtr($str, $tr);
}
function generate_password($length)
{
    $pass = "";
    $arr = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'v', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'S', 'T', 'U', 'V', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9');
    for ($i = 0; $i < $length; $i++) {
        $index = rand(0, count($arr) - 1);
        // Случайный индекс массива
        $pass .= $arr[$index];
    }
    return $pass;
}
$users = getUsers(true);
foreach ($users as $id => $user) {
    $users[$id]["permissions"] = 33;
    $users[$id]["login"] = mb_strtolower(translit(mb_substr($user["firstname"], 0, 1, "UTF-8") . $user["lastname"]));
    $users[$id]["login_ae"] = mb_strtoupper(mb_substr($user["firstname"], 0, 1, "UTF-8") . mb_substr($user["middlename"], 0, 1, "UTF-8") . $user["lastname"], "UTF-8");
    $users[$id]["email"] = $users[$id]["login"] . "@megacorp.com";
    $users[$id]["password"] = generate_password(8);
    $query = "UPDATE users SET\r\n        `login`='" . $users[$id]["login"] . "',\r\n        `login_ae`='" . $users[$id]["login_ae"] . "',\r\n        `pass`='" . $users[$id]["password"] . "',\r\n        `email`='" . $users[$id]["email"] . "'\r\n            WHERE `uid`={$id}";
    //    echo "\n\n";
    $query_upd = $db->query($query);
    if ($query_upd) {
        echo 1;
    }
}
//print_r($users);
print_r($db->error());
开发者ID:progervlad,项目名称:utils,代码行数:31,代码来源:create_users_shadows.php


示例19: ip2long

require_once 'head_inc.php';
$thread_owner = false;
$title = 'New message';
$ticket = '' . ip2long(substr($ip, 1, strlen($ip) - 2)) . '-' . time();
if (!is_null($re) && strlen($re) > 0) {
    $msg_id = $re;
    // Retrieve the original message's subject
    $query = 'SELECT u.username, u.moder, p.subject, p.closed as post_closed, p.views, p.id as msg_id, p.status, p.auth, p.parent, CONVERT_TZ(p.created, \'' . $server_tz . '\', \'' . $prop_tz . ':00\') as created, p.body, p.author, u.id as id, t.closed as thread_closed, ( select max(page) from confa_threads) - t.page + 1 as page, p.thread_id, t.id, p.status, t.author as t_author, t.properties as t_properties from confa_users u, confa_posts p, confa_threads t where p.thread_id=t.id and u.id=p.author and p.id=' . $msg_id;
    $result = mysql_query($query);
    if (!$result) {
        mysql_log(__FILE__, 'query 2 failed ' . mysql_error() . ' QUERY: ' . $query);
        die('Query failed');
    }
    if (mysql_num_rows($result) != 0) {
        $row = mysql_fetch_assoc($result);
        $subject = htmlentities(translit($row['subject'], $proceeded), HTML_ENTITIES, 'UTF-8');
        $subj = $subject;
        if (strpos($subj, 'Re:') !== 0) {
            $subj = "Re: " . $subj;
        }
        $author = htmlentities($row['username'], HTML_ENTITIES, 'UTF-8');
        $created = $row['created'];
        $msg_status = $row['status'];
        if (!is_null($row['post_closed']) && $row['post_closed'] > 0) {
            $post_closed = true;
        }
        if (!is_null($row['thread_closed']) && $row['thread_closed'] > 0) {
            $thread_closed = true;
        }
        if ($thread_closed || $post_closed) {
            $reply_closed = true;
开发者ID:BGmot,项目名称:kitchen,代码行数:31,代码来源:m_new.php


示例20: Blocked

 public function Blocked($id, $user_id, $reason, $reason_id = 0)
 {
     $data = $this->getCardModeration($id);
     if (!$data) {
         return false;
     }
     if ($data['is_blocked'] == 't') {
         return true;
     }
     $sQuery = "\n             UPDATE {$this->TABLE_MODERATION} SET \n                 status = 2 \n             WHERE \n                rec_id = ?i \n                AND rec_type = ?i \n             RETURNING rec_id";
     $sRecId = $this->db()->val($sQuery, $id, user_content::MODER_TSERVICES);
     //Если вдруг записи нет на модерации добавляем
     if (!$sRecId) {
         $this->sendToModeration($id, $data, 2);
     }
     $sBlockId = $this->db()->insert($this->TABLE_BLOCKED, array('src_id' => $id, 'admin' => $user_id, 'reason' => $reason, 'reason_id' => $reason_id, 'blocked_time' => 'NOW()'), 'id');
     if (!$sBlockId) {
         return false;
     }
     $sObjLink = sprintf('%s/tu/%d/%s.html', $GLOBALS['host'], $data['id'], translit(strtolower(htmlspecialchars_decode($data['title'], ENT_QUOTES))));
     //пишем лог админских действий
     admin_log::addLog(admin_log::OBJ_CODE_TSERVICES, 64, $data['uid'], $id, $data['title'], $sObjLink, 0, '', 0, $reason, $sBlockId, '', $user_id);
     //отправляем сообщение о блокировки
     messages::SendBlockedTServices($data, $reason);
     return true;
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:26,代码来源:tservices.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP transliterate函数代码示例发布时间:2022-05-23
下一篇:
PHP translate_with_gettext_context函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap