本文整理汇总了PHP中App::pluginPath方法的典型用法代码示例。如果您正苦于以下问题:PHP App::pluginPath方法的具体用法?PHP App::pluginPath怎么用?PHP App::pluginPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App
的用法示例。
在下文中一共展示了App::pluginPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
$this->path = App::pluginPath('Asset') . 'Test' . DS . 'test_app' . DS . 'webroot' . DS;
$this->file = $this->path . 'css' . DS . 'default.css';
$this->Asset = new CssAsset('css/default.css', $this->file, $this->path);
}
示例2: admin_edit
/**
* admin_edit method
*
* @param int $id
* @return void
*/
public function admin_edit($id = null)
{
$this->InvoicesCounter->recursive = -1;
if (!empty($this->data)) {
if ($this->InvoicesCounter->save($this->data)) {
Cache::delete('LilInvoices.sidebarCounters', 'Lil');
$this->setFlash(__d('lil_invoices', 'Counter has been saved.'));
$this->doRedirect(array('action' => 'index'));
} else {
$this->setFlash(__d('lil_invoices', 'Please verify that the information is correct.'), 'error');
}
} else {
if (!empty($id)) {
$this->data = $this->InvoicesCounter->read(null, $id);
}
}
$this->setupRedirect();
$layouts = array();
$files = new DirectoryIterator(App::pluginPath('LilInvoices') . 'View' . DS . 'Reports');
foreach ($files as $item) {
if ($item->isFile() && ($basename = $item->getBasename('.ctp'))) {
$layouts[$basename] = $basename;
}
}
$this->set(compact('layouts'));
}
示例3: loadConfig
/**
* Loads a file from app/tests/config/configure_file.php or app/plugins/PLUGIN/tests/config/configure_file.php
*
* Config file variables should be formated like:
* $config['name'] = 'value';
* These will be used to create dynamic Configure vars.
*
*
* @param string $fileName name of file to load, extension must be .php and only the name
* should be used, not the extenstion.
* @param string $type Type of config file being loaded. If equal to 'app' core config files will be use.
* if $type == 'pluginName' that plugins tests/config files will be loaded.
* @return mixed false if file not found, void if load successful
*/
public function loadConfig($fileName, $type = 'app')
{
$found = false;
if ($type == 'app') {
$folder = APP . 'tests' . DS . 'config' . DS;
} else {
$folder = App::pluginPath($type);
if (!empty($folder)) {
$folder .= 'tests' . DS . 'config' . DS;
} else {
return false;
}
}
if (file_exists($folder . $fileName . '.php')) {
include $folder . $fileName . '.php';
$found = true;
}
if (!$found) {
return false;
}
if (!isset($config)) {
$error = __("AppTestCase::load() - no variable \$config found in %s.php");
trigger_error(sprintf($error, $fileName), E_USER_WARNING);
return false;
}
return $config;
}
示例4: setUp
function setUp()
{
parent::setUp();
$this->_pluginPath = App::pluginPath('AssetCompress');
$this->_testPath = $this->_pluginPath . 'Test/test_files/css/';
$this->filter = new TimestampImage();
}
示例5: read
/**
* Read a config file and return its contents.
*
* Files with `.` in the name will be treated as values in plugins. Instead of reading from
* the initialized path, plugin keys will be located using App::pluginPath().
*
* @param string $key The identifier to read from. If the key has a . it will be treated
* as a plugin prefix.
* @return array Parsed configuration values.
* @throws ConfigureException when files don't exist or they don't contain `$config`.
* Or when files contain '..' as this could lead to abusive reads.
*/
public function read($key)
{
if (strpos($key, '..') !== false) {
throw new ConfigureException(__d('cake_dev', 'Cannot load configuration files with ../ in them.'));
}
if (substr($key, -4) === '.php') {
$key = substr($key, 0, -4);
}
list($plugin, $key) = pluginSplit($key);
if ($plugin) {
$file = App::pluginPath($plugin) . 'Config' . DS . $key;
} else {
$file = $this->_path . $key;
}
$file .= '.php';
if (!is_file($file)) {
if (!is_file(substr($file, 0, -4))) {
throw new ConfigureException(__d('cake_dev', 'Could not load configuration files: %s or %s', $file, substr($file, 0, -4)));
}
}
include $file;
if (!isset($config)) {
throw new ConfigureException(sprintf(__d('cake_dev', 'No variable $config found in %s.php'), $file));
}
return $config;
}
示例6: suite
/**
* All SnatzAPISource tests suite
*
* @return PHPUnit_Framework_TestSuite the instance of PHPUnit_Framework_TestSuite
*/
public static function suite()
{
$suite = new CakeTestSuite('All SMSFlySource Tests');
$basePath = App::pluginPath('SMSFlySource') . 'Test' . DS . 'Case' . DS;
$suite->addTestDirectoryRecursive($basePath);
return $suite;
}
示例7: startTest
public function startTest($method)
{
parent::startTest($method);
$this->path = App::pluginPath('upload') . 'tests' . DS . 'images' . DS;
$this->source = $this->path . 'panda.jpg';
$this->Resize = new Resize('php', $this->source);
}
示例8: setupDatabase
/**
* Run Migrations and add data in table
*
* @return If migrations have succeeded
*/
public function setupDatabase()
{
$plugins = Configure::read('Core.corePlugins');
$migrationsSucceed = true;
foreach ($plugins as $plugin) {
$migrationsSucceed = $this->runMigrations($plugin);
if (!$migrationsSucceed) {
break;
}
}
if ($migrationsSucceed) {
$path = App::pluginPath('Install') . DS . 'Config' . DS . 'Data' . DS;
$dataObjects = App::objects('class', $path);
foreach ($dataObjects as $data) {
include $path . $data . '.php';
$classVars = get_class_vars($data);
$modelAlias = substr($data, 0, -4);
$table = $classVars['table'];
$records = $classVars['records'];
App::uses('Model', 'Model');
$modelObject =& new Model(array('name' => $modelAlias, 'table' => $table, 'ds' => 'default'));
if (is_array($records) && count($records) > 0) {
foreach ($records as $record) {
$modelObject->create($record);
$modelObject->save();
}
$modelObject->getDatasource()->resetSequence($modelObject->useTable, $modelObject->primaryKey);
}
ClassRegistry::removeObject($modelAlias);
}
}
return $migrationsSucceed;
}
示例9: setUp
public function setUp()
{
parent::setUp();
$this->_pluginPath = App::pluginPath('AssetCompress');
$this->_cssDir = $this->_pluginPath . 'Test' . DS . 'test_files' . DS . 'css' . DS;
$this->filter = new SimpleCssMin();
}
示例10: setUp
/**
* {@inheritdoc}
*/
public function setUp()
{
parent::setUp();
$this->PdfGenerator = ClassRegistry::init('PdfGenerator.PdfGenerator');
$this->pluginPath = App::pluginPath('PdfGenerator');
$this->setDefaultConfig();
}
示例11: setUp
public function setUp()
{
$this->Env = AssetEnvironment::getInstance(App::pluginPath('Asset') . DS . 'Test' . DS . 'test_app' . DS . 'webroot' . DS);
$this->Asset = $this->getMock('CssAsset', array(), array('url', 'file'));
$this->Context = $this->getMock('AssetContext');
$this->Processor = new AssetProcessor($this->Asset, $this->Context);
}
示例12: suite
/**
* Suite define the tests for this suite
*
* @return void
*/
public static function suite()
{
$suite = new CakeTestSuite('All NLP Data Source Tests');
$path = App::pluginPath('ExcludeSimilarDocs') . 'Test' . DS . 'Case' . DS;
$suite->addTestFile($path . 'Model' . DS . 'ExcludeSimilarDocsTest.php');
return $suite;
}
示例13: render
public function render($action = null, $layout = null, $file = null)
{
if (!file_exists(VIEWS . 'utags' . DS . $action . '.ctp')) {
$file = App::pluginPath('tags') . 'views' . DS . 'tags' . DS . $action . '.ctp';
}
return parent::render($action, $layout, $file);
}
示例14: create
function create($width = '120', $height = '40', $characters = '6')
{
if ($this->font == null) {
$this->font = App::pluginPath($this->Controller->plugin) . DS . 'webroot' . DS . 'monofont.ttf';
}
$code = $this->generateCode($characters);
/* font size will be 75% of the image height */
$font_size = $height * 0.7;
$image = @imagecreate($width, $height) or die('Cannot initialize new GD image stream');
/* set the colours */
$background_color = imagecolorallocate($image, 220, 220, 220);
$text_color = imagecolorallocate($image, 10, 30, 80);
$noise_color = imagecolorallocate($image, 150, 180, 220);
/* generate random dots in background */
for ($i = 0; $i < $width * $height / 3; $i++) {
imagefilledellipse($image, mt_rand(0, $width), mt_rand(0, $height), 1, 1, $noise_color);
}
/* generate random lines in background */
for ($i = 0; $i < $width * $height / 150; $i++) {
imageline($image, mt_rand(0, $width), mt_rand(0, $height), mt_rand(0, $width), mt_rand(0, $height), $noise_color);
}
/* create textbox and add text */
$textbox = imagettfbbox($font_size, 0, $this->font, $code) or die('Error in imagettfbbox function');
$x = ($width - $textbox[4]) / 2;
$y = ($height - $textbox[5]) / 2;
$y -= 5;
$slope = rand(3, 8);
$slope = rand(0, 1) == 1 ? $slope : -$slope;
imagettftext($image, $font_size, $slope, $x, $y, $text_color, $this->font, $code) or die('Error in imagettftext function');
/* output captcha image to browser */
header('Content-Type: image/jpeg');
imagejpeg($image);
imagedestroy($image);
$this->Controller->Session->write('security_code', $code);
}
示例15: setUp
/**
* setUp
*/
public function setUp()
{
parent::setUp();
$this->_setupPaths();
$this->Init = new Init();
$this->Init->appPath = App::pluginPath('Oven') . 'Test' . DS . 'test_app' . DS;
}