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


PHP Context::get方法代码示例

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


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

示例1: testContext

 public function testContext()
 {
     $context = new Context();
     $this->assertEquals(null, $context->get('foo'));
     $this->assertFalse($context->has('foo'));
     $context->set('foo', 'bar');
     $this->assertEquals('bar', $context->get('foo'));
     $this->assertTrue($context->has('foo'));
 }
开发者ID:seytar,项目名称:psx,代码行数:9,代码来源:ContextTest.php

示例2: rpc_get_default

 public static function rpc_get_default(Context $ctx)
 {
     $user = Node::load(array('class' => 'user', 'deleted' => 0, 'published' => 1, 'id' => $ctx->get('id')), $ctx->db);
     $email = $user ? $user->email : 'john.doe@example.com';
     $gurl = 'http://www.gravatar.com/avatar/' . md5($email);
     if (null !== ($s = $ctx->get('s'))) {
         $gurl .= '?s=' . intval($s) . '&r=x';
     }
     return new Redirect($gurl);
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:10,代码来源:class.avatarrpc.php

示例3: rpc_change

 public static function rpc_change(Context $ctx)
 {
     if (null === ($id = $ctx->get('id'))) {
         throw new RuntimeException(t('Не указан id товара.'));
     }
     $cart = new Cart($ctx);
     $items = $cart->getItems();
     $items[$id] = $ctx->get('qty', 1);
     $cart->setItems($items);
     return $ctx->getRedirect();
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:11,代码来源:class.cartrpc.php

示例4: on_get_results

 /**
  * Возвращает результаты по опросу.
  */
 public static function on_get_results(Context $ctx)
 {
     $output = '';
     $id = $ctx->get('id');
     $data = $ctx->db->getResultsKV("option", "count", "SELECT `option`, COUNT(*) AS `count` FROM `node__poll` WHERE `nid` = ? GROUP BY `option`", array($ctx->get('id')));
     foreach ($data as $k => $v) {
         $output .= html::em('option', array('count' => $v), html::cdata($k));
     }
     $voted = $ctx->user->id ? $ctx->db->fetch("SELECT COUNT(*) FROM `node__poll` WHERE `nid` = ? AND `uid` = ?", array($id, $ctx->user->id)) : $ctx->db->fetch("SELECT COUNT(*) FROM `node__poll` WHERE `nid` = ? AND `ip` = ?", array($id, $_SERVER['REMOTE_ADDR']));
     return new Response(html::em('results', array('voted' => (bool) $voted), $output), 'text/xml');
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:14,代码来源:class.pollrpc.php

示例5: test_context

 public function test_context()
 {
     $c = new Context(array('a' => 1, 'b' => 'xyzzy'));
     $this->assertEquals($c['a'], 1);
     $this->assertEquals($c->push(), array());
     $c['a'] = 2;
     $this->assertEquals($c['a'], 2);
     $this->assertEquals($c->get('a'), 2);
     $this->assertEquals($c->pop(), array('a' => 2));
     $this->assertEquals($c['a'], 1);
     $this->assertEquals($c->get('foo', 42), 42);
 }
开发者ID:idlesign,项目名称:dja,代码行数:12,代码来源:context.php

示例6: hookRemoteCall

 public static function hookRemoteCall(Context $ctx)
 {
     if (null !== $ctx->get('source') and null !== $ctx->get('search')) {
         $output = array();
         $parts = explode('.', $ctx->get('source'), 2);
         foreach (Node::find($ctx->db, $filter = array('class' => $parts[0], $parts[1] => '%' . $ctx->get('search') . '%'), 10) as $n) {
             $output[$n->id] = isset($n->{$parts}[1]) ? $n->{$parts}[1] : $n->name;
         }
         $output = join("\n", array_values($output));
         return new Response($output, 'text/plain');
     }
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:12,代码来源:class.autocompletemodule.php

示例7: rpc_get_restore

 public static function rpc_get_restore(Context $ctx)
 {
     $node = Node::load(array('class' => 'user', 'name' => $ctx->get('email'), 'deleted' => 0, 'published' => 1));
     if ($ctx->get('otp') != $node->otp) {
         throw new ForbiddenException(t('Эта ссылка устарела.'));
     }
     $ctx->db->beginTransaction();
     unset($node->otp);
     $node->save();
     $ctx->db->commit();
     $ctx->user->login($node->name, null, true);
     Logger::log($node->name . ' logged in using OTP.', 'auth');
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:13,代码来源:class.authbasicrpc.php

示例8: on_get_list

 /**
  * Вывод списка файлов.
  */
 public static function on_get_list(Context $ctx)
 {
     try {
         $options = array('#raw' => true, 'name' => 'list', 'title' => t('Файловый архив'), 'path' => os::webpath(MCMS_SITE_FOLDER, $ctx->config->get('modules/files/storage')), 'advsearch' => true, 'canedit' => true, 'mode' => $ctx->get('mode', 'table'), 'scope' => $ctx->get('scope'), 'type' => 'file');
         $tmp = new FileList($ctx, $options['scope']);
         return $tmp->getHTML('files', $options);
     } catch (TableNotFoundException $e) {
         if ($e->getTableName() != 'node__idx_filetype') {
             throw $e;
         }
         throw new Exception(t('Отсутствует индекс по полю filetype, <a href="@url">исправьте это</a> и возвращайтесь.', array('@url' => 'admin/structure/fields/edit?type=file&field=filetype&destination=' . urlencode(MCMS_REQUEST_URI))));
     }
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:16,代码来源:class.filelist.php

示例9: _render

 /**
  * 
  * @param type Model_Page_Front
  */
 private function _render(Model_Page_Front $page)
 {
     View::set_global('page_object', $page);
     View::set_global('page', $page);
     $this->_ctx->set_page($page);
     // If page needs login, redirect to login
     if ($page->needs_login() == Model_Page::LOGIN_REQUIRED) {
         Observer::notify('frontpage_login_required', $page);
         if (!Auth::is_logged_in()) {
             Flash::set('redirect', $page->url());
             $this->redirect(Route::get('user')->uri(array('action' => 'login')));
         }
     }
     Observer::notify('frontpage_found', $page);
     $this->_ctx->set_crumbs($page);
     $this->_ctx->build_crumbs();
     // Если установлен статус 404, то выводим страницу 404
     // Страницу 404 могут выкидывать также Виджеты
     if (Request::current()->is_initial() and $this->response->status() == 404) {
         $message = $this->_ctx->get('throw_message');
         $this->_ctx = NULL;
         if (!$message) {
             $message = 'Page not found';
         }
         Model_Page_Front::not_found($message);
     }
     $html = (string) $page->render_layout();
     // Если пользователь Администраторо или девелопер, в конец шаблона
     // добавляем View 'system/blocks/toolbar', в котором можно добавлять
     // собственный HTML, например панель администратора
     if (Auth::is_logged_in() and Auth::has_permissions(array('administrator', 'developer'))) {
         $inject_html = (string) View::factory('system/blocks/toolbar');
         // Insert system HTML before closed tag body
         $matches = preg_split('/(<\\/body>)/i', $html, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
         if (count($matches) > 1) {
             /* assemble the HTML output back with the iframe code in it */
             $html = $matches[0] . $inject_html . $matches[1] . $matches[2];
         }
     }
     // Если в наcтройках выключен режим отладки, то выключить etag кеширование
     if (Config::get('site', 'debug') == Config::NO) {
         $this->check_cache(sha1($html));
         $this->response->headers('last-modified', date('r', strtotime($page->updated_on)));
     }
     $this->response->headers('Content-Type', $page->mime());
     if (Config::get('global', 'x_powered_header') == Config::YES) {
         $this->response->headers('X-Powered-CMS', CMS_NAME . '/' . CMS_VERSION);
     }
     $this->response->body($html);
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:54,代码来源:front.php

示例10: rpc_get

 public static function rpc_get(Context $ctx)
 {
     $host = null;
     if ($tmp = $ctx->get('host')) {
         $host = $tmp;
     } elseif ($tmp = $ctx->get('url')) {
         $url = new url($tmp);
         $host = $url->host;
     }
     if (null === $host) {
         throw new InvalidArgumentException(t('Имя сервера нужно указать в параметре host или url.'));
     }
     $next = 'http://www.google.com/s2/favicons?domain=' . urlencode($host);
     $ctx->redirect($next);
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:15,代码来源:class.faviconrpc.php

示例11: on_get_custom

 public static function on_get_custom(Context $ctx)
 {
     $filter = array();
     if (!($filter['class'] = $ctx->get('type'))) {
         $filter['class'] = $ctx->db->getResultsV("name", "SELECT name FROM node WHERE class = 'type' AND deleted = 0 AND published = 1");
     }
     if ($tmp = $ctx->get('tags')) {
         $filter['tags'] = explode('+', $tmp);
     }
     if ($tmp = $ctx->get('author')) {
         $filter['uid'] = $tmp;
     }
     $feed = new RSSFeed($filter);
     return $feed->render($ctx);
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:15,代码来源:class.rssrouter.php

示例12: rpc_get_remove

 protected static function rpc_get_remove(Context $ctx)
 {
     $name = $ctx->get('name');
     try {
         $node = Node::load(array('class' => 'subscription', 'name' => $name, 'deleted' => 0, 'published' => 1));
         if (empty($node) or $node->id != $ctx->get('id')) {
             throw new PageNotFoundException();
         }
         $ctx->db->beginTransaction();
         $node->delete();
         $ctx->db->commit();
     } catch (ObjectNotFoundException $e) {
     }
     return $ctx->getRedirect('?unsubscribed=' . urlencode($name));
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:15,代码来源:class.subscriptionrpc.php

示例13: on_find_xml

 public static function on_find_xml(Context $ctx)
 {
     if (null === ($search = $ctx->get('search'))) {
         throw new BadRequestException(t('Не указана подстрока для поиска (GET-параметр search).'));
     }
     if (!($limit = intval($ctx->get('limit', 5)))) {
         throw new BadRequestException(t('Не указано количество возовращаемых меток (GET-параметр limit).'));
     }
     list($sql, $params) = Query::build(array('class' => 'label', 'deleted' => 0, 'published' => 1, 'name?|' => '%' . $search . '%', '#sort' => 'name'))->getSelect(null, null, 'name');
     $result = '';
     foreach ((array) $ctx->db->getResultsV("name", $sql, $params) as $name) {
         $result .= html::em('label', html::cdata($name));
     }
     return new Response(html::em('labels', array('search' => $search, 'limit' => $limit), $result), 'text/xml');
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:15,代码来源:class.labelsapi.php

示例14: dispSocialxeAdminBitly

 function dispSocialxeAdminBitly()
 {
     // 설정 정보를 받아옴
     Context::set('config', $this->config);
     // bit.ly 설정이 되어 있지 않으면 환경설정으로 보낸다.
     if (!$this->config->bitly_username || !$this->config->bitly_api_key) {
         header('Location: ' . getNotEncodedUrl('act', 'dispSocialxeAdminConfig'));
         return;
     }
     // 목록을 구하기 위한 옵션
     $args->page = Context::get('page');
     $args->title = Context::get('title');
     $output = executeQueryArray('socialxe.getBitlyPageList', $args);
     if (!$output->toBool()) {
         return $output;
     }
     // 템플릿에 쓰기 위해서 comment_model::getTotalCommentList() 의 return object에 있는 값들을 세팅
     Context::set('total_count', $output->total_count);
     Context::set('total_page', $output->total_page);
     Context::set('page', $output->page);
     Context::set('bitly_list', $output->data);
     Context::set('page_navigation', $output->page_navigation);
     // 템플릿 파일 지정
     $this->setTemplatePath($this->module_path . 'tpl');
     $this->setTemplateFile('bitly_index');
 }
开发者ID:leehankyeol,项目名称:JaWeTip,代码行数:26,代码来源:socialxe.admin.view.php

示例15: getNickChangeList

 function getNickChangeList($obj)
 {
     $args->s_member_srl = $obj->member_srl;
     $args->page = Context::get('page');
     // /< Page
     $args->list_count = 20;
     // /< the number of posts to display on a single page
     $args->page_count = 10;
     // /< the number of pages that appear in the page navigation
     $args->sort_index = 'regdate';
     // /< sorting values
     $args->order_type = 'desc';
     // /< sorting values by order
     if ($obj->search_target == 'nick_name') {
         $args->nick_name_old = $obj->search_keyword;
         $args->nick_name_new = $obj->search_keyword;
     }
     if ($obj->search_target == 'member_srl') {
         $args->s_member_srl = $obj->search_keyword;
     }
     if ($obj->search_target == 'user_id') {
         $oMemberModel =& getModel('member');
         $member_info = $oMemberModel->getMemberInfoByUserID($obj->search_keyword);
         $args->s_member_srl = $member_info->member_srl;
     }
     $output = executeQueryArray('sejin7940_nick.getNickChangeList', $args);
     return $output;
 }
开发者ID:leehankyeol,项目名称:JaWeTip,代码行数:28,代码来源:sejin7940_nick.model.php


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