本文整理汇总了PHP中erLhcoreClassChatEventDispatcher类的典型用法代码示例。如果您正苦于以下问题:PHP erLhcoreClassChatEventDispatcher类的具体用法?PHP erLhcoreClassChatEventDispatcher怎么用?PHP erLhcoreClassChatEventDispatcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了erLhcoreClassChatEventDispatcher类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: setupSMTP
public static function setupSMTP(PHPMailer &$phpMailer)
{
// Allow extension override mail settings
$response = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chatmail.setup_smtp', array('phpmailer' => &$phpMailer));
if ($response !== false && isset($response['status']) && $response['status'] == erLhcoreClassChatEventDispatcher::STOP_WORKFLOW) {
return;
}
$smtpData = erLhcoreClassModelChatConfig::fetch('smtp_data');
$data = (array) $smtpData->data;
if (isset($data['sender']) && $data['sender'] != '') {
$phpMailer->Sender = $data['sender'];
}
if ($phpMailer->From == 'root@localhost') {
$phpMailer->From = $data['default_from'];
}
if ($phpMailer->FromName == 'Root User') {
$phpMailer->FromName = $data['default_from_name'];
}
if (isset($data['use_smtp']) && $data['use_smtp'] == 1) {
$phpMailer->IsSMTP();
$phpMailer->Host = $data['host'];
$phpMailer->Port = $data['port'];
if ($data['username'] != '' && $data['password'] != '') {
$phpMailer->Username = $data['username'];
$phpMailer->Password = $data['password'];
$phpMailer->SMTPAuth = true;
$phpMailer->From = isset($data['default_from']) ? $data['default_from'] : $data['username'];
} else {
$phpMailer->From = '';
}
}
}
开发者ID:sirromas,项目名称:medical,代码行数:32,代码来源:lhchatmail.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: run
public function run()
{
include 'extension/nodejshelper/design/nodejshelpertheme/tpl/pagelayouts/parts/nodejshelper_config.tpl.php';
$this->settings = $nodeJsHelperSettings;
if ($this->settings['use_publish_notifications'] == true) {
include_once 'extension/nodejshelper/vendor/predis-1.0.0/autoload.php';
$dispatcher = erLhcoreClassChatEventDispatcher::getInstance();
// On what events should NodeJS listening operators be notified
$dispatcher->listen('chat.sync_back_office', array($this, 'notifyBackOfficeOperators'));
$dispatcher->listen('chat.chat_started', array($this, 'notifyBackOfficeOperators'));
$dispatcher->listen('chat.data_changed', array($this, 'notifyBackOfficeOperators'));
$dispatcher->listen('chat.unread_chat', array($this, 'notifyBackOfficeOperatorsDelay'));
$dispatcher->listen('chat.data_changed_auto_assign', array($this, 'notifyBackOfficeOperators'));
$dispatcher->listen('chat.data_changed_assigned_department', array($this, 'notifyBackOfficeOperators'));
$dispatcher->listen('chat.close', array($this, 'notifyBackOfficeOperators'));
$dispatcher->listen('chat.delete', array($this, 'notifyBackOfficeOperators'));
$dispatcher->listen('chat.user_reopened', array($this, 'notifyBackOfficeOperators'));
$dispatcher->listen('chat.chat_transfer_accepted', array($this, 'notifyBackOfficeOperators'));
$dispatcher->listen('chat.chat_transfered', array($this, 'notifyBackOfficeOperators'));
$dispatcher->listen('chat.sync_back_office', array($this, 'notifyBackOfficeOperators'));
// Listed for desktop client events
$dispatcher->listen('chat.desktop_client_admin_msg', array($this, 'notifyUserNewMessage'));
$dispatcher->listen('chat.desktop_client_closed', array($this, 'notifyUserNewMessage'));
$dispatcher->listen('chat.desktop_client_deleted', array($this, 'notifyUserNewMessage'));
$dispatcher->listen('chat.messages_added_passive', array($this, 'notifyUserNewMessage'));
$dispatcher->listen('chat.data_changed_chat', array($this, 'dataChangedChat'));
$dispatcher->listen('chat.nodjshelper_notify_delay', array($this, 'notifyBackOfficeOperatorsDelay'));
}
}
开发者ID:creativeprogramming,项目名称:NodeJS-Helper,代码行数:29,代码来源:bootstrap.php
示例4: run
public function run()
{
$this->registerAutoload();
$dispatcher = erLhcoreClassChatEventDispatcher::getInstance();
$this->settings = (include 'extension/singlesignon/settings/settings.ini.php');
// Attatch event listeners
$dispatcher->listen('chat.close', array($this, 'chatClosed'));
}
开发者ID:creativeprogramming,项目名称:livehelperchat-extensions,代码行数:8,代码来源:bootstrap.php
示例5: 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
示例6: 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
示例7: 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
示例8: 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
示例9: addPageView
public static function addPageView(erLhcoreClassModelChatOnlineUser $onlineUser)
{
$item = new self();
$item->chat_id = $onlineUser->chat_id;
$item->online_user_id = $onlineUser->id;
$item->vtime = time();
$item->page = $_SERVER['HTTP_REFERER'];
erLhcoreClassChat::getSession()->save($item);
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('onlinefootprint.created', array('item' => &$item));
}
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:10,代码来源:erlhcoreclassmodelchatonlineuserfootprint.php
示例10: 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
示例11: removeThis
public function removeThis()
{
if (file_exists($this->file_path_server)) {
unlink($this->file_path_server);
}
if ($this->file_path != '') {
erLhcoreClassFileUpload::removeRecursiveIfEmpty('var/', str_replace('var/', '', $this->file_path));
}
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('file.remove_file', array('chat_file' => &$this));
erLhcoreClassChat::getSession()->delete($this);
}
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:11,代码来源:erlhcoreclassmodelchatfile.php
示例12: 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
示例13: 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;
}
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('survey.validate', array('survey' => &$survey, 'errors' => &$Errors));
return $Errors;
}
开发者ID:jackfoust,项目名称:livehelperchat,代码行数:13,代码来源:lhsurveyvalidator.php
示例14: run
public function run()
{
$dispatcher = erLhcoreClassChatEventDispatcher::getInstance();
/**
* We listen to all events, but check is done only in even method. This way we save 1 disk call for configuraiton file read.
* */
/**
* User events
*/
$dispatcher->listen('chat.close', array($this, 'chatClosed'));
$dispatcher->listen('chat.chat_started', array($this, 'chatCreated'));
$dispatcher->listen('chat.chat_offline_request', array($this, 'chatOfflineRequest'));
}
开发者ID:SetRandom,项目名称:osTicket,代码行数:13,代码来源:bootstrap.php
示例15: validateCannedMessage
public static function validateCannedMessage(erLhcoreClassModelCannedMsg &$cannedMessage, $userDepartments)
{
$definition = array('Message' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'FallbackMessage' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Title' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'ExplainHover' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Position' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0)), 'Delay' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0)), 'DepartmentID' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1)), 'AutoSend' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'));
$form = new ezcInputForm(INPUT_POST, $definition);
$Errors = array();
if (!$form->hasValidData('Message') || $form->Message == '') {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg', 'Please enter a canned message');
} else {
$cannedMessage->msg = $form->Message;
}
if ($form->hasValidData('FallbackMessage')) {
$cannedMessage->fallback_msg = $form->FallbackMessage;
}
if ($form->hasValidData('Title')) {
$cannedMessage->title = $form->Title;
}
if ($form->hasValidData('ExplainHover')) {
$cannedMessage->explain = $form->ExplainHover;
}
if ($form->hasValidData('AutoSend') && $form->AutoSend == true) {
$cannedMessage->auto_send = 1;
} else {
$cannedMessage->auto_send = 0;
}
if ($form->hasValidData('Position')) {
$cannedMessage->position = $form->Position;
}
if ($form->hasValidData('Delay')) {
$cannedMessage->delay = $form->Delay;
}
if ($form->hasValidData('DepartmentID')) {
$cannedMessage->department_id = $form->DepartmentID;
if ($userDepartments !== true) {
if (!in_array($cannedMessage->department_id, $userDepartments)) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg', 'Please choose a department');
}
}
} else {
$response = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.validate_canned_msg_user_departments', array('canned_msg' => &$cannedMessage, 'errors' => &$Errors));
// Perhaps extension did some internal validation and we don't need anymore validate internaly
if ($response === false) {
// User has to choose a department
if ($userDepartments !== true) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg', 'Please choose a department');
} else {
$cannedMessage->department_id = 0;
}
}
}
return $Errors;
}
开发者ID:niravpatel2008,项目名称:north-american-nemesis-new,代码行数:51,代码来源:lhchatadminvalidatorhelper.php
示例16: deletePhoto
public function deletePhoto($attr)
{
if ($this->{$attr} != '') {
if (file_exists($this->{$attr . '_path'} . $this->{$attr})) {
unlink($this->{$attr . '_path'} . $this->{$attr});
}
if ($this->{$attr . '_path'} != '') {
erLhcoreClassFileUpload::removeRecursiveIfEmpty('var/storagetheme/', str_replace('var/storagetheme/', '', $this->{$attr . '_path'}));
}
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('theme.edit.remove_' . $attr, array('theme' => &$this, 'path_attr' => $attr . '_path', 'name' => $this->{$attr}));
$this->{$attr} = '';
$this->{$attr . '_path'} = '';
}
}
开发者ID:nagyistoce,项目名称:livehelperchat,代码行数:14,代码来源:erlhabstractmodelwidgettheme.php
示例17: 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
示例18: movePhoto
public function movePhoto($attr, $isLocal = false, $localFile = false)
{
$this->deletePhoto($attr);
if ($this->id != null) {
$dir = 'var/storagetheme/' . date('Y') . 'y/' . date('m') . '/' . date('d') . '/' . $this->id . '/';
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('theme.edit.' . $attr . '_path', array('dir' => &$dir, 'storage_id' => $this->id));
erLhcoreClassFileUpload::mkdirRecursive($dir);
if ($isLocal == false) {
$this->{$attr} = erLhcoreClassSearchHandler::moveUploadedFile('AbstractInput_' . $attr, $dir . '/', '.');
} else {
$this->{$attr} = erLhcoreClassSearchHandler::moveLocalFile($localFile, $dir . '/', '.');
}
$this->{$attr . '_path'} = $dir;
} else {
$this->{$attr . '_pending'} = true;
}
}
开发者ID:Topspot,项目名称:livehelperchat,代码行数:17,代码来源:erlhabstractmodelwidgettheme.php
示例19: removeInstanceData
public function removeInstanceData()
{
foreach (erLhAbstractModelFormCollected::getList(array('limit' => 1000000)) as $item) {
$item->removeThis();
}
foreach (erLhAbstractModelWidgetTheme::getList(array('limit' => 1000000)) as $item) {
$item->removeThis();
}
foreach (erLhcoreClassChat::getList(array('limit' => 1000000)) as $item) {
$item->removeThis();
}
foreach (erLhcoreClassChat::getList(array('limit' => 1000000), 'erLhcoreClassModelChatFile', 'lh_chat_file') as $item) {
$item->removeThis();
}
foreach (erLhcoreClassModelUser::getUserList(array('limit' => 1000000)) as $item) {
$item->removeFile();
}
// Dispatch event for extensions
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('instance.destroyed', array('instance' => $this));
return true;
}
开发者ID:hgeorge123,项目名称:automated-hosting,代码行数:21,代码来源:erlhcoreclassmodelinstance.php
示例20: erLhcoreClassTemplate
/**
* Constructor
*
* @param $file string the file name you want to load
*/
function erLhcoreClassTemplate($file = null)
{
$cfg = erConfigClassLhConfig::getInstance();
$this->cacheEnabled = $cfg->getSetting('site', 'templatecache');
$this->templatecompile = $cfg->getSetting('site', 'templatecompile');
if (!is_null($file)) {
$this->file = $file;
}
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('tpl.new', array('tpl' => &$this));
$cacheObj = CSCacheAPC::getMem();
if (($this->cacheTemplates = $cacheObj->restore('templateCacheArray_version_' . $cacheObj->getCacheVersion('site_version'))) === false) {
try {
$this->cacheWriter = new erLhcoreClassCacheStorage('cache/cacheconfig/');
} catch (Exception $e) {
$instance = erLhcoreClassSystem::instance();
if ($instance->SiteAccess != 'site_admin') {
// Perhaps user opened site without installing it first?
if ($cfg->getSetting('site', 'installed') == false) {
header('Location: ' . erLhcoreClassDesign::baseurldirect('site_admin/install/install'));
exit;
}
header('HTTP/1.1 503 Service Temporarily Unavailable');
header('Status: 503 Service Temporarily Unavailable');
echo "<h1>Make sure cache/cacheconfig is writable by application</h1>";
exit;
} else {
throw $e;
}
}
if (($this->cacheTemplates = $this->cacheWriter->restore('templateCache')) == false) {
try {
$this->cacheWriter->store('templateCache', array());
$this->cacheTemplates = array();
} catch (Exception $e) {
// Do nothing
}
$cacheObj->store('templateCacheArray_version_' . $cacheObj->getCacheVersion('site_version'), array());
}
}
}
开发者ID:mdb-webdev,项目名称:livehelperchat,代码行数:45,代码来源:tpl.php
注:本文中的erLhcoreClassChatEventDispatcher类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论