Your SlideShare is downloading. ×
Quality Use Of Plugin
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Quality Use Of Plugin

1,041

Published on

Cakematsuri

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,041
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
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

    • 1. プラグイン活用法 quality use of Plugin slywalker
    • 2. About me原田 康生 Yasuo Harada 大阪のこっそりPHPer Sly PHPer in OsakaBlog 「忍び歩く男 - SLYWALKER」 http://d.hatena.ne.jp/slywalker/Twitter, Wassr, Hatena, GitHub ID slywalker
    • 3. 一瞬だけコミッターになれました I became a committer just a moment.
    • 4. 第4回CakePHP勉強会にて 「プラグイン3段活用」 LTで発表しました I made a presentation about Plugin at 4th CakePHP Workshop.http://d.hatena.ne.jp/slywalker/20090523/1243059244
    • 5. 簡単お手軽にプラグインを扱う方法を紹介しました I demonstrated how easily handle Plugin.
    • 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. エンタープライズ Rails「企業ユーザのためのWebアプリケーション設計術」2章 プラグインによる構成
    • 8. プラグインといえばDebugKit http://thechaw.com/debug_kit
    • 9. 通常ならばapp/plugins/debug_kit
    • 10. アプリケーションが 複数あるときは?
    • 11. 共有ならばROOT/plugins/debug_kit
    • 12. Each appapp/config/bootstrap.php$pluginPaths = array(ROOT.DS.plugins.DS);
    • 13. Call Pluginapp/app_controller.phpclass AppController extends Controller {� var $components = array(DebugKit.Toolbar);}
    • 14. Plugin Tips・ config・ multilingualization i18n(.pot .po)・ template(.ctp) using in app・ /css/images(.jpg .png .gif) in plugin s /vendors
    • 15. Account Manager Pluginhttp://github.com/slywalker/account_manager
    • 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. 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. Multilingualization i18n in Plugin __(Hello World); __d(account_manager, Hello World);account_manager/locale/jpn/LC_MESSAGES/account_manager.po
    • 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. 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. If you want use your template.
    • 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. Template using in app Copy account_manager/views/usersapp/views/themed/account_manager/users
    • 24. View search order1. themed2. plugin3. app4. core
    • 25. Jquery Pluginhttp://github.com/slywalker/jquery
    • 26. Using JqueryUI http://jqueryui.com/
    • 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. 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. 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. Using Custom Dispatcherapp/config/bootstrap.phpApp::import(Core, Dispatcher,array(� file => ROOT.DS.jquery.DS.dispatcher.php));
    • 31. In closing,I would like to thank you allfor listening so attentively.

    ×