本文整理汇总了PHP中Cake\Core\App::pluginPath方法的典型用法代码示例。如果您正苦于以下问题:PHP App::pluginPath方法的具体用法?PHP App::pluginPath怎么用?PHP App::pluginPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Core\App
的用法示例。
在下文中一共展示了App::pluginPath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPluginScriptTimestamping
/**
* test timestamp enforcement for script tags with plugin syntax.
*
* @return void
*/
public function testPluginScriptTimestamping()
{
Plugin::load('TestPlugin');
$pluginPath = App::pluginPath('TestPlugin');
$pluginJsPath = $pluginPath . 'webroot/js';
$this->skipIf(!is_writable($pluginJsPath), $pluginJsPath . ' is not Writable, timestamp testing has been skipped.');
Configure::write('debug', true);
Configure::write('Asset.timestamp', true);
touch($pluginJsPath . DS . '__cake_js_test.js');
$timestamp = substr(strtotime('now'), 0, 8);
$result = $this->Html->script('TestPlugin.__cake_js_test', array('once' => false));
$this->assertRegExp('/test_plugin\\/js\\/__cake_js_test.js\\?' . $timestamp . '[0-9]{2}"/', $result, 'Timestamp value not found %s');
Configure::write('debug', false);
Configure::write('Asset.timestamp', 'force');
$result = $this->Html->script('TestPlugin.__cake_js_test', array('once' => false));
$this->assertRegExp('/test_plugin\\/js\\/__cake_js_test.js\\?' . $timestamp . '[0-9]{2}"/', $result, 'Timestamp value not found %s');
unlink($pluginJsPath . DS . '__cake_js_test.js');
Configure::write('Asset.timestamp', false);
Plugin::unload('TestPlugin');
}
示例2: _getFilePath
/**
* Get file path
*
* @param string $key The identifier to write to. If the key has a . it will be treated
* as a plugin prefix.
* @return string Full file path
*/
protected function _getFilePath($key)
{
if (substr($key, -4) === '.php') {
$key = substr($key, 0, -4);
}
list($plugin, $key) = pluginSplit($key);
$key .= '.php';
if ($plugin) {
$file = App::pluginPath($plugin) . 'Config' . DS . $key;
} else {
$file = $this->_path . $key;
}
return $file;
}
示例3: testPluginPath
/**
* test that pluginPath can find paths for plugins.
*
* @return void
*/
public function testPluginPath()
{
Plugin::load(array('TestPlugin', 'TestPluginTwo'));
$path = App::pluginPath('TestPlugin');
$expected = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS;
$this->assertPathEquals($expected, $path);
$path = App::pluginPath('TestPluginTwo');
$expected = TEST_APP . 'Plugin' . DS . 'TestPluginTwo' . DS;
$this->assertPathEquals($expected, $path);
}