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

PHP erTranslationClassLhTranslation类代码示例

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

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



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

示例1: validateRequest

 public static function validateRequest()
 {
     $headers = self::getHeaders();
     if (isset($headers['Authorization'])) {
         $dataAuthorisation = explode(' ', $headers['Authorization']);
         $apiData = explode(':', base64_decode($dataAuthorisation[1]));
         if (count($apiData) != 2) {
             throw new Exception(erTranslationClassLhTranslation::getInstance()->getTranslation('lhrestapi/validation', 'Authorization failed!'));
         }
         $apiKey = erLhAbstractModelRestAPIKey::findOne(array('enable_sql_cache' => true, 'filter' => array('active' => 1, 'api_key' => $apiData[1])));
         if (!$apiKey instanceof erLhAbstractModelRestAPIKey) {
             throw new Exception(erTranslationClassLhTranslation::getInstance()->getTranslation('lhrestapi/validation', 'Authorization failed!'));
         }
         if ($apiKey->user->username != $apiData[0]) {
             throw new Exception(erTranslationClassLhTranslation::getInstance()->getTranslation('lhrestapi/validation', 'Authorization failed!'));
         }
         // API Key
         self::$apiKey = $apiKey;
         if (isset($_GET['update_activity'])) {
             $db = ezcDbInstance::get();
             $stmt = $db->prepare('UPDATE lh_userdep SET last_activity = :last_activity WHERE user_id = :user_id');
             $stmt->bindValue(':last_activity', time(), PDO::PARAM_INT);
             $stmt->bindValue(':user_id', self::$apiKey->user->id, PDO::PARAM_INT);
             $stmt->execute();
         }
     } else {
         throw new Exception(erTranslationClassLhTranslation::getInstance()->getTranslation('lhrestapi/validation', 'Authorization header is missing!'));
     }
 }
开发者ID:detain,项目名称:livehelperchat,代码行数:29,代码来源:lhrestapivalidator.php


示例2: translate

 public static function translate($access_token, $word, $from, $to)
 {
     $url = 'http://api.microsofttranslator.com/V2/Http.svc/Translate?text=' . urlencode($word) . '&from=' . $from . '&to=' . $to;
     if (empty($word)) {
         throw new Exception(erTranslationClassLhTranslation::getInstance()->getTranslation('chat/translation', 'Missing text to translate'));
     }
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization:bearer ' . $access_token));
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
     curl_setopt($ch, CURLOPT_TIMEOUT, 5);
     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
     $rsp = curl_exec($ch);
     if (strpos($rsp, '<string') === false) {
         throw new Exception($rsp);
     }
     $errors = array();
     erLhcoreClassChatEventDispatcher::getInstance()->dispatch('translate.after_bing_translate', array('word' => &$word, 'errors' => &$errors));
     if (!empty($errors)) {
         throw new Exception(erTranslationClassLhTranslation::getInstance()->getTranslation('chat/translation', 'Could not translate') . ' - ' . implode('; ', $errors));
     }
     preg_match_all('/<string (.*?)>(.*?)<\\/string>/s', $rsp, $matches);
     return htmlspecialchars_decode($matches[2][0]);
 }
开发者ID:detain,项目名称:livehelperchat,代码行数:26,代码来源:lhbingtranslate.php


示例3: getModuleTranslations

 public function getModuleTranslations()
 {
     /**
      * Get's executed before permissions check. It can redirect to frontpage throw permission exception etc
      * */
     erLhcoreClassChatEventDispatcher::getInstance()->dispatch('feature.can_use_proactive', array());
     return array('can_use' => $can_use, 'permission_delete' => array('module' => 'lhchat', 'function' => 'administrateinvitations'), 'permission' => array('module' => 'lhchat', 'function' => 'administrateinvitations'), 'name' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Pro active chat invitations'));
 }
开发者ID:p4prawin,项目名称:livechat,代码行数:8,代码来源:erlhabstractmodeleproactivechatinvitation.php


示例4: getModuleTranslations

 public function getModuleTranslations()
 {
     /**
      * Get's executed before permissions check. It can redirect to frontpage throw permission exception etc
      * */
     erLhcoreClassChatEventDispatcher::getInstance()->dispatch('feature.can_use_forms', array());
     return array('path' => array('url' => erLhcoreClassDesign::baseurl('form/index'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('browseoffer/index', 'Form')), 'permission_delete' => array('module' => 'lhform', 'function' => 'delete_fm'), 'permission' => array('module' => 'lhform', 'function' => 'manage_fm'), 'name' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/browserofferinvitation', 'Forms list'));
 }
开发者ID:p4prawin,项目名称:livechat,代码行数:8,代码来源:erlhabstractmodelform.php


示例5: getModuleTranslations

 public function getModuleTranslations()
 {
     $metaData = array('permission_delete' => array('module' => 'lhchat', 'function' => 'administrateresponder'), 'permission' => array('module' => 'lhchat', 'function' => 'administrateresponder'), 'name' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Auto responder'));
     /**
      * Get's executed before permissions check. It can redirect to frontpage throw permission exception etc
      * */
     erLhcoreClassChatEventDispatcher::getInstance()->dispatch('feature.can_use_autoresponder', array('object_meta_data' => &$metaData));
     return $metaData;
 }
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:9,代码来源:erlhabstractmodelautoresponder.php


示例6: getModuleTranslations

 public function getModuleTranslations()
 {
     $metaData = array('path' => array('url' => erLhcoreClassDesign::baseurl('restapi/index'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('theme/index', 'Rest API')), 'permission_delete' => array('module' => 'lhrestapi', 'function' => 'use_admin'), 'permission' => array('module' => 'lhrestapi', 'function' => 'use_admin'), 'name' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/product', 'API Key'));
     /**
      * Get's executed before permissions check. It can redirect to frontpage throw permission exception etc
      * */
     erLhcoreClassChatEventDispatcher::getInstance()->dispatch('feature.can_use_product', array('object_meta_data' => &$metaData));
     return $metaData;
 }
开发者ID:detain,项目名称:livehelperchat,代码行数:9,代码来源:erlhabstractmodelrestapikey.php


示例7: translate

 public static function translate($apiKey, $word, $from, $to)
 {
     $url = "https://www.googleapis.com/language/translate/v2?key={$apiKey}&q=" . urlencode($word) . "&source={$from}&target={$to}";
     $rsp = self::executeRequest($url);
     $data = json_decode($rsp, true);
     if (isset($data['data']['translations'][0]['translatedText'])) {
         return htmlspecialchars_decode($data['data']['translations'][0]['translatedText']);
     }
     throw new Exception(erTranslationClassLhTranslation::getInstance()->getTranslation('chat/translation', 'Could not translate') . ' - ' . $rsp);
 }
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:10,代码来源:lhgoogletranslate.php


示例8: validateAdminTheme

 public static function validateAdminTheme(erLhAbstractModelAdminTheme &$clickform)
 {
     $definition = array('Name' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'header_content' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'header_css' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'static_content_name' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY), 'static_content_hash' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY), 'static_js_content_name' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY), 'static_js_content_hash' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY), 'static_css_content_name' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY), 'static_css_content_hash' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY));
     $form = new ezcInputForm(INPUT_POST, $definition);
     $Errors = array();
     $currentUser = erLhcoreClassUser::instance();
     if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('icclicktocallform/form', 'Invalid CSRF token!');
     }
     if (!$form->hasValidData('Name') || $form->Name == '') {
         $Errors['Name'] = erTranslationClassLhTranslation::getInstance()->getTranslation('icclicktocallform/form', 'Please enter a name');
     } else {
         $clickform->name = $form->Name;
     }
     if ($form->hasValidData('header_content')) {
         $clickform->header_content = $form->header_content;
     }
     if ($form->hasValidData('header_css')) {
         $clickform->header_css = $form->header_css;
     }
     $resourcesArray = array('static_content', 'static_js_content', 'static_css_content');
     $supportedExtensions = array('zip', 'doc', 'docx', 'ttf', 'pdf', 'xls', 'ico', 'gif', 'xlsx', 'jpg', 'jpeg', 'png', 'bmp', 'rar', '7z', 'css', 'js', 'eot', 'woff', 'woff2', 'svg');
     // Validate resources
     foreach ($resourcesArray as $resource) {
         if ($form->hasValidData($resource . '_hash') && !empty($form->{$resource . '_hash'})) {
             $customFields = $currentStaticResources = $clickform->{$resource . '_array'};
             foreach ($form->{$resource . '_hash'} as $key => $customFieldType) {
                 if (!erLhcoreClassSearchHandler::isFile($resource . '_file_' . $key, $supportedExtensions) && !isset($currentStaticResources[$key]['file'])) {
                     $Errors[$resource . '_file_' . $key] = erTranslationClassLhTranslation::getInstance()->getTranslation('icclicktocallform/form', 'File not chosen for') . (isset($form->{$resource . '_name'}[$key]) ? ' - ' . htmlspecialchars($form->{$resource . '_name'}[$key]) : '');
                 }
             }
             // If there is no errors upload files
             if (empty($Errors)) {
                 foreach ($form->{$resource . '_hash'} as $key => $customFieldType) {
                     $customFields[$key]['name'] = $form->{$resource . '_name'}[$key];
                     $customFields[$key]['hash'] = $key;
                     if (erLhcoreClassSearchHandler::isFile($resource . '_file_' . $key, $supportedExtensions)) {
                         // Check there is already uploaded file and remove it
                         $clickform->removeResource($resource, $key);
                         // Store new file if required
                         $dir = 'var/storageadmintheme/' . date('Y') . 'y/' . date('m') . '/' . date('d') . '/' . $clickform->id . '/';
                         erLhcoreClassChatEventDispatcher::getInstance()->dispatch('admintheme.filedir', array('dir' => &$dir, 'storage_id' => $clickform->id));
                         erLhcoreClassFileUpload::mkdirRecursive($dir);
                         $customFields[$key]['file'] = erLhcoreClassSearchHandler::moveUploadedFile($resource . '_file_' . $key, $dir . '/', '.');
                         $customFields[$key]['file_dir'] = $dir;
                     }
                 }
                 $clickform->{$resource} = json_encode($customFields, JSON_HEX_APOS);
             }
         } else {
             $clickform->{$resource} = '';
         }
     }
     return $Errors;
 }
开发者ID:detain,项目名称:livehelperchat,代码行数:55,代码来源:lhthemevalidator.php


示例9: validateSurvey

 public static function validateSurvey(erLhAbstractModelSurveyItem &$surveyItem, erLhAbstractModelSurvey $survey)
 {
     $definition = array('StarsValue' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1, 'max_range' => $survey->max_stars)));
     $form = new ezcInputForm(INPUT_POST, $definition);
     $Errors = array();
     if (!$form->hasValidData('StarsValue')) {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please choose a star');
     } else {
         $surveyItem->stars = $form->StarsValue;
     }
     return $Errors;
 }
开发者ID:mdb-webdev,项目名称:livehelperchat,代码行数:12,代码来源:lhsurveyvalidator.php


示例10: validateSurvey

 public static function validateSurvey(erLhAbstractModelSurveyItem &$surveyItem, erLhAbstractModelSurvey $survey)
 {
     include erLhcoreClassDesign::designtpl('lhsurvey/forms/fields_names.tpl.php');
     $definition = array();
     for ($i = 0; $i < 16; $i++) {
         foreach ($sortOptions as $keyOption => $sortOption) {
             if ($survey->{$keyOption . '_pos'} == $i && $survey->{$keyOption . '_enabled'}) {
                 if ($sortOption['type'] == 'stars') {
                     $definition[$sortOption['field'] . 'Evaluate'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1, 'max_range' => $survey->{$sortOption}['field']));
                 } elseif ($sortOption['type'] == 'question') {
                     $definition[$sortOption['field'] . 'Question'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
                 } elseif ($sortOption['type'] == 'question_options') {
                     $definition[$sortOption['field'] . 'EvaluateOption'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1));
                 }
             }
         }
     }
     $form = new ezcInputForm(INPUT_POST, $definition);
     $Errors = array();
     for ($i = 0; $i < 16; $i++) {
         foreach ($sortOptions as $keyOption => $sortOption) {
             if ($survey->{$keyOption . '_pos'} == $i && $survey->{$keyOption . '_enabled'}) {
                 if ($sortOption['type'] == 'stars') {
                     if (!$form->hasValidData($sortOption['field'] . 'Evaluate')) {
                         if ($survey->{$keyOption . '_req'} == 1) {
                             $Errors[] = '"' . htmlspecialchars(trim($survey->{$keyOption . '_title'})) . '" : ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'is required');
                         }
                     } else {
                         $surveyItem->{$sortOption['field']} = $form->{$sortOption['field'] . 'Evaluate'};
                     }
                 } elseif ($sortOption['type'] == 'question') {
                     if (!$form->hasValidData($sortOption['field'] . 'Question') || $form->{$sortOption['field'] . 'Question'} == '' && $survey->{$keyOption . '_req'} == 1) {
                         // @todo Make possible to choose field type in the future
                         $Errors[] = '"' . htmlspecialchars(trim($survey->{$keyOption})) . '" : ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'is required');
                     } else {
                         $surveyItem->{$sortOption['field']} = $form->{$sortOption['field'] . 'Question'};
                     }
                 } elseif ($sortOption['type'] == 'question_options') {
                     if (!$form->hasValidData($sortOption['field'] . 'EvaluateOption')) {
                         if ($survey->{$keyOption . '_req'} == 1) {
                             $Errors[] = '"' . htmlspecialchars(trim($survey->{$sortOption['field']})) . '" : ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'is required');
                         }
                     } else {
                         $surveyItem->{$sortOption['field']} = $form->{$sortOption['field'] . 'EvaluateOption'};
                     }
                 }
             }
         }
     }
     erLhcoreClassChatEventDispatcher::getInstance()->dispatch('survey.validate', array('survey' => &$survey, 'survey_item' => &$surveyItem, 'errors' => &$Errors));
     return $Errors;
 }
开发者ID:detain,项目名称:livehelperchat,代码行数:52,代码来源:lhsurveyvalidator.php


示例11: chatListExportXLS

 public static function chatListExportXLS($chats)
 {
     include 'lib/core/lhform/PHPExcel.php';
     $objPHPExcel = new PHPExcel();
     $objPHPExcel->setActiveSheetIndex(0);
     $objPHPExcel->getActiveSheet()->getStyle('A1:AW1')->getFont()->setBold(true);
     $objPHPExcel->getActiveSheet()->setTitle('Report');
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, 1, "ID");
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Visitor Name'));
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(2, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'E-mail'));
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(3, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Phone'));
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(4, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Country'));
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(5, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'City'));
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(6, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'IP'));
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(7, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Operator'));
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(8, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Department'));
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(9, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Date'));
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(10, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Mail send'));
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(11, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Referrer'));
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(12, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Link'));
     $attributes = array('id', 'nick', 'email', 'phone', 'country_name', 'city', 'ip', 'user', 'department');
     $i = 2;
     foreach ($chats as $item) {
         foreach ($attributes as $key => $attr) {
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($key, $i, (string) $item->{$attr});
         }
         $key++;
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($key, $i, date(erLhcoreClassModule::$dateFormat, $item->time));
         $key++;
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($key, $i, $item->mail_send == 1 ? 'Yes' : 'No');
         $key++;
         if ($item->session_referrer != '') {
             $referer = parse_url($item->session_referrer);
             if (isset($referer['host'])) {
                 $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($key, $i, $referer['host']);
             }
         }
         $key++;
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($key, $i, "URL");
         $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($key, $i)->getHyperlink()->setUrl(erLhcoreClassXMP::getBaseHost() . $_SERVER['HTTP_HOST'] . erLhcoreClassDesign::baseurl('user/login') . '/(r)/' . rawurlencode(base64_encode('chat/single/' . $item->id)));
         $i++;
     }
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
     // We'll be outputting an excel file
     header('Content-type: application/vnd.ms-excel');
     // It will be called file.xls
     header('Content-Disposition: attachment; filename="report.xlsx"');
     // Write file to the browser
     $objWriter->save('php://output');
 }
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:50,代码来源:lhchatexport.php


示例12: fillDataByChat

 public function fillDataByChat($chat)
 {
     $this->getConfig();
     $messages = array_reverse(erLhcoreClassModelmsg::getList(array('limit' => 5000, 'sort' => 'id DESC', 'filter' => array('chat_id' => $chat->id))));
     $messagesContent = '';
     foreach ($messages as $msg) {
         if ($msg->user_id == -1) {
             $messagesContent .= date(erLhcoreClassModule::$dateDateHourFormat, $msg->time) . ' ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncadmin', 'System assistant') . ': ' . htmlspecialchars($msg->msg) . "\n";
         } else {
             $messagesContent .= date(erLhcoreClassModule::$dateDateHourFormat, $msg->time) . ' ' . ($msg->user_id == 0 ? htmlspecialchars($chat->nick) : htmlspecialchars($msg->name_support)) . ': ' . htmlspecialchars($msg->msg) . "\n";
         }
     }
     $data = array('name' => $chat->nick, 'email' => $chat->email, 'subject' => str_replace(array('{referrer}', '{nick}', '{email}', '{country_code}', '{country_name}', '{city}', '{user_tz_identifier}'), array($chat->referrer, $chat->nick, $chat->email, $chat->country_code, $chat->country_name, $chat->city, $chat->user_tz_identifier), $this->configData['subject']), 'message' => str_replace(array('{time_created_front}', '{additional_data}', '{id}', '{url}', '{referrer}', '{messages}', '{remarks}', '{nick}', '{email}', '{country_code}', '{country_name}', '{city}', '{user_tz_identifier}'), array(date(erLhcoreClassModule::$dateDateHourFormat, $chat->time), $chat->additional_data, $chat->id, (erLhcoreClassSystem::$httpsMode == true ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . erLhcoreClassDesign::baseurl('user/login') . '/(r)/' . rawurlencode(base64_encode('chat/single/' . $chat->id)), $chat->referrer, $messagesContent, $chat->remarks, $chat->nick, $chat->email, $chat->country_code, $chat->country_name, $chat->city, $chat->user_tz_identifier), $this->configData['message']), 'ip' => $chat->ip);
     return $data;
 }
开发者ID:SetRandom,项目名称:osTicket,代码行数:15,代码来源:bootstrap.php


示例13: translate

 public static function translate($apiKey, $word, $from, $to)
 {
     $url = "https://www.googleapis.com/language/translate/v2?key={$apiKey}&q=" . urlencode($word) . "&source={$from}&target={$to}";
     $rsp = self::executeRequest($url);
     $data = json_decode($rsp, true);
     if (isset($data['data']['translations'][0]['translatedText'])) {
         $errors = array();
         erLhcoreClassChatEventDispatcher::getInstance()->dispatch('translate.after_google_translate', array('word' => &$word, 'errors' => &$errors));
         if (!empty($errors)) {
             throw new Exception(erTranslationClassLhTranslation::getInstance()->getTranslation('chat/translation', 'Could not translate') . ' - ' . implode('; ', $errors));
         }
         return htmlspecialchars_decode($data['data']['translations'][0]['translatedText']);
     }
     throw new Exception(erTranslationClassLhTranslation::getInstance()->getTranslation('chat/translation', 'Could not translate') . ' - ' . $rsp);
 }
开发者ID:detain,项目名称:livehelperchat,代码行数:15,代码来源:lhgoogletranslate.php


示例14: setChatLanguages

 /**
  * Set's chat language
  * 
  * Detects chats languages, operator and visitor and translates recent chat messages
  * 
  * @param erLhcoreClassModelChat $chat
  * 
  * @param string $visitorLanguage | Optional
  * 
  * @param string $operatorLanguage | Optional
  * 
  * @return void || Exception
  * */
 public static function setChatLanguages(erLhcoreClassModelChat $chat, $visitorLanguage, $operatorLanguage)
 {
     $originalLanguages = array('chat_locale' => $chat->chat_locale, 'chat_locale_to' => $chat->chat_locale_to);
     $supportedLanguages = self::getSupportedLanguages(true);
     $db = ezcDbInstance::get();
     $data = array();
     if (key_exists($visitorLanguage, $supportedLanguages)) {
         $chat->chat_locale = $data['chat_locale'] = $visitorLanguage;
     } else {
         // We take few first messages from visitor and try to detect language
         $stmt = $db->prepare('SELECT msg FROM lh_msg WHERE chat_id = :chat_id AND user_id = 0 ORDER BY id ASC LIMIT 3 OFFSET 0');
         $stmt->bindValue(':chat_id', $chat->id);
         $stmt->execute();
         $rows = $stmt->fetchAll(PDO::FETCH_COLUMN);
         foreach ($rows as &$row) {
             $row = preg_replace('#\\[translation\\](.*?)\\[/translation\\]#is', '', $row);
         }
         $msgText = substr(implode("\n", $rows), 0, 500);
         $languageCode = self::detectLanguage($msgText);
         $chat->chat_locale = $data['chat_locale'] = $languageCode;
     }
     if (key_exists($operatorLanguage, $supportedLanguages)) {
         $chat->chat_locale_to = $data['chat_locale_to'] = $operatorLanguage;
     } else {
         // We need to detect opetator language, basically we just take back office language and try to find a match
         $languageCode = substr(erLhcoreClassSystem::instance()->Language, 0, 2);
         if (key_exists($languageCode, $supportedLanguages)) {
             $chat->chat_locale_to = $data['chat_locale_to'] = $languageCode;
         } else {
             throw new Exception(erTranslationClassLhTranslation::getInstance()->getTranslation('chat/translation', 'We could not detect operator language'));
         }
     }
     if ($chat->chat_locale == $chat->chat_locale_to) {
         throw new Exception(erTranslationClassLhTranslation::getInstance()->getTranslation('chat/translation', 'Detected operator and visitor languages matches, please choose languages manually'));
     }
     // Because chat data can be already be changed we modify just required fields
     $stmt = $db->prepare('UPDATE lh_chat SET chat_locale_to = :chat_locale_to, chat_locale =:chat_locale WHERE id = :chat_id');
     $stmt->bindValue(':chat_id', $chat->id, PDO::PARAM_INT);
     $stmt->bindValue(':chat_locale_to', $data['chat_locale_to'], PDO::PARAM_STR);
     $stmt->bindValue(':chat_locale', $data['chat_locale'], PDO::PARAM_STR);
     $stmt->execute();
     // We have to translate only if our languages are different
     if ($originalLanguages['chat_locale'] != $chat->chat_locale || $originalLanguages['chat_locale_to'] != $chat->chat_locale_to) {
         // And now we can translate all chat messages
         self::translateChatMessages($chat);
     }
     return $data;
 }
开发者ID:p4prawin,项目名称:livechat,代码行数:61,代码来源:lhtranslate.php


示例15: changeStatus

 public static function changeStatus($params)
 {
     $changeStatus = $params['status'];
     $chat = $params['chat'];
     $userData = $params['user'];
     $allowCloseRemote = $params['allow_close_remote'];
     if ($changeStatus == erLhcoreClassModelChat::STATUS_ACTIVE_CHAT) {
         if ($chat->status != erLhcoreClassModelChat::STATUS_ACTIVE_CHAT) {
             $chat->status = erLhcoreClassModelChat::STATUS_ACTIVE_CHAT;
             $chat->wait_time = time() - $chat->time;
         }
         if ($chat->user_id == 0) {
             $chat->user_id = $userData->id;
         }
         $chat->updateThis();
     } elseif ($changeStatus == erLhcoreClassModelChat::STATUS_PENDING_CHAT) {
         $chat->status = erLhcoreClassModelChat::STATUS_PENDING_CHAT;
         $chat->support_informed = 0;
         $chat->has_unread_messages = 1;
         $chat->updateThis();
     } elseif ($changeStatus == erLhcoreClassModelChat::STATUS_CLOSED_CHAT && $chat->user_id == $userData->id || $allowCloseRemote == true) {
         if ($chat->status != erLhcoreClassModelChat::STATUS_CLOSED_CHAT) {
             $chat->status = erLhcoreClassModelChat::STATUS_CLOSED_CHAT;
             $chat->chat_duration = erLhcoreClassChat::getChatDurationToUpdateChatID($chat->id);
             $msg = new erLhcoreClassModelmsg();
             $msg->msg = (string) $userData . ' ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/closechatadmin', 'has closed the chat!');
             $msg->chat_id = $chat->id;
             $msg->user_id = -1;
             $chat->last_user_msg_time = $msg->time = time();
             erLhcoreClassChat::getSession()->save($msg);
             $chat->updateThis();
             CSCacheAPC::getMem()->removeFromArray('lhc_open_chats', $chat->id);
             // Execute callback for close chat
             erLhcoreClassChat::closeChatCallback($chat, $userData);
         }
     } elseif ($changeStatus == erLhcoreClassModelChat::STATUS_CHATBOX_CHAT) {
         $chat->status = erLhcoreClassModelChat::STATUS_CHATBOX_CHAT;
         erLhcoreClassChat::getSession()->update($chat);
     } elseif ($changeStatus == erLhcoreClassModelChat::STATUS_OPERATORS_CHAT) {
         $chat->status = erLhcoreClassModelChat::STATUS_OPERATORS_CHAT;
         erLhcoreClassChat::getSession()->update($chat);
     }
     erLhcoreClassChat::updateActiveChats($chat->user_id);
     if ($chat->department !== false) {
         erLhcoreClassChat::updateDepartmentStats($chat->department);
     }
 }
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:47,代码来源:lhchathelper.php


示例16: validateXMPPAccount

 public static function validateXMPPAccount(erLhcoreClassModelXMPPAccount &$xmppAccount)
 {
     $definition = array('username' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'password' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'user_id' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1)), 'sendmessage' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'));
     $form = new ezcInputForm(INPUT_POST, $definition);
     $Errors = array();
     // Username is available only for new accounts
     if ($xmppAccount->id == 0) {
         if (!$form->hasValidData('username') || $form->username == '') {
             $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('xmppservice/operatorvalidator', 'Please enter a username');
         } else {
             if (strpos($form->username, 'visitor') === false) {
                 if (preg_match('/[^a-z_0-9]/i', $form->username)) {
                     $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('xmppservice/operatorvalidator', 'Not allowed characters detected');
                 } elseif ($form->username != 'admin') {
                     $subdomain = erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionXmppservice')->settings['subdomain'];
                     $xmppAccount->username = $form->username . ($subdomain != '' ? '.' . $subdomain : '') . '@' . erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionXmppservice')->settings['xmpp_host'];
                 } else {
                     $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('xmppservice/operatorvalidator', 'Admin is reserved username and can not be used');
                 }
             } else {
                 $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('xmppservice/operatorvalidator', 'Username cannot start with visitor keyword');
             }
         }
     }
     if ($xmppAccount->id == 0) {
         if (!$form->hasValidData('password') || $form->password == '') {
             $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('xmppservice/operatorvalidator', 'Please enter a password');
         } else {
             $xmppAccount->password = $form->password;
         }
     } else {
         if ($form->hasValidData('password') && $form->password != '') {
             $xmppAccount->password = $form->password;
         }
     }
     if ($form->hasValidData('user_id')) {
         $xmppAccount->user_id = $form->user_id;
     } else {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('xmppservice/operatorvalidator', 'Please choose opeator id!');
     }
     if ($form->hasValidData('sendmessage') && $form->sendmessage == true) {
         $xmppAccount->sendmessage = 1;
     } else {
         $xmppAccount->sendmessage = 0;
     }
     return $Errors;
 }
开发者ID:noikiy,项目名称:xmpp-chat,代码行数:47,代码来源:erlhcoreclassxmppaccountvalidator.php


示例17: sevabot

 /**
  * Arguments
  * array('chat' => & $chat)
  * */
 public function sevabot($params)
 {
     $settings = (include 'extension/sevabot/settings/settings.ini.php');
     // Format message content
     $chat = $params['chat'];
     $messages = array_reverse(erLhcoreClassModelmsg::getList(array('limit' => 5, 'sort' => 'id DESC', 'filter' => array('chat_id' => $chat->id))));
     $messagesContent = '';
     foreach ($messages as $msg) {
         if ($msg->user_id == -1) {
             $messagesContent .= date(erLhcoreClassModule::$dateDateHourFormat, $msg->time) . ' ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncadmin', 'System assistant') . ': ' . htmlspecialchars($msg->msg) . "\n";
         } else {
             $messagesContent .= date(erLhcoreClassModule::$dateDateHourFormat, $msg->time) . ' ' . ($msg->user_id == 0 ? htmlspecialchars($chat->nick) : htmlspecialchars($msg->name_support)) . ': ' . htmlspecialchars($msg->msg) . "\n";
         }
     }
     $cfgSite = erConfigClassLhConfig::getInstance();
     $secretHash = $cfgSite->getSetting('site', 'secrethash');
     $chatDataItems = $settings['chat'];
     if (isset($settings['chat_dep'][$chat->dep_id]) && !empty($settings['chat_dep'][$chat->dep_id])) {
         $chatDataItems = array_merge($chatDataItems, $settings['chat_dep'][$chat->dep_id]);
     }
     // Global notifications
     foreach ($chatDataItems as $chatData) {
         $veryfyEmail = sha1(sha1($chatData['email'] . $secretHash) . $secretHash);
         $msgParsed = str_replace(array('{messages}', '{url_accept}', '{chat_id}', '{user_name}'), array($messagesContent, erLhcoreClassXMP::getBaseHost() . $_SERVER['HTTP_HOST'] . erLhcoreClassDesign::baseurl('chat/accept') . '/' . erLhcoreClassModelChatAccept::generateAcceptLink($chat) . '/' . $veryfyEmail . '/' . $chatData['email'], $chat->id, $chat->user_name), $settings['msg']);
         $md5 = md5($chatData['chat_id'] . $msgParsed . $settings['sevabot_secret']);
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $settings['url']);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($ch, CURLOPT_TIMEOUT, 5);
         curl_setopt($ch, CURLOPT_POST, true);
         curl_setopt($ch, CURLOPT_POSTFIELDS, array('md5' => $md5, 'msg' => $msgParsed, 'chat' => $chatData['chat_id']));
         curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
         @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
         // Some hostings produces wargning...
         $content = curl_exec($ch);
         if ($content != 'OK') {
             erLhcoreClassLog::write(print_r($content, true));
         }
     }
 }
开发者ID:creativeprogramming,项目名称:livehelperchat-extensions,代码行数:46,代码来源:bootstrap.php


示例18: validateFaq

 public static function validateFaq(&$faq)
 {
     $definition = array('answer' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'question' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'URL' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Email' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'validate_email'), 'Identifier' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'ActiveFAQ' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'));
     $form = new ezcInputForm(INPUT_POST, $definition);
     $Errors = array();
     if (!$form->hasValidData('answer') || $form->answer == '') {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('faq/view', 'Please enter answer!');
     } else {
         $faq->answer = $form->answer;
     }
     if ($form->hasValidData('Identifier') && $form->Identifier != '') {
         if (mb_strlen($form->Identifier) <= 10) {
             $faq->identifier = $form->Identifier;
         } else {
             $faq->identifier = $form->Identifier;
             $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('faq/view', 'Identifier has to be shorter than 10 characters!');
         }
     } else {
         $faq->identifier = '';
     }
     if ($form->hasValidData('Email')) {
         $faq->email = $form->Email;
     } else {
         $faq->email = '';
     }
     if (!$form->hasValidData('question') || $form->question == '') {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('faq/view', 'Please enter question!');
     } else {
         $faq->question = $form->question;
     }
     if ($form->hasValidData('URL')) {
         $faq->url = $form->URL;
     } else {
         $faq->url = '';
     }
     if ($form->hasValidData('ActiveFAQ') && $form->ActiveFAQ == true) {
         $faq->active = 1;
     } else {
         $faq->active = 0;
     }
     return $Errors;
 }
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:42,代码来源:lhfaq.php


示例19: generateEmbedCode

<

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP error类代码示例发布时间:2022-05-23
下一篇:
PHP erLhcoreClassUserDep类代码示例发布时间: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