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


PHP Input::getInstance方法代码示例

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


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

示例1: toggleVisibility

 /**
  * Disable/enable a user group
  * @param integer
  * @param boolean
  */
 public function toggleVisibility($intId, $blnVisible)
 {
     // Check permissions to edit
     $objInput = \Input::getInstance();
     $objInput->setGet('id', $intId);
     $objInput->setGet('act', 'toggle');
     #$this->checkPermission();
     // Check permissions to publish
     if (!$this->User->isAdmin && !$this->User->hasAccess('tl_glossary_term::published', 'alexf')) {
         $this->log('Not enough permissions to publish/unpublish item ID "' . $intId . '"', 'tl_glossary_term toggleVisibility', TL_ERROR);
         $this->redirect('contao/main.php?act=error');
     }
     $objVersions = new \Versions('tl_glossary_term', $intId);
     $objVersions->initialize();
     // Trigger the save_callback
     if (is_array($GLOBALS['TL_DCA']['tl_glossary_term']['fields']['published']['save_callback'])) {
         foreach ($GLOBALS['TL_DCA']['tl_glossary_term']['fields']['published']['save_callback'] as $callback) {
             $this->import($callback[0]);
             $blnVisible = $this->{$callback}[0]->{$callback}[1]($blnVisible, $this);
         }
     }
     // Update the database
     \Database::getInstance()->prepare("UPDATE tl_glossary_term SET tstamp=" . time() . ", published='" . ($blnVisible ? 1 : '') . "' WHERE id=?")->execute($intId);
     $objVersions->create();
     $this->log('A new version of record "tl_glossary_term.id=' . $intId . '" has been created', 'tl_revolutionslider_slides toggleVisibility()', TL_GENERAL);
 }
开发者ID:w3scout,项目名称:glossary_revisited,代码行数:31,代码来源:TableGlossaryTerm.php

示例2: renderPreviewView

 /**
  * @param DC_General $dc
  */
 public function renderPreviewView(EnvironmentInterface $environment)
 {
     /** @var EventDispatcher $eventDispatcher */
     $eventDispatcher = $GLOBALS['container']['event-dispatcher'];
     $eventDispatcher->dispatch(ContaoEvents::SYSTEM_LOAD_LANGUAGE_FILE, new LoadLanguageFileEvent('avisota_message_preview'));
     $eventDispatcher->dispatch(ContaoEvents::SYSTEM_LOAD_LANGUAGE_FILE, new LoadLanguageFileEvent('orm_avisota_message'));
     $input = \Input::getInstance();
     $messageRepository = EntityHelper::getRepository('Avisota\\Contao:Message');
     $messageId = IdSerializer::fromSerialized($input->get('id') ? $input->get('id') : $input->get('pid'));
     $message = $messageRepository->find($messageId->getId());
     if (!$message) {
         $environment = \Environment::getInstance();
         $eventDispatcher->dispatch(ContaoEvents::CONTROLLER_REDIRECT, new RedirectEvent(preg_replace('#&(act=preview|id=[a-f0-9\\-]+)#', '', $environment->request)));
     }
     $modules = new \StringBuilder();
     /** @var \Avisota\Contao\Message\Core\Send\SendModuleInterface $module */
     foreach ($GLOBALS['AVISOTA_SEND_MODULE'] as $className) {
         $class = new \ReflectionClass($className);
         $module = $class->newInstance();
         $modules->append($module->run($message));
     }
     $context = array('message' => $message, 'modules' => $modules);
     $template = new \TwigTemplate('avisota/backend/preview', 'html5');
     return $template->parse($context);
 }
开发者ID:Ainschy,项目名称:contao-message,代码行数:28,代码来源:Preview.php

示例3: intializeObjectStack

 /**
  * Initialize object stack.
  *
  * @return void
  */
 public static function intializeObjectStack()
 {
     \Config::getInstance();
     \Environment::getInstance();
     \Input::getInstance();
     static::getUser();
     \Database::getInstance();
 }
开发者ID:contao-bootstrap,项目名称:core,代码行数:13,代码来源:Contao.php

示例4: getPost

 /**
  * Compat wrapper for contao 2.X and 3.X - delegates to the relevant input handler.
  *
  * @param string $key               The key to retrieve.
  *
  * @param bool   $blnDecodeEntities Decode the entities.
  *
  * @return mixed
  */
 protected static function getPost($key, $blnDecodeEntities = false)
 {
     // TODO: use dependency injection here.
     if (version_compare(VERSION, '3.0', '>=')) {
         return \Input::post($key, $blnDecodeEntities);
     }
     return \Input::getInstance()->post($key, $blnDecodeEntities);
 }
开发者ID:amenk,项目名称:dc-general,代码行数:17,代码来源:Ajax.php

示例5: resolveCategoryFromInput

 /**
  * @return MessageCategory|null
  */
 public static function resolveCategoryFromInput()
 {
     $input = \Input::getInstance();
     $id = $input->get('id');
     $pid = $input->get('pid');
     $modelId = null;
     $parentModelId = null;
     /** @var MessageCategory $category */
     $category = null;
     /** @var Message $message */
     $message = null;
     /** @var MessageContent $content */
     $content = null;
     if ($id) {
         $modelId = IdSerializer::fromSerialized($id);
     }
     if ($pid) {
         $parentModelId = IdSerializer::fromSerialized($pid);
     }
     // $id or $pid is a category ID
     if ($modelId && $modelId->getDataProviderName() == 'orm_avisota_message_category') {
         $repository = EntityHelper::getRepository('Avisota\\Contao:MessageCategory');
         $category = $repository->find($modelId->getId());
     } else {
         if ($parentModelId && $parentModelId->getDataProviderName() == 'orm_avisota_message_category') {
             $repository = EntityHelper::getRepository('Avisota\\Contao:MessageCategory');
             $category = $repository->find($parentModelId->getId());
         } else {
             if ($modelId && $modelId->getDataProviderName() == 'orm_avisota_message') {
                 $repository = EntityHelper::getRepository('Avisota\\Contao:Message');
                 $message = $repository->find($modelId->getId());
                 $category = $message->getCategory();
             } else {
                 if ($parentModelId && $parentModelId->getDataProviderName() == 'orm_avisota_message') {
                     $repository = EntityHelper::getRepository('Avisota\\Contao:Message');
                     $message = $repository->find($parentModelId->getId());
                     $category = $message->getCategory();
                 } else {
                     if ($modelId && $modelId->getDataProviderName() == 'orm_avisota_message_content') {
                         $repository = EntityHelper::getRepository('Avisota\\Contao:MessageContent');
                         $content = $repository->find($modelId->getId());
                         $message = $content->getMessage();
                         $category = $message->getCategory();
                     } else {
                         if ($parentModelId && $parentModelId->getDataProviderName() == 'orm_avisota_message_content') {
                             $repository = EntityHelper::getRepository('Avisota\\Contao:MessageContent');
                             $content = $repository->find($parentModelId->getId());
                             $message = $content->getMessage();
                             $category = $message->getCategory();
                         }
                     }
                 }
             }
         }
     }
     return $category;
 }
开发者ID:Ainschy,项目名称:contao-message,代码行数:60,代码来源:Helper.php

示例6: getFilterParameters

 /**
  * Retrieve all filter parameters from the input class for the specified filter setting.
  *
  * @param MetaModelList $objItemRenderer
  *
  * @return string[]
  */
 protected function getFilterParameters($objItemRenderer)
 {
     $arrReturn = array();
     foreach (array_keys($objItemRenderer->getFilterSettings()->getParameterFilterNames()) as $strName) {
         $varValue = \Input::getInstance()->get($strName);
         if (is_string($varValue)) {
             $arrReturn[$strName] = $varValue;
         }
     }
     return $arrReturn;
 }
开发者ID:amenk,项目名称:MetaModels-core,代码行数:18,代码来源:ContentMetaModel.php

示例7: execute

 protected function execute(Message $message, \BackendUser $user)
 {
     global $container;
     /** @var \Symfony\Component\EventDispatcher\EventDispatcher $eventDispatcher */
     $eventDispatcher = $GLOBALS['container']['event-dispatcher'];
     $input = \Input::getInstance();
     $user = $input->get('recipient_user');
     /** @var \Doctrine\DBAL\Connection $connection */
     $connection = $container['doctrine.connection.default'];
     $queryBuilder = $connection->createQueryBuilder();
     /** @var \Doctrine\DBAL\Statement $statement */
     $statement = $queryBuilder->select('u.*')->from('tl_user', 'u')->where('id=:id')->setParameter(':id', $user)->execute();
     $userData = $statement->fetch();
     if (!$userData) {
         $_SESSION['AVISOTA_SEND_PREVIEW_TO_USER_EMPTY'] = true;
         header('Location: ' . $url);
         exit;
     }
     $idSerializer = new IdSerializer();
     $idSerializer->setDataProviderName('orm_avisota_message');
     $idSerializer->setId($message->getId());
     $pidSerializer = new IdSerializer();
     $pidSerializer->setDataProviderName('orm_avisota_message_category');
     $pidSerializer->setId($message->getCategory()->getId());
     $environment = Environment::getInstance();
     $url = sprintf('%scontao/main.php?do=avisota_newsletter&table=orm_avisota_message&act=preview&id=%s&pid=%s', $environment->base, $idSerializer->getSerialized(), $pidSerializer->getSerialized());
     if ($message->getCategory()->getViewOnlinePage()) {
         $event = new LoadLanguageFileEvent('avisota_message');
         $eventDispatcher->dispatch(ContaoEvents::SYSTEM_LOAD_LANGUAGE_FILE, $event);
         $viewOnlineLink = sprintf($GLOBALS['TL_LANG']['avisota_message']['viewOnline'], $url);
     } else {
         $viewOnlineLink = false;
     }
     $event = new \Avisota\Contao\Core\Event\CreateFakeRecipientEvent($message);
     $eventDispatcher->dispatch(\Avisota\Contao\Core\CoreEvents::CREATE_FAKE_RECIPIENT, $event);
     $recipient = $event->getRecipient();
     $recipient->setEmail($userData['email']);
     $additionalData = array('view_online_link' => $viewOnlineLink);
     /** @var \Avisota\Contao\Message\Core\Renderer\MessageRendererInterface $renderer */
     $renderer = $container['avisota.message.renderer'];
     $messageTemplate = $renderer->renderMessage($message);
     $messageMail = $messageTemplate->render($recipient, $additionalData);
     /** @var \Avisota\Transport\TransportInterface $transport */
     $transport = $GLOBALS['container']['avisota.transport.' . $message->getQueue()->getTransport()->getId()];
     $transport->send($messageMail);
     $event = new \ContaoCommunityAlliance\Contao\Bindings\Events\System\LoadLanguageFileEvent('avisota_message_preview');
     $eventDispatcher->dispatch(\ContaoCommunityAlliance\Contao\Bindings\ContaoEvents::SYSTEM_LOAD_LANGUAGE_FILE, $event);
     $_SESSION['TL_CONFIRM'][] = sprintf($GLOBALS['TL_LANG']['avisota_message_preview']['previewSend'], $recipient->getEmail());
     header('Location: ' . $url);
     exit;
 }
开发者ID:Ainschy,项目名称:contao-message,代码行数:51,代码来源:send_preview_to_user.php

示例8: modifyDCA

 /**
  * Modify field dca depending on loaded module
  * @param object, DataContainer
  * @return object, DataContainer
  */
 public function modifyDCA(\DataContainer $objDC)
 {
     if (\Input::getInstance()->get('act') != 'edit') {
         return $objDC;
     }
     $objActiveRecord = \Database::getInstance()->prepare("SELECT * FROM " . $objDC->table . " WHERE id=?")->limit(1)->execute($objDC->id);
     if ($objActiveRecord->type == 'onepagewebsiteregular') {
         $GLOBALS['TL_DCA']['tl_module']['fields']['showLevel']['eval']['tl_class'] = '';
         $GLOBALS['TL_DCA']['tl_module']['fields']['hardLimit']['eval']['tl_class'] = 'w50';
     }
     if ($objActiveRecord->type == 'onepagewebsitenavigation') {
         $GLOBALS['TL_DCA']['tl_module']['fields']['rootPage'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['rootModule'], 'exclude' => false, 'inputType' => 'radio', 'options_callback' => array('OnePageWebsite\\Backend\\TableModule', 'getModules'));
     }
     return $objDC;
 }
开发者ID:mad99,项目名称:onepagewebsite,代码行数:20,代码来源:TableModule.php

示例9: initializeContaoObjectStack

 /**
  * This initializes the Contao Singleton object stack as it must be,
  * when using singletons within the config.php file of an Extension.
  *
  * @return void
  */
 protected static function initializeContaoObjectStack()
 {
     // all of these getInstance calls are neccessary to keep the instance stack intact
     // and therefore prevent an Exception in unknown on line 0.
     // Hopefully this will get fixed with Contao Reloaded or Contao 3.
     Config::getInstance();
     Environment::getInstance();
     Input::getInstance();
     // request token became available in 2.11
     if (version_compare(TL_VERSION, '2.11', '>=')) {
         RequestToken::getInstance();
     }
     self::getUser();
     Database::getInstance();
 }
开发者ID:amenk,项目名称:MetaModels-core,代码行数:21,代码来源:MetaModelFactory.php

示例10: initializeContaoObjectStack

 /**
  * This initializes the Contao Singleton object stack as it must be,
  * when using singletons within the config.php file of an Extension.
  *
  * @return bool
  */
 protected static function initializeContaoObjectStack()
 {
     if (!file_exists(TL_ROOT . '/system/config/localconfig.php')) {
         return false;
     }
     // all of these getInstance calls are neccessary to keep the instance stack intact
     // and therefore prevent an Exception in unknown on line 0.
     // Hopefully this will get fixed with Contao Reloaded or Contao 3.
     require_once TL_ROOT . '/system/config/localconfig.php';
     Config::getInstance();
     Environment::getInstance();
     Input::getInstance();
     self::getUser();
     Database::getInstance();
     return true;
 }
开发者ID:amenk,项目名称:MetaModels-core,代码行数:22,代码来源:MetaModelBackend.php

示例11: initialize

 /**
  * Initialize the composer environment.
  */
 public static function initialize()
 {
     if (version_compare(PHP_VERSION, COMPOSER_MIN_PHPVERSION, '<')) {
         return;
     }
     if (TL_MODE == 'BE') {
         $GLOBALS['TL_HOOKS']['loadLanguageFile']['composer'] = array('ContaoCommunityAlliance\\Contao\\Composer\\Client', 'disableOldClientHook');
         $input = \Input::getInstance();
         if ($input->get('do') == 'repository_manager') {
             $environment = \Environment::getInstance();
             header('Location: ' . $environment->base . 'contao/main.php?do=composer');
             exit;
         }
     }
     static::registerVendorClassLoader();
 }
开发者ID:tim-bec,项目名称:composer-client,代码行数:19,代码来源:Runtime.php

示例12: run

 public function run()
 {
     $input = \Input::getInstance();
     $messageRepository = \Contao\Doctrine\ORM\EntityHelper::getRepository('Avisota\\Contao:Message');
     $messageId = $input->get('id');
     $message = $messageRepository->find($messageId);
     /** @var \Avisota\Contao\Entity\Message $message */
     if (!$message) {
         header("HTTP/1.0 404 Not Found");
         echo '<h1>404 Not Found</h1>';
         exit;
     }
     $user = \BackendUser::getInstance();
     $user->authenticate();
     $this->execute($message, $user);
 }
开发者ID:Ainschy,项目名称:contao-message,代码行数:16,代码来源:AbstractWebRunner.php

示例13: getClasses

 public function getClasses()
 {
     // only in backend
     if (TL_MODE == 'BE') {
         // order is important
         \BackendUser::getInstance();
         \Database::getInstance();
         \Config::getInstance();
         \Environment::getInstance();
         \Input::getInstance();
         // init language files and start f module
         if (\Database::getInstance()->tableExists('tl_fmodules')) {
             $saveLanguage = $_SESSION['fm_language'] ? $_SESSION['fm_language'] : 'de';
             \Backend::loadLanguageFile('tl_fmodules_language_pack', $saveLanguage);
             $dcaCreator = new DCACreator();
             $dcaCreator->loadModules();
             $dcaCreator->createLabels();
         }
     }
 }
开发者ID:alnv,项目名称:fmodul,代码行数:20,代码来源:Initialize.php

示例14: executeQueue

 protected function executeQueue(EntityRepository $queueRepository)
 {
     global $container;
     $input = \Input::getInstance();
     $executeId = $input->get('execute');
     if ($executeId) {
         /** @var Queue $queueData */
         $queueData = $queueRepository->find($executeId);
         if (!$queueData->getAllowManualSending()) {
             return;
         }
         $serviceName = sprintf('avisota.queue.%s', $queueData->getId());
         /** @var QueueInterface $queue */
         $queue = $container[$serviceName];
         $this->Template->setName('avisota/backend/outbox_execute');
         $this->Template->queue = $queue;
         $this->Template->config = $queueData;
         $GLOBALS['TL_CSS'][] = 'assets/avisota/core/css/be_outbox.css';
         $GLOBALS['TL_JAVASCRIPT'][] = 'assets/avisota/core/js/Number.js';
         $GLOBALS['TL_JAVASCRIPT'][] = 'assets/avisota/core/js/be_outbox.js';
     }
 }
开发者ID:Ainschy,项目名称:contao-core,代码行数:22,代码来源:Outbox.php

示例15: handle

 /**
  * {@inheritdoc}
  */
 public function handle(\Input $input)
 {
     $outFile = new \File(self::OUT_FILE_PATHNAME);
     $pidFile = new \File(self::PID_FILE_PATHNAME);
     $output = $outFile->getContent();
     $pid = $pidFile->getContent();
     // We send special signal 0 to test for existance of the process which is much more bullet proof than
     // using anything like shell_exec() wrapped ps/pgrep magic (which is not available on all systems).
     $isRunning = (bool) posix_kill($pid, 0);
     $startTime = new \DateTime();
     $startTime->setTimestamp(filectime(TL_ROOT . '/' . self::PID_FILE_PATHNAME));
     $endTime = new \DateTime();
     $endTime->setTimestamp($isRunning ? time() : filemtime(TL_ROOT . '/' . self::OUT_FILE_PATHNAME));
     $uptime = $endTime->diff($startTime);
     $uptime = $uptime->format('%h h %I m %S s');
     if (!$isRunning && \Input::getInstance()->post('close')) {
         $outFile->renameTo(UpdatePackagesController::OUTPUT_FILE_PATHNAME);
         $pidFile->delete();
         $this->redirect('contao/main.php?do=composer&amp;update=database');
     } else {
         if ($isRunning && \Input::getInstance()->post('terminate')) {
             posix_kill($pid, SIGTERM);
             $this->reload();
         }
     }
     $converter = new ConsoleColorConverter();
     $output = $converter->parse($output);
     if (\Environment::getInstance()->isAjaxRequest) {
         header('Content-Type: application/json; charset=utf-8');
         echo json_encode(array('output' => $output, 'isRunning' => $isRunning, 'uptime' => $uptime));
         exit;
     } else {
         $template = new \BackendTemplate('be_composer_client_detached');
         $template->output = $output;
         $template->isRunning = $isRunning;
         $template->uptime = $uptime;
         return $template->parse();
     }
 }
开发者ID:designs2,项目名称:composer-client,代码行数:42,代码来源:DetachedController.php


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