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


PHP App::getInstance方法代码示例

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


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

示例1: onNotFound

 public function onNotFound(\Event $event)
 {
     $controller = new \Controller(\App::getInstance());
     $page = $controller->twigInit()->render(\Config::get('view::notfound_page'));
     $response = new \Response($page, 404);
     \Container::getInstance()->setResponse($response);
 }
开发者ID:fucongcong,项目名称:framework,代码行数:7,代码来源:NotFoundListener.php

示例2: dispatch

 public static function dispatch()
 {
     if (empty($_GET['path'])) {
         $action = App::getInstance()->getConfig('default_action');
         $controller = App::getInstance()->getConfig('default_controller');
     } else {
         $requestedPath = $_GET['path'];
         $route = explode('/', $requestedPath);
         if (count($route) == 1) {
             $action = 'index';
             $controller = $route[0];
         } else {
             $action = $route[1];
             $controller = $route[0];
             if (count($route) > 2) {
                 unset($route[0]);
                 unset($route[1]);
                 //@todo send params to controller function
             }
         }
     }
     $action = self::sanitizeAction($action);
     $controller = self::sanitizeController($controller);
     if (!file_exists(__DIR__ . '/Controller/' . $controller . '.php')) {
         self::return404();
     }
     $controller = '\\Todos\\Controller\\' . $controller;
     $controllerInstance = new $controller();
     if (!method_exists($controllerInstance, $action)) {
         self::return404();
     }
     call_user_func_array(array($controllerInstance, $action), array());
 }
开发者ID:santerref,项目名称:minimal-php-web-framework,代码行数:33,代码来源:Router.php

示例3: getGroups

 protected function getGroups()
 {
     // get app instance
     $app = App::getInstance('zoo');
     // Merge the select item option into existing groups
     return array_merge(array(array($app->html->_('select.option', '', '- ' . JText::_('Select Item') . ' -', 'value', 'text'))), parent::getGroups());
 }
开发者ID:unrealprojects,项目名称:journal,代码行数:7,代码来源:zoomenuitem.php

示例4: onAfterInitialise

 /**
  * onAfterInitialise handler
  *
  *
  * @access	public
  * @return null
  */
 public function onAfterInitialise()
 {
     // make sure ZOO exists
     jimport('joomla.filesystem.file');
     if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_zoo/config.php') || !JComponentHelper::getComponent('com_zoo', true)->enabled) {
         return;
     }
     // load zoo
     require_once JPATH_ADMINISTRATOR . '/components/com_zoo/config.php';
     // check if Zoo > 2.4 is loaded
     if (!class_exists('App')) {
         return;
     }
     // get zoo instance
     $this->zoo = App::getInstance('zoo');
     // check if Zoo > 2.5
     if (version_compare($this->zoo->zoo->version(), '2.5') < 0) {
         return;
     }
     // load zoo language file
     $this->zoo->system->language->load('com_' . $this->zoo->id);
     // register plugin paths
     $path = $this->zoo->path->path('plugins:system/herdboyzoo/');
     // register element path
     $this->zoo->path->register($path . '/elements', 'elements');
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:33,代码来源:herdboyzoo.php

示例5: validate

 /**
  * validate
  *
  * Run validation process
  *
  * @return null
  */
 public function validate()
 {
     parent::validate();
     // compare protection code
     if (property_exists($this->_data, 'protection_code')) {
         $protectionCode = \Storage::read('protection-code-register');
         \Storage::remove('protection-code-register');
         if ($this->_data->protection_code !== $protectionCode) {
             $this->addMessage('protection_code', \View::$language->register_form_protection_code_invalid);
         }
     }
     // compare password confirmation
     if (property_exists($this->_data, 'password') && property_exists($this->_data, 'confirm_password') && $this->_data->password !== $this->_data->confirm_password) {
         $this->addMessage('confirm_password', \View::$language->register_form_password_confirm_mismatch);
     }
     // check for existence
     if ($this->isValid()) {
         $checkedFields = array('email', 'login');
         $UserModel = \App::getInstance('common\\UserModel');
         foreach ($checkedFields as $fName) {
             if ($UserModel->isExists($fName, $this->_data->{$fName})) {
                 $mKey = 'register_form_' . $fName . '_is_exists';
                 $this->addMessage($fName, \View::$language->{$mKey});
             }
         }
     }
 }
开发者ID:nsedenkov,项目名称:phpsu,代码行数:34,代码来源:RegisterForm.php

示例6: render

 public function render($data = array())
 {
     $app = App::getInstance('zoo');
     $data['order']->state = $app->zoocart->getConfig()->get('payment_pending_orderstate', 4);
     $app->zoocart->table->orders->save($data['order']);
     return parent::render($data);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:7,代码来源:offline.php

示例7: __construct

 /**
  * JBTemplate constructor.
  *
  * @param $event
  */
 public function __construct($event)
 {
     $this->event = $event;
     $this->app = App::getInstance('zoo');
     $this->application = $this->event->getSubject();
     $this->params = $this->application->params;
 }
开发者ID:alexmixaylov,项目名称:real,代码行数:12,代码来源:jbtemplate.php

示例8: getInput

 /**
  * Get input HTML
  * @return string
  */
 public function getInput()
 {
     $app = App::getInstance('zoo');
     $params = $app->jborder->getCatOrderings(false);
     $app->jbassets->jQuery();
     $app->jbassets->js("jbapp:joomla/fields/jbcategoryorder.js");
     $orderId = uniqid('jbcategoryorder-');
     $value = array('order' => $this->value, 'reverse' => 0, 'random' => 0);
     if (!empty($this->value)) {
         if ($this->value == 'random' || $this->value == 'rrandom') {
             $value['random'] = 1;
         } else {
             if (preg_match('#^r#', $this->value)) {
                 $cleanValue = preg_replace('#^r#', '', $this->value);
                 if (isset($params[$cleanValue])) {
                     $value['reverse'] = 1;
                     $value['order'] = $cleanValue;
                 }
             } else {
                 $value['order'] = $this->value;
             }
         }
     }
     $html[] = '<div id="' . $orderId . '" style="float: left;width: 250px;">';
     $html[] = $app->jbhtml->select($params, "", array('class' => 'order-select'), $value['order']);
     $html[] = '<label class="order-reverse-wrap"><input class="order-reverse" type="checkbox">' . JText::_('JBZOO_ORDER_REVERSE') . '</label> ';
     $html[] = '<label class="order-random-wrap"><input class="order-random" type="checkbox">' . JText::_('JBZOO_ORDER_RANDOM') . '</label>';
     $html[] = $app->jbhtml->hidden($this->getName($this->fieldname), $this->value, array('class' => 'hidden-value'));
     $html[] = '</div>';
     $html[] = $app->jbassets->widget('#' . $orderId, 'JBCategoryOrder', $value, true);
     return implode(PHP_EOL, $html);
 }
开发者ID:alexmixaylov,项目名称:real,代码行数:36,代码来源:jbcategoryorder.php

示例9: deleteAction

 public function deleteAction()
 {
     $app = App::getInstance();
     $id = (int) $app->getUrlParam('id');
     Options::delete($id);
     $app->redirect(__HOME__ . '/options/');
 }
开发者ID:ctlr,项目名称:Simple-File-Manager,代码行数:7,代码来源:OptionsController.php

示例10: getMarkers

 public static function getMarkers($params, $renderer)
 {
     $app = App::getInstance('zoo');
     //чтоб работал выбор категории в модуле
     $category_id = $params->get('category');
     //чтоб отображало текущую категорию
     // $category_id = $app->jbrequest->getSystem('category');
     //var_dump($category_id);
     $conditions = " a.state = 1 " . ($params->get('application') ? " AND a.application_id = " . $params->get('application') : '') . ($category_id ? " AND cc.category_id " . (is_array($category_id) ? ' IN (' . implode(',', $category_id) . ')' : ' = ' . $category_id) : '') . " GROUP BY a.id";
     $options = array('select' => "a.*", 'from' => "#__zoo_item AS a" . ($category_id ? " LEFT JOIN #__zoo_category_item as cc on a.id=cc.item_id" : ""), 'conditions' => $conditions);
     $items = $app->table->item->all($options);
     foreach ($items as $item) {
         $elements = $item->getElements();
         foreach ($elements as $element) {
             if ($element->getElementType() == 'yamap' && $element->hasValue()) {
                 foreach ($element->data() as $value) {
                     $coordinatesArr = explode(',', $value["coordinates"]);
                     $lng = trim($coordinatesArr[1]);
                     $lat = trim($coordinatesArr[0]);
                     $name = htmlspecialchars($item->name, ENT_QUOTES);
                     $text = modZoomapHelper::relToAbs($renderer->render('item.' . str_replace('_:', '', $params->get('layout', 'default')), compact('item', 'params')));
                     $markers[] = array(array($lat, $lng), $name, $item->id, JFactory::getApplication()->getMenu()->getActive()->id);
                 }
             }
         }
     }
     return $markers;
 }
开发者ID:alexmixaylov,项目名称:real,代码行数:28,代码来源:helper.php

示例11: postflight

 public function postflight($type, $parent, $results)
 {
     if (class_exists('AppRequirements')) {
         $requirements = new AppRequirements();
         $requirements->checkRequirements();
         $requirements->displayResults();
     }
     if (class_exists('App')) {
         // get zoo instance
         $app = App::getInstance('zoo');
         $app->module->enable('mod_zooquickicon', 'icon');
         $app->plugin->enable('zooshortcode');
         $app->plugin->enable('zoosmartsearch');
         $app->plugin->enable('zoosearch');
         $app->plugin->enable('zooevent');
     }
     // updateservers url update workaround
     if ('update' == $type) {
         JFactory::getDBO()->setQuery("DELETE a, b, c FROM `#__update_sites_extensions` a" . " LEFT JOIN `#__update_sites` b ON b.update_site_id = a.update_site_id" . " LEFT JOIN `#__updates` c ON c.update_site_id = a.update_site_id" . " WHERE a.extension_id = (SELECT `extension_id` FROM `#__extensions` WHERE `type` = 'package' AND `element` = 'pkg_zoo')")->execute();
     }
     $extensions = array();
     foreach ($results as $result) {
         $extensions[] = (object) array('name' => $result['name'] == 'com_zoo' ? 'ZOO extension' : $result['name'], 'status' => $result['result'], 'message' => $result['result'] ? ($type == 'update' ? 'Updated' : 'Installed') . ' successfully' : 'NOT Installed');
     }
     // display extension installation results
     self::displayResults($extensions, 'Extensions', 'Extension');
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:27,代码来源:file.script.php

示例12: execute

 public function execute()
 {
     $app = \App::getInstance();
     $conn = $app->DB_CONNECT;
     $evs = new \Archive\Port\Adaptor\Data\Archive\Events();
     $params = array();
     $start = isset($app->QUERY['start']) ? intval($app->QUERY['start']) : 0;
     $count = isset($app->QUERY['count']) ? intval($app->QUERY['count']) : (isset($app->QUERY['search']) ? 100 : 100);
     $where = "";
     if (isset($app->QUERY['type']) && $app->QUERY['type'] != "") {
         $where = " AND `ek`.`type`= :type";
         $id = trim($app->QUERY['id']);
         $params[":type"] = $type;
         $ref = new \Archive\Port\Adaptor\Data\Archive\Refs\Ref();
         $ref->setRel("type");
         $ref->setHref($id);
         $evs->setRef($ref);
     }
     $query = "SELECT `r`.`autoid`,`r`.`xmlview` FROM `resources` AS `r` \n\t\t            LEFT JOIN `events_keys` AS `ek` ON `ek`.`eventId`=`r`.`id`\n\t\t            WHERE `r`.`type`='event' {$where}\n\t\t            ORDER BY `ek`.`dt` LIMIT {$start},{$count};";
     $sth = $conn->prepare($query);
     $sth->execute(array());
     while ($row = $sth->fetch()) {
         $ev = new \Archive\Port\Adaptor\Data\Archive\Events\Event();
         $ev->fromXmlStr($row["xmlview"]);
         $evs->setEvent($ev);
     }
     $evs->setPI(str_replace($app->API_VERSION . $app->PATH_INFO, "", $_SERVER["SCRIPT_URI"]) . "/stylesheets/Archive/Timeline.xsl");
     return $evs;
 }
开发者ID:servandserv,项目名称:sf,代码行数:29,代码来源:FindEventsUseCase.php

示例13: array

 public function &getItemList($overrideLimits = false, $group = '')
 {
     if (empty($this->list)) {
         // make sure ZOO exist
         if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_zoo/config.php') || !JComponentHelper::getComponent('com_zoo', true)->enabled) {
             return;
         }
         // load zoo
         require_once JPATH_ADMINISTRATOR . '/components/com_zoo/config.php';
         // check if Zoo > 2.4 is loaded
         if (!class_exists('App')) {
             return;
         }
         // Get the ZOO App instance
         $zoo = App::getInstance('zoo');
         $elements = array();
         $apps = $zoo->zoo->getApplicationGroups();
         $applications = array();
         foreach ($apps as $app) {
             $author = strtolower($app->getMetaData('author'));
             if ($author == 'zoolanders' || $author == 'joolanders') {
                 $applications[] = $app;
             }
         }
         $this->list = $applications;
     }
     return $this->list;
 }
开发者ID:unrealprojects,项目名称:journal,代码行数:28,代码来源:apps.php

示例14: patch

 public function patch(\Archive\Port\Adaptor\Data\Archive\Documents\Document $doc, \Archive\Port\Adaptor\Data\Archive\Documents\Document $old)
 {
     $app = \App::getInstance();
     $handler = new \Happymeal\Port\Adaptor\Data\ValidationHandler();
     $doc->validateType($handler);
     if ($handler->hasErrors()) {
         $errors = $handler->getErrors();
         foreach ($errors as $code => $err) {
             $app->throwError(new \Exception(implode(";", $err), $code));
         }
     } else {
         $conn = $app->DB_CONNECT;
         $old->setYear($doc->getYear());
         $old->setType($doc->getType());
         $old->setPublished($doc->getPublished());
         $old->setComments($doc->getComments());
         $params = array();
         $qb = new \Archive\Port\Adaptor\Persistence\QueryBuilder($params);
         $query = $qb->update()->t("resources")->set()->c("xmlview")->eq()->val($old->toXmlStr())->where()->c("id")->eq()->val($old->getID())->fi();
         $sth1 = $conn->prepare($query);
         $sth1->execute($params);
         $params = [];
         $qb = new \Archive\Port\Adaptor\Persistence\QueryBuilder($params);
         $query = $qb->update()->t("documents_keys")->set()->c("type")->eq()->val($old->getType(), $qb::NOT_NULL)->c("year")->eq()->val($old->getYear(), $qb::NOT_NULL)->c("published")->eq()->val($old->getPublished(), $qb::NOT_NULL)->where()->c("documentId")->eq()->val($old->getID())->fi();
         $sth2 = $conn->prepare($query);
         $sth2->execute($params);
         return $old;
     }
 }
开发者ID:servandserv,项目名称:sf,代码行数:29,代码来源:DocumentEntityManager.php

示例15: array

 public function &getItemList($overrideLimits = false, $group = '')
 {
     if (empty($this->list)) {
         // Find ZL Elements plugin (if installed)
         $plugin = JPluginHelper::getPlugin('system', 'zoo_zlelements');
         if ($plugin) {
             // make sure ZOO exist
             if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_zoo/config.php') || !JComponentHelper::getComponent('com_zoo', true)->enabled) {
                 return;
             }
             // load zoo
             require_once JPATH_ADMINISTRATOR . '/components/com_zoo/config.php';
             // check if Zoo > 2.4 is loaded
             if (!class_exists('App')) {
                 return;
             }
             // Get the ZOO App instance
             $zoo = App::getInstance('zoo');
             $elements = array();
             $apps = $zoo->zoo->getApplicationGroups();
             foreach ($apps as $app) {
                 $el = $zoo->element->getAll($app);
                 foreach ($el as $e) {
                     if (!in_array($e, $elements)) {
                         $elements[] = $e;
                     }
                 }
             }
             $this->list = $elements;
         }
     }
     return $this->list;
 }
开发者ID:unrealprojects,项目名称:journal,代码行数:33,代码来源:elements.php


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