SlideShare a Scribd company logo
1 of 31
プラグイン活用法
 quality use of Plugin



      slywalker
About me
原田 康生 Yasuo Harada
 大阪のこっそりPHPer
 Sly PHPer in Osaka

Blog 「忍び歩く男 - SLYWALKER」
 http://d.hatena.ne.jp/slywalker/

Twitter, Wassr, Hatena, GitHub ID
 slywalker
一瞬だけコミッターになれました
  I became a committer just a moment.
第4回CakePHP勉強会にて
      「プラグイン3段活用」
        LTで発表しました
           I made a presentation about Plugin
               at 4th CakePHP Workshop.
http://d.hatena.ne.jp/slywalker/20090523/1243059244
簡単お手軽にプラグインを
扱う方法を紹介しました
 I demonstrated how easily handle Plugin.
1. 整 理 整 頓                smarten up


  機能ごとにプラグイン化する
  Create a Plugin for each feature

2. 道 具 箱            tool box


  汎用的なプラグインをアプリケーションで共有
  To share a generic plug-in application

3. プラグイン                  Plugin


  開発しながら修復。完成度を高めていく
  Repair and development.
  Gradually increase the degree of completion
エンタープライズ Rails
「企業ユーザのための
Webアプリケーション設計術」


2章 プラグインによる構成
プラグインといえばDebugKit
    http://thechaw.com/debug_kit
通常ならば
app/plugins/debug_kit
アプリケーションが
 複数あるときは?
共有ならば
ROOT/plugins/debug_kit
Each app
app/config/bootstrap.php

$pluginPaths = array(ROOT.DS.'plugins'.DS);
Call Plugin
app/app_controller.php

class 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)
     in plugin s /vendors
Account Manager Plugin
http://github.com/slywalker/account_manager
smtp.php.default
Copy 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',
� );
}
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);

 }

 ....
}
Multilingualization i18n in Plugin


                 __('Hello World');




   __d('account_manager', 'Hello World');

account_manager/locale/jpn/LC_MESSAGES/account_manager.po
$ cd /your_plugins_path/account_manager
   $ cake i18n

Welcome to CakePHP v1.2.4.8284 Console
---------------------------------------------------------------
App : account_manager
Path: /your_plugins_path/account_manager
---------------------------------------------------------------
I18n Shell
---------------------------------------------------------------
[E]xtract POT file from sources
[I]nitialize i18n database table
[H]elp
[Q]uit
What would you like to do? (E/I/H/Q)
>e
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_manager
Output 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
If you want use your template.
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'];
�   � � }
�   � }
�   }
Template using in app
   Copy account_manager/views/users




app/views/themed/account_manager/users
View search order

1.   themed
2.   plugin
3.   app
4.   core
Jquery Plugin
http://github.com/slywalker/jquery
Using JqueryUI
  http://jqueryui.com/
Default Dispatcher
Request images/bg.png in css

app/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!!
Custom Dispatcher
jquery/dispatcher.php

class 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;
�   �    �   �    }
�   �    �   }
�   �    ...
�   }
}
Custom Dispatcher
Request images/bg.png in css

app/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!!
Using Custom
             Dispatcher
app/config/bootstrap.php

App::import('Core', 'Dispatcher',array(
� 'file' => ROOT.DS.'jquery'.DS.'dispatcher.php'));
In closing,
I would like to thank you all
for listening so attentively.

More Related Content

What's hot

Perl Dancer for Python programmers
Perl Dancer for Python programmersPerl Dancer for Python programmers
Perl Dancer for Python programmersxSawyer
 
Desymfony 2011 - Habemus Bundles
Desymfony 2011 - Habemus BundlesDesymfony 2011 - Habemus Bundles
Desymfony 2011 - Habemus BundlesAlbert Jessurum
 
With a Mighty Hammer
With a Mighty HammerWith a Mighty Hammer
With a Mighty HammerBen Scofield
 
Building Cloud Castles
Building Cloud CastlesBuilding Cloud Castles
Building Cloud CastlesBen Scofield
 
優しいWAFの作り方
優しいWAFの作り方優しいWAFの作り方
優しいWAFの作り方techmemo
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworksdiego_k
 
How to develop modern web application framework
How to develop modern web application frameworkHow to develop modern web application framework
How to develop modern web application frameworktechmemo
 
Mojolicious - A new hope
Mojolicious - A new hopeMojolicious - A new hope
Mojolicious - A new hopeMarcus Ramberg
 
Building Cloud Castles - LRUG
Building Cloud Castles - LRUGBuilding Cloud Castles - LRUG
Building Cloud Castles - LRUGBen Scofield
 
Codeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationCodeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationAbdul Malik Ikhsan
 
Inside Bokete: Web Application with Mojolicious and others
Inside Bokete:  Web Application with Mojolicious and othersInside Bokete:  Web Application with Mojolicious and others
Inside Bokete: Web Application with Mojolicious and othersYusuke Wada
 
Great Developers Steal
Great Developers StealGreat Developers Steal
Great Developers StealBen Scofield
 

What's hot (20)

Perl Dancer for Python programmers
Perl Dancer for Python programmersPerl Dancer for Python programmers
Perl Dancer for Python programmers
 
Mojolicious
MojoliciousMojolicious
Mojolicious
 
RESTful web services
RESTful web servicesRESTful web services
RESTful web services
 
Puppet modules for Fun and Profit
Puppet modules for Fun and ProfitPuppet modules for Fun and Profit
Puppet modules for Fun and Profit
 
Desymfony 2011 - Habemus Bundles
Desymfony 2011 - Habemus BundlesDesymfony 2011 - Habemus Bundles
Desymfony 2011 - Habemus Bundles
 
With a Mighty Hammer
With a Mighty HammerWith a Mighty Hammer
With a Mighty Hammer
 
Building Cloud Castles
Building Cloud CastlesBuilding Cloud Castles
Building Cloud Castles
 
Dancing Tutorial
Dancing TutorialDancing Tutorial
Dancing Tutorial
 
優しいWAFの作り方
優しいWAFの作り方優しいWAFの作り方
優しいWAFの作り方
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworks
 
How to develop modern web application framework
How to develop modern web application frameworkHow to develop modern web application framework
How to develop modern web application framework
 
Developing apps using Perl
Developing apps using PerlDeveloping apps using Perl
Developing apps using Perl
 
Mojolicious on Steroids
Mojolicious on SteroidsMojolicious on Steroids
Mojolicious on Steroids
 
Mojolicious - A new hope
Mojolicious - A new hopeMojolicious - A new hope
Mojolicious - A new hope
 
Building Cloud Castles - LRUG
Building Cloud Castles - LRUGBuilding Cloud Castles - LRUG
Building Cloud Castles - LRUG
 
Codeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationCodeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept Implementation
 
Inside Bokete: Web Application with Mojolicious and others
Inside Bokete:  Web Application with Mojolicious and othersInside Bokete:  Web Application with Mojolicious and others
Inside Bokete: Web Application with Mojolicious and others
 
Great Developers Steal
Great Developers StealGreat Developers Steal
Great Developers Steal
 
Perl5i
Perl5iPerl5i
Perl5i
 
Mojo as a_client
Mojo as a_clientMojo as a_client
Mojo as a_client
 

Viewers also liked

究極のコントローラを目指す
究極のコントローラを目指す究極のコントローラを目指す
究極のコントローラを目指すYasuo Harada
 
Chapter 2 – Near East
Chapter 2 – Near East Chapter 2 – Near East
Chapter 2 – Near East Laura Moakley
 
Babylon system found in the web
Babylon system found in the webBabylon system found in the web
Babylon system found in the webYasuo Harada
 
フレームワークの選び方・付き合い方
フレームワークの選び方・付き合い方フレームワークの選び方・付き合い方
フレームワークの選び方・付き合い方Yasuo Harada
 
PHP Conference Kansai 2015
PHP Conference Kansai 2015PHP Conference Kansai 2015
PHP Conference Kansai 2015Yasuo Harada
 

Viewers also liked (6)

究極のコントローラを目指す
究極のコントローラを目指す究極のコントローラを目指す
究極のコントローラを目指す
 
Chapter 2 – Near East
Chapter 2 – Near East Chapter 2 – Near East
Chapter 2 – Near East
 
Babylon system found in the web
Babylon system found in the webBabylon system found in the web
Babylon system found in the web
 
フレームワークの選び方・付き合い方
フレームワークの選び方・付き合い方フレームワークの選び方・付き合い方
フレームワークの選び方・付き合い方
 
Packagist
PackagistPackagist
Packagist
 
PHP Conference Kansai 2015
PHP Conference Kansai 2015PHP Conference Kansai 2015
PHP Conference Kansai 2015
 

Similar to Quality Use Of Plugin

Workshop quality assurance for php projects - ZendCon 2013
Workshop quality assurance for php projects - ZendCon 2013Workshop quality assurance for php projects - ZendCon 2013
Workshop quality assurance for php projects - ZendCon 2013Michelangelo van Dam
 
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)arcware
 
Best Practices in Plugin Development (WordCamp Seattle)
Best Practices in Plugin Development (WordCamp Seattle)Best Practices in Plugin Development (WordCamp Seattle)
Best Practices in Plugin Development (WordCamp Seattle)andrewnacin
 
Workshop quality assurance for php projects - phpbelfast
Workshop quality assurance for php projects - phpbelfastWorkshop quality assurance for php projects - phpbelfast
Workshop quality assurance for php projects - phpbelfastMichelangelo van Dam
 
Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Anatoly Sharifulin
 
Using and reusing CakePHP plugins
Using and reusing CakePHP pluginsUsing and reusing CakePHP plugins
Using and reusing CakePHP pluginsPierre MARTIN
 
Using Geeklog as a Web Application Framework
Using Geeklog as a Web Application FrameworkUsing Geeklog as a Web Application Framework
Using Geeklog as a Web Application FrameworkDirk Haun
 
Curscatalyst
CurscatalystCurscatalyst
CurscatalystKar Juan
 
JavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best PracticesJavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best PracticesSiarhei Barysiuk
 
Pyramid Lighter/Faster/Better web apps
Pyramid Lighter/Faster/Better web appsPyramid Lighter/Faster/Better web apps
Pyramid Lighter/Faster/Better web appsDylan Jay
 
Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門lestrrat
 
WordPress Plugin development
WordPress Plugin developmentWordPress Plugin development
WordPress Plugin developmentMostafa Soufi
 
Laying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme developmentLaying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme developmentTammy Hart
 
PSGI and Plack from first principles
PSGI and Plack from first principlesPSGI and Plack from first principles
PSGI and Plack from first principlesPerl Careers
 
Create a web-app with Cgi Appplication
Create a web-app with Cgi AppplicationCreate a web-app with Cgi Appplication
Create a web-app with Cgi Appplicationolegmmiller
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php PresentationAlan Pinstein
 

Similar to Quality Use Of Plugin (20)

Writing Pluggable Software
Writing Pluggable SoftwareWriting Pluggable Software
Writing Pluggable Software
 
Workshop quality assurance for php projects - ZendCon 2013
Workshop quality assurance for php projects - ZendCon 2013Workshop quality assurance for php projects - ZendCon 2013
Workshop quality assurance for php projects - ZendCon 2013
 
Silex Cheat Sheet
Silex Cheat SheetSilex Cheat Sheet
Silex Cheat Sheet
 
Silex Cheat Sheet
Silex Cheat SheetSilex Cheat Sheet
Silex Cheat Sheet
 
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
 
Best Practices in Plugin Development (WordCamp Seattle)
Best Practices in Plugin Development (WordCamp Seattle)Best Practices in Plugin Development (WordCamp Seattle)
Best Practices in Plugin Development (WordCamp Seattle)
 
Workshop quality assurance for php projects - phpbelfast
Workshop quality assurance for php projects - phpbelfastWorkshop quality assurance for php projects - phpbelfast
Workshop quality assurance for php projects - phpbelfast
 
Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!
 
Using and reusing CakePHP plugins
Using and reusing CakePHP pluginsUsing and reusing CakePHP plugins
Using and reusing CakePHP plugins
 
Using Geeklog as a Web Application Framework
Using Geeklog as a Web Application FrameworkUsing Geeklog as a Web Application Framework
Using Geeklog as a Web Application Framework
 
Curscatalyst
CurscatalystCurscatalyst
Curscatalyst
 
JavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best PracticesJavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best Practices
 
Pyramid Lighter/Faster/Better web apps
Pyramid Lighter/Faster/Better web appsPyramid Lighter/Faster/Better web apps
Pyramid Lighter/Faster/Better web apps
 
Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門
 
WordPress Plugin development
WordPress Plugin developmentWordPress Plugin development
WordPress Plugin development
 
Laying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme developmentLaying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme development
 
Pluggin creation
Pluggin creationPluggin creation
Pluggin creation
 
PSGI and Plack from first principles
PSGI and Plack from first principlesPSGI and Plack from first principles
PSGI and Plack from first principles
 
Create a web-app with Cgi Appplication
Create a web-app with Cgi AppplicationCreate a web-app with Cgi Appplication
Create a web-app with Cgi Appplication
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php Presentation
 

Recently uploaded

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 

Recently uploaded (20)

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

Quality Use Of Plugin

  • 2. About me 原田 康生 Yasuo Harada 大阪のこっそりPHPer Sly PHPer in Osaka Blog 「忍び歩く男 - 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
  • 6. 1. 整 理 整 頓 smarten up 機能ごとにプラグイン化する Create a Plugin for each feature 2. 道 具 箱 tool box 汎用的なプラグインをアプリケーションで共有 To share a generic plug-in application 3. プラグイン Plugin 開発しながら修復。完成度を高めていく Repair and development. Gradually increase the degree of completion
  • 8. プラグインといえばDebugKit http://thechaw.com/debug_kit
  • 12. Each app app/config/bootstrap.php $pluginPaths = array(ROOT.DS.'plugins'.DS);
  • 13. Call Plugin app/app_controller.php class 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
  • 16. smtp.php.default Copy 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 i18n Welcome to CakePHP v1.2.4.8284 Console --------------------------------------------------------------- App : account_manager Path: /your_plugins_path/account_manager --------------------------------------------------------------- I18n Shell --------------------------------------------------------------- [E]xtract POT file from sources [I]nitialize i18n database table [H]elp [Q]uit What 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_manager Output 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/users app/views/themed/account_manager/users
  • 24. View search order 1. themed 2. plugin 3. app 4. core
  • 26. Using JqueryUI http://jqueryui.com/
  • 27. Default Dispatcher Request images/bg.png in css app/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 Dispatcher jquery/dispatcher.php class 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 Dispatcher Request images/bg.png in css app/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 Dispatcher app/config/bootstrap.php App::import('Core', 'Dispatcher',array( � 'file' => ROOT.DS.'jquery'.DS.'dispatcher.php'));
  • 31. In closing, I would like to thank you all for listening so attentively.

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n