コード例 #1
0
 /**
  * 添加memcache缓存项
  * @see Star_Cache_Interface::set()
  */
 public function set($key, $value, $lefttime = 0)
 {
     if ($lefttime == 0) {
         return $this->memcache->set($key, $value, false);
     } else {
         return $this->memcache->set($key, $value, false, $lefttime);
     }
 }
コード例 #2
0
ファイル: Redis.php プロジェクト: hwsyy/php-management-system
 /**
  * 添加redis缓存项
  * @see Star_Cache_Interface::set()
  */
 public function set($key, $value, $lefttime = 0)
 {
     if ($lefttime > 0) {
         return $this->redis->setex($key, $lefttime, $value);
     } else {
         return $this->redis->set($key, $value);
     }
 }
コード例 #3
0
ファイル: message.php プロジェクト: stripthis/donate
 /**
  * Allows us to add a message with a given $text and $type and to specify whether to show directly
  * or store them into the $session for the next request.
  *
  * @param string $text The text for this message
  * @param string $type The type of this message
  * @param boolean $session If set to true the message will be shown after the next redirect or request
  * @return boolean Returns true on success
  * @access public
 */
 function add($text, $type = 'success', $session = false, $redirect = false, $params = array())
 {
     $params['forceNonAjax'] = isset($params['forceNonAjax']) ? $params['forceNonAjax'] : false;
     $params['dontShow'] = isset($params['dontShow']) ? $params['dontShow'] : false;
     if ($this->RequestHandler->isAjax() && !$params['forceNonAjax'] && !$params['dontShow']) {
         if ($redirect) {
             return $this->Json->redirect($redirect, $text);
         }
         if (in_array($type, array('ok', 'success'))) {
             $this->log('success');
             return $this->Json->success($text, $params);
         }
         $this->log('error');
         return $this->Json->error($text, $params);
     }
     $message = array('type' => $type, 'text' => $text);
     if ($session == true) {
         $this->sessMessages[] = $message;
         $result = $this->writeToSession();
     } else {
         $this->messages[] = $message;
         $this->Controller->set($this->controllerVar, $this->messages);
     }
     if (!empty($redirect)) {
         if ($this->RequestHandler->isAjax()) {
             if ($params['dontShow']) {
                 $text = '';
             }
             return $this->Json->redirect($redirect, $text);
         }
         $this->Controller->redirect($redirect);
     }
     return true;
 }
コード例 #4
0
ファイル: FilterCore.php プロジェクト: atudz/snapneat
 /**
  * Clear data filter from session
  * @param string $key
  */
 protected function clear($key = '')
 {
     $data = $this->session->get('filters');
     if ($this->request->has('clear_filter')) {
         if (isset($data[$this->request->getPathInfo()])) {
             $this->session->set('filters.' . $this->request->getPathInfo(), '');
         }
     } elseif ($key) {
         if (isset($data[$this->request->getPathInfo()][$key])) {
             unset($data[$this->request->getPathInfo()][$key]);
             $this->session->set('filters', $data);
         }
     }
 }
コード例 #5
0
ファイル: post.php プロジェクト: joffcrabtree/wp-orbis-tasks
/**
 * Defaults
 * @param unknown $query
 */
function orbis_tasks_pre_get_posts($query)
{
    $post_type = $query->get('post_type');
    if ('orbis_task' == $post_type) {
        // Order
        $orderby = $query->get('orderby');
        $order = $query->get('order');
        if (empty($orderby)) {
            //  Default = Due At
            $query->set('orderby', 'orbis_task_due_at');
            if (empty($order)) {
                if (is_admin()) {
                    // Default = Descending
                    $query->set('order', 'DESC');
                } else {
                    // Default = Ascending
                    $query->set('order', 'ASC');
                }
            }
        }
        // Completed
        if ($query->is_post_type_archive('orbis_task') && !is_admin()) {
            $completed = $query->get('orbis_task_completed');
            if (empty($completed)) {
                //  Default = Not completed
                $query->set('orbis_task_completed', 'no');
            }
        }
    }
}
コード例 #6
0
ファイル: AccessController.php プロジェクト: m3uzz/module
 /**
  *
  * @param unknown $poIdentity
  * @param unknown $psUrlFrom
  */
 public function authentication($poAuthService, $poIdentity, $psUrlFrom = null, $poForm = null, $psType = 'onion')
 {
     $lsStatus = null;
     if ($poIdentity->getActive() == 1) {
         $laUserContext = null;
         if ($poIdentity->get('stIpContext') !== null) {
             $lsUserAgent = '*';
             if ($poIdentity->get('stUserAgent') !== null) {
                 $lsUserAgent = $poIdentity->get('stUserAgent');
             }
             $laUserContext = array($poIdentity->get('stIpContext') => array('denied' => $poIdentity->get('isContextDenied'), $lsUserAgent => $poIdentity->get('stRegistrationToken')));
         }
         if (Context::hasContextAccess($laUserContext)) {
             $loSession = new Session();
             $loSession->clearRegister('OnionAuth');
             $loSession->clearRegister('storage', 'Zend_Auth');
             $poIdentity->getObject();
             $poIdentity->set('stPassword', 'nono');
             $poIdentity->set('stPasswordSalt', '');
             $poIdentity->set('stAnswer', '');
             $loSession->setRegister('OnionAuth', $poIdentity);
             $loIdentity = $loSession->getRegister('OnionAuth');
             $poAuthService->getStorage()->write($poIdentity);
             if ($poForm->get('rememberme')->getValue() == 1) {
                 $laOptions = Config::getAppOptions('settings');
                 $loSessionManager = new SessionManager();
                 $loSessionManager->rememberMe($laOptions['sessionLifeTime']);
             }
             Debug::debug($poIdentity->getUsername() . " [SUCCESS by {$psType}]");
             Access::log($poIdentity, "SUCCESS by " . $psType);
             if ($psUrlFrom !== null) {
                 if ('/' !== $psUrlFrom) {
                     $psUrlFrom = base64_decode($psUrlFrom);
                 }
                 Debug::debug("Redirect to: ({$psUrlFrom})");
                 $this->redirect()->toUrl($psUrlFrom);
             }
         } else {
             $poForm->get('stUsername')->setMessages(array("Permissão negada para o contexto de acesso!"));
             $lsStatus = "CONTEXT DENIED";
         }
     } else {
         $poForm->get('stUsername')->setMessages(array("Usuário desativado!"));
         $lsStatus = "USER DISABLED";
     }
     return $lsStatus;
 }
コード例 #7
0
ファイル: objects.php プロジェクト: cabelotaina/redelivre
/**
 * Na listagem de objetos no admin permite exibir somente
 * objetos criados pelos admins ou somente objetos criados pelos
 * demais usuários.
 * 
 * @param unknown $query
 * @return null
 */
function consulta_filter_by_user_created($query)
{
    global $pagenow, $typenow;
    if ($pagenow == 'edit.php' && $typenow == 'object' && isset($_REQUEST['who_created']) && $_REQUEST['who_created'] != 'all') {
        if ($_REQUEST['who_created'] == 'user_created') {
            $user_created = true;
        } else {
            $user_created = false;
        }
        $query->set('meta_key', '_user_created');
        $query->set('meta_value', $user_created);
    }
}
コード例 #8
0
ファイル: extras.php プロジェクト: az2009/tema-padrao-wp
/**
 * Função que define o post por page do custom post type depoimentos
 * @param unknown $query
 */
function depoimentos_pre_get_post($query)
{
    if (is_post_type_archive('depoimentos') && !is_admin() && $query->is_main_query()) {
        $query->set('posts_per_page', 6);
    }
}
コード例 #9
0
ファイル: post.php プロジェクト: joffcrabtree/wp-orbis-deals
/**
 * Defaults
 * @param unknown $query
 */
function orbis_deals_pre_get_posts($query)
{
    $post_type = $query->get('post_type');
    if ('orbis_deal' == $post_type) {
        // Status
        $status = $query->get('orbis_deal_status');
        if ($status) {
            $meta_query = $query->get('meta_query');
            if (!is_array($meta_query)) {
                $meta_query = array();
            }
            $meta_query[] = array('key' => '_orbis_deal_status', 'value' => $status);
            $query->set('meta_query', $meta_query);
        }
    }
}
コード例 #10
0
ファイル: BalanceRedisBase.php プロジェクト: noikiy/public
 /**
  * 设置
  * @param string $key
  * @param string $value
  * @param unknown $expire
  */
 public function set($key = '', $value = '', $expire = 0)
 {
     return $this->cacheWrite->set($key, $value, $expire);
 }