web apps for the masses
DESCRIPTION
Using WordPress to develop Web Apps, and adding an API to WordPressTRANSCRIPT
![Page 1: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/1.jpg)
Web Apps for the Masses
@davidscotttufts
davidscotttufts.com
Photo by razorray15
![Page 2: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/2.jpg)
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
![Page 3: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/3.jpg)
The Sweet Smell of Success
Graph by Francesco Schwarz
In under 2 years with WordPress on odb.org
• 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
![Page 5: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/5.jpg)
WordPress Evolution
1. Blog 2. Multi-User 3. Custom Post Types 4. CMS 5. What’s next?
Illustration by Rob Green
![Page 6: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/6.jpg)
Popular Web Apps
![Page 7: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/7.jpg)
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
![Page 9: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/9.jpg)
WordPress Web Apps
![Page 10: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/10.jpg)
With no API, users are limited in how the can access their data
Illustration by Eric Tufts
![Page 13: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/13.jpg)
![Page 14: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/14.jpg)
Photo by Sarah Fleming
No WordPress core files or database tables were harmed in the production of this plugin
![Page 15: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/15.jpg)
Custom Post Types
KickPress allows for easy Custom Post Type management
• Create new post types
• Assign Roles and Capabilities per post type
• Manage custom workflows
• Extend post types with modules
Photo by Brad Coy
![Page 16: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/16.jpg)
Advanced custom post type management
![Page 17: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/17.jpg)
Advanced roles and capabilities for managing user permissions
![Page 18: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/18.jpg)
3 kinds of API requests to the server
1. // 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();
![Page 19: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/19.jpg)
1. Full Page Requests
![Page 20: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/20.jpg)
Triggering the KickPress API
{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/
API Parameters are appended to the end of the standard WordPress permalinks:
![Page 21: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/21.jpg)
2. Ajax Requests
![Page 22: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/22.jpg)
Theme Modifications Add an extra conditional comment to the top of these theme files:
header.php footer.php sidebar.php
<?php
if ( kickpress_is_ajax() ) { return; }
?>
![Page 23: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/23.jpg)
Theme Modifications Add a conditional blocks for any code that should 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(); ?>
![Page 24: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/24.jpg)
3. Remote API Requests
![Page 25: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/25.jpg)
Authentication
Photo by Jon Worth
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.
![Page 26: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/26.jpg)
Authentication credentials are available on the user’s profile page
![Page 27: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/27.jpg)
$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: http://kickpress.org/documentation/api-authentication/
![Page 28: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/28.jpg)
API Serialized Response { "status":"success", "messages":{ "note":"Term Added" }, "data":{ "terms":[{ "term_id":"7", "name":"Featured", "slug":"featured", "taxonomy":"category", "count":"26" }] } }
![Page 30: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/30.jpg)
Use KickPress to Build your next Web App in
WordPress
![Page 31: Web Apps for the Masses](https://reader034.vdocuments.site/reader034/viewer/2022050816/54b5028b4a795945748b47d1/html5/thumbnails/31.jpg)
The Beginning
http://kickpress.org/getting-started/