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


PHP App::objects方法代码示例

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


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

示例1: _findThemes

 /**
  * Find the paths to all the installed shell themes in the app.
  *
  * Bake themes are directories not named `skel` inside a `Console/Templates` path.
  * They are listed in this order: app -> plugin -> default
  *
  * @return array Array of bake themes that are installed.
  */
 protected function _findThemes()
 {
     $paths = App::path('Console');
     $plugins = App::objects('plugin');
     foreach ($plugins as $plugin) {
         $paths[] = $this->_pluginPath($plugin) . 'Console/';
     }
     $core = current(App::core('Console'));
     $Folder = new Folder($core . 'Templates/default');
     $contents = $Folder->read();
     $themeFolders = $contents[0];
     $paths[] = $core;
     foreach ($paths as $i => $path) {
         $paths[$i] = rtrim($path, DS) . DS;
     }
     $this->_io->verbose('Found the following bake themes:');
     $themes = [];
     foreach ($paths as $path) {
         $Folder = new Folder($path . 'Templates', false);
         $contents = $Folder->read();
         $subDirs = $contents[0];
         foreach ($subDirs as $dir) {
             $Folder = new Folder($path . 'Templates/' . $dir);
             $contents = $Folder->read();
             $subDirs = $contents[0];
             if (array_intersect($contents[0], $themeFolders)) {
                 $templateDir = $path . 'Templates/' . $dir . DS;
                 $themes[$dir] = $templateDir;
                 $this->_io->verbose(sprintf("- %s -> %s", $dir, $templateDir));
             }
         }
     }
     return $themes;
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:42,代码来源:TemplateTask.php

示例2: getShellList

 /**
  * Gets the shell command listing.
  *
  * @return array
  */
 public function getShellList()
 {
     $skipFiles = ['AppShell'];
     $hiddenCommands = ['CommandListShell', 'CompletionShell'];
     $plugins = Plugin::loaded();
     $shellList = array_fill_keys($plugins, null) + ['CORE' => null, 'app' => null];
     $corePath = App::core('Console/Command');
     $shells = App::objects('file', $corePath[0]);
     $shells = array_diff($shells, $skipFiles, $hiddenCommands);
     $this->_appendShells('CORE', $shells, $shellList);
     $appShells = App::objects('Console/Command', null, false);
     $appShells = array_diff($appShells, $shells, $skipFiles);
     $this->_appendShells('app', $appShells, $shellList);
     foreach ($plugins as $plugin) {
         $pluginShells = App::objects($plugin . '.Console/Command');
         $this->_appendShells($plugin, $pluginShells, $shellList);
     }
     return array_filter($shellList);
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:24,代码来源:CommandTask.php

示例3: setUp

 /**
  * Sets the plugins folder for this test
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     App::objects('Plugin', null, false);
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:10,代码来源:PluginTest.php

示例4: testListObjectsInPlugin

 /**
  * Tests listing objects within a plugin
  *
  * @return void
  */
 public function testListObjectsInPlugin()
 {
     Plugin::load(array('TestPlugin', 'TestPluginTwo'));
     $result = App::objects('TestPlugin.Model/Table');
     $this->assertContains('TestPluginCommentsTable', $result);
     $result = App::objects('TestPlugin.Model/Behavior');
     $this->assertTrue(in_array('PersisterOneBehavior', $result));
     $result = App::objects('TestPlugin.View/Helper');
     $expected = array('OtherHelperHelper', 'PluggedHelperHelper', 'TestPluginAppHelper');
     $this->assertEquals($expected, $result);
     $result = App::objects('TestPlugin.Controller/Component');
     $this->assertTrue(in_array('OtherComponent', $result));
     $result = App::objects('TestPluginTwo.Model/Behavior');
     $this->assertSame(array(), $result);
     $result = App::objects('Model/Table', null, false);
     $this->assertContains('PostsTable', $result);
     $this->assertContains('ArticlesTable', $result);
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:23,代码来源:AppTest.php

示例5: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Cache::disable();
     App::objects('Plugin', null, true);
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:11,代码来源:ConfigureTest.php

示例6: _getViewFileName

 /**
  * Returns filename of given action's template file (.ctp) as a string.
  * CamelCased action names will be under_scored! This means that you can have
  * LongActionNames that refer to long_action_names.ctp views.
  *
  * @param string $name Controller action to find template filename for
  * @return string Template filename
  * @throws \Cake\View\Error\MissingViewException when a view file could not be found.
  */
 protected function _getViewFileName($name = null)
 {
     $subDir = null;
     if ($this->subDir !== null) {
         $subDir = $this->subDir . DS;
     }
     if ($name === null) {
         $name = $this->view;
     }
     $name = str_replace('/', DS, $name);
     list($plugin, $name) = $this->pluginSplit($name);
     if (strpos($name, DS) === false && $name[0] !== '.') {
         $name = $this->viewPath . DS . $subDir . Inflector::underscore($name);
     } elseif (strpos($name, DS) !== false) {
         if ($name[0] === DS || $name[1] === ':') {
             if (is_file($name)) {
                 return $name;
             }
             $name = trim($name, DS);
         } elseif ($name[0] === '.') {
             $name = substr($name, 3);
         } elseif (!$plugin || $this->viewPath !== $this->name) {
             $name = $this->viewPath . DS . $subDir . $name;
         }
     }
     $paths = $this->_paths($plugin);
     $exts = $this->_getExtensions();
     foreach ($exts as $ext) {
         foreach ($paths as $path) {
             if (file_exists($path . $name . $ext)) {
                 return $path . $name . $ext;
             }
         }
     }
     $defaultPath = $paths[0];
     if ($this->plugin) {
         $pluginPaths = App::objects('Plugin');
         foreach ($paths as $path) {
             if (strpos($path, $pluginPaths[0]) === 0) {
                 $defaultPath = $path;
                 break;
             }
         }
     }
     throw new Error\MissingViewException(array('file' => $defaultPath . $name . $this->_ext));
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:55,代码来源:View.php

示例7: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $request = new Request();
     $this->Controller = new Controller($request);
     $this->PostsController = new ViewPostsController($request);
     $this->PostsController->viewPath = 'Posts';
     $this->PostsController->index();
     $this->View = $this->PostsController->createView();
     $themeRequest = new Request('posts/index');
     $this->ThemeController = new Controller($themeRequest);
     $this->ThemePostsController = new ThemePostsController($themeRequest);
     $this->ThemePostsController->viewPath = 'Posts';
     $this->ThemePostsController->index();
     $this->ThemeView = $this->ThemePostsController->createView();
     App::objects('Plugin', null, false);
     Plugin::load(array('TestPlugin', 'TestPlugin', 'PluginJs'));
     Configure::write('debug', true);
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:24,代码来源:ViewTest.php

示例8: loadAll

 /**
  * Will load all the plugins located in the default plugin folder.
  *
  * If passed an options array, it will be used as a common default for all plugins to be loaded
  * It is possible to set specific defaults for each plugins in the options array. Examples:
  *
  * {{{
  *  Plugin::loadAll([
  *      ['bootstrap' => true],
  *      'DebugKit' => ['routes' => true],
  *  ]);
  * }}}
  *
  * The above example will load the bootstrap file for all plugins, but for DebugKit it will only load the routes file
  * and will not look for any bootstrap script.
  *
  * If a plugin has been loaded already, it will not be reloaded by loadAll().
  *
  * @param array $options
  * @return void
  */
 public static function loadAll(array $options = [])
 {
     $plugins = App::objects('Plugin');
     foreach ($plugins as $p) {
         $opts = isset($options[$p]) ? $options[$p] : null;
         if ($opts === null && isset($options[0])) {
             $opts = $options[0];
         }
         if (isset(static::$_plugins[$p])) {
             continue;
         }
         static::load($p, (array) $opts);
     }
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:35,代码来源:Plugin.php

示例9: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $_GET = [];
     Configure::write('App.base', false);
     Configure::write('App.baseUrl', false);
     Configure::write('App.dir', 'app');
     Configure::write('App.webroot', 'webroot');
     Configure::write('App.namespace', 'TestApp');
     Cache::disable();
     App::objects('Plugin', null, false);
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:17,代码来源:DispatcherTest.php


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