本文整理汇总了PHP中CakePlugin::load方法的典型用法代码示例。如果您正苦于以下问题:PHP CakePlugin::load方法的具体用法?PHP CakePlugin::load怎么用?PHP CakePlugin::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CakePlugin
的用法示例。
在下文中一共展示了CakePlugin::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testThemeAndPluginInclusion
public function testThemeAndPluginInclusion()
{
App::build(array('Plugin' => array($this->_testFiles . 'Plugin' . DS), 'View' => array($this->_testFiles . 'View' . DS)));
CakePlugin::load('TestAsset');
$settings = array('paths' => array(), 'theme' => 'Red');
$this->filter->settings($settings);
$this->_themeDir = $this->_testFiles . DS . 'View' . DS . 'Themed' . DS . $settings['theme'] . DS;
$content = file_get_contents($this->_themeDir . 'webroot' . DS . 'theme.js');
$result = $this->filter->input('theme.js', $content);
$expected = <<<TEXT
var Theme = new Class({
});
var ThemeInclude = new Class({
});
var Plugin = new Class({
});
TEXT;
$this->assertTextEquals($expected, $result);
}
示例2: links
public function links()
{
if (!CakePlugin::loaded('Menus')) {
CakePlugin::load('Menus');
}
App::uses('View', 'View');
App::uses('AppHelper', 'View/Helper');
App::uses('MenusHelper', 'Menus.View/Helper');
$Menus = new MenusHelper(new View());
$Link = ClassRegistry::init('Menus.Link');
$links = $Link->find('all', array('fields' => array('id', 'title', 'link')));
$count = 0;
foreach ($links as $link) {
if (!strstr($link['Link']['link'], 'controller:')) {
continue;
}
if (strstr($link['Link']['link'], 'plugin:')) {
continue;
}
$url = $Menus->linkStringToArray($link['Link']['link']);
if (isset($this->_controllerMap[$url['controller']])) {
$url['plugin'] = $this->_controllerMap[$url['controller']];
$linkString = $Menus->urlToLinkString($url);
$Link->id = $link['Link']['id'];
$this->out(__('Updating Link %s', $Link->id));
$this->warn(__('- %s', $link['Link']['link']));
$this->success(__('+ %s', $linkString), 2);
$Link->saveField('link', $linkString, false);
$count++;
}
}
$this->out(__('Links updated: %d rows', $count));
}
示例3: _basePath
/**
* Generates the base path to a set of tests based on the parameters.
*
* @param array $params
* @return string The base path.
*/
protected static function _basePath($params)
{
$result = null;
if (!empty($params['core'])) {
$result = CORE_TEST_CASES;
// CUSTOMIZE ADD 2014/07/02 ryuring
// >>>
} elseif ($params['baser']) {
$result = BASER_TEST_CASES;
// <<<
} elseif (!empty($params['plugin'])) {
if (!CakePlugin::loaded($params['plugin'])) {
try {
CakePlugin::load($params['plugin']);
$result = CakePlugin::path($params['plugin']) . 'Test' . DS . 'Case';
} catch (MissingPluginException $e) {
}
} else {
$result = CakePlugin::path($params['plugin']) . 'Test' . DS . 'Case';
}
} elseif (!empty($params['app'])) {
$result = APP_TEST_CASES;
}
return $result;
}
示例4: setUp
public function setUp() {
parent::setUp();
$this->_pluginPath = App::pluginPath('AssetCompress');
$this->testConfig = $this->_pluginPath . 'Test' . DS . 'test_files' . DS . 'Config' . DS . 'integration.ini';
$map = array(
'TEST_FILES/' => $this->_pluginPath . 'Test' . DS . 'test_files' . DS
);
App::build(array(
'Plugin' => array($map['TEST_FILES/'] . 'Plugin' . DS )
));
CakePlugin::load('TestAssetIni');
AssetConfig::clearAllCachedKeys();
$config = AssetConfig::buildFromIniFile($this->testConfig, $map);
$config->filters('js', null, array());
$this->Compressor = $this->getMock('AssetCompressor', array('_getConfig'));
$this->Compressor->expects($this->atLeastOnce())
->method('_getConfig')
->will($this->returnValue($config));
$this->request = new CakeRequest(null, false);
$this->response = $this->getMock('CakeResponse', array('checkNotModified', 'type', 'send'));
Configure::write('debug', 2);
}
示例5: setUp
public function setUp()
{
App::build(array('View' => array(App::pluginPath('Asset') . 'Test' . DS . 'test_app' . DS . 'View' . DS), 'Plugin' => array(App::pluginPath('Asset') . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)), App::RESET);
CakePlugin::load('Other', array());
$this->path = App::pluginPath('Asset') . 'Test' . DS . 'test_app' . DS . 'webroot' . DS;
$this->AssetEnvironment = new AssetEnvironment($this->path);
}
示例6: setUp
/**
* setUp method
*
* @return void
*/
public function setUp()
{
parent::setUp();
Cache::delete('object_map', '_cake_core_');
App::build(array('Locale' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Locale' . DS), 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)), App::RESET);
CakePlugin::load(array('TestPlugin'));
}
示例7: onActivation
public function onActivation(&$controller)
{
CakePlugin::load('Sites');
App::import('Model', 'CakeSchema');
App::import('Model', 'ConnectionManager');
App::uses('Sites', 'Sites.Lib');
include_once APP . 'Plugin' . DS . 'Sites' . DS . 'Config' . DS . 'Schema' . DS . 'schema.php';
$db = ConnectionManager::getDataSource('default');
//Get all available tables
$tables = $db->listSources();
$CakeSchema = new CakeSchema();
$SiteSchema = new SiteSchema();
foreach ($SiteSchema->tables as $table => $config) {
if (!in_array($table, $tables)) {
$db->execute($db->createSchema($SiteSchema, $table));
}
}
//Ignore the cache since the tables wont be inside the cache at this point
//$db->cacheSources = false;
@unlink(TMP . 'cache' . DS . 'models/cake_model_' . ConnectionManager::getSourceName($db) . '_' . $db->config["database"] . '_list');
$db->listSources();
//Insert "ALL SITES"
$controller->loadModel('Sites.Site');
$controller->Site->create();
$data = array('Site' => array('id' => Sites::ALL_SITES, 'title' => 'All Sites', 'tagline' => Configure::read('Site.tagline'), 'email' => Configure::read('Site.email'), 'locale' => Configure::read('Site.locale'), 'status' => Configure::read('Site.status'), 'timezone' => Configure::read('Site.timezone'), 'theme' => Configure::read('Site.theme'), 'default' => 1), 'SiteDomain' => array(0 => array('site_id' => Sites::ALL_SITES, 'domain' => $_SERVER["HTTP_HOST"])));
$controller->Site->id = Sites::ALL_SITES;
if ($controller->Site->exists()) {
$count = $controller->Site->SiteDomain->find('count', array('conditions' => array('SiteDomain.site_id' => Sites::ALL_SITES)));
if ($count > 0) {
unset($data['SiteDomain']);
}
}
$controller->Site->saveAll($data);
}
示例8: setUp
public function setUp()
{
parent::setUp();
App::build(array('Plugin' => array(App::pluginPath('TwigView') . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)));
App::build(array('View' => array(App::pluginPath('TwigView') . 'Test' . DS . 'test_app' . DS . 'View' . DS)), App::RESET);
CakePlugin::load('TestTwigView');
$this->Loader = new Twig_Loader_Cakephp();
}
示例9: setUp
public function setUp()
{
parent::setUp();
CakePlugin::load('Translate');
$this->View = new View(null);
$this->AppHelper = new CroogoAppHelper($this->View);
$this->AppHelper->request = new CakeRequest(null, false);
}
示例10: setUp
public function setUp()
{
parent::setUp();
CakePlugin::load('Translate', array('bootstrap' => true));
$this->View = new View(null);
$this->AppHelper = new AppHelper($this->View);
$this->AppHelper->request = new CakeRequest(null, false);
}
示例11: setUp
/**
* setUp
*/
public function setUp()
{
parent::setUp();
CakePlugin::load('Translate', array('bootstrap' => true));
$this->TranslateController = $this->generate('Translate.Translate', array('methods' => array('redirect'), 'components' => array('Auth' => array('user'), 'Session')));
$this->TranslateController->Auth->staticExpects($this->any())->method('user')->will($this->returnCallback(array($this, 'authUserCallback')));
$this->TranslateController->Security->Session = $this->getMock('CakeSession');
}
示例12: setUp
/**
* setUp method
*
* @return void
*/
public function setUp()
{
parent::setUp();
App::build(array('Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS), 'Console/Command' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Console' . DS . 'Command' . DS)), App::RESET);
CakePlugin::load(array('TestPlugin', 'TestPluginTwo'));
$out = $this->getMock('ConsoleOutput', array(), array(), '', FALSE);
$in = $this->getMock('ConsoleInput', array(), array(), '', FALSE);
$this->CommandTask = $this->getMock('CommandTask', array('in', '_stop', 'clear'), array($out, $out, $in));
}
示例13: setUp
/**
* setUp method
*
* @return void
*/
public function setUp()
{
parent::setUp();
App::build(array('Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS), 'Console/Command' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Console' . DS . 'Command' . DS)), App::RESET);
CakePlugin::load(array('TestPlugin', 'TestPluginTwo'));
$out = new TestStringOutput();
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
$this->Shell = $this->getMock('CommandListShell', array('in', '_stop', 'clear'), array($out, $out, $in));
}
示例14: setUp
/**
* setUp
*
* @return void
*/
public function setUp()
{
parent::setUp();
$this->Node = ClassRegistry::init('Nodes.Node');
if (!CakePlugin::loaded('Translate')) {
CakePlugin::load('Translate');
}
$this->Node->Behaviors->attach('Translate.CroogoTranslate', array('fields' => array('title' => 'titleTranslation')));
}
示例15: setUp
/**
* setUp method
*
* @return void
*/
public function setUp()
{
parent::setUp();
$this->request = new CakeRequest(null, false);
$this->Controller = new ScaffoldViewMockController($this->request);
$this->Controller->response = $this->getMock('CakeResponse', array('_sendHeader'));
App::build(array('View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS), 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)));
CakePlugin::load('TestPlugin');
}