{"id":30618,"date":"2014-07-24T14:20:50","date_gmt":"2014-07-24T14:20:50","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/appcachify\/"},"modified":"2014-07-24T14:20:50","modified_gmt":"2014-07-24T14:20:50","slug":"appcachify","status":"publish","type":"plugin","link":"https:\/\/af.wordpress.org\/plugins\/appcachify\/","author":65781,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"0.1","stable_tag":"trunk","tested":"3.9.40","requires":"3.8","requires_php":"","requires_plugins":"","header_name":"Appcachify","header_author":"Robert O'Rourke","header_description":"","assets_banners_color":"1d1d1d","last_updated":"2014-07-24 14:20:50","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"http:\/\/interconnectit.com","header_author_uri":"http:\/\/interconnectit.com","rating":5,"author_block_rating":0,"active_installs":10,"downloads":1929,"num_ratings":2,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":"2"},"assets_icons":[],"assets_banners":{"banner-772x250.png":{"filename":"banner-772x250.png","revision":"954160","resolution":"772x250","location":"assets"}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":[],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[8022,144,203,247],"plugin_category":[52,54],"plugin_contributors":[79639],"plugin_business_model":[],"class_list":["post-30618","plugin","type-plugin","status-publish","hentry","plugin_tags-appcache","plugin_tags-caching","plugin_tags-html5","plugin_tags-performance","plugin_category-performance","plugin_category-security-and-spam-protection","plugin_contributors-sanchothefat","plugin_committers-sanchothefat"],"banners":{"banner":"https:\/\/ps.w.org\/appcachify\/assets\/banner-772x250.png?rev=954160","banner_2x":false,"banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/appcachify_1d1d1d.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>The plugin adds an iframe to the footer of your website which points to <code>example.com\/manifest<\/code>.<\/p>\n\n<p>That URL is an empty page that references the generated manifest file at <code>example.com\/manifest.appcache<\/code>.<\/p>\n\n<p>The manifest itself is built in the following way:<\/p>\n\n<ol>\n<li>adds URLs of all queued scripts and styles<\/li>\n<li>searches theme files and folder for any images or other static assets<\/li>\n<li>if a theme has a 307.php template it is used as an offline fallback<\/li>\n<li>a timestamp of the most recently modified file is added to force appcache to refresh<\/li>\n<\/ol>\n\n<p>The net result of all this is that your main static files are stored locally on your visitors devices. For mobile this greatly helps to improve download and rendering times.<\/p>\n\n<h3>Documentation<\/h3>\n\n<h3>Adding items to the manifest<\/h3>\n\n<p>Appcache can do more than store static assets. You could cache entire pages, or add fallbacks for when a user is offline.<\/p>\n\n<p>There are 3 main sections to a manifest:<\/p>\n\n<h4>CACHE<\/h4>\n\n<p>The main <code>CACHE<\/code> section is for URLs that should be explicitly cached.<\/p>\n\n<pre><code>&lt;?php\nadd_filter( 'appcache_cache', function( $urls ) {\n   $urls[] = '\/page-available-offline\/';\n   return $urls;\n} );\n?&gt;\n<\/code><\/pre>\n\n<h4>NETWORK<\/h4>\n\n<p>This section is for specifying URLs that should <em>never<\/em> be cached.<\/p>\n\n<pre><code>&lt;?php\nadd_filter( 'appcache_network', function( $urls ) {\n   $urls[] = '*';\n   $urls[] = '\/online-only-page\/';\n   return $urls;\n} );\n?&gt;\n<\/code><\/pre>\n\n<h4>FALLBACK<\/h4>\n\n<p>The fallback section allows you to set fallback pages or images if the user is offline.<\/p>\n\n<pre><code>&lt;?php\nadd_filter( 'appcache_fallback', function( $patterns ) {\n   $patterns[] = 'wp-content\/uploads\/ wp-content\/uploads\/offline.jpg';\n   return $patterns;\n} );\n?&gt;\n<\/code><\/pre>\n\n<h4>The update header<\/h4>\n\n<p>Appcaches are refetched when the manifest file content changes so we add a few items as comments at the top of the file.<\/p>\n\n<ol>\n<li>The current theme (and version if available)<\/li>\n<li>The most recent modified time of any files we find the server path for<\/li>\n<li><p>The size of all the files that we find a server path for<\/p>\n\nget_var( \"SELECT post_modified FROM $wpdb-&gt;posts WHERE post_type = 'post' ORDER BY post_modified DESC LIMIT 1\" );\n   return $headers;\n} );\n?&gt;<\/li>\n<\/ol>\n\n<h3>More about appcache<\/h3>\n\n<p>I strongly recommend learning more about what you can do with appcache by reading the following articles:<\/p>\n\n<ul>\n<li><a href=\"http:\/\/www.html5rocks.com\/en\/tutorials\/appcache\/beginner\/\">HTML5 Rock's Introduction to Appcache<\/a><\/li>\n<li><a href=\"http:\/\/alistapart.com\/article\/application-cache-is-a-douchebag\">Application cache is a douchebag<\/a><\/li>\n<\/ul>\n\n<!--section=installation-->\n<p>Upload the plugin to your plugins directory and activate it. There's no configuration involved or settings screen.<\/p>\n\n<!--section=changelog-->\n<h4>1.0<\/h4>\n\n<ul>\n<li>Initial commit to wordpress.org<\/li>\n<\/ul>","raw_excerpt":"Adds an HTML5 appcache manifest to speed up your site by storing static assets client-side.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/af.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/30618","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/af.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/af.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/af.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=30618"}],"author":[{"embeddable":true,"href":"https:\/\/af.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/sanchothefat"}],"wp:attachment":[{"href":"https:\/\/af.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=30618"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/af.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=30618"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/af.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=30618"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/af.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=30618"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/af.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=30618"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/af.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=30618"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}