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


PHP Application::getInstance方法代码示例

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


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

示例1: getResourceRouting

 public function getResourceRouting()
 {
     $admin_app = Application::getInstance('admin');
     $resource_routing = $admin_app->getResourceRouting();
     array_unshift($resource_routing['default'], 'applications/cli');
     return $resource_routing;
 }
开发者ID:alex-ch,项目名称:test,代码行数:7,代码来源:application.php

示例2: csrf

 /**
  * Returns a Csrf instance
  *
  * @return Csrf
  */
 public function csrf()
 {
     if (!$this->csrf) {
         $this->csrf = \Dependency::resolve('security.csrf', array($this->config, \Application::getInstance()->getSession()));
     }
     return $this->csrf;
 }
开发者ID:fuelphp,项目名称:security,代码行数:12,代码来源:Manager.php

示例3: actionIndex

 public function actionIndex()
 {
     $poll = Application::getInstance()->fetchers->poll->getByOpenAttribute();
     $questions = Application::getInstance()->fetchers->questions->getByPollId($poll['id']);
     $answers = Application::getInstance()->fetchers->answers->getByPollId($poll['id']);
     $this->render('index', array('poll' => $poll, 'questions' => $questions, 'answers' => $answers));
 }
开发者ID:rail-rz,项目名称:framework,代码行数:7,代码来源:VoteController.php

示例4: __construct

 /**
  * @param	Product $product
  * @param	integer $qtd
  */
 public function __construct(Product $product, $qtd)
 {
     parent::__construct();
     $resourceBundle = Application::getInstance()->getBundle();
     $idProduct = $product->getIdProduct();
     $moneyformat = $resourceBundle->getString('MONEY_FORMAT');
     $productName = $product->getProductName();
     $productDescription = $product->getProductDescription();
     $productPrice = $product->getProductPrice();
     $form = $this->addChild(new Form('/?c=cart&a=change&p=' . $idProduct));
     //Imagem do produto
     $form->addChild(new Image($product->getProductImage(), $productName))->setTitle($productName)->setAttribute('width', 80)->setAttribute('height', 80);
     //Nome e descrição do produto
     $form->addChild(new Span())->addStyle('name')->addChild(new Text($productName));
     $form->addChild(new Span())->addStyle('desc')->addChild(new Text($productDescription));
     //Input com a quantidade de itens
     $form->addChild(new Label(new Text($resourceBundle->getString('QUANTITY'))))->addChild(new Input('qtd'))->setValue($qtd);
     //Preço unitário
     $form->addChild(new Span())->addStyle('price')->addChild(new Text(money_format($moneyformat, $productPrice)));
     //Preço total
     $form->addChild(new Span())->addStyle('total')->addChild(new Text(money_format($moneyformat, $qtd * $productPrice)));
     //Botões para edição e exclusão do item do carrinho
     $form->addChild(new Input('save', Input::SUBMIT))->setValue($resourceBundle->getString('SAVE'));
     $form->addChild(new Input('del', Input::SUBMIT))->setValue($resourceBundle->getString('DELETE'));
 }
开发者ID:rcastardo,项目名称:mvc-na-pratica,代码行数:29,代码来源:CartItem.php

示例5: __construct

 public function __construct()
 {
     $this->session = Application::getInstance('Session');
     if (!isset($this->session->{self::KEY})) {
         $this->session->{self::KEY} = array();
     }
 }
开发者ID:andrewyang96,项目名称:phpmongodb,代码行数:7,代码来源:Message.php

示例6: testAdd

 /**
  * @covers QueueController::Add
  * @todo Implement testAdd().
  */
 public function testAdd()
 {
     $person = Person::factory('adult');
     $person->name = 'Poehavshiy';
     $person->add();
     $store = Store::factory('Grocery');
     $store->name = 'Prison';
     $store->add();
     $product = new Product();
     $product->name = 'Sladkiy hleb';
     $product->add();
     $request = Application::getInstance()->request;
     $request->setParams(array('storeId' => $store->id, 'personId' => $person->id, 'product_' . $product->id => 'on'));
     $personId = $request->p('personId');
     $storeId = $request->p('storeId');
     $store = Store::get($storeId);
     $person = Person::get($personId);
     $store->queue->add($person);
     $person->basket->drop();
     $name = 'product_' . $product->id;
     $value = $product;
     if (preg_match_all('/^product_(\\d+)$/', $name, $matches)) {
         $person->basket->add(Product::get($matches[1][0]));
     }
 }
开发者ID:ruyozora,项目名称:Test-test,代码行数:29,代码来源:QueueControllerTest.php

示例7: __construct

 private function __construct()
 {
     $this->_viewPath = Application::getInstance()->getConfig()->app['views'];
     if ($this->_viewPath == null) {
         $this->_viewPath = realpath('../Views/');
     }
 }
开发者ID:ksevery,项目名称:MVCEndProject,代码行数:7,代码来源:View.php

示例8: testStore

 /**
  * @covers AssortmentController::Store
  * @todo Implement testStore().
  */
 public function testStore()
 {
     $request = Application::getInstance()->request;
     $request->setParam('storeId', '6');
     $c = new AssortmentController();
     $result = $c->Store();
 }
开发者ID:ruyozora,项目名称:Test-test,代码行数:11,代码来源:AssortmentControllerTest.php

示例9: actionDelete

 public function actionDelete()
 {
     $questions = Application::getInstance()->fetchers->questions->getById($_GET['id']);
     Application::getInstance()->fetchers->questions->delete($_GET['id']);
     $poll_id = $questions['poll_id'];
     header("Location: /index.php?r=adminQuestion/index&poll_id={$poll_id}");
 }
开发者ID:rail-rz,项目名称:framework,代码行数:7,代码来源:AdminQuestionController.php

示例10: __callStatic

 public static function __callStatic($func, ...$args)
 {
     if (!in_array($func, self::FUNC_ALLOWED)) {
         throw new \Exception("method {$func} not found");
     }
     $obj = Application::getInstance()->produce('router');
     return call_user_func_array([$obj, $func], ...$args);
 }
开发者ID:jesusslim,项目名称:partini,代码行数:8,代码来源:Routes.php

示例11: getInstance

 /**
  * {@inheritdoc}
  */
 public static function getInstance()
 {
     // get the current session via the active request instance
     if ($request = \Request::getInstance()) {
         return $request->getApplication()->getSession();
     }
     return Application::getInstance()->getSession();
 }
开发者ID:fuelphp,项目名称:legacy,代码行数:11,代码来源:Session.php

示例12: saveText

 private function saveText($question)
 {
     foreach ($_POST['answers'] as $answers) {
         if (!empty($answers)) {
             Application::getInstance()->fetchers->answers->addSting($answers, $_GET['question_id'], $question);
         }
     }
 }
开发者ID:rail-rz,项目名称:framework,代码行数:8,代码来源:AdminAnswerController.php

示例13: getFromDomain

 public static function getFromDomain($domain)
 {
     $db =& Application::getInstance()->db;
     $s = $db->prepare("select " . School::fieldList . " from School where domain=:d");
     $s->bindParam(':d', $domain);
     $s->execute();
     return $s->fetchObject();
 }
开发者ID:neojjang,项目名称:Sneffel,代码行数:8,代码来源:School.class.php

示例14: add

 public static function add($moduleName)
 {
     $con = Application::getDbConnection();
     $con->queryExecute("INSERT INTO b_module(ID) VALUES('" . $con->getSqlHelper()->forSql($moduleName) . "')");
     self::$installedModules = array();
     $cacheManager = Application::getInstance()->getManagedCache();
     $cacheManager->clean("b_module");
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:8,代码来源:modulemanager.php

示例15: __construct

 public function __construct()
 {
     $registry = Registry::getInstance();
     if (!$registry->has('pdo')) {
         $resourceBundle = Application::getInstance()->getBundle();
         $registry->set('pdo', new PDO($resourceBundle->getString('MYSQL_DSN'), $resourceBundle->getString('MYSQL_USER'), $resourceBundle->getString('MYSQL_PSWD')));
     }
 }
开发者ID:rcastardo,项目名称:mvc-na-pratica,代码行数:8,代码来源:MySQLFactory.php


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