0
プラグイン活用法 quality use of Plugin      slywalker
About me原田 康生 Yasuo Harada 大阪のこっそりPHPer Sly PHPer in OsakaBlog 「忍び歩く男 - SLYWALKER」 http://d.hatena.ne.jp/slywalker/Twitter...
一瞬だけコミッターになれました  I became a committer just a moment.
第4回CakePHP勉強会にて      「プラグイン3段活用」        LTで発表しました           I made a presentation about Plugin               at 4th CakePH...
簡単お手軽にプラグインを扱う方法を紹介しました I demonstrated how easily handle Plugin.
1. 整 理 整 頓                smarten up  機能ごとにプラグイン化する  Create a Plugin for each feature2. 道 具 箱            tool box  汎用的なプラグ...
エンタープライズ Rails「企業ユーザのためのWebアプリケーション設計術」2章 プラグインによる構成
プラグインといえばDebugKit    http://thechaw.com/debug_kit
通常ならばapp/plugins/debug_kit
アプリケーションが 複数あるときは?
共有ならばROOT/plugins/debug_kit
Each appapp/config/bootstrap.php$pluginPaths = array(ROOT.DS.plugins.DS);
Call Pluginapp/app_controller.phpclass AppController extends Controller {� var $components = array(DebugKit.Toolbar);}
Plugin Tips・   config・   multilingualization i18n(.pot .po)・   template(.ctp) using in app・   /css/images(.jpg .png .gif)  ...
Account Manager Pluginhttp://github.com/slywalker/account_manager
smtp.php.defaultCopy app/config/smtp.php/** * SMTP_CONFIG **/class SMTP_CONFIG { � static $default = array(� � host => tls...
users_controller.php/**  * _send  *  * @param string $to  * @param string $subject  * @param string $template  * @param st...
Multilingualization i18n in Plugin                 __(Hello World);   __d(account_manager, Hello World);account_manager/lo...
$ cd /your_plugins_path/account_manager   $ cake i18nWelcome to CakePHP v1.2.4.8284 Console-------------------------------...
What is the full path you would like to extract?Example: /your_plugins_path/myapp[Q]uit[/your_plugins_path/account_manager...
If you want use your template.
Template using in app    use Themed�   app_controller.php�   class AppController extends Controller {�   � function before...
Template using in app   Copy account_manager/views/usersapp/views/themed/account_manager/users
View search order1.   themed2.   plugin3.   app4.   core
Jquery Pluginhttp://github.com/slywalker/jquery
Using JqueryUI  http://jqueryui.com/
Default DispatcherRequest images/bg.png in cssapp/webroot/css/images/bg.png <- Get!!app/vendors/css/images/bg.png <- Get!!...
Custom Dispatcherjquery/dispatcher.phpclass Dispatcher extends Object {�   function cached($url) {�   �    ...�   �    �  ...
Custom DispatcherRequest images/bg.png in cssapp/webroot/css/images/bg.png <- Get!!app/vendors/css/images/bg.png <- Get!!a...
Using Custom             Dispatcherapp/config/bootstrap.phpApp::import(Core, Dispatcher,array(� file => ROOT.DS.jquery.DS....
In closing,I would like to thank you allfor listening so attentively.
Upcoming SlideShare
Loading in...5
×

Quality Use Of Plugin

1,126

Published on

Cakematsuri

Published in: Technology, Art & Photos
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,126
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript of "Quality Use Of Plugin"

    1. 1. プラグイン活用法 quality use of Plugin slywalker
    2. 2. About me原田 康生 Yasuo Harada 大阪のこっそりPHPer Sly PHPer in OsakaBlog 「忍び歩く男 - SLYWALKER」 http://d.hatena.ne.jp/slywalker/Twitter, Wassr, Hatena, GitHub ID slywalker
    3. 3. 一瞬だけコミッターになれました I became a committer just a moment.
    4. 4. 第4回CakePHP勉強会にて 「プラグイン3段活用」 LTで発表しました I made a presentation about Plugin at 4th CakePHP Workshop.http://d.hatena.ne.jp/slywalker/20090523/1243059244
    5. 5. 簡単お手軽にプラグインを扱う方法を紹介しました I demonstrated how easily handle Plugin.
    6. 6. 1. 整 理 整 頓 smarten up 機能ごとにプラグイン化する Create a Plugin for each feature2. 道 具 箱 tool box 汎用的なプラグインをアプリケーションで共有 To share a generic plug-in application3. プラグイン Plugin 開発しながら修復。完成度を高めていく Repair and development. Gradually increase the degree of completion
    7. 7. エンタープライズ Rails「企業ユーザのためのWebアプリケーション設計術」2章 プラグインによる構成
    8. 8. プラグインといえばDebugKit http://thechaw.com/debug_kit
    9. 9. 通常ならばapp/plugins/debug_kit
    10. 10. アプリケーションが 複数あるときは?
    11. 11. 共有ならばROOT/plugins/debug_kit
    12. 12. Each appapp/config/bootstrap.php$pluginPaths = array(ROOT.DS.plugins.DS);
    13. 13. Call Pluginapp/app_controller.phpclass AppController extends Controller {� var $components = array(DebugKit.Toolbar);}
    14. 14. Plugin Tips・ config・ multilingualization i18n(.pot .po)・ template(.ctp) using in app・ /css/images(.jpg .png .gif) in plugin s /vendors
    15. 15. Account Manager Pluginhttp://github.com/slywalker/account_manager
    16. 16. smtp.php.defaultCopy app/config/smtp.php/** * SMTP_CONFIG **/class SMTP_CONFIG { � static $default = array(� � host => tls://smtp.gmail.com,� � port => 465,� � from => username@gmail.com,� � user => username,� � pass => password,� � protocol => SMTP_AUTH,� );}
    17. 17. users_controller.php/** * _send * * @param string $to * @param string $subject * @param string $template * @param string $config * @return boolean * @author Yasuo Harada */protected function _send(..., $config = default) { if (config(smtp)) { $params = SMTP_CONFIG::$$config; $this->Qdmail->smtp(true); $this->Qdmail->smtpServer($params); } ....}
    18. 18. Multilingualization i18n in Plugin __(Hello World); __d(account_manager, Hello World);account_manager/locale/jpn/LC_MESSAGES/account_manager.po
    19. 19. $ cd /your_plugins_path/account_manager $ cake i18nWelcome to CakePHP v1.2.4.8284 Console---------------------------------------------------------------App : account_managerPath: /your_plugins_path/account_manager---------------------------------------------------------------I18n Shell---------------------------------------------------------------[E]xtract POT file from sources[I]nitialize i18n database table[H]elp[Q]uitWhat would you like to do? (E/I/H/Q)>e
    20. 20. What is the full path you would like to extract?Example: /your_plugins_path/myapp[Q]uit[/your_plugins_path/account_manager] > (enter)What is the full path you would like to output?Example: /your_plugins_path/account_manager/locale[Q]uit[/your_plugins_path/account_manager/locale] > (enter)Extracting...---------------------------------------------------------------Path: /your_plugins_path/account_managerOutput Directory: /your_plugins_path/account_manager/locale/---------------------------------------------------------------Would you like to merge all translations into one file? (y/n)[y] > (enter)What should we name this file?[default] > account_manager
    21. 21. If you want use your template.
    22. 22. Template using in app use Themed� app_controller.php� class AppController extends Controller {� � function beforeFilter() {� � � if (isset($this->params[plugin])) {� � � � $this->view = Theme;� � � � $this->theme = $this->params[plugin];� � � }� � }� }
    23. 23. Template using in app Copy account_manager/views/usersapp/views/themed/account_manager/users
    24. 24. View search order1. themed2. plugin3. app4. core
    25. 25. Jquery Pluginhttp://github.com/slywalker/jquery
    26. 26. Using JqueryUI http://jqueryui.com/
    27. 27. Default DispatcherRequest images/bg.png in cssapp/webroot/css/images/bg.png <- Get!!app/vendors/css/images/bg.png <- Get!!app/plugins/vendors/css/images/bg.png <- Ooops!!vendors/css/images/bg.png <- Get!!plugins/vendors/css/images/bg.png <- Ooops!!
    28. 28. Custom Dispatcherjquery/dispatcher.phpclass Dispatcher extends Object {� function cached($url) {� � ...� � � foreach ($assets as $type => $contentType) {� � � � if ($type === $ext) {� � � � � if ($type === css || $type === js) {� � � � � � $pos = strpos($url, $type . /);� � � � � } else {� � � � � � $pos = strpos($url, img/);� � � � � � // add by slywalker start� � � � � � if ($pos === false) {� � � � � � � $pos = strpos($url, js/);� � � � � � }� � � � � � if ($pos === false) {� � � � � � � $pos = strpos($url, css/);� � � � � � }� � � � � � // add by slywalker end� � � � � }� � � � � $isAsset = true;� � � � � break;� � � � }� � � }� � ...� }}
    29. 29. Custom DispatcherRequest images/bg.png in cssapp/webroot/css/images/bg.png <- Get!!app/vendors/css/images/bg.png <- Get!!app/plugins/vendors/css/images/bg.png <- Get!!vendors/css/images/bg.png <- Get!!plugins/vendors/css/images/bg.png <- Get!!
    30. 30. Using Custom Dispatcherapp/config/bootstrap.phpApp::import(Core, Dispatcher,array(� file => ROOT.DS.jquery.DS.dispatcher.php));
    31. 31. In closing,I would like to thank you allfor listening so attentively.
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×