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


PHP functions::translit方法代码示例

本文整理汇总了PHP中functions::translit方法的典型用法代码示例。如果您正苦于以下问题:PHP functions::translit方法的具体用法?PHP functions::translit怎么用?PHP functions::translit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在functions的用法示例。


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

示例1: isset

 /**/
 $change = isset($_GET['act']) && $_GET['act'] != 'complete' && $_GET['act'] != 'changed';
 /*if($change) {
 		$b = $db->result("SELECT user_id FROM board WHERE href = '".$_GET['act']."'");
 		if(!$board->getAdmin() or $board->getUserId() != $b) exit("У Вас нет прав для редкатирования этого объявления!<br />");
 	}*/
 $required = array("title" => "Заголовок", "id_category" => "Категория", "autor" => "Автор", "phone" => "Телефон", "email" => "E-mail", "text" => "Описание", "city" => "Город");
 $title = trim($_POST['title']);
 $text = trim($_POST['text']);
 $price = trim($_POST['price']);
 $price_t = trim($_POST['price_t']);
 $id_category = trim($_POST['id_category']);
 //echo '<pre>';var_dump($_POST);exit();
 $info = $_POST;
 $user_id = $board->checkUser($info['email']);
 $push = array('user_id' => $user_id, 'href' => functions::translit($title) . '-' . functions::generate_password(10), 'status' => 'new');
 $info = array_merge($info, $push);
 //$info['time'] = !$change ? time() : $db->query("SELECT time FROM board WHERE href = '".functions::q($_GET['act'])."'");
 if (!$change) {
     $info['time'] = time();
 } else {
     unset($info['time']);
 }
 $db->query("SELECT * FROM photo WHERE folder = '" . functions::q($_POST['photos_id']) . "' ORDER BY `time` ASC");
 if ($db->getNumRows() > 0) {
     $image = new SimpleImage();
     $i = 0;
     while ($photo = mysql_fetch_array($db->data)) {
         $url = 'photo/' . $photo['folder'] . '/' . $photo['name'];
         $image->load($url);
         if ($i == $_POST['photo_c']) {
开发者ID:Sywooch,项目名称:dump,代码行数:31,代码来源:additem.php

示例2: format_fields

 /**
  * Format all fields
  * Calls to container method
  * @param array data
  * @param string type {@see format_field}
  * @throws tf_exception
  */
 public function format_fields(&$data, $type = false)
 {
     if (!$type) {
         throw new collection_exception('Undefined format type');
     }
     if (!is_array($data)) {
         core::dprint_r($data);
         throw new collection_exception('Data wrong type: ' . gettype($data));
     }
     $container = $this->get_container();
     $vfs_keys = $this->get_fields_keys();
     foreach ($vfs_keys as $k) {
         if (!isset($data[$k])) {
             $data[$k] = '';
         }
         $v =& $data[$k];
         $current = $this->get_data($k);
         /* 
             Fields modificators:
               + autosave
               + default 
               + make_seo
         */
         $skip = false;
         if ('modify' == $type) {
             if (!$this->in_working_set($k)) {
                 $skip = true;
             } else {
                 if ($vf = $this->field($k)) {
                     // make seo
                     if (isset($vf['make_seo']) && !empty($vf['make_seo'])) {
                         $with_translit = false;
                         $with_strict = false;
                         if (is_array($vf['make_seo'])) {
                             if (isset($vf['make_seo']['key'])) {
                                 // new syntax: key, translit, strict (without spaces)
                                 $with_strict = @$vf['make_seo']['strict'];
                                 $with_translit = @$vf['make_seo']['translit'];
                                 $vf['make_seo'] = $vf['make_seo']['key'];
                             } else {
                                 $with_translit = $vf['make_seo'][1];
                                 $vf['make_seo'] = $vf['make_seo'][0];
                             }
                             // fill url, if empty
                             if (empty($v) && $vf['make_seo'] && isset($data[$vf['make_seo']])) {
                                 $v = $data[$vf['make_seo']];
                             }
                         } else {
                             // oldstyle: make_seo = 1|true switch
                             $with_translit = true;
                         }
                         if ($with_translit && !empty($v)) {
                             $v = functions::translit($v);
                         }
                         // something bad trigger this code
                         if (empty($v)) {
                             $v = uniqid();
                         } else {
                             $v = preg_replace('/[^а-яёa-z\\-\\_0-9[:space:]]/ui', '', $v);
                             if ($with_strict) {
                                 $v = preg_replace('/\\s{1,}/u', '-', $v);
                             }
                             $v = strings::strtolower(trim($v));
                             // @todo fix name spaces
                             if (($this->is_new() || empty($v)) && !empty($data[$vf['make_seo']])) {
                                 $v = $this->_unique_alias($k, @$vf['space'], $data);
                             }
                         }
                     }
                     // autosave
                     if (isset($vf['autosave']) && $vf['autosave'] && !$this->is_new()) {
                         $data[$k] = $this->get_data($k);
                     }
                     // default
                     if (isset($vf['default']) && $this->is_new() && empty($data[$k])) {
                         $data[$k] = $vf['default'];
                         // for unixtime 'now' set, parsed in collection::on_modify to time()
                     }
                 }
             }
         }
         if (!$skip) {
             $v = $container->format_field($k, $v, $type, $current, $this);
         }
     }
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:93,代码来源:item.php

示例3: format_fields

 /**
  * Format all fields
  * Calls to container method
  * @param array data
  * @param string type {@see format_field}
  * @throws tf_exception
  */
 public function format_fields(&$data, $type = false)
 {
     if (!$type) {
         throw new collection_exception('Undefined format type');
     }
     $container = $this->get_container();
     $vfs_keys = $this->get_vfs_keys();
     foreach ($vfs_keys as $k) {
         if (!isset($data[$k])) {
             $data[$k] = '';
         }
         $v =& $data[$k];
         $current = $this->get_data($k);
         /* 
             Fields modificators:
               + autosave
               + default 
               + make_seo
         */
         $skip = false;
         if ('modify' == $type) {
             if (!$this->in_working_set($k)) {
                 $skip = true;
             } else {
                 if ($vf = $this->get_valid_field($k)) {
                     // make seo
                     if (isset($vf['make_seo']) && !empty($vf['make_seo'])) {
                         if (empty($v)) {
                             //(true === $vf['make_seo']) {
                             $v = functions::translit($data[$vf['make_seo']]);
                         }
                         // @todo fix name spaces
                         /*
                             if (($this->is_new() || empty($v)) && !empty($data[$vf['make_seo']])) {
                                 $v = $data[$vf['make_seo']];
                                 $this->make_name($v, (isset($vf['space']) ? array(array($vf['space'], $data[$vf['space']])) : false));
                             }  
                         }
                         */
                         if (empty($v)) {
                             $data[$k] = date('d_m_Y_H_i_s');
                         } else {
                             $v = strtolower(trim($v));
                         }
                     }
                     // autosave
                     if (isset($vf['autosave']) && $vf['autosave'] && !$this->is_new()) {
                         $data[$k] = $this->get_data($k);
                     }
                     // default
                     if (isset($vf['default']) && $this->is_new() && empty($data[$k])) {
                         $data[$k] = $vf['default'];
                         // for unixtime 'now' set, parsed in collection::on_modify to time()
                     }
                 }
             }
         }
         if (!$skip) {
             $v = $container->format_field($k, $v, $type, $current);
         }
     }
 }
开发者ID:rustyJ4ck,项目名称:moswarBot,代码行数:69,代码来源:collection_item.php


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