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


PHP CSCacheAPC类代码示例

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


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

示例1: expireCache

 public function expireCache()
 {
     if (isset($_SESSION['lhc_chat_config'])) {
         unset($_SESSION['lhc_chat_config']);
     }
     if ($this->expiredInRuntime == false) {
         $this->expiredInRuntime = true;
         foreach ($this->expireOptions as $option) {
             $this->setSetting('cachetimestamps', $option, 0);
         }
         foreach ($this->sessionExpireOptions as $option) {
             if (isset($_SESSION[$option])) {
                 unset($_SESSION[$option]);
             }
         }
         $compiledModules = ezcBaseFile::findRecursive('cache/cacheconfig', array('@\\.cache\\.php@'));
         foreach ($compiledModules as $compiledClass) {
             unlink($compiledClass);
         }
         $compiledTemplates = ezcBaseFile::findRecursive('cache/compiledtemplates', array('@(\\.php|\\.js|\\.css)@'));
         foreach ($compiledTemplates as $compiledTemplate) {
             unlink($compiledTemplate);
         }
         $instance = CSCacheAPC::getMem();
         $instance->increaseImageManipulationCache();
         $this->save();
     }
 }
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:28,代码来源:lhcacheconfig.php

示例2: getMem

 static function getMem()
 {
     if (self::$m_objMem == NULL) {
         self::$m_objMem = new CSCacheAPC();
     }
     return self::$m_objMem;
 }
开发者ID:kenjiro7,项目名称:livehelperchat,代码行数:7,代码来源:lhsys.php

示例3: getTranslatedURL

 public static function getTranslatedURL($url, $suburl = '')
 {
     $cache = CSCacheAPC::getMem();
     $cacheKey = md5('site_version_' . $cache->getCacheVersion('site_version') . '_alias_' . $url . '_' . $suburl);
     if (($returnAlias = $cache->restore($cacheKey)) === false) {
         $url = erLhcoreClassCharTransform::TransformToURL($url);
         $returnAlias = false;
         if ($returnAlias !== false) {
             $cache->store($cacheKey, $returnAlias);
         }
     }
     return $returnAlias;
 }
开发者ID:sslavescu,项目名称:livehelperchat,代码行数:13,代码来源:lhurl.php

示例4: fetchCache

 public static function fetchCache($identifier)
 {
     if (self::$disableCache == false && isset($GLOBALS['lhc_erLhcoreClassModelChatConfig' . $identifier])) {
         return $GLOBALS['lhc_erLhcoreClassModelChatConfig' . $identifier];
     }
     $cache = CSCacheAPC::getMem();
     $configArray = $cache->getArray('lhc_chat_config');
     if (isset($configArray[$identifier])) {
         return $configArray[$identifier];
     } else {
         $_SESSION['lhc_chat_config'][$identifier] = self::fetch($identifier);
         return $_SESSION['lhc_chat_config'][$identifier];
     }
 }
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:14,代码来源:erlhcoreclassmodelchatconfig.php

示例5: 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

示例6: ezcInputForm

     exit;
 }
 $form = new ezcInputForm(INPUT_POST, $definition);
 $Errors = array();
 if (!$form->hasValidData('Username')) {
     $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/account', 'Please enter a username!');
 } elseif ($form->hasValidData('Username') && $form->Username != $UserData->username && !erLhcoreClassModelUser::userExists($form->Username)) {
     $UserData->username = $form->Username;
 } elseif ($form->hasValidData('Username') && $form->Username != $UserData->username) {
     $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/account', 'User exists!');
 }
 if ($form->hasValidData('UserTimeZone') && $form->UserTimeZone != '') {
     $UserData->time_zone = $form->UserTimeZone;
     CSCacheAPC::getMem()->setSession('lhc_user_timezone', $UserData->time_zone, true);
 } else {
     CSCacheAPC::getMem()->setSession('lhc_user_timezone', '', true);
     $UserData->time_zone = '';
 }
 if (!$form->hasValidData('Email')) {
     $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/account', 'Wrong email address');
 }
 if (!$form->hasValidData('Name') || $form->Name == '') {
     $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/account', 'Please enter a name');
 }
 if ($form->hasValidData('Surname') && $form->Surname != '') {
     $UserData->surname = $form->Surname;
 } else {
     $UserData->surname = '';
 }
 if ($form->hasValidData('JobTitle') && $form->JobTitle != '') {
     $UserData->job_title = $form->JobTitle;
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:31,代码来源:account.php

示例7: time

<?php

$tpl = erLhcoreClassTemplate::getInstance('lhchat/adminchat.tpl.php');
$chat = erLhcoreClassChat::getSession()->load('erLhcoreClassModelChat', $Params['user_parameters']['chat_id']);
$tpl->set('chat', $chat);
if (erLhcoreClassChat::hasAccessToRead($chat)) {
    $userData = $currentUser->getUserData();
    if ($Params['user_parameters_unordered']['remember'] == 'true') {
        CSCacheAPC::getMem()->appendToArray('lhc_open_chats', $chat->id);
    }
    if ($userData->invisible_mode == 0) {
        $operatorAccepted = false;
        $chatDataChanged = false;
        if ($chat->user_id == 0) {
            $currentUser = erLhcoreClassUser::instance();
            $chat->user_id = $currentUser->getUserID();
            $chatDataChanged = true;
        }
        // If status is pending change status to active
        if ($chat->status == erLhcoreClassModelChat::STATUS_PENDING_CHAT) {
            $chat->status = erLhcoreClassModelChat::STATUS_ACTIVE_CHAT;
            if ($chat->wait_time == 0) {
                $chat->wait_time = time() - $chat->time;
            }
            $chat->user_id = $currentUser->getUserID();
            $operatorAccepted = true;
            $chatDataChanged = true;
        }
        if ($chat->support_informed == 0 || $chat->has_unread_messages == 1 || $chat->unread_messages_informed == 1) {
            $chatDataChanged = true;
        }
开发者ID:mdb-webdev,项目名称:livehelperchat,代码行数:31,代码来源:adminchat.php

示例8: getList

 public static function getList($paramsSearch = array())
 {
     $paramsDefault = array('limit' => 500, 'offset' => 0);
     $params = array_merge($paramsDefault, $paramsSearch);
     if (isset($params['enable_sql_cache']) && $params['enable_sql_cache'] == true) {
         $sql = self::multi_implode(',', $params);
         $cache = CSCacheAPC::getMem();
         $cacheKey = isset($params['cache_key']) ? md5($sql . $params['cache_key']) : md5('objects_list_' . strtolower(__CLASS__) . '_v_' . $cache->getCacheVersion('site_attributes_version_' . strtolower(__CLASS__)) . $sql);
         if (($result = $cache->restore($cacheKey)) !== false) {
             return $result;
         }
     }
     $session = self::getSession();
     $q = $session->createFindQuery(__CLASS__);
     $conditions = self::getConditions($params, $q);
     if (count($conditions) > 0) {
         $q->where($conditions);
     }
     if ($params['limit'] !== false) {
         $q->limit($params['limit'], $params['offset']);
     }
     if (!isset($params['sort']) || $params['sort'] !== false) {
         if (isset(self::$dbDefaultSort)) {
             $q->orderBy(isset($params['sort']) ? $params['sort'] : self::$dbDefaultSort);
         } else {
             $q->orderBy(isset($params['sort']) ? $params['sort'] : self::$dbTable . "." . self::$dbTableId . " " . self::$dbSortOrder);
         }
     }
     $objects = $session->find($q);
     if (isset($params['prefill_attributes'])) {
         foreach ($params['prefill_attributes'] as $attr => $prefillOptions) {
             $teamsId = array();
             foreach ($objects as $object) {
                 $teamsId[] = $object->{$prefillOptions}['attr_id'];
             }
             if (!empty($teamsId)) {
                 $teams = call_user_func($object->{$prefillOptions}['function'], array('limit' => false, 'sort' => false, 'filterin' => array('id' => $teamsId)));
                 foreach ($objects as &$object) {
                     if (isset($teams[$object->{$prefillOptions}['attr_id']])) {
                         $object->{$prefillOptions}['attr_name'] = $teams[$object->{$prefillOptions}['attr_id']];
                     }
                 }
             }
         }
     }
     if (isset($params['enable_sql_cache']) && $params['enable_sql_cache'] == true) {
         if (isset($params['sql_cache_timeout'])) {
             $cache->store($cacheKey, $objects, $params['sql_cache_timeout']);
         } else {
             $cache->store($cacheKey, $objects);
         }
     }
     return $objects;
 }
开发者ID:sirromas,项目名称:medical,代码行数:54,代码来源:lhdbtrait.php

示例9: canReopenDirectly

 public static function canReopenDirectly($params = array())
 {
     if (($chatPart = CSCacheAPC::getMem()->getSession('chat_hash_widget_resume', true)) !== false) {
         try {
             $parts = explode('_', $chatPart);
             $chat = erLhcoreClassModelChat::fetch($parts[0]);
             if (($chat->last_user_msg_time > time() - 600 || $chat->last_user_msg_time == 0) && (!isset($params['reopen_closed']) || $params['reopen_closed'] == 1 || $params['reopen_closed'] == 0 && $chat->status != erLhcoreClassModelChat::STATUS_CLOSED_CHAT)) {
                 return array('id' => $parts[0], 'hash' => $parts[1]);
             } else {
                 return false;
             }
         } catch (Exception $e) {
             return false;
         }
     }
     return false;
 }
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:17,代码来源:lhchat.php

示例10: array

        }
    }
    ?>
</div></div></div><script>$( document ).ready(function() {lhinst.attachTabNavigator();$('#right-column-page').removeAttr('id');$('#tabs a:first').tab('show')});<?php 
    $chatsOpen = CSCacheAPC::getMem()->getArray('lhc_open_chats');
    if (!empty($chatsOpen)) {
        $chats = erLhcoreClassChat::getList(array('filterin' => array('id' => $chatsOpen)));
        $deleteKeys = array_diff($chatsOpen, array_keys($chats));
        foreach ($deleteKeys as $chat_id) {
            CSCacheAPC::getMem()->removeFromArray('lhc_open_chats', $chat_id);
        }
        foreach ($chats as $chat) {
            if (erLhcoreClassChat::hasAccessToRead($chat)) {
                echo "lhinst.startChat('{$chat->id}',\$('#tabs'),'" . erLhcoreClassDesign::shrt($chat->nick, 10, '...', 30, ENT_QUOTES) . "');";
            } else {
                CSCacheAPC::getMem()->removeFromArray('lhc_open_chats', $chat->id);
            }
        }
    }
    ?>
</script><?php 
} else {
    ?>
<h1>System configuration</h1><?php 
    $currentUser = erLhcoreClassUser::instance();
    ?>
<div role="tabpanel"><ul class="nav nav-tabs" role="tablist"><li role="presentation" class="active"><a href="#system" aria-controls="system" role="tab" data-toggle="tab">System</a></li><?php 
    $system_configuration_tabs_generate_js_enabled = true;
    if ($system_configuration_tabs_generate_js_enabled == true && $currentUser->hasAccessTo('lhsystem', 'generate_js_tab')) {
        ?>
<li role="presentation"><a href="#embed" aria-controls="embed" role="tab" data-toggle="tab">Embed code</a></li><?php 
开发者ID:niravpatel2008,项目名称:north-american-nemesis-new,代码行数:31,代码来源:5d0370c4f43d45420ba48ede3ad4b44f.php

示例11: time

        // Set last message ID
        if ($Chat->last_msg_id < $msg->id) {
            $Chat->last_msg_id = $msg->id;
        }
        // Delete legacy messages, propability 1 of 100
        if (1 == mt_rand(1, 100)) {
            erLhcoreClassChatbox::cleanupChatbox($Chat);
        }
        $Chat->last_user_msg_time = $msg->time = time();
        $Chat->has_unread_messages = 1;
        $Chat->updateThis();
        if ($Params['user_parameters_unordered']['render'] == 'true') {
            $tpl = erLhcoreClassTemplate::getInstance('lhchatbox/render.tpl.php');
            $tpl->set('msg', $msg);
            $tpl->set('chat', $Chat);
            $content = $tpl->fetch();
            $parts = explode('{{SPLITTER}}', $content);
            $partsReturn['or'] = $parts[0];
            $partsReturn['ur'] = $parts[1];
        }
        // Just increase cache version upon message ad
        CSCacheAPC::getMem()->increaseCacheVersion('chatbox_' . erLhcoreClassChatbox::getIdentifierByChatId($Chat->id));
        echo json_encode(array('error' => $error, 'id' => $msg->id, 'or' => $partsReturn['or'], 'ur' => $partsReturn['ur'], 'sender' => $sender));
        exit;
    }
} else {
    $error = 't';
    $partsReturn['or'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please enter a message, max characters') . ' - ' . (int) erLhcoreClassModelChatConfig::fetch('max_message_length')->current_value;
    echo json_encode(array('error' => $error, 'or' => $partsReturn['or']));
    exit;
}
开发者ID:detain,项目名称:livehelperchat,代码行数:31,代码来源:addmsguser.php

示例12: die

<?php

if (!$currentUser->validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
    die('Invalid CSFR Token');
    exit;
}
$ObjectData = erLhcoreClassAbstract::getSession()->load('erLhAbstractModel' . $Params['user_parameters']['identifier'], (int) $Params['user_parameters']['object_id']);
$object_trans = $ObjectData->getModuleTranslations();
if (isset($object_trans['permission']) && !$currentUser->hasAccessTo($object_trans['permission']['module'], $object_trans['permission']['function'])) {
    erLhcoreClassModule::redirect();
    exit;
}
if (method_exists($ObjectData, 'checkPermission')) {
    if ($ObjectData->checkPermission() === false) {
        erLhcoreClassModule::redirect();
        exit;
    }
}
$ObjectData->removeThis();
$cache = CSCacheAPC::getMem();
$cache->increaseCacheVersion('site_attributes_version');
erLhcoreClassModule::redirect('abstract/list', '/' . $Params['user_parameters']['identifier']);
exit;
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:23,代码来源:delete.php

示例13: storeCache

 function storeCache()
 {
     if (is_null($this->cacheWriter)) {
         $this->cacheWriter = new erLhcoreClassCacheStorage('cache/cacheconfig/');
     }
     try {
         $this->cacheWriter->store('templateCache', $this->cacheTemplates);
     } catch (Exception $e) {
         // Do nothing, this happens on a lot of requests
     }
     $cacheObj = CSCacheAPC::getMem();
     $cacheObj->store('templateCacheArray_version_' . $cacheObj->getCacheVersion('site_version'), $this->cacheTemplates);
 }
开发者ID:mdb-webdev,项目名称:livehelperchat,代码行数:13,代码来源:tpl.php

示例14: validateAccount

 public static function validateAccount(&$userData)
 {
     $definition = array('Password' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Password1' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Email' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'validate_email'), 'Name' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'unsafe_raw'), 'Surname' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'unsafe_raw'), 'Username' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'JobTitle' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Skype' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'XMPPUsername' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'ChatNickname' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'UserTimeZone' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'UserInvisible' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'ReceivePermissionRequest' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'));
     $form = new ezcInputForm(INPUT_POST, $definition);
     $Errors = array();
     if (!$form->hasValidData('Username') || $form->Username == '') {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/validator', 'Please enter a username');
     } else {
         if ($form->Username != $userData->username) {
             $userData->username = $form->Username;
             if (erLhcoreClassModelUser::userExists($userData->username) === true) {
                 $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/validator', 'User exists');
             }
         }
     }
     if ($form->hasValidData('Password') && $form->hasValidData('Password1')) {
         $userData->password_temp_1 = $form->Password;
         $userData->password_temp_2 = $form->Password1;
     }
     if ($form->hasInputField('Password') && (!$form->hasInputField('Password1') || $form->Password != $form->Password1)) {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/validator', 'Passwords mismatch');
     } else {
         if ($form->hasInputField('Password') && $form->hasInputField('Password1') && $form->Password != '' && $form->Password1 != '') {
             $userData->setPassword($form->Password);
             $userData->password_front = $form->Password;
         }
     }
     if ($form->hasValidData('ChatNickname') && $form->ChatNickname != '') {
         $userData->chat_nickname = $form->ChatNickname;
     } else {
         $userData->chat_nickname = '';
     }
     if (!$form->hasValidData('Email')) {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/validator', 'Wrong email address');
     } else {
         $userData->email = $form->Email;
     }
     if (!$form->hasValidData('Name') || $form->Name == '') {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/validator', 'Please enter a name');
     } else {
         $userData->name = $form->Name;
     }
     if ($form->hasValidData('Surname') && $form->Surname != '') {
         $userData->surname = $form->Surname;
     } else {
         $userData->surname = '';
     }
     if ($form->hasValidData('JobTitle') && $form->JobTitle != '') {
         $userData->job_title = $form->JobTitle;
     } else {
         $userData->job_title = '';
     }
     if ($form->hasValidData('UserTimeZone') && $form->UserTimeZone != '') {
         $userData->time_zone = $form->UserTimeZone;
         CSCacheAPC::getMem()->setSession('lhc_user_timezone', $userData->time_zone, true);
     } else {
         CSCacheAPC::getMem()->setSession('lhc_user_timezone', '', true);
         $userData->time_zone = '';
     }
     if (erLhcoreClassUser::instance()->hasAccessTo('lhuser', 'changevisibility')) {
         if ($form->hasValidData('UserInvisible') && $form->UserInvisible == true) {
             $userData->invisible_mode = 1;
         } else {
             $userData->invisible_mode = 0;
         }
     }
     if (erLhcoreClassUser::instance()->hasAccessTo('lhuser', 'receivepermissionrequest')) {
         if ($form->hasValidData('ReceivePermissionRequest') && $form->ReceivePermissionRequest == true) {
             $userData->rec_per_req = 1;
         } else {
             $userData->rec_per_req = 0;
         }
     }
     if (erLhcoreClassUser::instance()->hasAccessTo('lhuser', 'changeskypenick')) {
         if ($form->hasValidData('Skype') && $form->Skype != '') {
             $userData->skype = $form->Skype;
         } else {
             $userData->skype = '';
         }
     }
     if ($form->hasValidData('XMPPUsername') && $form->XMPPUsername != '') {
         $userData->xmpp_username = $form->XMPPUsername;
     } else {
         $userData->xmpp_username = '';
     }
     return $Errors;
 }
开发者ID:detain,项目名称:livehelperchat,代码行数:87,代码来源:lhuservalidator.php

示例15: __get

 public function __get($var)
 {
     switch ($var) {
         case 'is_active':
             $this->is_active = $this->request > 0 && ($this->expires == 0 || $this->expires > time()) && $this->suspended == 0 && $this->reseller_suspended == 0;
             return $this->is_active;
             break;
         case 'sms_used_percentenge':
             return round($this->sms_left / $this->sms_plan * 100, 2);
             break;
         case 'soft_limit_in_effect':
             $soft_limit_in_effect = false;
             if ($this->soft_limit_type == 0 && $this->sms_left / $this->sms_plan * 100 < $this->soft_limit) {
                 $soft_limit_in_effect = true;
             } elseif ($this->soft_limit_type == 1 && $this->sms_left < $this->soft_limit) {
                 $soft_limit_in_effect = true;
             }
             return $soft_limit_in_effect;
             break;
         case 'hard_limit_in_effect':
             $hard_limit_in_effect = false;
             if ($this->hard_limit_type == 0 && $this->sms_left / $this->sms_plan * 100 < $this->hard_limit) {
                 $hard_limit_in_effect = true;
             } elseif ($this->hard_limit_type == 1 && $this->sms_left < $this->hard_limit) {
                 $hard_limit_in_effect = true;
             }
             return $hard_limit_in_effect;
             break;
         case 'can_send_sms':
             $this->can_send_sms = $this->sms_supported == true && $this->hard_limit_in_effect == false;
             return $this->can_send_sms;
             break;
         case 'phone_response':
             $this->phone_response = $this->phone_response_data;
             return $this->phone_response;
             break;
         case 'phone_response_timeout':
             $this->phone_response_timeout = $this->phone_response_timeout_data;
             return $this->phone_response_timeout;
             break;
         case 'phone_number_departments':
             $this->phone_number_departments = array();
             foreach ($this->phone_number as $phoneData) {
                 if ($phoneData['phone'] != '') {
                     $this->phone_number_departments[$phoneData['phone']] = $phoneData['department'];
                 }
             }
             return $this->phone_number_departments;
             break;
         case 'phone_number_first':
             $this->phone_number_first = '';
             foreach ($this->phone_number as $phone) {
                 if ($phone['phone'] != '') {
                     $this->phone_number_first = $phone['phone'];
                     return $this->phone_number_first;
                 }
             }
             return $this->phone_number_first;
             break;
         case 'phone_number':
             $phoneNumber = json_decode($this->phone_number_data, true);
             if ($phoneNumber !== false) {
                 $this->phone_number = $phoneNumber;
             } else {
                 $this->phone_number = array(array('phone' => $this->phone_number_data, 'department' => 0));
             }
             for ($i = count($this->phone_number); $i < 15; $i++) {
                 $this->phone_number = array(array('phone' => '', 'department' => 0));
             }
             return $this->phone_number;
             break;
         case 'translation_config':
             if (($this->translation_config = CSCacheAPC::getMem()->getSession('automatic_translations')) == false) {
                 $db = ezcDbInstance::get();
                 $cfg = erConfigClassLhConfig::getInstance();
                 $db->query('USE ' . $cfg->getSetting('db', 'database'));
                 // Fetches from manager
                 $this->translation_config = erLhcoreClassModelChatConfig::fetch('translation_data')->data;
                 $db->query('USE ' . $cfg->getSetting('db', 'database_user_prefix') . erLhcoreClassInstance::$instanceChat->id);
                 CSCacheAPC::getMem()->setSession('automatic_translations', $this->translation_config);
             }
             return $this->translation_config;
             break;
         case 'reseller_instances_count':
             $db = ezcDbInstance::get();
             $cfg = erConfigClassLhConfig::getInstance();
             $db->query('USE ' . $cfg->getSetting('db', 'database'));
             $this->reseller_instances_count = self::getCount(array('filter' => array('reseller_id' => $this->id)));
             $db->query('USE ' . $cfg->getSetting('db', 'database_user_prefix') . erLhcoreClassInstance::$instanceChat->id);
             return $this->reseller_instances_count;
             break;
         case 'client_attributes_array':
             $this->client_attributes_array = json_decode($this->client_attributes, true);
             if (!is_array($this->client_attributes_array)) {
                 $this->client_attributes_array = array();
             }
             return $this->client_attributes_array;
             break;
         default:
             break;
//.........这里部分代码省略.........
开发者ID:hgeorge123,项目名称:automated-hosting,代码行数:101,代码来源:erlhcoreclassmodelinstance.php


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