using wordpress as an application framework

56
WordPress is an Application Framework 1 Friday, 17 August 12

Upload: tom-willmot

Post on 17-May-2015

1.320 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Using WordPress as an Application Framework

WordPress is an Application Framework

1Friday, 17 August 12

Page 2: Using WordPress as an Application Framework

Tom Willmothumanmade • happytables • wpremote

tomwillmot.com

hmn.md

wpremote.com

happytables.com

@tomwillmot

@humanmadeltd

@wpremote

@happytables

github.com/humanmade2Friday, 17 August 12

Page 3: Using WordPress as an Application Framework

WordPress is not just for blogging.

3Friday, 17 August 12

Page 4: Using WordPress as an Application Framework

WordPress is a CMS.

4Friday, 17 August 12

Page 5: Using WordPress as an Application Framework

WordPress is not just a CMS.

5Friday, 17 August 12

Page 6: Using WordPress as an Application Framework

WordPress is an Application Framework.

6Friday, 17 August 12

Page 7: Using WordPress as an Application Framework

7Friday, 17 August 12

Page 8: Using WordPress as an Application Framework

• What is an Application Framework

• What makes WordPress an Application Framework

• How we built the WP Remote web app on WordPress.

What is an Application Framework

8Friday, 17 August 12

Page 9: Using WordPress as an Application Framework

What is an Application Framework

9Friday, 17 August 12

Page 10: Using WordPress as an Application Framework

A web application framework is a software framework that is designed to support the development of dynamic websites, Web applications and Web services. The framework aims to alleviate the overhead associated with common activities performed in Web development. For example, many frameworks provide libraries for database access, templating frameworks and session management, and often promote code reuse.

http://en.wikipedia.org/wiki/Web_application_framework10Friday, 17 August 12

Page 11: Using WordPress as an Application Framework

That sounds a lot like WordPress!

11Friday, 17 August 12

Page 12: Using WordPress as an Application Framework

A web application framework is a software framework that is designed to support the development of dynamic websites, Web applications and Web services. The framework aims to alleviate the overhead associated with common activities performed in Web development. For example, many frameworks provide libraries for database access, templating frameworks and session management, and often promote code reuse.

http://en.wikipedia.org/wiki/Web_application_framework12Friday, 17 August 12

Page 13: Using WordPress as an Application Framework

A web application framework is a software framework that is designed to support the development of dynamic websites, Web applications and Web services. The framework aims to alleviate the overhead associated with common activities performed in Web development. For example, many frameworks provide libraries for database access, templating frameworks and session management, and often promote code reuse.

http://en.wikipedia.org/wiki/Web_application_framework13Friday, 17 August 12

Page 14: Using WordPress as an Application Framework

WordPress is web software you can use to create a beautiful website or blog.

14Friday, 17 August 12

Page 15: Using WordPress as an Application Framework

WordPress is an Application Framework that happens to come with a default app called “Blog”.

15Friday, 17 August 12

Page 16: Using WordPress as an Application Framework

WordPress is web software you can use to create a beautiful app, website or blog.

16Friday, 17 August 12

Page 17: Using WordPress as an Application Framework

Application Frameworks are libraries of useful API’s & Classes

17Friday, 17 August 12

Page 18: Using WordPress as an Application Framework

• HTTP

• XMLRPC

• WP_User

• WP_Rewrite

• WPDB

• WP_Cache & Transients

• WP_Scripts

• WP_Filesystem

• admin-ajax.php

• I18N

• WP_Query

• Security

• Templating system

• An Administration interface

Core API’s

18Friday, 17 August 12

Page 19: Using WordPress as an Application Framework

• HTTP

• XMLRPC

• WP_User

• WP_Rewrite

• WPDB

• WP_Cache & Transients

• WP_Scripts

• WP_Filesystem

• admin-ajax.php

• I18N

• WP_Query

• Security

• Templating system

• An Administration interface

19Friday, 17 August 12

Page 20: Using WordPress as an Application Framework

• HTTP

• XMLRPC

• WP_User

• WP_Rewrite

• WPDB

• WP_Cache & Transients

• WP_Scripts

• WP_Filesystem

• admin-ajax.php

• I18N

• WP_Query

• Security

• Templating system

• An Administration interface

20Friday, 17 August 12

Page 21: Using WordPress as an Application Framework

• HTTP

• XMLRPC

• WP_User

• WP_Rewrite

• WPDB

• WP_Cache & Transients

• WP_Scripts

• WP_Filesystem

• admin-ajax.php

• I18N

• WP_Query

• Security

• Templating system

• An Administration interface

21Friday, 17 August 12

Page 22: Using WordPress as an Application Framework

• HTTP

• XMLRPC

• WP_User

• WP_Rewrite

• WPDB

• WP_Cache & Transients

• WP_Scripts

• WP_Filesystem

• admin-ajax.php

• I18N

• WP_Query

• Security

• Templating system

• An Administration interface

22Friday, 17 August 12

Page 23: Using WordPress as an Application Framework

• HTTP

• XMLRPC

• WP_User

• WP_Rewrite

• WPDB

• WP_Cache & Transients

• WP_Scripts

• WP_Filesystem

• admin-ajax.php

• I18N

• WP_Query

• Security

• Templating system

• An Administration interface

23Friday, 17 August 12

Page 24: Using WordPress as an Application Framework

• HTTP

• XMLRPC

• WP_User

• WP_Rewrite

• WPDB

• WP_Cache & Transients

• WP_Scripts

• WP_Filesystem

• admin-ajax.php

• I18N

• WP_Query

• Security

• Templating system

• An Administration interface

24Friday, 17 August 12

Page 25: Using WordPress as an Application Framework

• HTTP

• XMLRPC

• WP_User

• WP_Rewrite

• WPDB

• WP_Cache & Transients

• WP_Scripts

• WP_Filesystem

• admin-ajax.php

• I18N

• WP_Query

• Security

• Templating system

• An Administration interface

25Friday, 17 August 12

Page 26: Using WordPress as an Application Framework

• HTTP

• XMLRPC

• WP_User

• WP_Rewrite

• WPDB

• WP_Cache & Transients

• WP_Scripts

• WP_Filesystem

• admin-ajax.php

• I18N

• WP_Query

• Security

• Templating system

• An Administration interface

26Friday, 17 August 12

Page 27: Using WordPress as an Application Framework

• HTTP

• XMLRPC

• WP_User

• WP_Rewrite

• WPDB

• WP_Cache & Transients

• WP_Scripts

• WP_Filesystem

• admin-ajax.php

• I18N

• WP_Query

• Security

• Templating system

• An Administration interface

27Friday, 17 August 12

Page 28: Using WordPress as an Application Framework

• HTTP

• XMLRPC

• WP_User

• WP_Rewrite

• WPDB

• WP_Cache & Transients

• WP_Scripts

• WP_Filesystem

• admin-ajax.php

• I18N

• WP_Query

• Security

• Templating system

• An Administration interface

28Friday, 17 August 12

Page 29: Using WordPress as an Application Framework

• HTTP

• XMLRPC

• WP_User

• WP_Rewrite

• WPDB

• WP_Cache & Transients

• WP_Scripts

• WP_Filesystem

• admin-ajax.php

• I18N

• WP_Query

• Security

• Templating system

• An Administration interface

29Friday, 17 August 12

Page 30: Using WordPress as an Application Framework

• HTTP

• XMLRPC

• WP_User

• WP_Rewrite

• WPDB

• WP_Cache & Transients

• WP_Scripts

• WP_Filesystem

• admin-ajax.php

• I18N

• WP_Query

• Security

• Templating system

• An Administration interface

30Friday, 17 August 12

Page 31: Using WordPress as an Application Framework

• HTTP

• XMLRPC

• WP_User

• WP_Rewrite

• WPDB

• WP_Cache & Transients

• WP_Scripts

• WP_Filesystem

• admin-ajax.php

• I18N

• WP_Query

• Security

• Templating system

• An Administration interface

31Friday, 17 August 12

Page 32: Using WordPress as an Application Framework

• HTTP

• XMLRPC

• WP_User

• WP_Rewrite

• WPDB

• WP_Cache & Transients

• WP_Scripts

• WP_Filesystem

• admin-ajax.php

• I18N

• WP_Query

• Security

• Templating system

• An Administration interface

32Friday, 17 August 12

Page 33: Using WordPress as an Application Framework

What did I miss?

33Friday, 17 August 12

Page 34: Using WordPress as an Application Framework

The thing that makes WordPress uniquely powerful?

34Friday, 17 August 12

Page 35: Using WordPress as an Application Framework

add_filter();

35Friday, 17 August 12

Page 36: Using WordPress as an Application Framework

3rd Party API’s

• TLC Transients

• WP Thumb

• Custom Meta Box API

• WordPress Objects

36Friday, 17 August 12

Page 38: Using WordPress as an Application Framework

• TLC Transients

• WP Thumbhttps://github.com/humanmade/WPThumb

• Custom Meta Box API

• WordPress Objects

• Term Meta

38Friday, 17 August 12

Page 39: Using WordPress as an Application Framework

• TLC Transients

• WP Thumb

• Custom Meta Box APIhttps://github.com/humanmade/Customs

• WordPress Objects

• Term Meta

39Friday, 17 August 12

Page 41: Using WordPress as an Application Framework

• TLC Transients

• WP Thumb

• Custom Meta Box API

• WordPress Objects

• Term Metahttps://gist.github.com/2953813

41Friday, 17 August 12

Page 42: Using WordPress as an Application Framework

All these API’s can be used without the “Blog”

part of WordPress

42Friday, 17 August 12

Page 43: Using WordPress as an Application Framework

Still need convincing?

• Continuously improved.

• Great backwards compatibility support.

• Super easy to jump in and get started.

• Can run on literally any server.

• Widely tested, runs 16.7% of the web, some of the largest sites in the world.

43Friday, 17 August 12

Page 44: Using WordPress as an Application Framework

Why Not

• Some of the core API’s are old and nasty.

• It doesn’t enforce a strict MVC structure.https://github.com/markjaquith/WordPress-Skeleton/

• People might think your not a real software engineer if your not using Ruby to build your web app.

44Friday, 17 August 12

Page 45: Using WordPress as an Application Framework

WordPress powered Apps!

45Friday, 17 August 12

Page 46: Using WordPress as an Application Framework

WP Remote

Quick Demo

46Friday, 17 August 12

Page 47: Using WordPress as an Application Framework

WordPressBack-end

WordPress PluginClient Site

Knockout.jsFront-endJSON

JSON

47Friday, 17 August 12

Page 48: Using WordPress as an Application Framework

• Users

• Sites

• Site Meta

• Core, Plugin and Theme updates

• Groups

• History

• Backups

• Settings

48Friday, 17 August 12

Page 49: Using WordPress as an Application Framework

• Standard WordPress subscriber level users.

• Custom Login, Registration and Lost Password pages and Change Password pages.

Users

49Friday, 17 August 12

Page 50: Using WordPress as an Application Framework

• Sites are stored as a custom post_type.

• Each site has the post_author set to the user that owns the site.

• The site status is set to private to signify that users sites are private to them.

• Meta information about the site like home_url, admin_url etc. are stored in post_meta. As are lists of backups, history items and plugins and themes that need updating.

Sites

50Friday, 17 August 12

Page 51: Using WordPress as an Application Framework

• Site Group is a custom taxonomy

• Each group is a new term in that taxonomy

• Doesn’t matter if 2 users unknowingly use the same group as each user only sees sites that they own.

• We use a custom term_meta table to store things like whether a group is collapsed or not.

Site Groups

51Friday, 17 August 12

Page 52: Using WordPress as an Application Framework

• Installed on each of the users sites

• We use the HTTP API to communicate between the back-end and Plugin.

• The Plugin hooks into the Core, Plugin & Theme update API’s to do the actual updates.

Plugin

52Friday, 17 August 12

Page 54: Using WordPress as an Application Framework

Done!

54Friday, 17 August 12

Page 55: Using WordPress as an Application Framework

Thanks For Listening

55Friday, 17 August 12

Page 56: Using WordPress as an Application Framework

Ask Questions Now

Or later on twitter @tomwillmot

56Friday, 17 August 12