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


PHP Context::instance方法代码示例

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


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

示例1: instance

 /**
  * Get a instance.
  *
  * @return \Jobqueue\Queue
  */
 public static function instance()
 {
     if (is_null(static::$instance)) {
         static::$instance = new static(Context::instance());
     }
     return static::$instance;
 }
开发者ID:hosopy,项目名称:fuel-jobqueue,代码行数:12,代码来源:queue.php

示例2: getInstance

 /**
  *  Get the singleton instance
  *
  * @return unknown
  */
 public static function getInstance()
 {
     if (!is_object(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:fica990,项目名称:jsonapi,代码行数:12,代码来源:Context.php

示例3: get_instance

 public static function get_instance()
 {
     if (empty(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:utumdol,项目名称:codeseed,代码行数:7,代码来源:context.class.php

示例4: __construct

 /**
  * Class constructor.
  *
  * @param Page $page Current page object.
  */
 public function __construct($page)
 {
     $this->page = $page;
     $this->blocks = array();
     $this->context = Context::instance('\\Innomedia\\Context');
     // Check if a local template file exists.
     $tpl = $this->context->getGridsHome() . $this->page->getTheme() . '.local.tpl.php';
     if (!file_exists($tpl)) {
         // Check if a predefined template file exists.
         $tpl = $this->context->getGridsHome() . $this->page->getTheme() . '.tpl.php';
         if (!file_exists($tpl)) {
             // Check if a local default template file exists.
             $tpl = $this->context->getGridsHome() . 'default.local.tpl.php';
             if (!file_exists($tpl)) {
                 // Check if a default template file exists.
                 $tpl = $this->context->getGridsHome() . 'default.tpl.php';
                 if (!file_exists($tpl)) {
                     // No template file found, send error.
                     $this->context->getResponse()->sendError(WebAppResponse::SC_INTERNAL_SERVER_ERROR, 'No theme grid found');
                 }
             }
         }
     }
     // Call the template constructor with the found template file.
     parent::__construct($tpl);
     // Set the blocks list in the template blocks variable.
     $this->setArray('blocks', $this->blocks);
 }
开发者ID:innomatic,项目名称:innomedia,代码行数:33,代码来源:Grid.php

示例5: before

 public function before()
 {
     parent::before();
     $this->_ctx = Context::instance();
     $this->_ctx->request($this->request)->response($this->response);
     View_Front::bind_global('ctx', $this->_ctx);
 }
开发者ID:ortodesign,项目名称:cms,代码行数:7,代码来源:handler.php

示例6: getInstance

 /**
  * Get the singleton instance of the Context
  * @return Context
  */
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:11,代码来源:Context.class.php

示例7: get_response

 /**
  * Generate a Response for the 401 Exception.
  * 
  * The user should be redirect to a login page.
  * 
  * @return Response
  */
 public function get_response()
 {
     Flash::set('protected_page', Context::instance()->get_page());
     if (($page = Model_Page_Front::findByField('behavior_id', 'protected_page')) !== FALSE) {
         return Request::factory($page->url)->execute();
     }
     throw new HTTP_Exception_401($this->message);
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:15,代码来源:401.php

示例8: fetch_widget_field

 /**
  * @param Model_Widget_Hybrid
  * @param array $field
  * @param array $row
  * @param string $fid
  * @return mixed
  */
 public static function fetch_widget_field($widget, $field, $row, $fid, $recurse)
 {
     $related_widget = NULL;
     Context::instance()->set($field->inject_key, explode(',', $row[$fid]));
     if ($recurse > 0 and isset($widget->doc_fetched_widgets[$fid])) {
         if (!empty($row[$fid])) {
             $related_widget = self::_fetch_related_widget($widget, $row, $fid, $recurse, $field->inject_key, TRUE);
         }
     }
     return !empty($related_widget) ? $related_widget : $row[$fid];
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:18,代码来源:free.php

示例9: action_forgot

 public function action_forgot()
 {
     if ($this->request->method() == Request::POST) {
         $this->auto_render = FALSE;
         $widget = Widget_Manager::factory('User_Forgot');
         Context::instance()->set('email', Arr::path($this->request->post(), 'forgot.email'));
         $widget->set_values(array('next_url' => Route::get('user')->uri(array('action' => 'login'))))->on_page_load();
     }
     $this->set_title(__('Forgot password'));
     $this->template->content = View::factory('system/forgot');
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:11,代码来源:login.php

示例10: get

 /**
  * Получение виджетов блока без вывода.
  * 
  * Для вывода данных блока
  * 
  *		$widget = Block::get('block_name', $params);
  *		if(is_array($widget))
  *		{
  *			foreach($widget as $data)
  *			{
  *				echo $data;
  *			}
  *		}
  *		else
  *			echo $widget;
  * 
  * @param string $name
  * @param array $params Дополнительные параметры доступные в виджете
  * @return array
  */
 public static function get($name, array $params = array())
 {
     $ctx = Context::instance();
     $widgets = $ctx->get_widgets_by_block($name);
     foreach ($widgets as $widget) {
         if ($widget instanceof View) {
             $widget->bind('ctx', $ctx)->set('params', $params);
         } else {
             if ($widget instanceof Model_Widget_Decorator) {
                 $widget->set_params($params);
             }
         }
     }
     return $widgets;
 }
开发者ID:ortodesign,项目名称:cms,代码行数:35,代码来源:block.php

示例11: _fetch_related_widget

 /**
  * 
  * @param array $row
  * @param integr $fid
  * @param integer $recurse
  * @return array
  */
 protected static function _fetch_related_widget($widget, $row, $fid, $recurse, $key = 'ids', $fetch = FALSE)
 {
     $widget_id = Arr::get($widget->doc_fetched_widgets, $fid);
     if (empty($widget_id)) {
         return NULL;
     }
     $widget = Context::instance()->get_widget($widget_id);
     if (!$widget) {
         $widget = Widget_Manager::load($widget_id);
     }
     if ($widget === NULL) {
         return array();
     }
     $widget->{$key} = $row[$fid];
     if ($fetch === FALSE) {
         return $widget->get_document($row[$fid], $recurse - 1);
     } else {
         return $widget->fetch_data();
     }
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:27,代码来源:onetoone.php

示例12: doGet

 public function doGet(\Innomatic\Webapp\WebAppRequest $req, \Innomatic\Webapp\WebAppResponse $res)
 {
     // Start Innomatic
     $innomatic = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer');
     $innomatic->setInterface(\Innomatic\Core\InnomaticContainer::INTERFACE_EXTERNAL);
     $root = \Innomatic\Core\RootContainer::instance('\\Innomatic\\Core\\RootContainer');
     $innomatic_home = $root->getHome() . 'innomatic/';
     $innomatic->bootstrap($innomatic_home, $innomatic_home . 'core/conf/innomatic.ini');
     // Start Innomatic domain
     \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->startDomain(\Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp()->getName());
     // Innomedia page
     $scope_page = 'frontend';
     // Check if the page exists in the page tree
     $pageSearch = PageTree::findPageByPath(substr($req->getPathInfo(), 1));
     if ($pageSearch === false) {
         // This is a static page (excluding the home page).
         $location = explode('/', $req->getPathInfo());
         $module_name = isset($location[1]) ? $location[1] : '';
         $page_name = isset($location[2]) ? $location[2] : '';
         $pageId = isset($location[3]) ? $location[3] : 0;
     } else {
         // This is the home page or a content page.
         $module_name = $pageSearch['module'];
         $page_name = $pageSearch['page'];
         $pageId = $pageSearch['page_id'];
     }
     // Define Innomatic context
     $home = \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp()->getHome();
     $context = Context::instance('\\Innomedia\\Context');
     $context->setRequest($req)->setResponse($res)->process();
     // Build Innomedia page
     $page = new Page($module_name, $page_name, $pageId, $scope_page);
     $page->parsePage();
     // Check if the page is valid
     if (!$page->isValid()) {
         $res->sendError(\Innomatic\Webapp\WebAppResponse::SC_NOT_FOUND, $req->getRequestURI());
     } else {
         $page->build();
     }
 }
开发者ID:innomatic,项目名称:innomedia,代码行数:40,代码来源:WebAppHandler.php

示例13: defined

<?php

defined('SYSPATH') or die('No direct script access.');
// При сохранении страницы обновление тегов
Observer::observe(array('page_add_after_save', 'page_edit_after_save'), function ($page) {
    $tags = Request::current()->post('page_tags');
    if ($tags !== NULL) {
        Model_Page_Tag::save_by_page($page->id, $tags);
    }
});
// Загрузка шаблона с тегами в блок с метатегами в редактор страницы
Observer::observe('view_page_edit_meta', function ($page) {
    echo View::factory('page/tags', array('tags' => Model_Page_Tag::find_by_page($page->id)));
});
Observer::observe('layout_backend_head_before', function () {
    echo '<script type="text/javascript">var TAG_SEPARATOR = "' . Model_Tag::SEPARATOR . '";</script>';
});
// При выводе списка стран запускается метод custom_filter и передача в него
// Database_query_builder, в этом обсервере можно дополнять этот запрос
Observer::observe('frontpage_custom_filter', function ($sql, $page) {
    $tags = Context::instance()->get('tag');
    if (empty($tags)) {
        return;
    }
    $sql->join(array(Model_Page_Tag::TABLE_NAME, 'pts'), 'inner')->distinct(TRUE)->on('pts.page_id', '=', 'page.id')->join(array(Model_Tag::TABLE_NAME, 'ts'))->on('pts.tag_id', '=', 'ts.id')->where('ts.name', 'in', explode(',', $tags));
});
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:26,代码来源:init.php

示例14: getContext

 /**
  * Get a singleton context
  *
  * @return Context
  */
 public static function getContext()
 {
     if (!isset(self::$instance)) {
         self::$instance = new Context();
     }
     return self::$instance;
 }
开发者ID:dhootha,项目名称:prestashop-google-checkout,代码行数:12,代码来源:Context.php

示例15: Exception

            @class_alias("{$name}_Core", "{$name}");
        }
    } else {
        if (file_exists(SYSTEM_ROOT . '/helper/' . $raw_file)) {
            require_once SYSTEM_ROOT . '/helper/' . $raw_file;
            @class_alias("{$name}_Helper", "{$name}");
        } else {
            if (file_exists(SYSTEM_ROOT . '/library/' . $raw_file)) {
                require_once SYSTEM_ROOT . '/library/' . $raw_file;
                if (!$force_core) {
                    @class_alias("{$name}_Core", "{$name}");
                }
            } else {
                throw new Exception("Class Not Found: {$name}");
            }
        }
    }
}
// __autoload()
// Tricky bugger. If we have documents stored in session, and this is pre-autoloader we can't find any classes.
session_start();
if (false === strpos($_SERVER['REQUEST_URI'], Config::get('xoket.location'))) {
    die('Configuration Error - xoket.location is invalid.');
}
$uri = substr($_SERVER['REQUEST_URI'], strlen(Config::get('xoket.location')));
$uri = URI::route($uri);
Request::load($uri);
$context = Context::instance();
$context->headers();
echo $context->execute();
Flash::update();
开发者ID:jmhobbs,项目名称:NodeRegator,代码行数:31,代码来源:index.php


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