Changeset 1145869
- Timestamp:
- 04/26/2015 02:33:40 AM (11 years ago)
- Location:
- staticwp/trunk
- Files:
-
- 7 edited
-
README.md (modified) (1 diff)
-
includes/staticwp-admin.class.php (modified) (2 diffs)
-
includes/staticwp.class.php (modified) (4 diffs)
-
readme.txt (modified) (1 diff)
-
staticwp.php (modified) (2 diffs)
-
templates/admin/info.page.php (modified) (1 diff)
-
templates/admin/preload.page.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
staticwp/trunk/README.md
r1145758 r1145869 11 11 Upload the StaticWP plugin to your site, and activate it! Yep, that's it! 12 12 13 Optionally, you can set your web server to look in the storage directory (default is `staticwp/_site/` 14 in your uploads directory) for files prior to letting Wordpress take over control. 15 16 ## Hooks 17 18 Need to modify how StaticWP works? Look to an action or a filter to accomplish what you need. 19 20 ### Actions 21 22 #### `staticwp_pre_cache_hit` 23 24 Called prior to outputting a cache hit to the client. 25 26 Params: 27 28 - `$_SERVER['REQUEST_URI']` - `string|null` 29 30 #### `staticwp_post_cache_hit` 31 32 Called after outputting a cache hit to the client. 33 34 Params: 35 36 - `$_SERVER['REQUEST_URI']` - `string|null` 37 38 #### `staticwp_cache_miss` 39 40 Called when a requested post does not exist in the cache. 41 42 Params: 43 44 - `$_SERVER['REQUEST_URI']` - `string|null` 45 46 #### `staticwp_pre_cache_update` 47 48 Called prior to saving a post's static HTML to disk. 49 50 Params: 51 52 - `$post_id` - `integer` 53 54 #### `staticwp_post_cache_update` 55 56 Called after saving a post's static HTML to disk. 57 58 Params: 59 60 - `$post_id` - `integer` 61 62 ### Filters 63 64 #### `staticwp_preload_post_types` 65 66 Allows a developer to modify the list of post types to preload. 67 Default/starting value is `array('post', 'page')`. 68 69 Params: 70 71 - `$post_types` - `array(string)` 72 73 #### `staticwp_preload_{$post_type}_posts` 74 75 Allows a developer to modify the list of posts to preload. By 76 default, all published posts of type `$post_type` will be used 77 and will be ordered by `post_date` in descending order. 78 79 Params: 80 81 - `$post_ids` - `array(integer)` 82 83 #### `staticwp_cache_hit_contents` 84 85 Allows a developer to modify the contents of a post's static 86 HTML prior to ouputting to the client. 87 88 Params: 89 90 - `$contents` - `string` 91 92 #### `staticwp_cache_update_contents` 93 94 Allows a developer to modify the contents of a post's static 95 HTML prior to saving to disk. 96 97 Params: 98 99 - `$contents` - `string` 100 - `$post_id` - `integer` 101 102 #### `staticwp_cache_destination` 103 104 Allows a developer to modify the storage directory for the static 105 HTML files. 106 107 Params: 108 109 - `$dir` - `string` 110 13 111 ## Changelog 112 113 ### 1.5.0 114 115 *Release Date - 25th April, 2015* 116 117 - Add actions. 118 - Add filters. 119 - Fix bug with `StaticWP\StaticWP` not qualifying `Exception` before its use. 14 120 15 121 ### 1.4.2 16 122 17 * In progress*123 *Release Date - 25th April, 2015* 18 124 19 125 - Fix issue with preload. -
staticwp/trunk/includes/staticwp-admin.class.php
r1145758 r1145869 183 183 set_error_handler(array(__CLASS__, 'errorToException'), E_ALL); 184 184 try { 185 $types = a rray('post', 'page');185 $types = apply_filters('staticwp_preload_post_types', array('post', 'page')); 186 186 foreach ($types as $type) { 187 187 $this->preload($type); … … 300 300 301 301 if ($query->have_posts()) { 302 foreach ($query->posts as $post_id) { 302 $posts = apply_filters('staticwp_preload_' . $post_type . '_posts', $query->posts); 303 foreach ($posts as $post_id) { 303 304 $this->updateHtml($post_id); 304 305 } -
staticwp/trunk/includes/staticwp.class.php
r1145758 r1145869 2 2 3 3 namespace StaticWP; 4 5 use \Exception; 4 6 5 7 if (!defined('ABSPATH')) { … … 85 87 $file = $_SERVER['REQUEST_URI'] . 'index.html'; 86 88 if (is_file($this->destination . $file)) { 87 echo file_get_contents($this->destination . $file); 89 $contents = file_get_contents($this->destination . $file); 90 do_action('staticwp_pre_cache_hit', $_SERVER['REQUEST_URI']); 91 echo apply_filters('staticwp_cache_hit_contents', $contents); 92 do_action('staticwp_post_cache_hit', $_SERVER['REQUEST_URI']); 88 93 exit(); 94 } else { 95 do_action('staticwp_cache_miss', $_SERVER['REQUEST_URI']); 89 96 } 90 97 } … … 129 136 130 137 curl_close($curl); 131 file_put_contents($filename, $data); 138 do_action('staticwp_pre_cache_update', $id); 139 file_put_contents($filename, apply_filters('staticwp_cache_update_contents', $data, $id)); 140 do_action('staticwp_post_cache_update', $id); 132 141 } 133 142 … … 150 159 } 151 160 152 return $dir;161 return apply_filters('staticwp_cache_destination', $dir); 153 162 } 154 163 } -
staticwp/trunk/readme.txt
r1109162 r1145869 17 17 Upload the StaticWP plugin to your site, and activate it! Yep, that's it! 18 18 19 Optionally, you can set your web server to look in the storage directory (default is `staticwp/_site/` 20 in your uploads directory) for files prior to letting Wordpress take over control. 21 19 22 == Changelog == 20 23 24 = 1.5.0 = 25 *Release Date - 25th April, 2015* 26 27 * Add actions. 28 * Add filters. 29 * Fix bug with `StaticWP\StaticWP` not qualifying `Exception` before its use. 30 21 31 = 1.4.2 = 22 * In progress*32 *Release Date - 25th April, 2015* 23 33 24 34 * Fix issue with preload. -
staticwp/trunk/staticwp.php
r1145758 r1145869 4 4 Description: Converts your blog into a static site. 5 5 Author: Shane Logsdon 6 Version: 1. 4.26 Version: 1.5.0 7 7 Author URI: http://www.slogsdon.com/ 8 8 License: MIT … … 16 16 17 17 if (!defined('STATICWP_VERSION')) { 18 define('STATICWP_VERSION', '1. 4.2');18 define('STATICWP_VERSION', '1.5.0'); 19 19 } 20 20 -
staticwp/trunk/templates/admin/info.page.php
r1145758 r1145869 4 4 <nav> 5 5 <?php \StaticWP\View::template('admin/menu', 'include'); ?> 6 <br /> 7 <br /> 6 8 </nav> 7 9 -
staticwp/trunk/templates/admin/preload.page.php
r1145758 r1145869 4 4 <nav> 5 5 <?php \StaticWP\View::template('admin/menu', 'include'); ?> 6 <br /> 7 <br /> 6 8 </nav> 7 9
Note: See TracChangeset
for help on using the changeset viewer.