• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CakePlugin类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中CakePlugin的典型用法代码示例。如果您正苦于以下问题:PHP CakePlugin类的具体用法?PHP CakePlugin怎么用?PHP CakePlugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: admin_index

 public function admin_index()
 {
     if ($this->request->is('post') && isset($this->request->data)) {
         $models = $this->request->data['Audit']['models'];
         $models = array_combine(array_values($models), array_values($models));
         $this->Setting->write('Audit.models', json_encode($models));
         return $this->redirect(array('action' => 'index'));
     }
     $plugins = App::objects('plugin');
     $models = array();
     $cakePlugin = new CakePlugin();
     foreach ($plugins as $plugin) {
         if (!$cakePlugin->loaded($plugin)) {
             continue;
         }
         $pluginModels = App::objects($plugin . '.Model');
         foreach ($pluginModels as $pluginModel) {
             if (substr($pluginModel, -8) == 'AppModel') {
                 continue;
             }
             $model = $plugin . '.' . $pluginModel;
             $models[$model] = $model;
         }
     }
     $this->request->data = array('Audit' => array('models' => json_decode(Configure::read('Audit.models'), true)));
     $this->set(compact('models'));
 }
开发者ID:xintesa,项目名称:audit,代码行数:27,代码来源:AuditSettingsController.php


示例2: createAvatarAutomatically

 /**
  * アバター自動生成処理
  *
  * @param Model $model ビヘイビア呼び出し元モデル
  * @param array $user ユーザデータ配列
  * @return mixed On success Model::$data, false on failure
  * @throws InternalErrorException
  */
 public function createAvatarAutomatically(Model $model, $user)
 {
     //imagickdraw オブジェクトを作成します
     $draw = new ImagickDraw();
     //文字色のセット
     $draw->setfillcolor('white');
     //フォントサイズを 160 に設定します
     $draw->setFontSize(140);
     //テキストを追加します
     $draw->setFont(CakePlugin::path($model->plugin) . 'webroot' . DS . 'fonts' . DS . 'ipaexg.ttf');
     $draw->annotation(19, 143, mb_substr(mb_convert_kana($user['User']['handlename'], 'KVA'), 0, 1));
     //新しいキャンバスオブジェクトを作成する
     $canvas = new Imagick();
     //ランダムで背景色を指定する
     $red1 = strtolower(dechex(mt_rand(3, 12)));
     $red2 = strtolower(dechex(mt_rand(0, 15)));
     $green1 = strtolower(dechex(mt_rand(3, 12)));
     $green2 = strtolower(dechex(mt_rand(0, 15)));
     $blue1 = strtolower(dechex(mt_rand(3, 12)));
     $blue2 = strtolower(dechex(mt_rand(0, 15)));
     $canvas->newImage(179, 179, '#' . $red1 . $red2 . $green1 . $green2 . $blue1 . $blue2);
     //ImagickDraw をキャンバス上に描画します
     $canvas->drawImage($draw);
     //フォーマットを PNG に設定します
     $canvas->setImageFormat('png');
     App::uses('TemporaryFolder', 'Files.Utility');
     $folder = new TemporaryFolder();
     $filePath = $folder->path . DS . Security::hash($user['User']['handlename'], 'md5') . '.png';
     $canvas->writeImages($filePath, true);
     return $filePath;
 }
开发者ID:akagane99,项目名称:Users,代码行数:39,代码来源:AvatarBehavior.php


示例3: tearDown

 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     Cache::delete('object_map', '_cake_core_');
     App::build();
     CakePlugin::unload();
 }
开发者ID:kuradakis,项目名称:cakephp-ex,代码行数:12,代码来源:I18nTest.php


示例4: setUp

 /**
  * setUp
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     App::build(array('View' => array(CakePlugin::path('Taxonomy') . 'View' . DS)), App::APPEND);
     $this->VocabulariesController = $this->generate('Taxonomy.Vocabularies', array('methods' => array('redirect'), 'components' => array('Auth' => array('user'), 'Session')));
     $this->VocabulariesController->Auth->staticExpects($this->any())->method('user')->will($this->returnCallback(array($this, 'authUserCallback')));
 }
开发者ID:Demired,项目名称:CakeWX,代码行数:12,代码来源:VocabulariesControllerTest.php


示例5: suite

 /**
  * All test suite
  *
  * @return CakeTestSuite
  */
 public static function suite()
 {
     $plugin = preg_replace('/^All([\\w]+)Test$/', '$1', __CLASS__);
     $suite = new CakeTestSuite(sprintf('All %s Plugin tests', $plugin));
     $suite->addTestDirectoryRecursive(CakePlugin::path($plugin) . 'Test' . DS . 'Case');
     return $suite;
 }
开发者ID:s-nakajima,项目名称:Search,代码行数:12,代码来源:AllSearchTest.php


示例6: setUp

 public function setUp()
 {
     $this->FileManager = new FileManager(false, null, null, null);
     $this->__testAppPath = CakePlugin::path('FileManager') . 'Test' . DS . 'test_app' . DS;
     $this->__setFilePathsForTests();
     parent::setUp();
 }
开发者ID:saydulk,项目名称:croogo,代码行数:7,代码来源:FileManagerTest.php


示例7: __construct

 /**
  * Get a list of plugins on construct for later use
  */
 public function __construct()
 {
     foreach (CakePlugin::loaded() as $plugin) {
         $this->_pluginPaths[$plugin] = CakePlugin::path($plugin);
     }
     parent::__construct();
 }
开发者ID:byu-oit-appdev,项目名称:student-ratings,代码行数:10,代码来源:IncludePanel.php


示例8: 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));
 }
开发者ID:laiello,项目名称:plankonindia,代码行数:33,代码来源:UpgradeTask.php


示例9: constructClasses

 /**
  * AppController::constructClasses()
  *
  * @return void
  */
 public function constructClasses()
 {
     if (CakePlugin::loaded('DebugKit')) {
         $this->components[] = 'DebugKit.Toolbar';
     }
     parent::constructClasses();
 }
开发者ID:dereuromark,项目名称:cakephp-sandbox,代码行数:12,代码来源:AppController.php


示例10: main

 public function main()
 {
     $wsdl = $path = $plugin = null;
     while (!$wsdl) {
         $wsdl = $this->in('Enter the url of the wsdl');
     }
     while (!$path) {
         $path = $this->in('Save to App or a plugin?', array('app', 'plugin'));
     }
     if ($path == 'plugin') {
         $loaded = CakePlugin::loaded();
         while (!$plugin) {
             $plugin = $this->in('Select plugin', $loaded);
             if (!in_array($plugin, $loaded)) {
                 $plugin = null;
             }
         }
         $path = CakePlugin::path($plugin) . 'Lib';
         $plugin .= '.';
     } else {
         $path = APP . 'Lib';
     }
     $wsdlInterpreter = new WSDLInterpreter($wsdl);
     $return = $wsdlInterpreter->savePHP($path);
     $path .= DS;
     $file = str_replace($path, '', $return[0]);
     $class = substr($file, 0, -4);
     $this->hr();
     $this->out('Lib saved to:' . $path . $file);
     $text = "'lib' => '" . $plugin . $class . "'";
     $this->out("Add 'lib' key to the config in database.php: " . $text);
     $this->hr();
 }
开发者ID:ceeram,项目名称:wsdl,代码行数:33,代码来源:WsdlShell.php


示例11: setUp

 public function setUp()
 {
     parent::setUp();
     App::build(array('Plugin' => array(CakePlugin::path('Extensions') . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)), App::PREPEND);
     $this->CroogoPlugin = new CroogoPlugin();
     $this->_mapping = array(1346748762 => array('version' => 1346748762, 'name' => '1346748762_first', 'class' => 'First', 'type' => 'app', 'migrated' => '2012-09-04 10:52:42'), 1346748933 => array('version' => 1346748933, 'name' => '1346748933_addstatus', 'class' => 'AddStatus', 'type' => 'app', 'migrated' => '2012-09-04 10:55:33'));
 }
开发者ID:laiello,项目名称:plankonindia,代码行数:7,代码来源:CroogoPluginTest.php


示例12: 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);
    }
开发者ID:superstarrajini,项目名称:cakepackages,代码行数:25,代码来源:SprocketsTest.php


示例13: __construct

 public function __construct($request = null, $response = null)
 {
     if (CakePlugin::loaded('DebugKit')) {
         $this->components[] = 'DebugKit.Toolbar';
     }
     parent::__construct($request, $response);
 }
开发者ID:eimanavicius,项目名称:cakephp-skeleton,代码行数:7,代码来源:AppController.php


示例14: _getFullAssetPath

 protected function _getFullAssetPath($path)
 {
     $filepath = preg_replace('/^' . preg_quote($this->Helper->request->webroot, '/') . '/', '', urldecode($path));
     $webrootPath = WWW_ROOT . str_replace('/', DS, $filepath);
     if (file_exists($webrootPath)) {
         //@codingStandardsIgnoreStart
         return $webrootPath;
         //@codingStandardsIgnoreEnd
     }
     $segments = explode('/', ltrim($filepath, '/'));
     if ($segments[0] === 'theme') {
         $theme = $segments[1];
         unset($segments[0], $segments[1]);
         $themePath = App::themePath($theme) . 'webroot' . DS . implode(DS, $segments);
         //@codingStandardsIgnoreStart
         return $themePath;
         //@codingStandardsIgnoreEnd
     } else {
         $plugin = Inflector::camelize($segments[0]);
         if (CakePlugin::loaded($plugin)) {
             unset($segments[0]);
             $pluginPath = CakePlugin::path($plugin) . 'webroot' . DS . implode(DS, $segments);
             //@codingStandardsIgnoreStart
             return $pluginPath;
             //@codingStandardsIgnoreEnd
         }
     }
     return false;
 }
开发者ID:ZakSchaffstall,项目名称:SassCompiler,代码行数:29,代码来源:SassHelper.php


示例15: css

 /**
  * @param array $scripts to minify
  * @param array $options theme
  */
 public function css($scripts, $options = array())
 {
     if (Configure::read('debug') || Configure::read('Minify.minify') === false) {
         return $this->Html->css($scripts);
     }
     $options = Set::merge(array('theme' => $this->_View->theme, 'plugin' => false, 'subdir' => false), $options);
     extract($options);
     $path = APP;
     if (!empty($theme)) {
         $path = App::themePath($theme);
     } elseif (!empty($plugin)) {
         $path = CakePlugin::pluginPath($plugin);
     }
     $targetDirectory = $path . DS . 'webroot' . DS . 'css' . DS;
     $outputfile = $targetDirectory . $subdir . DS . 'minified-' . sha1(join(':', $scripts)) . '.css';
     if (file_exists($outputfile)) {
         $outputfile = str_replace($targetDirectory, '', $outputfile);
         return $this->Html->css($outputfile);
     }
     $contents = '';
     foreach ($scripts as $script) {
         $file = $targetDirectory . $script;
         if (!preg_match('/\\.css$/', $file)) {
             $file .= '.css';
         }
         $contents .= file_get_contents($file);
     }
     $contents = Minify_CSS_Compressor::process($contents);
     file_put_contents($outputfile, $contents);
     return $this->Html->css($scripts);
 }
开发者ID:rchavik,项目名称:minify,代码行数:35,代码来源:MinifyHelper.php


示例16: fetch

 public function fetch()
 {
     $pluginName = '.';
     if (isset($this->args['0'])) {
         $pluginName = $this->args['0'];
     }
     $this->out('Installing packages for: ' . $pluginName);
     $dependencies = array();
     if ($pluginName == '.') {
         // install ALL
         $dependencies = $this->_getDependencies(APP);
         foreach (CakePlugin::loaded() as $plugin) {
             $dependencies = $this->_getDependencies(App::pluginPath($plugin), $dependencies);
         }
     } elseif (strtolower($pluginName) == 'app') {
         // install App only
         $path = APP;
         $dependencies = $this->_getDependencies($path);
     } else {
         // install Plugin only
         $path = App::pluginPath($pluginName);
         $dependencies = $this->_getDependencies($path);
     }
     if (count($dependencies) > 0) {
         $cmd = 'install';
         foreach ($dependencies as $name => $semVer) {
             $cmd .= ' ' . $name . '#' . $semVer;
         }
         $this->out($this->_runCmd($cmd));
     } else {
         $this->out('No packages info found to be installed.');
     }
 }
开发者ID:edweezy,项目名称:cakephp-bower,代码行数:33,代码来源:BowerShell.php


示例17: _configTestFile

 protected function _configTestFile($path = null, $baseKey = null)
 {
     if ($path === null) {
         $path = CakePlugin::path('YamlReader') . 'Test' . DS . 'files' . DS;
     }
     Configure::config('YamlTestConfig', new YamlReader($path, $baseKey));
 }
开发者ID:hiromi2424,项目名称:yaml_reader,代码行数:7,代码来源:YamlReaderTest.php


示例18: testParsePlural

 public function testParsePlural()
 {
     $path = CakePlugin::path('Translations') . 'Test/Files/plural.po';
     $result = PoParser::parse($path);
     $expected = array('count' => 3, 'translations' => array(array('locale' => 'en', 'domain' => 'plural', 'category' => 'LC_MESSAGES', 'key' => '%d post', 'value' => '1 post'), array('locale' => 'en', 'domain' => 'plural', 'category' => 'LC_MESSAGES', 'key' => '%d posts', 'value' => '1 post', 'single_key' => '%d post', 'plural_case' => 0), array('locale' => 'en', 'domain' => 'plural', 'category' => 'LC_MESSAGES', 'key' => '%d posts', 'value' => '%d many posts', 'single_key' => '%d post', 'plural_case' => 1)), 'settings' => array('domain' => 'plural'));
     $this->assertSame($expected, $result);
 }
开发者ID:nodesagency,项目名称:Translations,代码行数:7,代码来源:PoParserTest.php


示例19: testHomeRoute

 /**
  * testHomeRoute
  */
 public function testHomeRoute()
 {
     $promoted = array('plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'promoted');
     $result = CroogoRouter::connect('/', $promoted);
     $translateLoaded = CakePlugin::loaded('Translate');
     $expected = $translateLoaded ? 2 : 1;
     $this->assertEquals($expected, count($result));
     $this->assertNotEmpty($result[0]);
     $this->assertInstanceOf('CakeRoute', $result[0]);
     $reversed = Router::parse('/');
     $this->assertEquals($promoted, array_intersect_key($promoted, $reversed));
     // another route
     $index = array('plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'index');
     $result = CroogoRouter::connect('/nodes', $index);
     $expected = $translateLoaded ? 4 : 2;
     $this->assertEquals($expected, count($result));
     $reversed = Router::parse('/');
     $this->assertEquals($promoted, array_intersect_key($promoted, $reversed));
     $terms = array('plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'terms');
     $result = CroogoRouter::connect('/', $terms);
     $expected = $translateLoaded ? 6 : 3;
     $this->assertEquals($expected, count($result));
     // override '/' route
     Router::promote();
     $reversed = Router::parse('/');
     $this->assertEquals($terms, array_intersect_key($terms, $reversed));
 }
开发者ID:croogo,项目名称:croogo,代码行数:30,代码来源:CroogoRouterTest.php


示例20: suite

 /**
  * Suite define the tests for this suite
  *
  * @return void
  */
 public static function suite()
 {
     $suite = new PHPUnit_Framework_TestSuite('All Oauth Plugin Tests');
     $basePath = CakePlugin::path('OauthLib') . 'Test' . DS . 'Case' . DS;
     $libs = $basePath . 'Lib' . DS;
     $tokens = $libs . 'Token' . DS;
     $spec = $basePath . 'Spec' . DS;
     // Libs
     $suite->addTestFile($libs . 'ClientHttpGoogleTest.php');
     $suite->addTestFile($libs . 'ClientHttpTermieTest.php');
     $suite->addTestFile($libs . 'ClientHttpTest.php');
     $suite->addTestFile($libs . 'ConsumerGoogleTest.php');
     $suite->addTestFile($libs . 'ConsumerTest.php');
     $suite->addTestFile($libs . 'HmacTest.php');
     $suite->addTestFile($libs . 'RequestFactoryTest.php');
     $suite->addTestFile($libs . 'SignatureTest.php');
     // Libs/Token
     $suite->addTestFile($tokens . 'AccessTokenTest.php');
     $suite->addTestFile($tokens . 'RequestTokenTest.php');
     $suite->addTestFile($tokens . 'TokenTest.php');
     // Libs/RequestProxy
     $suite->addTestFile($libs . 'RequestProxy' . DS . 'RequestProxyControllerTest.php');
     $suite->addTestFile($libs . 'RequestProxy' . DS . 'RequestProxyHttpTest.php');
     // Spec
     $suite->addTestFile($spec . 'ConstructRequestUrlTest.php');
     $suite->addTestFile($spec . 'NormalizeRequestParametersTest.php');
     $suite->addTestFile($spec . 'SignatureBaseStringsTest.php');
     return $suite;
 }
开发者ID:jxav,项目名称:oauth_lib,代码行数:34,代码来源:AllOauthPluginTest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CakeRequest类代码示例发布时间:2022-05-20
下一篇:
PHP CakeNumber类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap