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


PHP Dispatcher::instance方法代码示例

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


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

示例1: getInstance

 /**
  * Get current instance of dispatcher (singleton)
  *
  * @return Dispatcher
  */
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new Dispatcher();
     }
     return self::$instance;
 }
开发者ID:jessylenne,项目名称:sf2-technical-test,代码行数:12,代码来源:Dispatcher.php

示例2: self

 public function &getInstance()
 {
     if (self::$instance === false) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:ahmed555,项目名称:Cupcake,代码行数:7,代码来源:dispatcher.php

示例3: getInstance

 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:valentinkh1,项目名称:mcdaemon,代码行数:7,代码来源:Dispatcher.php

示例4: getInstance

 public static function getInstance($url = null)
 {
     if (!isset(self::$instance)) {
         self::$instance = new self($url);
     }
     return self::$instance;
 }
开发者ID:nicolasmartin,项目名称:framework,代码行数:7,代码来源:dispatcher.php

示例5: ProcessRequest

 function ProcessRequest()
 {
     $messenger = Messenger::Instance()->Receive(__FILE__);
     $mObj = new Anggota();
     $arr_kelompok = $mObj->getKelompok();
     $request_data = array();
     $query_string = '';
     $message = $style = $message = NULL;
     if (isset($mObj->_POST['btnSearch'])) {
         $request_data['nama'] = $mObj->_POST['nama'];
         $request_data['kelompok'] = $mObj->_POST['kelompok'];
     } elseif (isset($mObj->_GET['search'])) {
         $request_data['nama'] = Dispatcher::Instance()->Decrypt($mObj->_GET['nama']);
         $request_data['kelompok'] = Dispatcher::Instance()->Decrypt($mObj->_GET['kelompok']);
     } else {
         $request_data['nama'] = '';
         $request_data['kelompok'] = '';
     }
     if (method_exists(Dispatcher::Instance(), 'getQueryString')) {
         # @param array
         $query_string = Dispatcher::instance()->getQueryString($request_data);
     } else {
         $query = array();
         foreach ($request_data as $key => $value) {
             $query[$key] = Dispatcher::Instance()->Encrypt($value);
         }
         $query_string = urldecode(http_build_query($query));
     }
     $offset = 0;
     $limit = 20;
     $page = 0;
     if (isset($_GET['page'])) {
         $page = (string) $_GET['page']->StripHtmlTags()->SqlString()->Raw();
         $offset = ($page - 1) * $limit;
     }
     #paging url
     $url = Dispatcher::Instance()->GetUrl(Dispatcher::Instance()->mModule, Dispatcher::Instance()->mSubModule, Dispatcher::Instance()->mAction, Dispatcher::Instance()->mType) . '&search=' . Dispatcher::Instance()->Encrypt(1) . '&' . $query_string;
     $destination_id = "subcontent-element";
     $data_list = $mObj->getDataAnggota($offset, $limit, $request_data);
     $total_data = $mObj->Count();
     #send data to pagging component
     Messenger::Instance()->SendToComponent('paging', 'Paging', 'view', 'html', 'paging_top', array($limit, $total_data, $url, $page, $destination_id), Messenger::CurrentRequest);
     # Combobox
     Messenger::Instance()->SendToComponent('combobox', 'Combobox', 'view', 'html', 'kelompok', array('kelompok', $arr_kelompok, $request_data['kelompok'], true, 'id="cmb_kelompok"'), Messenger::CurrentRequest);
     $start = $offset + 1;
     if ($messenger) {
         $message = $messenger[0][1];
         $style = $messenger[0][2];
     }
     return compact('request_data', 'query_string', 'start', 'data_list', 'message', 'style');
 }
开发者ID:rifkiferdian,项目名称:gtfw_boostab,代码行数:51,代码来源:ViewAnggota.html.class.php

示例6: makeContext

 /**
  * Modifies the current context and replaces the info related to shop, link, language and currency.
  *
  * We need this when generating the product data for the different shops and languages.
  * The currency will be the first found for the shop, but it defaults to the PS default currency
  * if no shop specific one is found.
  *
  * @param int $id_lang the language ID to add to the new context.
  * @param int $id_shop the shop ID to add to the new context.
  * @return Context the new context.
  */
 protected function makeContext($id_lang, $id_shop)
 {
     if (_PS_VERSION_ >= '1.5') {
         // Reset the shop context to be the current processed shop. This will fix the "friendly url" format of urls
         // generated through the Link class.
         Shop::setContext(Shop::CONTEXT_SHOP, $id_shop);
         // Reset the dispatcher singleton instance so that the url rewrite setting is check on a shop basis when
         // generating product urls. This will fix the issue of incorrectly formatted urls when one shop has the
         // rewrite setting enabled and another does not.
         Dispatcher::$instance = null;
         if (method_exists('ShopUrl', 'resetMainDomainCache')) {
             // Reset the shop url domain cache so that it is re-initialized on a shop basis when generating product
             // image urls. This will fix the issue of the image urls having an incorrect shop base url when the
             // shops are configured to use different domains.
             ShopUrl::resetMainDomainCache();
         }
         foreach (Currency::getCurrenciesByIdShop($id_shop) as $row) {
             if ($row['deleted'] === '0' && $row['active'] === '1') {
                 $currency = new Currency($row['id_currency']);
                 break;
             }
         }
     }
     $context = Context::getContext();
     $context->language = new Language($id_lang);
     $context->shop = new Shop($id_shop);
     $context->link = new Link('http://', 'http://');
     $context->currency = isset($currency) ? $currency : Currency::getDefaultCurrency();
     return $context;
 }
开发者ID:silbersaiten,项目名称:nostotagging,代码行数:41,代码来源:product-operation.php

示例7: testFactoryReturnsAnIndividualInstance

 /**
  * Factory instance should be different from the global instance
  *
  * @test
  * @covers Dispatcher::instance
  * @covers Dispatcher::factory
  */
 public function testFactoryReturnsAnIndividualInstance()
 {
     $instance = Dispatcher::instance();
     $factory = Dispatcher::factory();
     $this->assertNotSame($factory, $instance);
 }
开发者ID:BRMatt,项目名称:Kohana-Dispatcher,代码行数:13,代码来源:DispatcherTest.php


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