本文整理汇总了PHP中unknown::set方法的典型用法代码示例。如果您正苦于以下问题:PHP unknown::set方法的具体用法?PHP unknown::set怎么用?PHP unknown::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unknown
的用法示例。
在下文中一共展示了unknown::set方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set
/**
* 添加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: set
/**
* 添加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: add
/**
* 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: clear
/**
* 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: orbis_tasks_pre_get_posts
/**
* 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: authentication
/**
*
* @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: consulta_filter_by_user_created
/**
* 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: depoimentos_pre_get_post
/**
* 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: orbis_deals_pre_get_posts
/**
* 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: set
/**
* 设置
* @param string $key
* @param string $value
* @param unknown $expire
*/
public function set($key = '', $value = '', $expire = 0)
{
return $this->cacheWrite->set($key, $value, $expire);
}