當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Application::getInstance方法代碼示例

本文整理匯總了PHP中Pagekit\Application::getInstance方法的典型用法代碼示例。如果您正苦於以下問題:PHP Application::getInstance方法的具體用法?PHP Application::getInstance怎麽用?PHP Application::getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Pagekit\Application的用法示例。


在下文中一共展示了Application::getInstance方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getFieldTypes

 /**
  * @return array
  */
 public function getFieldTypes($extension = null)
 {
     //todo cache this
     if (!$this->fieldTypes) {
         $this->fieldTypes = [];
         /** @noinspection PhpUnusedLocalVariableInspection */
         $app = App::getInstance();
         //available for index.php files
         $paths = [];
         foreach (App::module() as $module) {
             if ($module->get('fieldtypes')) {
                 $paths = array_merge($paths, glob(sprintf('%s/%s/*/index.php', $module->path, $module->get('fieldtypes')), GLOB_NOSORT) ?: []);
             }
         }
         foreach ($paths as $p) {
             $package = array_merge(['id' => '', 'path' => dirname($p), 'main' => '', 'extensions' => $this->fieldExtensions, 'class' => '\\Bixie\\Framework\\FieldType\\FieldType', 'resource' => 'bixie/framework:app/bundle', 'config' => ['hasOptions' => 0, 'readonlyOptions' => 0, 'required' => 0, 'multiple' => 0], 'dependancies' => [], 'styles' => [], 'getOptions' => '', 'prepareValue' => '', 'formatValue' => ''], include $p);
             $this->registerFieldType($package);
         }
     }
     if ($extension) {
         return array_filter($this->fieldTypes, function ($fieldType) use($extension) {
             /** @var FieldTypeBase $fieldType */
             return in_array($extension, $fieldType->getExtensions());
         });
     }
     return $this->fieldTypes;
 }
開發者ID:Bixie,項目名稱:pagekit-framework,代碼行數:30,代碼來源:FrameworkModule.php

示例2: applyPlugin

 /**
  * Defines the plugins callback.
  *
  * @param  array $options
  * @return string|null
  */
 public function applyPlugin(array $options)
 {
     if (!isset($options['id'])) {
         return;
     }
     $formmaker = App::module('bixie/formmaker');
     $app = App::getInstance();
     $form_id = $options['id'];
     unset($options['id']);
     try {
         return $formmaker->renderForm($app, $form_id, $options);
     } catch (App\Exception $e) {
         return $e->getMessage();
     }
 }
開發者ID:Bixie,項目名稱:pagekit-formmaker,代碼行數:21,代碼來源:FormmakerPlugin.php

示例3: formAction

 /**
  * @Route("/{id}", name="form/front")
  */
 public function formAction($id = 0)
 {
     if (!($formmaker = App::module('bixie/formmaker'))) {
         return 'Formmaker extension is disabled!';
     }
     $user = App::user();
     /** @var Form $form */
     if (!($form = Form::where(['id = ?'], [$id])->where(function ($query) use($user) {
         if (!$user->isAdministrator()) {
             $query->where('status = 1');
         }
     })->related('fields')->first())) {
         App::abort(404, __('Form not found!'));
     }
     if (!App::node()->hasAccess(App::user())) {
         App::abort(403, __('Insufficient User Rights.'));
     }
     $app = App::getInstance();
     $form->prepareView($app, $formmaker);
     return ['$view' => ['title' => __($form->title), 'name' => 'bixie/formmaker/form.php'], '$formmaker' => ['config' => $formmaker->publicConfig(), 'formitem' => $form, 'fields' => array_values($form->getFields())], 'node' => App::node()];
 }
開發者ID:Eichi,項目名稱:pagekit-formmaker,代碼行數:24,代碼來源:SiteController.php

示例4: __construct

 /**
  * Constructor.
  */
 public function __construct()
 {
     $app = App::getInstance();
     $this->installer = new Installer($app);
 }
開發者ID:pagekit,項目名稱:pagekit,代碼行數:8,代碼來源:InstallerController.php

示例5: run

 /**
  * @param array|callable $scripts
  */
 protected function run($scripts)
 {
     array_map(function ($script) {
         if (is_callable($script)) {
             call_user_func($script, App::getInstance());
         }
     }, (array) $scripts);
 }
開發者ID:rifal89,項目名稱:pagekit,代碼行數:11,代碼來源:PackageScripts.php

示例6: execute

 /**
  * @param array|callable $scripts
  */
 public function execute($scripts)
 {
     array_map(function ($script) {
         call_user_func($script, App::getInstance());
     }, (array) $scripts);
 }
開發者ID:4nxiety,項目名稱:pagekit,代碼行數:9,代碼來源:PackageManager.php

示例7: loadPackages

 /**
  * Load packages from paths.
  */
 protected function loadPackages()
 {
     $app = App::getInstance();
     foreach ($this->paths as $path) {
         $paths = glob($path, GLOB_NOSORT) ?: [];
         foreach ($paths as $p) {
             if (!($package = $this->load($p))) {
                 continue;
             }
             $this->packages[$package->getName()] = $package;
         }
     }
 }
開發者ID:4nxiety,項目名稱:pagekit,代碼行數:16,代碼來源:PackageFactory.php


注:本文中的Pagekit\Application::getInstance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。