本文整理汇总了PHP中Cake\Core\Plugin::loadAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugin::loadAll方法的具体用法?PHP Plugin::loadAll怎么用?PHP Plugin::loadAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Core\Plugin
的用法示例。
在下文中一共展示了Plugin::loadAll方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
*
* Inflector::rules('plural', ['/^(inflect)or$/i' => '\1ables']);
* Inflector::rules('irregular', ['red' => 'redlings']);
* Inflector::rules('uninflected', ['dontinflectme']);
* Inflector::rules('transliteration', ['/å/' => 'aa']);
*/
/**
* Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
* Uncomment one of the lines below, as you need. make sure you read the documentation on Plugin to use more
* advanced ways of loading plugins
*
* Plugin::loadAll(); // Loads all plugins at once
* Plugin::load('Migrations'); //Loads a single plugin named Migrations
*
*/
Plugin::loadAll();
// Only try to load DebugKit in development mode
// Debug Kit should not be installed on a production system
if (Configure::read('debug')) {
Plugin::load('DebugKit', ['bootstrap' => true]);
}
/**
* Connect middleware/dispatcher filters.
*/
DispatcherFactory::add('Asset');
DispatcherFactory::add('Routing');
DispatcherFactory::add('ControllerFactory');
/**
* Enable default locale format parsing.
* This is needed for matching the auto-localized string output of Time() class when parsing dates.
*/
示例2: finder_access
<?php
use Cake\Core\Plugin;
use Cake\Core\Configure;
use Cake\Routing\Router;
Plugin::loadAll([['ignoreMissing' => true, 'bootstrap' => true], 'Editorial/Core' => ['routes' => true]]);
Configure::write('Summernote.elFinder', ['debug' => false, 'roots' => [['primary' => true, 'driver' => 'LocalFileSystem', 'alias' => __('Uploads folder'), 'path' => ROOT . DS . Configure::read('App.webroot') . DS . 'files' . DS, 'URL' => Router::url('/', true) . 'files/', 'uploadDeny' => array('all'), 'uploadAllow' => array('image', 'text/plain'), 'uploadOrder' => array('deny', 'allow'), 'accessControl' => 'finder_access']]]);
function finder_access($attr, $path, $data, $volume)
{
return strpos(basename($path), '.') === 0 ? !($attr == 'read' || $attr == 'write') : null;
// else elFinder decide it itself
}
示例3: testLoadAllWithDefaultsAndOverride
/**
* Tests that Plugin::loadAll() will load all plgins in the configured folder wit defaults
* and overrides for a plugin
*
* @return void
*/
public function testLoadAllWithDefaultsAndOverride()
{
Plugin::loadAll(array(array('bootstrap' => true, 'ignoreMissing' => true), 'TestPlugin' => array('routes' => true)));
Plugin::routes();
$expected = ['Company', 'PluginJs', 'TestPlugin', 'TestPluginTwo'];
$this->assertEquals($expected, Plugin::loaded());
$this->assertEquals('loaded js plugin bootstrap', Configure::read('PluginTest.js_plugin.bootstrap'));
$this->assertEquals('loaded plugin routes', Configure::read('PluginTest.test_plugin.routes'));
$this->assertEquals(null, Configure::read('PluginTest.test_plugin.bootstrap'));
$this->assertEquals('loaded plugin two bootstrap', Configure::read('PluginTest.test_plugin_two.bootstrap'));
}
示例4:
<?php
/**
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) MindForce Team (http://mindforce.me)
* @link http://mindforce.me Garderobe Jquery Plugin
* @since 0.0.1
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Cake\Core\Configure;
use Cake\Core\Plugin;
Plugin::loadAll([['ignoreMissing' => true, 'bootstrap' => true, 'routes' => true], 'Garderobe/Core']);
Configure::write('Garderobe.Plugin.Jquery', ['name' => 'Garderobe/Jquery']);
示例5: testThatHelperHelpersAreNotAttached
/**
* test that a helpers Helper is not 'attached' to the collection
*
* @return void
*/
public function testThatHelperHelpersAreNotAttached()
{
Plugin::loadAll();
$events = $this->getMock('\\Cake\\Event\\EventManager');
$this->View->setEventManager($events);
$events->expects($this->never())->method('attach');
$Helper = new TestHelper($this->View);
$Helper->OtherHelper;
}
示例6:
<?php
/**
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Mindforce Team (http://mindforce.me)
* @link http://mindforce.me RearEngine CakePHP 3 Plugin
* @since 0.0.1
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Cake\Core\Configure;
use Cake\Database\Type;
use Cake\Core\App;
use Cake\Event\EventManager;
use Cake\Core\Plugin;
Plugin::loadAll([['ignoreMissing' => true, 'bootstrap' => true, 'routes' => true], 'Platform', 'Garderobe/Bootstrap3', 'Garderobe/BootstrapKit', 'PlumSearch', 'Search']);
// Setup RearEngine as theme does not provide layout and view overriding
// so we just add it as additional templates path
Configure::write('App.paths.templates', array_merge([APP . 'Template' . DS . 'Plugin' . DS . 'RearEngine' . DS], App::path('Template', 'RearEngine'), App::path('Template')));
Configure::write('Routing.prefixes', ['admin']);
EventManager::instance()->attach(new RearEngine\Event\CoreEvent(), null, ['priority' => 2]);
示例7:
*
* Inflector::rules('plural', ['/^(inflect)or$/i' => '\1ables']);
* Inflector::rules('irregular', ['red' => 'redlings']);
* Inflector::rules('uninflected', ['dontinflectme']);
* Inflector::rules('transliteration', ['/å/' => 'aa']);
*/
/**
* Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
* Uncomment one of the lines below, as you need. make sure you read the documentation on Plugin to use more
* advanced ways of loading plugins
*
* Plugin::loadAll(); // Loads all plugins at once
* Plugin::load('Migrations'); //Loads a single plugin named Migrations
*
*/
Plugin::loadAll(['Admin' => ['bootstrap' => false, 'routes' => true, 'ignoreMissing' => true], 'System' => ['bootstrap' => false, 'routes' => true, 'ignoreMissing' => true], 'Api' => ['bootstrap' => false, 'routes' => true, 'ignoreMissing' => true], 'Page' => ['bootstrap' => false, 'routes' => true, 'ignoreMissing' => true], 'Social' => ['bootstrap' => false, 'routes' => true, 'ignoreMissing' => true], 'Setting' => ['bootstrap' => false, 'routes' => true, 'ignoreMissing' => true]]);
Plugin::load('Migrations');
// Only try to load DebugKit in development mode
// Debug Kit should not be installed on a production system
if (Configure::read('debug')) {
Plugin::load('DebugKit', ['bootstrap' => true]);
}
/**
* Connect middleware/dispatcher filters.
*/
DispatcherFactory::add('Asset');
DispatcherFactory::add('Routing');
DispatcherFactory::add('ControllerFactory');
/**
* Enable default locale format parsing.
* This is needed for matching the auto-localized string output of Time() class when parsing dates.
示例8: testLoadAllWithDefaultsAndOverride
/**
* Tests that Plugin::loadAll() will load all plugins in the configured folder wit defaults
* and overrides for a plugin
*
* @return void
*/
public function testLoadAllWithDefaultsAndOverride()
{
Plugin::loadAll([['bootstrap' => true, 'ignoreMissing' => true], 'TestPlugin' => ['routes' => true], 'TestPluginFour' => ['bootstrap' => true, 'classBase' => '']]);
Plugin::routes();
$expected = ['Company', 'PluginJs', 'TestPlugin', 'TestPluginFour', 'TestPluginTwo', 'TestTheme'];
$this->assertEquals($expected, Plugin::loaded());
$this->assertEquals('loaded js plugin bootstrap', Configure::read('PluginTest.js_plugin.bootstrap'));
$this->assertEquals('loaded plugin routes', Configure::read('PluginTest.test_plugin.routes'));
$this->assertEquals(null, Configure::read('PluginTest.test_plugin.bootstrap'));
$this->assertEquals('loaded plugin two bootstrap', Configure::read('PluginTest.test_plugin_two.bootstrap'));
$this->assertEquals('loaded plugin four bootstrap', Configure::read('PluginTest.test_plugin_four.bootstrap'));
// TestPluginThree won't get loaded by loadAll() since it's in a sub directory.
$this->assertEquals(null, Configure::read('PluginTest.test_plugin_three.bootstrap'));
}
示例9:
<?php
/**
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Mindforce Team (http://mindforce.me)
* @link http://mindforce.me FrontEngine CakePHP 3 Plugin
* @since 0.0.1
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Cake\Event\EventManager;
use Cake\Core\Plugin;
Plugin::loadAll([['ignoreMissing' => true, 'bootstrap' => true, 'routes' => true], 'Garderobe/Bootstrap3', 'RearEngine']);
EventManager::instance()->attach(new FrontEngine\Event\CoreEvent(), null, ['priority' => 2]);
示例10:
* Inflector::rules('uninflected', ['dontinflectme']);
* Inflector::rules('transliteration', ['/å/' => 'aa']);
*/
/**
* Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
* Uncomment one of the lines below, as you need. make sure you read the documentation on Plugin to use more
* advanced ways of loading plugins
*
* Plugin::loadAll(); // Loads all plugins at once
* Plugin::load('Migrations'); //Loads a single plugin named Migrations
*
*/
Plugin::load('Migrations');
// Only try to load DebugKit in development mode
// Debug Kit should not be installed on a production system
if (Configure::read('debug')) {
Plugin::load('DebugKit', ['bootstrap' => true]);
}
/**
* Connect middleware/dispatcher filters.
*/
DispatcherFactory::add('Asset');
DispatcherFactory::add('Routing');
DispatcherFactory::add('ControllerFactory');
/**
* Enable default locale format parsing.
* This is needed for matching the auto-localized string output of Time() class when parsing dates.
*/
Type::build('datetime')->useLocaleParser();
Plugin::loadAll(['Block' => ['bootstrap' => true, 'routes' => false], 'CMS' => ['bootstrap' => true], 'Menu' => ['bootstrap' => true, 'routes' => false]]);
示例11:
*/
Type::build('time')->useImmutable();
Type::build('date')->useImmutable();
Type::build('datetime')->useImmutable();
/*
* Custom Inflector rules, can be set to correctly pluralize or singularize
* table, model, controller names or whatever other string is passed to the
* inflection functions.
*/
//Inflector::rules('plural', ['/^(inflect)or$/i' => '\1ables']);
//Inflector::rules('irregular', ['red' => 'redlings']);
//Inflector::rules('uninflected', ['dontinflectme']);
//Inflector::rules('transliteration', ['/å/' => 'aa']);
/*
* Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
* Uncomment one of the lines below, as you need. make sure you read the documentation on Plugin to use more
* advanced ways of loading plugins
*
* Plugin::loadAll(); // Loads all plugins at once
* Plugin::load('Migrations'); //Loads a single plugin named Migrations
*
*/
/*
* Only try to load DebugKit in development mode
* Debug Kit should not be installed on a production system
*/
if (Configure::read('debug')) {
Plugin::load('DebugKit', ['bootstrap' => true]);
}
Plugin::loadAll(['routes' => true]);
include "cakeblog-config.php";