Back to WP2Static

Guess Staatic, doesn’t keep everything on some pages. Breaks the Lightbox plugin, by not keeping the <script>  on the pages with images.

I had to fix the wp2static-addon-copy add on for WP2Static. Can’t clean the directory, with the existing code.

Deployer.php:

use FilesystemIterator;

function rrmdir( string $path ) : void
{

    // if( trim( pathinfo( $path, PATHINFO_BASENAME ), '.' ) === '' )
    //     return;
    //
    // if( is_dir( $path ) )
    // {
    //     array_map( 'rrmdir', glob( $path . DIRECTORY_SEPARATOR . '{,.}*', GLOB_BRACE | GLOB_NOSORT ) );
    //     @rmdir( $path );
    // }
    //
    // else
    //     @unlink( $path );
    $dir = new RecursiveDirectoryIterator(
        $path, FilesystemIterator::SKIP_DOTS);
    $dir = new RecursiveIteratorIterator(
        $dir,RecursiveIteratorIterator::CHILD_FIRST);
    foreach ( $dir as $file ) {
        $file->isDir() ?  rmdir($file) : unlink($file);
    }

}

I found some working code by searching. Using a recursive function, might not be the best idea. Didn’t work anyways. Maybe works with older PHP.

To fix the problem of not being able to use code tags, use a different editor. Like peendev-markdown. Guess it doesn’t convert the code in the code tag, so it doesn’t try running.