Your SlideShare is downloading. ×

Web Apps for the Masses


Published on

Using WordPress to develop Web Apps, and adding an API to WordPress

Using WordPress to develop Web Apps, and adding an API to WordPress

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Web Apps for the Masses Photo by razorray15
  • 2. About Me• Born and raised in Brazil• Live in Grand Rapids, Michigan• 1 beautiful wife• 6 great kids (5 boys and 1 girl)• Co-founder at Rocketwood• Web Producer at RBC Ministries• Developing KickPress, a WordPress plugin
  • 3. The Sweet Smell of SuccessIn under 2 years with WordPress on• From 2.1 million to 5 million page views per month• From 0 to 140,000 subscribers to daily email• From 0 to 100,000 mobile app sales• From 0 to 90,000 Facebook fans• Web donations increased 50%+• 40% less hardware• 30% savings Graph by Francesco Schwarz
  • 4. We are the 15.7% Photo by Tim Wilson
  • 5. WordPress Evolution 1. Blog 2. Multi-User 3. Custom Post Types 4. CMS 5. What’s next? Illustration by Rob Green
  • 6. Popular Web Apps
  • 7. Features of Web Apps  Offer a service  Safe-keeping of your personal data  Access to your personal data through an API  Roles and permissions for controlled and/or restricted access
  • 8. They own your data! Photo by Rob Young
  • 9. WordPress Web Apps
  • 10. With no API, users are limited in how the can access their data Illustration by Eric Tufts
  • 11. Separating contentfrom presentation Illustration by Eric Tufts
  • 12. Illustration by Eric Tufts
  • 13. No WordPresscore files ordatabase tableswere harmed inthe productionof this plugin Photo by Sarah Fleming
  • 14. KickPress allows for easy CustomPost Type management• Create new post types• Assign Roles and Capabilities per post type• Manage custom workflows• Extend post types with modulesCustom Post Types Photo by Brad Coy
  • 15. Advanced custom post type management
  • 16. Advanced roles and capabilities for managing user permissions
  • 17. 3 kinds of API requests to the server1. // Request for a full page from the theme kickpress_is_fullpage();2. // Request for a page fragment via Ajax kickpress_is_ajax();3. // Remote API request or action kickpress_is_remote_api();
  • 18. 1. Full Page Requests
  • 19. Triggering the KickPress APIAPI Parameters are appended to the endof the standard WordPress permalinks:{site}.com/how-to/ {Archive page for custom post type called “How To”}{site}.com/how-to/api/add/{site}.com/how-to/api/save/{site}.com/how-to/using-powerpoint/api/edit/More Examples:{site}.com/2012/02/18/wordcamp/api/edit/{site}.com/2012/02/18/wordcamp/api/save/{site}.com/2012/02/18/wordcamp/api/delete/{site}.com/2012/02/18/wordcamp/api/bookmark/{site}.com/2012/02/18/wordcamp/api/add_term[category]/featured/
  • 20. 2. Ajax Requests
  • 21. Theme ModificationsAdd an extra conditional commentto the top of these theme files: header.php footer.php sidebar.php<?php if ( kickpress_is_ajax() ) { return; }?>
  • 22. Theme ModificationsAdd a conditional blocks for any code thatshould be ignored on AJAX requests:<?php get_header(); ?><?php if ( kickpress_is_fullpage() ) : ?> <div id="content-wrapper"><?php endif; ?><?php $post_type = get_post_type(); ?><?php get_template_part( loop, $post_type ); ?><?php $args = array( post_type, $post_type );<?php kickpress_ajax_reload( $args, content-wrapper‘ ); ?><?php kickpress_is_fullpage( </div>‘ ); ?><?php get_sidebar(); ?><?php get_footer(); ?>
  • 23. 3. Remote API Requests
  • 24. Authentication Every registered user is assigned a “token” and a “secret” to be used in generating signatures for making ReSTful OAuth style API calls to the Web App. Photo by Jon Worth
  • 25. Authentication credentials areavailable on the user’s profile page
  • 26. $token = {token-from-profile-page};$secret = {secret-from-profile-page};$timestamp = time();$method = GET;$host = www.{your domain}.com;// Create the string to sign$string_to_sign = $method . "n" . $host . "n" . $timestamp . "n";// Calculate signature with SHA1 and base64-encoding$signature = base64_encode( hash_hmac( sha1, $string_to_sign, $secret, true ));$authentication_params = array( signature => $signature, timestamp => $timestamp, token => $token);// Normalize the query string parameters$query_parts = normalized_query_parameters( $authentication_params );$query_string = implode(&, $query_parts);// Build the URL for the remote API request$url = http:// . $host . /{post type}/api/{action}/? . $query_string; For more information:
  • 27. API Serialized Response{ "status":"success", "messages":{ "note":"Term Added" }, "data":{ "terms":[{ "term_id":"7", "name":"Featured", "slug":"featured", "taxonomy":"category", "count":"26" }] }}
  • 28. Use KickPress to Buildyour next Web App in WordPress
  • 29. The Beginning