Changeset 1546144
- Timestamp:
- 12/05/2016 10:56:15 PM (9 years ago)
- Location:
- flexistatic
- Files:
-
- 2 edited
- 6 copied
-
tags/1.0.4 (copied) (copied from flexistatic/trunk)
-
tags/1.0.4/flexistatic-de_DE.mo (copied) (copied from flexistatic/trunk/flexistatic-de_DE.mo)
-
tags/1.0.4/flexistatic-de_DE.po (copied) (copied from flexistatic/trunk/flexistatic-de_DE.po)
-
tags/1.0.4/flexistatic.php (copied) (copied from flexistatic/trunk/flexistatic.php) (10 diffs)
-
tags/1.0.4/license.txt (copied) (copied from flexistatic/trunk/license.txt)
-
tags/1.0.4/readme.txt (copied) (copied from flexistatic/trunk/readme.txt) (2 diffs)
-
trunk/flexistatic.php (modified) (10 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
flexistatic/tags/1.0.4/flexistatic.php
r1545276 r1546144 5 5 * Description: Make real static posts flexible. 6 6 * Author: 3UU 7 * Version: 1.0. 37 * Version: 1.0.4 8 8 * Author URI: http://datenverwurstungszentrale.com 9 9 * License: MIT … … 107 107 echo "<p><form style='display:inline!important;' action='".$_SERVER['PHP_SELF']."?page=flexistatic/flexistatic.php' method='POST'>"; 108 108 echo "<input type='hidden' name='static3uu_post_ID' value='0'><input type='hidden' name='static3uu_startID' value='$static3uu_startID'> 109 <input type='hidden' name='static3uu_act' value='static3UU_proc_remove_static'><input type='submit' style='background-color: #ff0000;' value='".__('remove static','flexistatic')."'></form>"; 109 <input type='hidden' name='static3uu_act' value='static3UU_proc_remove_static'><input type='submit' style='background-color: #ff0000;' value='".__('remove static','flexistatic')."'></form> "; 110 echo date("Y-m-d H:i:s", filemtime($_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/index.html')); 110 111 echo " ". __('Homepage (this will remove the file','flexistatic'). "<code><a target='_blank' href='".get_site_url()."'>".get_site_url()."</a>/<b>index.html</b></code> )</p>"; 111 112 // some plugins with dirty hooks to the /index.php of WP instead of the plugin files will not work … … 122 123 // all list posts/pages 123 124 echo "<h2>".__('Make single posts static.','flexistatic')."</h2>"; 124 // retrieve all URLs125 // alle Seiten-Urls holen 125 126 $posts = new WP_Query('post_type=any&posts_per_page=-1'); 126 127 $posts = $posts->posts; … … 160 161 161 162 // draw the buttons 162 $status = is_file($_SERVER['DOCUMENT_ROOT'].$permalink) ? 'static' : 'dynamic'; 163 if($post->post_type =='post') $fsfile = $_SERVER['DOCUMENT_ROOT'].$permalink; 164 if($post->post_type =='page') $fsfile = $_SERVER['DOCUMENT_ROOT'].$permalink.'/index.html'; 165 $status = is_file($fsfile) ? 'static' : 'dynamic'; 166 163 167 if($status=='dynamic'){ 164 168 echo "<form style='display:inline!important;' action='".$_SERVER['PHP_SELF']."?page=flexistatic/flexistatic.php' method='POST'>"; … … 168 172 echo "<form style='display:inline!important;' action='".$_SERVER['PHP_SELF']."?page=flexistatic/flexistatic.php' method='POST'>"; 169 173 echo "$i<input type='hidden' name='static3uu_post_ID' value='". sanitize_html_class($post->ID) ."'><input type='hidden' name='static3uu_startID' value='$static3uu_startID'> 170 <input type='hidden' name='static3uu_act' value='static3UU_proc_remove_static'><input type='submit' style='background-color: #ff0000;' value='".__('remove static','flexistatic')."'></form>"; 174 <input type='hidden' name='static3uu_act' value='static3UU_proc_remove_static'><input type='submit' style='background-color: #ff0000;' value='".__('remove static','flexistatic')."'></form> "; 175 echo date("Y-m-d H:i:s", filemtime($fsfile)); 171 176 } 172 echo " $post->post_type <a target='_blank' href='$permalink'>". esc_html( $post->post_title) ."</a> $permalink <br>";177 echo " $post->post_type <a target='_blank' href='$permalink'>". esc_html( $post->post_title) ."</a> $permalink <br>"; 173 178 } 174 179 … … 178 183 179 184 function static3UU_proc_make_static($static3uu_post_ID){ 180 181 185 // make sure we deal with an int 182 186 if( !(intval($static3uu_post_ID) >= '0') ) die('something is really wrong'); … … 184 188 $webfile=($static3uu_post_ID == '0') ? get_site_url() : get_permalink($static3uu_post_ID); 185 189 $content=file_get_contents($webfile.'?ModPagespeed=off'); 190 191 // the blog startpage 192 if($static3uu_post_ID == '0') $fsfile = $_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/index.html'; 193 // pages 194 elseif(get_post_type($static3uu_post_ID)=='page') $fsfile=$_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_permalink($static3uu_post_ID).'/index.html'); 195 // posts 196 elseif(get_post_type($static3uu_post_ID)=='post') $fsfile = $_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_permalink($static3uu_post_ID)); 197 // anything else is not supported 198 else return 'something goes wrong: unknown content type'; 186 199 187 $fsfile =($static3uu_post_ID == '0') ? $_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/index.html' : $_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_permalink($static3uu_post_ID));188 189 200 // Falls das Unterverzeichnis noch nicht existiert, legen wir es an 190 201 if( !is_dir( dirname($fsfile) ) ) mkdir(dirname($fsfile), 0755, true); … … 233 244 } 234 245 } 246 // if we have updated a post/page perhaps we must update the blog startpage too 247 // rtzTodo: this is workarround until we do a implementition at the editor pages and make a hook on save action 248 if(($static3uu_post_ID != '0') && file_exists($_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/index.html')) static3UU_proc_update_static('0'); 235 249 } 236 250 237 251 function static3UU_proc_remove_static($static3uu_post_ID){ 238 239 252 // make sure we deal with an int 240 253 // 0 is internal used as sign for the blog start page because posts will start at 1 … … 244 257 if(wp_is_post_revision($static3uu_post_ID)) { global $post; $static3uu_post_ID=$post->ID; } 245 258 246 $fsfile=$_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_permalink($static3uu_post_ID)); 247 // the blog page has no permalink format. So we use index.html and hope that it has hiegher priority than index.php 259 // the blog page has no permalink format. So we use index.html and hope that it has higher priority than index.php 248 260 // rtzTodo: make an admin option to define the name of the index.html 249 if($static3uu_post_ID == '0') $fsfile=$_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/index.html'; 250 // look up the URI 251 else $fsfile=$_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_permalink($static3uu_post_ID)); 261 // blog page 262 if($static3uu_post_ID == '0') $fsfile=$_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/index.html'; 263 // page 264 elseif(get_post_type($static3uu_post_ID)=='page') $fsfile=$_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_permalink($static3uu_post_ID).'/index.html'); 265 // post 266 elseif(get_post_type($static3uu_post_ID)=='post') $fsfile=$_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_permalink($static3uu_post_ID)); 252 267 253 268 // check that the static file exists. Than read it... … … 261 276 // However we should at least check that the dir is empty! 262 277 if(count(scandir(dirname($fsfile)))=='2') rmdir(dirname($fsfile)); 263 } 264 265 #function static3UU_proc_update_static($static3uu_post_ID){ 266 # // update only needed, if static content exists 267 # if(file_exists($_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_permalink($static3uu_post_ID)))){ 268 # static3UU_proc_remove_static($static3uu_post_ID); 269 # // perhaps we have a (now outdated) static start page too 270 # if( file_exists($_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/index.html') ){ 271 # static3UU_proc_remove_static('0'); 272 # } static3UU_proc_make_static('0'); 273 # } static3UU_proc_make_static($static3uu_post_ID); 274 #} 278 // if we have updated a post/page perhaps we must update the blog startpage too 279 // rtzTodo: this is workarround until we do a implementition at the editor pages and make a hook on save action 280 if(($static3uu_post_ID != '0') && file_exists($_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/index.html')) static3UU_proc_update_static('0'); 281 } 282 283 function static3UU_proc_update_static($static3uu_post_ID){ 284 static3UU_proc_remove_static($static3uu_post_ID); 285 static3UU_proc_make_static($static3uu_post_ID); 286 } 275 287 276 288 # only a warning on edit. prehaps later on auto delete/create -
flexistatic/tags/1.0.4/readme.txt
r1545276 r1546144 4 4 Requires at least: 4.4 5 5 Tested up to: 4.6.1 6 Stable tag: 1.0. 36 Stable tag: 1.0.4 7 7 License: MIT 8 8 License URI: http://opensource.org/licenses/mit … … 100 100 == Changelog == 101 101 102 = 1.0.4 = 103 - show creation date of the static content 104 - added autoupdate of a static startpage on any make/remove of static 105 content. This is a workarround for people how forget to recreate the 106 static blogpage on new/updated posts/pages. 107 - bugfix: correct find real localtion of virtual subdirs 108 102 109 = 1.0.3 = 103 110 - Bugfix: DOCUMENT_ROOT != blog_root; dont use get_home_path() because of -
flexistatic/trunk/flexistatic.php
r1545276 r1546144 5 5 * Description: Make real static posts flexible. 6 6 * Author: 3UU 7 * Version: 1.0. 37 * Version: 1.0.4 8 8 * Author URI: http://datenverwurstungszentrale.com 9 9 * License: MIT … … 107 107 echo "<p><form style='display:inline!important;' action='".$_SERVER['PHP_SELF']."?page=flexistatic/flexistatic.php' method='POST'>"; 108 108 echo "<input type='hidden' name='static3uu_post_ID' value='0'><input type='hidden' name='static3uu_startID' value='$static3uu_startID'> 109 <input type='hidden' name='static3uu_act' value='static3UU_proc_remove_static'><input type='submit' style='background-color: #ff0000;' value='".__('remove static','flexistatic')."'></form>"; 109 <input type='hidden' name='static3uu_act' value='static3UU_proc_remove_static'><input type='submit' style='background-color: #ff0000;' value='".__('remove static','flexistatic')."'></form> "; 110 echo date("Y-m-d H:i:s", filemtime($_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/index.html')); 110 111 echo " ". __('Homepage (this will remove the file','flexistatic'). "<code><a target='_blank' href='".get_site_url()."'>".get_site_url()."</a>/<b>index.html</b></code> )</p>"; 111 112 // some plugins with dirty hooks to the /index.php of WP instead of the plugin files will not work … … 122 123 // all list posts/pages 123 124 echo "<h2>".__('Make single posts static.','flexistatic')."</h2>"; 124 // retrieve all URLs125 // alle Seiten-Urls holen 125 126 $posts = new WP_Query('post_type=any&posts_per_page=-1'); 126 127 $posts = $posts->posts; … … 160 161 161 162 // draw the buttons 162 $status = is_file($_SERVER['DOCUMENT_ROOT'].$permalink) ? 'static' : 'dynamic'; 163 if($post->post_type =='post') $fsfile = $_SERVER['DOCUMENT_ROOT'].$permalink; 164 if($post->post_type =='page') $fsfile = $_SERVER['DOCUMENT_ROOT'].$permalink.'/index.html'; 165 $status = is_file($fsfile) ? 'static' : 'dynamic'; 166 163 167 if($status=='dynamic'){ 164 168 echo "<form style='display:inline!important;' action='".$_SERVER['PHP_SELF']."?page=flexistatic/flexistatic.php' method='POST'>"; … … 168 172 echo "<form style='display:inline!important;' action='".$_SERVER['PHP_SELF']."?page=flexistatic/flexistatic.php' method='POST'>"; 169 173 echo "$i<input type='hidden' name='static3uu_post_ID' value='". sanitize_html_class($post->ID) ."'><input type='hidden' name='static3uu_startID' value='$static3uu_startID'> 170 <input type='hidden' name='static3uu_act' value='static3UU_proc_remove_static'><input type='submit' style='background-color: #ff0000;' value='".__('remove static','flexistatic')."'></form>"; 174 <input type='hidden' name='static3uu_act' value='static3UU_proc_remove_static'><input type='submit' style='background-color: #ff0000;' value='".__('remove static','flexistatic')."'></form> "; 175 echo date("Y-m-d H:i:s", filemtime($fsfile)); 171 176 } 172 echo " $post->post_type <a target='_blank' href='$permalink'>". esc_html( $post->post_title) ."</a> $permalink <br>";177 echo " $post->post_type <a target='_blank' href='$permalink'>". esc_html( $post->post_title) ."</a> $permalink <br>"; 173 178 } 174 179 … … 178 183 179 184 function static3UU_proc_make_static($static3uu_post_ID){ 180 181 185 // make sure we deal with an int 182 186 if( !(intval($static3uu_post_ID) >= '0') ) die('something is really wrong'); … … 184 188 $webfile=($static3uu_post_ID == '0') ? get_site_url() : get_permalink($static3uu_post_ID); 185 189 $content=file_get_contents($webfile.'?ModPagespeed=off'); 190 191 // the blog startpage 192 if($static3uu_post_ID == '0') $fsfile = $_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/index.html'; 193 // pages 194 elseif(get_post_type($static3uu_post_ID)=='page') $fsfile=$_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_permalink($static3uu_post_ID).'/index.html'); 195 // posts 196 elseif(get_post_type($static3uu_post_ID)=='post') $fsfile = $_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_permalink($static3uu_post_ID)); 197 // anything else is not supported 198 else return 'something goes wrong: unknown content type'; 186 199 187 $fsfile =($static3uu_post_ID == '0') ? $_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/index.html' : $_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_permalink($static3uu_post_ID));188 189 200 // Falls das Unterverzeichnis noch nicht existiert, legen wir es an 190 201 if( !is_dir( dirname($fsfile) ) ) mkdir(dirname($fsfile), 0755, true); … … 233 244 } 234 245 } 246 // if we have updated a post/page perhaps we must update the blog startpage too 247 // rtzTodo: this is workarround until we do a implementition at the editor pages and make a hook on save action 248 if(($static3uu_post_ID != '0') && file_exists($_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/index.html')) static3UU_proc_update_static('0'); 235 249 } 236 250 237 251 function static3UU_proc_remove_static($static3uu_post_ID){ 238 239 252 // make sure we deal with an int 240 253 // 0 is internal used as sign for the blog start page because posts will start at 1 … … 244 257 if(wp_is_post_revision($static3uu_post_ID)) { global $post; $static3uu_post_ID=$post->ID; } 245 258 246 $fsfile=$_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_permalink($static3uu_post_ID)); 247 // the blog page has no permalink format. So we use index.html and hope that it has hiegher priority than index.php 259 // the blog page has no permalink format. So we use index.html and hope that it has higher priority than index.php 248 260 // rtzTodo: make an admin option to define the name of the index.html 249 if($static3uu_post_ID == '0') $fsfile=$_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/index.html'; 250 // look up the URI 251 else $fsfile=$_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_permalink($static3uu_post_ID)); 261 // blog page 262 if($static3uu_post_ID == '0') $fsfile=$_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/index.html'; 263 // page 264 elseif(get_post_type($static3uu_post_ID)=='page') $fsfile=$_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_permalink($static3uu_post_ID).'/index.html'); 265 // post 266 elseif(get_post_type($static3uu_post_ID)=='post') $fsfile=$_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_permalink($static3uu_post_ID)); 252 267 253 268 // check that the static file exists. Than read it... … … 261 276 // However we should at least check that the dir is empty! 262 277 if(count(scandir(dirname($fsfile)))=='2') rmdir(dirname($fsfile)); 263 } 264 265 #function static3UU_proc_update_static($static3uu_post_ID){ 266 # // update only needed, if static content exists 267 # if(file_exists($_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_permalink($static3uu_post_ID)))){ 268 # static3UU_proc_remove_static($static3uu_post_ID); 269 # // perhaps we have a (now outdated) static start page too 270 # if( file_exists($_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/index.html') ){ 271 # static3UU_proc_remove_static('0'); 272 # } static3UU_proc_make_static('0'); 273 # } static3UU_proc_make_static($static3uu_post_ID); 274 #} 278 // if we have updated a post/page perhaps we must update the blog startpage too 279 // rtzTodo: this is workarround until we do a implementition at the editor pages and make a hook on save action 280 if(($static3uu_post_ID != '0') && file_exists($_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/index.html')) static3UU_proc_update_static('0'); 281 } 282 283 function static3UU_proc_update_static($static3uu_post_ID){ 284 static3UU_proc_remove_static($static3uu_post_ID); 285 static3UU_proc_make_static($static3uu_post_ID); 286 } 275 287 276 288 # only a warning on edit. prehaps later on auto delete/create -
flexistatic/trunk/readme.txt
r1545276 r1546144 4 4 Requires at least: 4.4 5 5 Tested up to: 4.6.1 6 Stable tag: 1.0. 36 Stable tag: 1.0.4 7 7 License: MIT 8 8 License URI: http://opensource.org/licenses/mit … … 100 100 == Changelog == 101 101 102 = 1.0.4 = 103 - show creation date of the static content 104 - added autoupdate of a static startpage on any make/remove of static 105 content. This is a workarround for people how forget to recreate the 106 static blogpage on new/updated posts/pages. 107 - bugfix: correct find real localtion of virtual subdirs 108 102 109 = 1.0.3 = 103 110 - Bugfix: DOCUMENT_ROOT != blog_root; dont use get_home_path() because of
Note: See TracChangeset
for help on using the changeset viewer.