SlideShare a Scribd company logo
Hacking Movable Type
Italian Perl Workshop 2006


Stefano Rodighiero - stefano.rodighiero@dada.net
“Movable Type 3.2 is the
premier weblog publishing
  platform for businesses,
 organizations, developers,
    and web designers”
Le funzioni di MT

                MT



                             ________
                             ________
 Articoli,
                             ________
template
Le funzioni di MT
<MTEntries>
<$MTEntryTrackbackData$>
...
<a id=quot;a<$MTEntryID pad=quot;1quot;$>quot;></a>
<div class=quot;entryquot; id=quot;entry-<$MTEntryID$>quot;>
 <h3 class=quot;entry-headerquot;><$MTEntryTitle$></h3>
 <div class=quot;entry-contentquot;>
    <div class=quot;entry-bodyquot;>
    <$MTEntryBody$>
    <MTEntryIfExtended>
       ...
    </div>
 </div>
</div>
</MTEntries>
Le caratteristiche di MT

• Interfaccia web completa ma affidabile
• Sistema di gestione degli autori (con
  abbozzo di gestione di ruoli e permessi)
• Sistema potente per la gestione dei template
Inoltre...
MT dal punto di vista
  del programmatore

• Espone una API sofisticata e documentata
• Incoraggia lo sviluppo di plug-in per
  estenderne le funzionalità
• È scritto in Perl :-)
Estendere MT
                   MT



                            ________
                            ________
 Articoli,
                            ________
template

                  Plugin
Esempi di realizzazioni
Esempi di realizzazioni
maketitle.pl
my $plugin;

require MT::Plugin;

$plugin = MT::Plugin->new( {
     name => 'Maketitle',
     description => q{Costruisce titoli grafici},
     doc_link => '',
} );

MT->add_plugin($plugin);
maketitle.pl /2

# ... continua

MT::Template::Context->add_tag(
   MakeGraphicTitle => &make_graphic_title
);
maketitle.pl /2
nel template...
...
<center>
  <$MTMakeGraphicTitle$>
</center>
...
maketitle.pl /2
sub make_graphic_title
{
    my $context = shift;
    my $params = shift;

    my $entry = $context->stash('entry');

    my $title = $entry->title();
    my $dirified_title = dirify( $title );
    ...
    return qq{<img src=quot;$imageurlquot;>};
}
maketitle.pl /2
nel file HTML risultante...
...
<center>
  <img src=”...”>
</center>
...
statwatch
statwatch
              schemas    mysql.dump



                           list.tmpl

statwatch
                        swfooter.tmpl

               tmpl
                        swheader.tmpl



                          view.tmpl
statwatch
                                 Stats.pm



                  lib            StatWatch       Visit.pm



             statvisit.cgi     StatWatch.pm



statwatch   statwatch.cgi    StatWatchConfig.pm



            statwatch.pl
statwatch.pl
...

MT::Template::Context->add_tag('Stats' => sub{&staturl});

sub staturl {
   my $ctx = shift;
   my $blog = $ctx->stash('blog');

     my $cfg = MT::ConfigMgr->instance;
     my $script = '<script type=quot;text/javascriptquot;>
                  '.'<!--
                  '. qq|document.write('<img src=quot;|
                   . $cfg->CGIPath
                   . quot;plugins/statwatch/statvisit.cgi?blog_id=quot; . $blog->id
                   ...
                  |.'// -->'.'
                  </script>';
     return $script;
}

1;
statwatch
                                 Stats.pm



                  lib            StatWatch       Visit.pm



             statvisit.cgi     StatWatch.pm



statwatch   statwatch.cgi    StatWatchConfig.pm



            statwatch.pl
Visit.pm
# StatWatch - lib/StatWatch/Visit.pm
# Nick O'Neill (http://www.raquo.net/statwatch/)

package StatWatch::Visit;
use strict;

use MT::App;
@StatWatch::Visit::ISA = qw( MT::App );

use Stats;
my $VERSION = '1.2';
my $DEBUG = 0;
MT::ErrorHandler




 MT::Plugin           MT




                    MT::App




MT::App::CMS   MT::App::Comments   MT::App::Search
Visit.pm /2
sub init {
    my $app = shift;
    $app->SUPER::init(@_) or return;
    $app->add_methods(
        visit => &visit,
    );
    $app->{default_mode} = 'visit';
    $app->{user_class} = 'MT::Author';

    $app->{charset} = $app->{cfg}->PublishCharset;
    my $q = $app->{query};

    $app;
}
Visit.pm /2
sub visit {
   my $app = shift;
   my $q = $app->{query};
   my $blog_id;

  if ($blog_id = $q->param('blog_id')) {
     require MT::Blog;
     my $blog = MT::Blog->load({ id => $blog_id })
       or die quot;Error loading blog from blog_id $blog_idquot;;

     my $stats = Stats->new;

     # ...
statwatch
                                 Stats.pm



                  lib            StatWatch       Visit.pm



             statvisit.cgi     StatWatch.pm



statwatch   statwatch.cgi    StatWatchConfig.pm



            statwatch.pl
Visit.pm /2
package Stats;
use strict;

use MT::Object;
@Stats::ISA = qw( MT::Object );
__PACKAGE__->install_properties({
    columns => [
         'id', 'blog_id', 'url', 'referrer', 'ip',
    ],
    indexes => {
       ip => 1,
       blog_id => 1,
       created_on => 1,
    },
    audit => 1,
    datasource => 'stats',
    primary_key => 'id',
});

1;
MT::ErrorHandler




              MT::Object                      MT::ObjectDriver




                                            MT::ObjectDriver::DBI   MT::ObjectDriver::DBM




MT::Entry     MT::Author       MT::Config
Visit.pm /2
       # ...

       $stats->ip($app->remote_ip);
       $stats->referrer($referrer);
       $stats->blog_id($blog_id);
       $stats->url($url);

       &compileStats($blog_id,$app->remote_ip);

       $stats->save
         or die quot;Saving stats failed: quot;, $stats->errstr;
    } else {
       die quot;No blog idquot;;
    }
}
statwatch
                                 Stats.pm



                  lib            StatWatch       Visit.pm



             statvisit.cgi     StatWatch.pm



statwatch   statwatch.cgi    StatWatchConfig.pm



            statwatch.pl
Visit.pm /2
sub init {
    my $app = shift;
    $app->SUPER::init(@_) or return;
    $app->add_methods(
        list => &list,
        view => &view,
    );
    $app->{default_mode} = 'list';
    $app->{user_class} = 'MT::Author';

    $app->{requires_login} = 1;
    $app->{charset} = $app->{cfg}->PublishCharset;
    my $q = $app->{query};

    $app;
}
Visit.pm /2
sub list {
   my $app = shift;
   my %param;
   my $q = $app->{query};
   $param{debug} = ($DEBUG || $q->param('debug'));
   $param{setup} = $q->param('setup');

  ( $param{script_url} ,
    $param{statwatch_base_url} ,
    $param{statwatch_url} ,
    my $static_uri) = parse_cfg();

  require MT::PluginData;
  unless (MT::PluginData->load({ plugin => 'statwatch',
                                 key => 'setup_'.$VERSION })) {
     &setup;
     $app->redirect($param{statwatch_url}.quot;?setup=1quot;);
  }

  require MT::Blog;
  my @blogs = MT::Blog->load;
  my $data = [];
  ...
Visit.pm /2
    ...
    ### Listing the blogs on the main page ###
    for my $blog (@blogs) {
       if (Stats->count({ blog_id => $blog->id })) {

          # [... colleziona i dati da mostrare ...]

          # Row it
          my $row = { ... };
          push @$data, $row;
      }
    }
    $param{blog_loop} = $data;

    $param{gen_time} = quot; | quot;.$now.quot; secondsquot;;

    $param{version} = $VERSION;
    $app->build_page('tmpl/list.tmpl', %param);
}
Riepilogo?

• Inserire nuovi tag speciale all’interno dei
  template
• Aggiungere pannelli (applicazioni)
• ...
BigPAPI

• Big Plugin API
• Permette di agganciarsi all’interfaccia
  esistente di MT, estendendo le funzionalità
  dei pannelli esistenti
Perchè?
RightFields
MT->add_callback( 'bigpapi::template::edit_entry::top',
                  9,
                  $rightfields,
                  &edit_entry_template );

MT->add_callback( 'bigpapi::param::edit_entry',
                  9,
                  $rightfields,
                  &edit_entry_param );

MT->add_callback( 'bigpapi::param::preview_entry',
                  9,
                  $rightfields,
                  &preview_entry_param);
RightFields
Approfondimenti

• Six Apart Developer Wiki
  http://www.lifewiki.net/sixapart/

• Seedmagazine.com — Lookin’ Good
  http://o2b.net/archives/seedmagazine

• Beyond the blog
  http://a.wholelottanothing.org/features/2003/07/beyond_the_blog

• http://del.icio.us/slr/movabletype :-)
Grazie :)

Stefano Rodighiero
stefano.rodighiero@dada.net

More Related Content

What's hot

Bag Of Tricks From Iusethis
Bag Of Tricks From IusethisBag Of Tricks From Iusethis
Bag Of Tricks From Iusethis
Marcus Ramberg
 
Be lazy, be ESI: HTTP caching and Symfony2 @ PHPDay 2011 05-13-2011
 Be lazy, be ESI: HTTP caching and Symfony2 @ PHPDay 2011 05-13-2011 Be lazy, be ESI: HTTP caching and Symfony2 @ PHPDay 2011 05-13-2011
Be lazy, be ESI: HTTP caching and Symfony2 @ PHPDay 2011 05-13-2011
Alessandro Nadalin
 
Angular.js Fundamentals
Angular.js FundamentalsAngular.js Fundamentals
Angular.js Fundamentals
Mark
 
TurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsTurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsAlessandro Molina
 
Intro to advanced caching in WordPress
Intro to advanced caching in WordPressIntro to advanced caching in WordPress
Intro to advanced caching in WordPress
Maor Chasen
 
Aplicacoes dinamicas Rails com Backbone
Aplicacoes dinamicas Rails com BackboneAplicacoes dinamicas Rails com Backbone
Aplicacoes dinamicas Rails com Backbone
Rafael Felix da Silva
 
Daily notes
Daily notesDaily notes
Daily notes
meghendra168
 
Анатолий Поляков - Drupal.ajax framework from a to z
Анатолий Поляков - Drupal.ajax framework from a to zАнатолий Поляков - Drupal.ajax framework from a to z
Анатолий Поляков - Drupal.ajax framework from a to z
LEDC 2016
 
Hidden in plain site – joomla! hidden secrets for code monkeys
Hidden in plain site – joomla! hidden secrets for code monkeysHidden in plain site – joomla! hidden secrets for code monkeys
Hidden in plain site – joomla! hidden secrets for code monkeys
Nicholas Dionysopoulos
 
Angular js routing options
Angular js routing optionsAngular js routing options
Angular js routing options
Nir Kaufman
 
WordCamp Montreal 2015: Combining Custom Post Types, Fields, and Meta Boxes t...
WordCamp Montreal 2015: Combining Custom Post Types, Fields, and Meta Boxes t...WordCamp Montreal 2015: Combining Custom Post Types, Fields, and Meta Boxes t...
WordCamp Montreal 2015: Combining Custom Post Types, Fields, and Meta Boxes t...
allilevine
 
Meet Magento Sweden - Magento 2 Layout and Code Compilation for Performance
Meet Magento Sweden - Magento 2 Layout and Code Compilation for PerformanceMeet Magento Sweden - Magento 2 Layout and Code Compilation for Performance
Meet Magento Sweden - Magento 2 Layout and Code Compilation for Performance
Ivan Chepurnyi
 
WordPress Kitchen 2014 - Александр Стриха: Кеширование в WordPress
WordPress Kitchen 2014 - Александр Стриха: Кеширование в WordPress WordPress Kitchen 2014 - Александр Стриха: Кеширование в WordPress
WordPress Kitchen 2014 - Александр Стриха: Кеширование в WordPress
WordCamp Kyiv
 
AngulrJS Overview
AngulrJS OverviewAngulrJS Overview
AngulrJS Overview
Eyal Vardi
 
Optimizing Angular Performance in Enterprise Single Page Apps
Optimizing Angular Performance in Enterprise Single Page AppsOptimizing Angular Performance in Enterprise Single Page Apps
Optimizing Angular Performance in Enterprise Single Page Apps
Morgan Stone
 
Upgrade your javascript to drupal 8
Upgrade your javascript to drupal 8Upgrade your javascript to drupal 8
Upgrade your javascript to drupal 8
Théodore Biadala
 
Keeping It Simple
Keeping It SimpleKeeping It Simple
Keeping It Simple
Stephanie Leary
 

What's hot (20)

Bag Of Tricks From Iusethis
Bag Of Tricks From IusethisBag Of Tricks From Iusethis
Bag Of Tricks From Iusethis
 
Perl5i
Perl5iPerl5i
Perl5i
 
Be lazy, be ESI: HTTP caching and Symfony2 @ PHPDay 2011 05-13-2011
 Be lazy, be ESI: HTTP caching and Symfony2 @ PHPDay 2011 05-13-2011 Be lazy, be ESI: HTTP caching and Symfony2 @ PHPDay 2011 05-13-2011
Be lazy, be ESI: HTTP caching and Symfony2 @ PHPDay 2011 05-13-2011
 
Angular.js Fundamentals
Angular.js FundamentalsAngular.js Fundamentals
Angular.js Fundamentals
 
TurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsTurboGears2 Pluggable Applications
TurboGears2 Pluggable Applications
 
Intro to advanced caching in WordPress
Intro to advanced caching in WordPressIntro to advanced caching in WordPress
Intro to advanced caching in WordPress
 
Mojolicious
MojoliciousMojolicious
Mojolicious
 
Add loop shortcode
Add loop shortcodeAdd loop shortcode
Add loop shortcode
 
Aplicacoes dinamicas Rails com Backbone
Aplicacoes dinamicas Rails com BackboneAplicacoes dinamicas Rails com Backbone
Aplicacoes dinamicas Rails com Backbone
 
Daily notes
Daily notesDaily notes
Daily notes
 
Анатолий Поляков - Drupal.ajax framework from a to z
Анатолий Поляков - Drupal.ajax framework from a to zАнатолий Поляков - Drupal.ajax framework from a to z
Анатолий Поляков - Drupal.ajax framework from a to z
 
Hidden in plain site – joomla! hidden secrets for code monkeys
Hidden in plain site – joomla! hidden secrets for code monkeysHidden in plain site – joomla! hidden secrets for code monkeys
Hidden in plain site – joomla! hidden secrets for code monkeys
 
Angular js routing options
Angular js routing optionsAngular js routing options
Angular js routing options
 
WordCamp Montreal 2015: Combining Custom Post Types, Fields, and Meta Boxes t...
WordCamp Montreal 2015: Combining Custom Post Types, Fields, and Meta Boxes t...WordCamp Montreal 2015: Combining Custom Post Types, Fields, and Meta Boxes t...
WordCamp Montreal 2015: Combining Custom Post Types, Fields, and Meta Boxes t...
 
Meet Magento Sweden - Magento 2 Layout and Code Compilation for Performance
Meet Magento Sweden - Magento 2 Layout and Code Compilation for PerformanceMeet Magento Sweden - Magento 2 Layout and Code Compilation for Performance
Meet Magento Sweden - Magento 2 Layout and Code Compilation for Performance
 
WordPress Kitchen 2014 - Александр Стриха: Кеширование в WordPress
WordPress Kitchen 2014 - Александр Стриха: Кеширование в WordPress WordPress Kitchen 2014 - Александр Стриха: Кеширование в WordPress
WordPress Kitchen 2014 - Александр Стриха: Кеширование в WordPress
 
AngulrJS Overview
AngulrJS OverviewAngulrJS Overview
AngulrJS Overview
 
Optimizing Angular Performance in Enterprise Single Page Apps
Optimizing Angular Performance in Enterprise Single Page AppsOptimizing Angular Performance in Enterprise Single Page Apps
Optimizing Angular Performance in Enterprise Single Page Apps
 
Upgrade your javascript to drupal 8
Upgrade your javascript to drupal 8Upgrade your javascript to drupal 8
Upgrade your javascript to drupal 8
 
Keeping It Simple
Keeping It SimpleKeeping It Simple
Keeping It Simple
 

Viewers also liked

Basic Introduction to hacking
Basic Introduction to hackingBasic Introduction to hacking
Basic Introduction to hacking
Sainath Volam
 
Internet and personal privacy
Internet and personal privacyInternet and personal privacy
Internet and personal privacy
Roshan Kumar Bhattarai
 
Evaporation New Template
Evaporation New TemplateEvaporation New Template
Evaporation New Templatedloschiavo
 
Evaporation
EvaporationEvaporation
Evaporation
Sayeed Hasan
 
Hacking 1
Hacking 1Hacking 1
Hacking 1
sonal bisla
 
Cybercrime (Computer Hacking)
Cybercrime (Computer Hacking)Cybercrime (Computer Hacking)
Cybercrime (Computer Hacking)
Michael Asres
 
Is hacking good or bad
Is hacking good or badIs hacking good or bad
Is hacking good or bad
Ashish Chandurkar
 
What is hacking | Types of Hacking
What is hacking | Types of HackingWhat is hacking | Types of Hacking
What is hacking | Types of Hacking
GOPCSOFT
 
Soil Steady-State Evaporation
Soil Steady-State EvaporationSoil Steady-State Evaporation
Soil Steady-State Evaporation
Morteza Sadeghi
 
AMAZING COMPUTER TRICKS
AMAZING COMPUTER TRICKSAMAZING COMPUTER TRICKS
AMAZING COMPUTER TRICKS
Marc Jones
 
Water evaporation reduction from lakes
Water evaporation reduction from lakesWater evaporation reduction from lakes
Water evaporation reduction from lakes
guestb311d8
 
CFD-based Evaporation Estimation Approach
CFD-based Evaporation Estimation ApproachCFD-based Evaporation Estimation Approach
CFD-based Evaporation Estimation ApproachAli Abbasi
 
Hacking And EthicalHacking By Satish
Hacking And EthicalHacking By SatishHacking And EthicalHacking By Satish
Hacking And EthicalHacking By Satish
Nugala Sathesh Chowdary
 
Hacking sites for fun and profit
Hacking sites for fun and profitHacking sites for fun and profit
Hacking sites for fun and profit
David Stockton
 
hacking and its types
hacking and its typeshacking and its types
hacking and its types
Bharath Reddy
 

Viewers also liked (20)

Basic Introduction to hacking
Basic Introduction to hackingBasic Introduction to hacking
Basic Introduction to hacking
 
Internet and personal privacy
Internet and personal privacyInternet and personal privacy
Internet and personal privacy
 
Evaporation New Template
Evaporation New TemplateEvaporation New Template
Evaporation New Template
 
Evaporation
EvaporationEvaporation
Evaporation
 
Hacking 1
Hacking 1Hacking 1
Hacking 1
 
Hacking
HackingHacking
Hacking
 
Cybercrime (Computer Hacking)
Cybercrime (Computer Hacking)Cybercrime (Computer Hacking)
Cybercrime (Computer Hacking)
 
Is hacking good or bad
Is hacking good or badIs hacking good or bad
Is hacking good or bad
 
my new HACKING
my new HACKINGmy new HACKING
my new HACKING
 
What is hacking | Types of Hacking
What is hacking | Types of HackingWhat is hacking | Types of Hacking
What is hacking | Types of Hacking
 
Group 4 (evaporation)
Group 4 (evaporation)Group 4 (evaporation)
Group 4 (evaporation)
 
Science - Evaporation
Science - EvaporationScience - Evaporation
Science - Evaporation
 
Soil Steady-State Evaporation
Soil Steady-State EvaporationSoil Steady-State Evaporation
Soil Steady-State Evaporation
 
AMAZING COMPUTER TRICKS
AMAZING COMPUTER TRICKSAMAZING COMPUTER TRICKS
AMAZING COMPUTER TRICKS
 
Water evaporation reduction from lakes
Water evaporation reduction from lakesWater evaporation reduction from lakes
Water evaporation reduction from lakes
 
CFD-based Evaporation Estimation Approach
CFD-based Evaporation Estimation ApproachCFD-based Evaporation Estimation Approach
CFD-based Evaporation Estimation Approach
 
Hacking And EthicalHacking By Satish
Hacking And EthicalHacking By SatishHacking And EthicalHacking By Satish
Hacking And EthicalHacking By Satish
 
Hacking sites for fun and profit
Hacking sites for fun and profitHacking sites for fun and profit
Hacking sites for fun and profit
 
Evaporation 4 slides
Evaporation 4 slidesEvaporation 4 slides
Evaporation 4 slides
 
hacking and its types
hacking and its typeshacking and its types
hacking and its types
 

Similar to Hacking Movable Type

Curscatalyst
CurscatalystCurscatalyst
CurscatalystKar Juan
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworksdiego_k
 
Api Design
Api DesignApi Design
Api Design
sartak
 
MTDDC 2010.2.5 Tokyo - Brand new API
MTDDC 2010.2.5 Tokyo - Brand new APIMTDDC 2010.2.5 Tokyo - Brand new API
MTDDC 2010.2.5 Tokyo - Brand new APISix Apart KK
 
Magento Live Australia 2016: Request Flow
Magento Live Australia 2016: Request FlowMagento Live Australia 2016: Request Flow
Magento Live Australia 2016: Request Flow
Vrann Tulika
 
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
Dirk Haun
 
Catalyst patterns-yapc-eu-2016
Catalyst patterns-yapc-eu-2016Catalyst patterns-yapc-eu-2016
Catalyst patterns-yapc-eu-2016
John Napiorkowski
 
Perl web app 테스트전략
Perl web app 테스트전략Perl web app 테스트전략
Perl web app 테스트전략
Jeen Lee
 
Magento Indexes
Magento IndexesMagento Indexes
Magento Indexes
Ivan Chepurnyi
 
Blog Hacks 2011
Blog Hacks 2011Blog Hacks 2011
Blog Hacks 2011
Yusuke Wada
 
Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)
Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)
Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)
Michael Wales
 
Web applications with Catalyst
Web applications with CatalystWeb applications with Catalyst
Web applications with Catalystsvilen.ivanov
 
Zend framework service
Zend framework serviceZend framework service
Zend framework service
Michelangelo van Dam
 
Zend framework service
Zend framework serviceZend framework service
Zend framework service
Michelangelo van Dam
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For Beginners
Jonathan Wage
 
Broadleaf Presents Thymeleaf
Broadleaf Presents ThymeleafBroadleaf Presents Thymeleaf
Broadleaf Presents Thymeleaf
Broadleaf Commerce
 
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, Germany
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, GermanyLet's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, Germany
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, Germany
Balázs Tatár
 
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
Michelangelo van Dam
 

Similar to Hacking Movable Type (20)

Curscatalyst
CurscatalystCurscatalyst
Curscatalyst
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworks
 
Api Design
Api DesignApi Design
Api Design
 
MTDDC 2010.2.5 Tokyo - Brand new API
MTDDC 2010.2.5 Tokyo - Brand new APIMTDDC 2010.2.5 Tokyo - Brand new API
MTDDC 2010.2.5 Tokyo - Brand new API
 
Magento Live Australia 2016: Request Flow
Magento Live Australia 2016: Request FlowMagento Live Australia 2016: Request Flow
Magento Live Australia 2016: Request Flow
 
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
 
Catalyst patterns-yapc-eu-2016
Catalyst patterns-yapc-eu-2016Catalyst patterns-yapc-eu-2016
Catalyst patterns-yapc-eu-2016
 
Perl web app 테스트전략
Perl web app 테스트전략Perl web app 테스트전략
Perl web app 테스트전략
 
Magento Indexes
Magento IndexesMagento Indexes
Magento Indexes
 
Blog Hacks 2011
Blog Hacks 2011Blog Hacks 2011
Blog Hacks 2011
 
Introduction to angular js
Introduction to angular jsIntroduction to angular js
Introduction to angular js
 
Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)
Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)
Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)
 
Web applications with Catalyst
Web applications with CatalystWeb applications with Catalyst
Web applications with Catalyst
 
Smarty
SmartySmarty
Smarty
 
Zend framework service
Zend framework serviceZend framework service
Zend framework service
 
Zend framework service
Zend framework serviceZend framework service
Zend framework service
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For Beginners
 
Broadleaf Presents Thymeleaf
Broadleaf Presents ThymeleafBroadleaf Presents Thymeleaf
Broadleaf Presents Thymeleaf
 
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, Germany
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, GermanyLet's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, Germany
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, Germany
 
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
 

More from Stefano Rodighiero

Perl101 - Italian Perl Workshop 2011
Perl101 - Italian Perl Workshop 2011Perl101 - Italian Perl Workshop 2011
Perl101 - Italian Perl Workshop 2011Stefano Rodighiero
 
On the most excellent theory of time travel, poetic revolutions, and dynamic ...
On the most excellent theory of time travel, poetic revolutions, and dynamic ...On the most excellent theory of time travel, poetic revolutions, and dynamic ...
On the most excellent theory of time travel, poetic revolutions, and dynamic ...
Stefano Rodighiero
 
Perl101
Perl101Perl101
Perl Template Toolkit
Perl Template ToolkitPerl Template Toolkit
Perl Template Toolkit
Stefano Rodighiero
 
Test Automatici^2 per applicazioni Web
Test Automatici^2 per applicazioni WebTest Automatici^2 per applicazioni Web
Test Automatici^2 per applicazioni Web
Stefano Rodighiero
 
Perl, musica automagica
Perl, musica automagicaPerl, musica automagica
Perl, musica automagica
Stefano Rodighiero
 
POE
POEPOE
Scatole Nere
Scatole NereScatole Nere
Scatole Nere
Stefano Rodighiero
 

More from Stefano Rodighiero (8)

Perl101 - Italian Perl Workshop 2011
Perl101 - Italian Perl Workshop 2011Perl101 - Italian Perl Workshop 2011
Perl101 - Italian Perl Workshop 2011
 
On the most excellent theory of time travel, poetic revolutions, and dynamic ...
On the most excellent theory of time travel, poetic revolutions, and dynamic ...On the most excellent theory of time travel, poetic revolutions, and dynamic ...
On the most excellent theory of time travel, poetic revolutions, and dynamic ...
 
Perl101
Perl101Perl101
Perl101
 
Perl Template Toolkit
Perl Template ToolkitPerl Template Toolkit
Perl Template Toolkit
 
Test Automatici^2 per applicazioni Web
Test Automatici^2 per applicazioni WebTest Automatici^2 per applicazioni Web
Test Automatici^2 per applicazioni Web
 
Perl, musica automagica
Perl, musica automagicaPerl, musica automagica
Perl, musica automagica
 
POE
POEPOE
POE
 
Scatole Nere
Scatole NereScatole Nere
Scatole Nere
 

Recently uploaded

Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
ViralQR
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 

Recently uploaded (20)

Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 

Hacking Movable Type

  • 1. Hacking Movable Type Italian Perl Workshop 2006 Stefano Rodighiero - stefano.rodighiero@dada.net
  • 2. “Movable Type 3.2 is the premier weblog publishing platform for businesses, organizations, developers, and web designers”
  • 3. Le funzioni di MT MT ________ ________ Articoli, ________ template
  • 4. Le funzioni di MT <MTEntries> <$MTEntryTrackbackData$> ... <a id=quot;a<$MTEntryID pad=quot;1quot;$>quot;></a> <div class=quot;entryquot; id=quot;entry-<$MTEntryID$>quot;> <h3 class=quot;entry-headerquot;><$MTEntryTitle$></h3> <div class=quot;entry-contentquot;> <div class=quot;entry-bodyquot;> <$MTEntryBody$> <MTEntryIfExtended> ... </div> </div> </div> </MTEntries>
  • 5. Le caratteristiche di MT • Interfaccia web completa ma affidabile • Sistema di gestione degli autori (con abbozzo di gestione di ruoli e permessi) • Sistema potente per la gestione dei template
  • 7. MT dal punto di vista del programmatore • Espone una API sofisticata e documentata • Incoraggia lo sviluppo di plug-in per estenderne le funzionalità • È scritto in Perl :-)
  • 8. Estendere MT MT ________ ________ Articoli, ________ template Plugin
  • 11. maketitle.pl my $plugin; require MT::Plugin; $plugin = MT::Plugin->new( { name => 'Maketitle', description => q{Costruisce titoli grafici}, doc_link => '', } ); MT->add_plugin($plugin);
  • 12.
  • 13. maketitle.pl /2 # ... continua MT::Template::Context->add_tag( MakeGraphicTitle => &make_graphic_title );
  • 14. maketitle.pl /2 nel template... ... <center> <$MTMakeGraphicTitle$> </center> ...
  • 15. maketitle.pl /2 sub make_graphic_title { my $context = shift; my $params = shift; my $entry = $context->stash('entry'); my $title = $entry->title(); my $dirified_title = dirify( $title ); ... return qq{<img src=quot;$imageurlquot;>}; }
  • 16. maketitle.pl /2 nel file HTML risultante... ... <center> <img src=”...”> </center> ...
  • 18. statwatch schemas mysql.dump list.tmpl statwatch swfooter.tmpl tmpl swheader.tmpl view.tmpl
  • 19. statwatch Stats.pm lib StatWatch Visit.pm statvisit.cgi StatWatch.pm statwatch statwatch.cgi StatWatchConfig.pm statwatch.pl
  • 20. statwatch.pl ... MT::Template::Context->add_tag('Stats' => sub{&staturl}); sub staturl { my $ctx = shift; my $blog = $ctx->stash('blog'); my $cfg = MT::ConfigMgr->instance; my $script = '<script type=quot;text/javascriptquot;> '.'<!-- '. qq|document.write('<img src=quot;| . $cfg->CGIPath . quot;plugins/statwatch/statvisit.cgi?blog_id=quot; . $blog->id ... |.'// -->'.' </script>'; return $script; } 1;
  • 21. statwatch Stats.pm lib StatWatch Visit.pm statvisit.cgi StatWatch.pm statwatch statwatch.cgi StatWatchConfig.pm statwatch.pl
  • 22. Visit.pm # StatWatch - lib/StatWatch/Visit.pm # Nick O'Neill (http://www.raquo.net/statwatch/) package StatWatch::Visit; use strict; use MT::App; @StatWatch::Visit::ISA = qw( MT::App ); use Stats; my $VERSION = '1.2'; my $DEBUG = 0;
  • 23. MT::ErrorHandler MT::Plugin MT MT::App MT::App::CMS MT::App::Comments MT::App::Search
  • 24. Visit.pm /2 sub init { my $app = shift; $app->SUPER::init(@_) or return; $app->add_methods( visit => &visit, ); $app->{default_mode} = 'visit'; $app->{user_class} = 'MT::Author'; $app->{charset} = $app->{cfg}->PublishCharset; my $q = $app->{query}; $app; }
  • 25. Visit.pm /2 sub visit { my $app = shift; my $q = $app->{query}; my $blog_id; if ($blog_id = $q->param('blog_id')) { require MT::Blog; my $blog = MT::Blog->load({ id => $blog_id }) or die quot;Error loading blog from blog_id $blog_idquot;; my $stats = Stats->new; # ...
  • 26. statwatch Stats.pm lib StatWatch Visit.pm statvisit.cgi StatWatch.pm statwatch statwatch.cgi StatWatchConfig.pm statwatch.pl
  • 27. Visit.pm /2 package Stats; use strict; use MT::Object; @Stats::ISA = qw( MT::Object ); __PACKAGE__->install_properties({ columns => [ 'id', 'blog_id', 'url', 'referrer', 'ip', ], indexes => { ip => 1, blog_id => 1, created_on => 1, }, audit => 1, datasource => 'stats', primary_key => 'id', }); 1;
  • 28. MT::ErrorHandler MT::Object MT::ObjectDriver MT::ObjectDriver::DBI MT::ObjectDriver::DBM MT::Entry MT::Author MT::Config
  • 29. Visit.pm /2 # ... $stats->ip($app->remote_ip); $stats->referrer($referrer); $stats->blog_id($blog_id); $stats->url($url); &compileStats($blog_id,$app->remote_ip); $stats->save or die quot;Saving stats failed: quot;, $stats->errstr; } else { die quot;No blog idquot;; } }
  • 30. statwatch Stats.pm lib StatWatch Visit.pm statvisit.cgi StatWatch.pm statwatch statwatch.cgi StatWatchConfig.pm statwatch.pl
  • 31. Visit.pm /2 sub init { my $app = shift; $app->SUPER::init(@_) or return; $app->add_methods( list => &list, view => &view, ); $app->{default_mode} = 'list'; $app->{user_class} = 'MT::Author'; $app->{requires_login} = 1; $app->{charset} = $app->{cfg}->PublishCharset; my $q = $app->{query}; $app; }
  • 32. Visit.pm /2 sub list { my $app = shift; my %param; my $q = $app->{query}; $param{debug} = ($DEBUG || $q->param('debug')); $param{setup} = $q->param('setup'); ( $param{script_url} , $param{statwatch_base_url} , $param{statwatch_url} , my $static_uri) = parse_cfg(); require MT::PluginData; unless (MT::PluginData->load({ plugin => 'statwatch', key => 'setup_'.$VERSION })) { &setup; $app->redirect($param{statwatch_url}.quot;?setup=1quot;); } require MT::Blog; my @blogs = MT::Blog->load; my $data = []; ...
  • 33. Visit.pm /2 ... ### Listing the blogs on the main page ### for my $blog (@blogs) { if (Stats->count({ blog_id => $blog->id })) { # [... colleziona i dati da mostrare ...] # Row it my $row = { ... }; push @$data, $row; } } $param{blog_loop} = $data; $param{gen_time} = quot; | quot;.$now.quot; secondsquot;; $param{version} = $VERSION; $app->build_page('tmpl/list.tmpl', %param); }
  • 34. Riepilogo? • Inserire nuovi tag speciale all’interno dei template • Aggiungere pannelli (applicazioni) • ...
  • 35. BigPAPI • Big Plugin API • Permette di agganciarsi all’interfaccia esistente di MT, estendendo le funzionalità dei pannelli esistenti
  • 37. RightFields MT->add_callback( 'bigpapi::template::edit_entry::top', 9, $rightfields, &edit_entry_template ); MT->add_callback( 'bigpapi::param::edit_entry', 9, $rightfields, &edit_entry_param ); MT->add_callback( 'bigpapi::param::preview_entry', 9, $rightfields, &preview_entry_param);
  • 39. Approfondimenti • Six Apart Developer Wiki http://www.lifewiki.net/sixapart/ • Seedmagazine.com — Lookin’ Good http://o2b.net/archives/seedmagazine • Beyond the blog http://a.wholelottanothing.org/features/2003/07/beyond_the_blog • http://del.icio.us/slr/movabletype :-)