Plugin Directory

Changeset 1561220


Ignore:
Timestamp:
12/24/2016 07:24:29 AM (9 years ago)
Author:
3UU
Message:

startpage compatible with WPMU

Location:
flexistatic
Files:
2 edited
6 copied

Legend:

Unmodified
Added
Removed
  • flexistatic/tags/2.0.1/flexistatic.php

    r1546144 r1561220  
    55 * Description:  Make real static posts flexible.
    66 * Author: 3UU
    7  * Version: 1.0.4
     7 * Version: 2.0.1
    88 * Author URI: http://datenverwurstungszentrale.com
    99 * License: MIT
     
    5353         <h2>flexible static content</h2>
    5454         <p><? _e('For best results you should set a permalink that is ending in <code>.htm</code> or <code>.html</code>. Example: <code>/%postname%-%post_id%.htm</code>','flexistatic') ?><br>
    55          <? printf( __("You current definition for permalinks is <code>%s</code> and can be changed <a href='options-permalink.php'>here</a>.", 'flexistatic'),get_option('permalink_structure')) ?> 
    56          </p><p><? _e('IMPORTANT: Please DELETE ALL static posts/pages here BEFORE CHANGING the definition of permalinks!!!','flexistatic') ?></p>
     55         <? printf( __("You current definition for permalinks is <code>%s</code> and can be changed <a href='options-permalink.php'>here</a>.", 'flexistatic'),get_option('permalink_structure')) ?></p>
     56         <p><? _e('IMPORTANT: Please DELETE ALL static posts/pages here BEFORE CHANGING the definition of permalinks!!!','flexistatic') ?></p>
    5757         <hr>
    5858<?
     
    7676          foreach($posts as $post) {
    7777              $permalink=wp_make_link_relative(get_permalink($post->ID));
    78               if(!is_file($_SERVER['DOCUMENT_ROOT'].$permalink)){
     78              // if it is a dir, append index.html
     79              $fsfile=is_dir($_SERVER['DOCUMENT_ROOT'].$permalink) ? $_SERVER['DOCUMENT_ROOT'].$permalink.'/index.html' : $_SERVER['DOCUMENT_ROOT'].$permalink;
     80              if(!is_file($fsfile)){
    7981                echo "<form style='display:inline!important;' action='".$_SERVER['PHP_SELF']."?page=flexistatic/flexistatic.php' method='POST'>";
    8082                echo "<input type='hidden' name='static3uu_post_ID' value='".$post->ID."'>
     
    99101  // start page static
    100102  echo "<h2>".__('Make the start page static.','flexistatic')."</h2>";
    101   if( !is_file($_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/index.html') ){
     103 
     104#  $blog_list = get_blog_list( 0, 'all' );
     105#  foreach ($blog_list AS $blog) {
     106#      echo 'Blog '.$blog['blog_id'].': '.$blog['domain'].$blog['path'].'<br />';
     107#      echo $_SERVER['HTTP_HOST'];
     108#          }
     109 
     110  if( !is_file($_SERVER["DOCUMENT_ROOT"].wp_make_link_relative(get_site_url()).'/'.$_SERVER["HTTP_HOST"].'.html') ){
    102111      echo "<p><form style='display:inline!important;' action='".$_SERVER['PHP_SELF']."?page=flexistatic/flexistatic.php' method='POST'>";
    103112      echo "<input type='hidden' name='static3uu_post_ID' value='0'><input type='hidden' name='static3uu_startID' value='$static3uu_startID'>
    104113            <input type='hidden' name='static3uu_act' value='static3UU_proc_make_static'><input type='submit' value='".__('make static','flexistatic')."'></form>";
    105       echo "Homepage (this will write the file <code><a target='_blank' href='".get_site_url()."'>".get_site_url()."</a>/<b>index.html</b></code> )</p>";
     114      echo "Homepage (this will write the file <code><a target='_blank' href='".get_site_url()."'>".get_site_url()."</a>/<b>".$_SERVER["HTTP_HOST"].".html</b></code>. Check your <code>.htaccess</code> to enable!)</p>";
    106115  }else{
    107116      echo "<p><form style='display:inline!important;' action='".$_SERVER['PHP_SELF']."?page=flexistatic/flexistatic.php' method='POST'>";
    108117      echo "<input type='hidden' name='static3uu_post_ID' value='0'><input type='hidden' name='static3uu_startID' value='$static3uu_startID'>
    109118      <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'));
    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>";
     119      echo date("Y-m-d H:i:s", filemtime($_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/'.$_SERVER["HTTP_HOST"].'.html'));
     120      echo " ". __('Homepage (this will remove the file','flexistatic'). "<code><a target='_blank' href='".get_site_url()."'>".get_site_url()."</a>/<b>".$_SERVER["HTTP_HOST"].".html</b></code> )</p>";
    112121      // some plugins with dirty hooks to the /index.php of WP instead of the plugin files will not work
    113122      // if index.html get preference. E.g. the very usefull "Simple Custom CSS".
    114123      echo "<p>".__('Attention: Some more ore less usefull plugins do need direct requests to the <code>index.php</code> in the blog root folder. Therefor you should add','flexistatic')," ";
    115       echo "<pre>            RewriteEngine On
    116             RewriteCond %{REQUEST_URI} ^/index\.html
     124      echo "<pre>            # FlexiStatic
     125            RewriteEngine On
     126            RewriteCond %{REQUEST_URI} ^/(index|%{HTTP_HOST})\.html
    117127            RewriteCond %{QUERY_STRING} !^$
    118128            RewriteRule . /index.php [L]</pre>";
     129      echo "<pre>            ### only needed for WPMU ###
     130            RewriteCond %{REQUEST_FILENAME} /$
     131            RewriteCond %{DOCUMENT_ROOT}/%{HTTP_HOST}.html -f
     132            RewriteRule .* %{HTTP_HOST}.html [L]
     133            # END FlexiStatic
     134      </pre>";
    119135      printf ( __("to your <code>%s/.htaccess</code> file.",'flexistatic'), $_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()) );
    120136      echo "</p>";
     
    190206
    191207    // the blog startpage   
    192     if($static3uu_post_ID == '0')             $fsfile = $_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/index.html';
     208    if($static3uu_post_ID == '0')             $fsfile = $_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/'.$_SERVER["HTTP_HOST"].'.html';
    193209    // pages
    194210    elseif(get_post_type($static3uu_post_ID)=='page') $fsfile=$_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_permalink($static3uu_post_ID).'/index.html');
     
    246262    // if we have updated a post/page perhaps we must update the blog startpage too
    247263    // 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');
     264    if(($static3uu_post_ID != '0') && file_exists($_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/'.$_SERVER["HTTP_HOST"].'.html')) static3UU_proc_update_static('0');
    249265}
    250266
     
    260276    // rtzTodo: make an admin option to define the name of the index.html
    261277    // blog page
    262     if($static3uu_post_ID == '0')           $fsfile=$_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/index.html';
     278    if($static3uu_post_ID == '0')           $fsfile=$_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/'.$_SERVER["HTTP_HOST"].'.html';
    263279    // page
    264280    elseif(get_post_type($static3uu_post_ID)=='page')   $fsfile=$_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_permalink($static3uu_post_ID).'/index.html');
     
    278294    // if we have updated a post/page perhaps we must update the blog startpage too
    279295    // 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');
     296    if(($static3uu_post_ID != '0') && file_exists($_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/'.$_SERVER["HTTP_HOST"].'.html')) static3UU_proc_update_static('0');
    281297}
    282298
  • flexistatic/tags/2.0.1/readme.txt

    r1552917 r1561220  
    44Requires at least: 4.4
    55Tested up to: 4.7
    6 Stable tag: 1.0.4
     6Stable tag: 2.0.1
    77License: MIT
    88License URI: http://opensource.org/licenses/mit
     
    6969connections to URI of your blog.
    7070
    71 = Q: Can I make the whole blog static publish it on an other server? =
     71= Q: Can I make a static version of my whole WP blog to transfer it on an
     72punblishing server? =
    7273A: No. There are other plugins to do this job. But this plugin was developed
    7374with the aim to keep as most dynamic features of Wordpress and plugins as
     
    99100== Changelog ==
    100101
    101 = 1.0.5 =
    102 - cleanup README
     102= 2.0.1 =
     103- Bugfix: append index.html if the rel path is a directory
     104
     105= 2.0.0 =
     106- Startpage now full compatible with WPMU
    103107
    104108= 1.0.4 =
  • flexistatic/trunk/flexistatic.php

    r1546144 r1561220  
    55 * Description:  Make real static posts flexible.
    66 * Author: 3UU
    7  * Version: 1.0.4
     7 * Version: 2.0.1
    88 * Author URI: http://datenverwurstungszentrale.com
    99 * License: MIT
     
    5353         <h2>flexible static content</h2>
    5454         <p><? _e('For best results you should set a permalink that is ending in <code>.htm</code> or <code>.html</code>. Example: <code>/%postname%-%post_id%.htm</code>','flexistatic') ?><br>
    55          <? printf( __("You current definition for permalinks is <code>%s</code> and can be changed <a href='options-permalink.php'>here</a>.", 'flexistatic'),get_option('permalink_structure')) ?> 
    56          </p><p><? _e('IMPORTANT: Please DELETE ALL static posts/pages here BEFORE CHANGING the definition of permalinks!!!','flexistatic') ?></p>
     55         <? printf( __("You current definition for permalinks is <code>%s</code> and can be changed <a href='options-permalink.php'>here</a>.", 'flexistatic'),get_option('permalink_structure')) ?></p>
     56         <p><? _e('IMPORTANT: Please DELETE ALL static posts/pages here BEFORE CHANGING the definition of permalinks!!!','flexistatic') ?></p>
    5757         <hr>
    5858<?
     
    7676          foreach($posts as $post) {
    7777              $permalink=wp_make_link_relative(get_permalink($post->ID));
    78               if(!is_file($_SERVER['DOCUMENT_ROOT'].$permalink)){
     78              // if it is a dir, append index.html
     79              $fsfile=is_dir($_SERVER['DOCUMENT_ROOT'].$permalink) ? $_SERVER['DOCUMENT_ROOT'].$permalink.'/index.html' : $_SERVER['DOCUMENT_ROOT'].$permalink;
     80              if(!is_file($fsfile)){
    7981                echo "<form style='display:inline!important;' action='".$_SERVER['PHP_SELF']."?page=flexistatic/flexistatic.php' method='POST'>";
    8082                echo "<input type='hidden' name='static3uu_post_ID' value='".$post->ID."'>
     
    99101  // start page static
    100102  echo "<h2>".__('Make the start page static.','flexistatic')."</h2>";
    101   if( !is_file($_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/index.html') ){
     103 
     104#  $blog_list = get_blog_list( 0, 'all' );
     105#  foreach ($blog_list AS $blog) {
     106#      echo 'Blog '.$blog['blog_id'].': '.$blog['domain'].$blog['path'].'<br />';
     107#      echo $_SERVER['HTTP_HOST'];
     108#          }
     109 
     110  if( !is_file($_SERVER["DOCUMENT_ROOT"].wp_make_link_relative(get_site_url()).'/'.$_SERVER["HTTP_HOST"].'.html') ){
    102111      echo "<p><form style='display:inline!important;' action='".$_SERVER['PHP_SELF']."?page=flexistatic/flexistatic.php' method='POST'>";
    103112      echo "<input type='hidden' name='static3uu_post_ID' value='0'><input type='hidden' name='static3uu_startID' value='$static3uu_startID'>
    104113            <input type='hidden' name='static3uu_act' value='static3UU_proc_make_static'><input type='submit' value='".__('make static','flexistatic')."'></form>";
    105       echo "Homepage (this will write the file <code><a target='_blank' href='".get_site_url()."'>".get_site_url()."</a>/<b>index.html</b></code> )</p>";
     114      echo "Homepage (this will write the file <code><a target='_blank' href='".get_site_url()."'>".get_site_url()."</a>/<b>".$_SERVER["HTTP_HOST"].".html</b></code>. Check your <code>.htaccess</code> to enable!)</p>";
    106115  }else{
    107116      echo "<p><form style='display:inline!important;' action='".$_SERVER['PHP_SELF']."?page=flexistatic/flexistatic.php' method='POST'>";
    108117      echo "<input type='hidden' name='static3uu_post_ID' value='0'><input type='hidden' name='static3uu_startID' value='$static3uu_startID'>
    109118      <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'));
    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>";
     119      echo date("Y-m-d H:i:s", filemtime($_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/'.$_SERVER["HTTP_HOST"].'.html'));
     120      echo " ". __('Homepage (this will remove the file','flexistatic'). "<code><a target='_blank' href='".get_site_url()."'>".get_site_url()."</a>/<b>".$_SERVER["HTTP_HOST"].".html</b></code> )</p>";
    112121      // some plugins with dirty hooks to the /index.php of WP instead of the plugin files will not work
    113122      // if index.html get preference. E.g. the very usefull "Simple Custom CSS".
    114123      echo "<p>".__('Attention: Some more ore less usefull plugins do need direct requests to the <code>index.php</code> in the blog root folder. Therefor you should add','flexistatic')," ";
    115       echo "<pre>            RewriteEngine On
    116             RewriteCond %{REQUEST_URI} ^/index\.html
     124      echo "<pre>            # FlexiStatic
     125            RewriteEngine On
     126            RewriteCond %{REQUEST_URI} ^/(index|%{HTTP_HOST})\.html
    117127            RewriteCond %{QUERY_STRING} !^$
    118128            RewriteRule . /index.php [L]</pre>";
     129      echo "<pre>            ### only needed for WPMU ###
     130            RewriteCond %{REQUEST_FILENAME} /$
     131            RewriteCond %{DOCUMENT_ROOT}/%{HTTP_HOST}.html -f
     132            RewriteRule .* %{HTTP_HOST}.html [L]
     133            # END FlexiStatic
     134      </pre>";
    119135      printf ( __("to your <code>%s/.htaccess</code> file.",'flexistatic'), $_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()) );
    120136      echo "</p>";
     
    190206
    191207    // the blog startpage   
    192     if($static3uu_post_ID == '0')             $fsfile = $_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/index.html';
     208    if($static3uu_post_ID == '0')             $fsfile = $_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/'.$_SERVER["HTTP_HOST"].'.html';
    193209    // pages
    194210    elseif(get_post_type($static3uu_post_ID)=='page') $fsfile=$_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_permalink($static3uu_post_ID).'/index.html');
     
    246262    // if we have updated a post/page perhaps we must update the blog startpage too
    247263    // 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');
     264    if(($static3uu_post_ID != '0') && file_exists($_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/'.$_SERVER["HTTP_HOST"].'.html')) static3UU_proc_update_static('0');
    249265}
    250266
     
    260276    // rtzTodo: make an admin option to define the name of the index.html
    261277    // blog page
    262     if($static3uu_post_ID == '0')           $fsfile=$_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/index.html';
     278    if($static3uu_post_ID == '0')           $fsfile=$_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/'.$_SERVER["HTTP_HOST"].'.html';
    263279    // page
    264280    elseif(get_post_type($static3uu_post_ID)=='page')   $fsfile=$_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_permalink($static3uu_post_ID).'/index.html');
     
    278294    // if we have updated a post/page perhaps we must update the blog startpage too
    279295    // 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');
     296    if(($static3uu_post_ID != '0') && file_exists($_SERVER['DOCUMENT_ROOT'].wp_make_link_relative(get_site_url()).'/'.$_SERVER["HTTP_HOST"].'.html')) static3UU_proc_update_static('0');
    281297}
    282298
  • flexistatic/trunk/readme.txt

    r1552917 r1561220  
    44Requires at least: 4.4
    55Tested up to: 4.7
    6 Stable tag: 1.0.4
     6Stable tag: 2.0.1
    77License: MIT
    88License URI: http://opensource.org/licenses/mit
     
    6969connections to URI of your blog.
    7070
    71 = Q: Can I make the whole blog static publish it on an other server? =
     71= Q: Can I make a static version of my whole WP blog to transfer it on an
     72punblishing server? =
    7273A: No. There are other plugins to do this job. But this plugin was developed
    7374with the aim to keep as most dynamic features of Wordpress and plugins as
     
    99100== Changelog ==
    100101
    101 = 1.0.5 =
    102 - cleanup README
     102= 2.0.1 =
     103- Bugfix: append index.html if the rel path is a directory
     104
     105= 2.0.0 =
     106- Startpage now full compatible with WPMU
    103107
    104108= 1.0.4 =
Note: See TracChangeset for help on using the changeset viewer.