当前位置: 首页>>代码示例>>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;未经允许,请勿转载。