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


PHP G::StrToTrans方法代码示例

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


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

示例1: UpdateManufacturer

 }
 // Обновление
 public function UpdateManufacturer($arr)
 {
     $manufacturer_id = trim($arr['manufacturer_id']);
     $name = trim($arr['name']);
     $translit = G::StrToTrans($name);
     $m_image = trim($arr['m_image']);
     $sql = "UPDATE " . _DB_PREFIX_ . "manufacturers SET `name` = \"{$name}\", `translit` = \"{$translit}\", `m_image` = \"{$m_image}\"\r\t\t\tWHERE manufacturer_id = {$manufacturer_id}";
     $this->db->Query($sql) or G::DieLoger("<b>SQL Error - </b>{$sql}");
开发者ID:Arikito,项目名称:webking.xt,代码行数:10,代码来源:manufacturers_c.php

示例2: UpdateNews

 public function UpdateNews($arr)
 {
     if (strpos($arr['thumb'], '/temp/') !== false) {
         $images = new Images();
         $path = $GLOBALS['PATH_news_img'] . $arr['id_news'] . '/';
         $images->checkStructure($path);
         $file = pathinfo($GLOBALS['PATH_global_root'] . $arr['thumb']);
         if (preg_match('/[А-Яа-яЁё]/u', $arr['thumb'])) {
             $file['filename'] = G::StrToTrans($file['filename']);
             $file['basename'] = $file['filename'] . '.' . $file['extension'];
         }
         $new_file = $path . $file['basename'];
         rename($GLOBALS['PATH_global_root'] . $arr['thumb'], $new_file);
         $arr['thumb'] = str_replace($GLOBALS['PATH_global_root'], '/', $new_file);
     }
     $f['title'] = trim($arr['title']);
     $f['descr_short'] = trim($arr['descr_short']);
     $f['descr_full'] = trim($arr['descr_full']);
     $f['thumbnail'] = trim($arr['thumb']);
     list($d, $m, $y) = explode(".", trim($arr['date']));
     $f['date'] = mktime(0, 0, 0, $m, $d, $y);
     $f['translit'] = G::StrToTrans($f['title']);
     $f['sid'] = $arr['sid'];
     $f['indexation'] = isset($arr['indexation']) && $arr['indexation'] == "on" ? 1 : 0;
     $f['visible'] = isset($arr['visible']) && $arr['visible'] == "on" ? 0 : 1;
     $f['date_update'] = Date('Y-m-d H:i:s');
     $f['id_user'] = $_SESSION['member'][id_user];
     $f['page_title'] = trim($arr['page_title']);
     $f['page_description'] = trim($arr['page_description']);
     $f['page_keywords'] = trim($arr['page_keywords']);
     $this->db->StartTrans();
     if (!$this->db->Update(_DB_PREFIX_ . "news", $f, "id_news = {$arr['id_news']}")) {
         $this->db->FailTrans();
         return false;
     }
     $id_news = $this->db->GetLastId();
     $this->db->CompleteTrans();
     return true;
 }
开发者ID:Arikito,项目名称:webking.xt,代码行数:39,代码来源:news_c.php

示例3: AcceptProductModeration

 /**
  * [AcceptProductModeration description]
  * @param [type] $data [description]
  */
 public function AcceptProductModeration($data)
 {
     $product = $this->GetProductOnModeration($data['id']);
     $f['art'] = $data['art'];
     $f['name'] = $product['name'];
     $f['translit'] = G::StrToTrans($product['name']);
     $f['descr'] = $product['descr'];
     $f['inbox_qty'] = $product['inbox_qty'];
     $f['min_mopt_qty'] = $product['min_mopt_qty'];
     if (isset($product['qty_control'])) {
         $f['qty_control'] = $product['qty_control'];
     }
     $f['sertificate'] = '';
     $f['country'] = '';
     $f['max_supplier_qty'] = 0;
     $f['manufacturer_id'] = 0;
     $f['weight'] = $product['height'] * $product['width'] * $product['length'] * 1.0E-6;
     $f['volume'] = str_replace(',', '.', $product['weight']);
     $f['height'] = $product['height'];
     $f['width'] = $product['width'];
     $f['length'] = $product['length'];
     $f['coefficient_volume'] = $product['coefficient_volume'];
     $f['edit_user'] = trim($_SESSION['member']['id_user']);
     $f['edit_date'] = date('Y-m-d H:i:s');
     $f['create_user'] = $product['id_supplier'];
     $f['id_unit'] = $product['id_unit'];
     $f['prod_status'] = 3;
     $f['indexation'] = 1;
     $Images = new Images();
     if (isset($product['images']) && $product['images'] != '') {
         foreach (explode(';', $product['images']) as $k => $image) {
             $to_resize[] = $newname = $data['art'] . ($k == 0 ? '' : '-' . $k) . '.jpg';
             $structure = $GLOBALS['PATH_product_img'] . 'original/' . date('Y') . '/' . date('m') . '/' . date('d') . '/';
             $structure_bd = '/product_images/original/' . date('Y') . '/' . date('m') . '/' . date('d') . '/';
             $Images->checkStructure($structure);
             copy($_SERVER['DOCUMENT_ROOT'] . str_replace(_base_url, '/', $image), $structure . $newname);
             $images_arr[] = $structure_bd . $newname;
             $visible[] = 1;
         }
     } else {
         $images_arr = array();
     }
     $Images->resize(false, $to_resize);
     $this->db->StartTrans();
     if (!$this->db->Insert(_DB_PREFIX_ . 'product', $f)) {
         $this->db->FailTrans();
         return false;
     }
     $this->db->CompleteTrans();
     $sql = "SELECT MAX(id_product) AS id_product\n\t\t\tFROM " . _DB_PREFIX_ . "product";
     $res = $this->db->GetOneRowArray($sql);
     $sql = "SELECT koef_nazen_mopt, koef_nazen_opt\n\t\t\tFROM " . _DB_PREFIX_ . "supplier\n\t\t\tWHERE id_user = " . $product['id_supplier'];
     $sup = $this->db->GetOneRowArray($sql);
     $id = $res['id_product'];
     $a['id_product'] = $id;
     $this->UpdatePhoto($id, $images_arr, $visible);
     $a['id_supplier'] = $product['id_supplier'];
     $a['price_mopt_otpusk'] = str_replace(',', '.', $product['price_mopt']);
     $a['price_opt_otpusk'] = str_replace(',', '.', $product['price_opt']);
     $a['price_mopt_recommend'] = str_replace(',', '.', $product['price_mopt'] * $sup['koef_nazen_mopt']);
     $a['price_opt_recommend'] = str_replace(',', '.', $product['price_opt'] * $sup['koef_nazen_opt']);
     $a['product_limit'] = $product['product_limit'];
     $a['sup_comment'] = '';
     $a['edited'] = date('Y-m-d');
     $this->db->StartTrans();
     if (!$this->db->Insert(_DB_PREFIX_ . 'assortiment', $a)) {
         $this->db->FailTrans();
         return false;
     }
     $this->db->CompleteTrans();
     return $id;
 }
开发者ID:Arikito,项目名称:webking.xt,代码行数:76,代码来源:products_c.php

示例4: unset

unset($parsed_res);
// --------------------------------------------------------------------------------------
$tpl->Assign('h1', 'Добавление категории');
$ii = count($GLOBALS['IERA_LINKS']);
$GLOBALS['IERA_LINKS'][$ii]['title'] = "Каталог";
$GLOBALS['IERA_LINKS'][$ii++]['url'] = $GLOBALS['URL_base'] . 'adm/cat/';
$GLOBALS['IERA_LINKS'][$ii]['title'] = "Добавление категории";
if (isset($_POST['smb'])) {
    require_once $GLOBALS['PATH_block'] . 't_fnc.php';
    // для ф-ции проверки формы
    list($err, $errm) = Cat_form_validate();
    if (!$err) {
        $arr = array();
        $arr['name'] = mysql_real_escape_string(trim($_POST['name']));
        $arr['content'] = mysql_real_escape_string(trim($_POST['content']));
        $arr['translit'] = G::StrToTrans($_POST['name']);
        $arr['pid'] = mysql_real_escape_string(trim($_POST['pid']));
        $arr['visible'] = 1;
        if (isset($_POST['visible']) && $_POST['visible'] == "on") {
            $arr['visible'] = 0;
        }
        if ($id = $dbtree->Insert($arr['pid'], $arr)) {
            $tpl->Assign('msg', 'Категория добавлена.');
            unset($_POST);
        } else {
            $tpl->Assign('msg', 'Ошибочка. Категория не добавлена.');
            $tpl->Assign('errm', 1);
        }
    } else {
        // показываем все заново но с сообщениями об ошибках
        $tpl->Assign('msg', 'Ошибка! Категория не добавлена.');
开发者ID:Arikito,项目名称:webking.xt,代码行数:31,代码来源:cat_tagadd.php

示例5: foreach

 //Удаление фото при нажатии на корзину
 if (isset($_POST['removed_images'])) {
     foreach ($_POST['removed_images'] as $del_image) {
         unlink($GLOBALS['PATH_global_root'] . $del_image);
     }
 }
 //Добавление фото
 if (isset($_POST['images'])) {
     foreach ($_POST['images'] as &$image) {
         if (strpos($image, '/temp/') !== false) {
             $Images = new Images();
             $path = $GLOBALS['PATH_news_img'] . $_POST['id_news'] . '/';
             $Images->checkStructure($path);
             $file = pathinfo($GLOBALS['PATH_global_root'] . $image);
             if (preg_match('/[А-Яа-яЁё]/u', $image)) {
                 $file['filename'] = G::StrToTrans($file['filename']);
                 $file['basename'] = $file['filename'] . '.' . $file['extension'];
             }
             $new_file = $path . $file['basename'];
             rename($GLOBALS['PATH_global_root'] . $image, $new_file);
             $image = str_replace($GLOBALS['PATH_global_root'], '/', $new_file);
         }
     }
 }
 if (!$err) {
     if ($News->UpdateNews($_POST)) {
         $News->UpdatePhoto($id, $_POST['images']);
         $tpl->Assign('msg', 'Новость обновлена.');
         if (isset($_POST['news_distribution']) && $_POST['news_distribution'] == 1) {
             $Mailer = new Mailer();
             $Mailer->SendNewsToCustomers1($_POST);
开发者ID:Arikito,项目名称:webking.xt,代码行数:31,代码来源:newsedit.php

示例6: UpdatePost

 public function UpdatePost($arr)
 {
     if (strpos($arr['thumb'], '/temp/')) {
         $images = new Images();
         $path = $GLOBALS['PATH_post_img'] . $arr['id'] . '/';
         $images->checkStructure($path);
         if (preg_match('/[А-Яа-яЁё]/u', $arr['thumb'])) {
             $file = pathinfo($GLOBALS['PATH_global_root'] . $arr['thumb']);
             $new_file = $file['dirname'] . '/' . G::StrToTrans($file['filename']) . '.' . $file['extension'];
             rename($GLOBALS['PATH_global_root'] . $arr['thumb'], $new_file);
             $arr['thumb'] = str_replace($GLOBALS['PATH_global_root'], '', $new_file);
         }
         $new_path = str_replace('temp/', trim($arr['id']) . '/thumb_', $arr['thumb']);
         rename($GLOBALS['PATH_global_root'] . $arr['thumb'], $GLOBALS['PATH_global_root'] . $new_path);
         $arr['thumb'] = $new_path;
     }
     $f['title'] = trim($arr['title']);
     $f['thumbnail'] = trim($arr['thumb']);
     list($d, $m, $y) = explode(".", trim($arr['date']));
     $f['date'] = mktime(0, 0, 0, $m, $d, $y);
     $f['content_preview'] = trim($arr['content_preview']);
     $f['content'] = trim($arr['content']);
     $f['translit'] = G::StrToTrans($arr['title']);
     $f['sid'] = $arr['sid'];
     $f['indexation'] = isset($arr['indexation']) && $arr['indexation'] == "on" ? 1 : 0;
     $f['visible'] = isset($arr['visible']) && $arr['visible'] == "on" ? 0 : 1;
     $f['date_update'] = Date('Y-m-d H:i:s');
     $f['id_user'] = $_SESSION['member'][id_user];
     $this->db->StartTrans();
     if (!($sql = $this->db->Update(_DB_PREFIX_ . "post", $f, "id = " . $arr['id']))) {
         $this->db->FailTrans();
         return false;
     }
     $this->db->CompleteTrans();
     return true;
 }
开发者ID:Arikito,项目名称:webking.xt,代码行数:36,代码来源:post_c.php

示例7: UpdatePage

 public function UpdatePage($arr)
 {
     if (isset($arr['title'])) {
         $f['title'] = trim($arr['title']);
         $f['translit'] = G::StrToTrans($arr['title']);
     }
     if (isset($arr['editor'])) {
         $f['new_content'] = trim($arr['editor']);
     }
     if (isset($arr['page_description'])) {
         $f['page_description'] = trim($arr['page_description']);
     }
     if (isset($arr['page_title'])) {
         $f['page_title'] = trim($arr['page_title']);
     }
     if (isset($arr['page_keywords'])) {
         $f['page_keywords'] = trim($arr['page_keywords']);
     }
     if (isset($arr['ptype'])) {
         $f['ptype'] = trim($arr['ptype']);
     }
     $f['indexation'] = isset($arr['indexation']) && $arr['indexation'] == "on" ? 1 : 0;
     $f['visible'] = 1;
     if (isset($arr['visible']) && $arr['visible'] == "on") {
         $f['visible'] = 0;
     }
     $this->db->StartTrans();
     if (!$this->db->Update(_DB_PREFIX_ . 'page', $f, 'id_page = ' . $arr['id_page'])) {
         $this->db->FailTrans();
         return false;
     }
     $this->db->CompleteTrans();
     return true;
 }
开发者ID:Arikito,项目名称:webking.xt,代码行数:34,代码来源:page_c.php

示例8: foreach

 // проход по первой строке
 foreach ($ca as $k => $i) {
     if ($i != $heading[$k]) {
         $_SESSION['errm'][] = 'Неверный формат файла';
         return array(0, 0);
     }
     $keys[] = $i;
 }
 $Products = new Products();
 $Parser = new Parser();
 // ini_set('memory_limit', '728M');
 ini_set('max_execution_time', 3000);
 $k = $l = $i = 0;
 foreach ($array as $row) {
     $res = array_combine($keys, $row);
     if (isset($res['url']) && $res['url'] !== '' && !$Products->SetFieldsByRewrite(G::StrToTrans($res['name']))) {
         // print_r($res['name']);
         // print_r('</br>');
         // var_dump(G::StrToTrans($res['name']));
         // print_r('</br>');
         // var_dump(!$Products->SetFieldsByRewrite(G::StrToTrans($res['name'])));die();
         if ($Parser->parseUrl($res['url'])) {
             $k++;
             sleep(3);
         } else {
             $l++;
         }
     } else {
         $i++;
     }
 }
开发者ID:Arikito,项目名称:webking.xt,代码行数:31,代码来源:site_parsers.php

示例9: UpdateTranslit

    public function UpdateTranslit($id_category)
    {
        $this->SetFieldsByID($id_category);
        $cat = $this->fields;
        $translit = G::StrToTrans($cat['name']);
        $sql = 'UPDATE ' . $this->table . '
			SET edit_user = ' . $_SESSION['member']['id_user'] . ',
			edit_date = "' . date('Y-m-d H:i:s') . '",
			translit = "' . $translit . '"
			WHERE id_category = ' . $id_category;
        $this->db->StartTrans();
        $res = $this->db->Execute($sql);
        if (false === $res) {
            $this->ERRORS[] = array(2, 'SQL query error.', __FILE__ . '::' . __CLASS__ . '::' . __FUNCTION__ . '::' . __LINE__, 'SQL QUERY: ' . $sql, 'SQL ERROR: ' . $this->db->ErrorMsg());
            $this->ERRORS_MES[] = extension_loaded('gettext') ? _('internal_error') : 'internal_error';
            $this->db->FailTrans();
            return false;
        }
        $this->db->CompleteTrans();
        return $translit;
    }
开发者ID:Arikito,项目名称:webking.xt,代码行数:21,代码来源:dbtree_c.php


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