當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。