Plugin Directory

Changeset 3442759


Ignore:
Timestamp:
01/19/2026 07:17:29 PM (2 months ago)
Author:
kturgutoglu
Message:

VERSION 3.5.4

Location:
static-porter/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • static-porter/trunk/readme.txt

    r3441946 r3442759  
    11=== Static Porter ===
    2 Contributors: kturgutoglu
    3 Tags: static site generator, SEO, performance, page speed, optimization
     2Contributors: KAYIHAN TURGUTOGLU, KAYA TURK
     3Donate link: https://www.paypal.me/kturgutoglu
     4Tags: static, cache, performance, speed, optimization
    45Requires at least: 5.0
    56Tested up to: 6.9
     
    910License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1011
    11 Slash your page load times without changing a single URL. Static Porter converts WordPress into lightning-fast static HTML while preserving your exact permalink structure for 100% SEO safety. Reduce server load and improve SEO instantly.
     12Convert your dynamic WordPress site into ultra-fast static HTML files. Reduce server load and improve SEO instantly.
    1213
    1314== Description ==
     
    1819
    1920### Key Features:
    20 * **One-Click Full Crawl:** Easily generate a static HTML version of your entire site.
    21 * **Zero URL Changes:** Static Porter keeps your original URL slugs exactly as they are. Your SEO remains intact with no broken links.
     21* **One-Click Full Crawl:** Easily generate a static version of your entire site.
    2222* **Smart Refresh:** Automatically updates the static home page and post pages when you hit publish.
    2323* **Persistent Cache Table:** Monitor exactly which files are cached with individual 'Delete' and 'Recrawl' controls.
     
    3535== Frequently Asked Questions ==
    3636
    37 = Will Static Porter really make my site faster? =
    38 Yes! Traditional WordPress pages require the server to process PHP and query a MySQL database every time a visitor arrives. Static Porter converts these into flat HTML files. Your server can then deliver these files instantly, bypassing the "heavy lifting" entirely. This often results in a nearly instant Time to First Byte (TTFB).
    39 
    40 = Will my URL structure or permalinks change? =
    41 No. This is one of the core strengths of Static Porter. The plugin generates a static mirror of your site that follows your existing WordPress permalink structure perfectly. Your visitors (and search engine bots) will continue to see the same clean URLs they always have, but the pages will simply load much faster.
    42 
    43 = Do I have to manually recrawl my site every time I write a post? =
    44 No. Static Porter includes a "Smart Refresh" feature. When you publish or update a post, the plugin automatically regenerates the static version of that specific post and your homepage. It’s a "set-and-forget" solution for active bloggers.
    45 
    46 = Can I use this on a low-resource budget server? =
    47 Absolutely. Static Porter is designed to be resource-efficient and includes a built-in "Peak Memory" monitor in the dashboard so you can track its impact. If the crawl is too heavy for your server, you can use the "Stop Crawl" safety button at any time to immediately halt the process.
    48 
    49 = Does this plugin improve my site's security? =
    50 Yes. In addition to serving static files (which are inherently more secure than dynamic PHP), Static Porter automatically injects security headers into your .htaccess file. This includes protection against clickjacking (X-Frame-Options) and MIME-type sniffing (X-Content-Type-Options).
    51 
    52 = Will this help my Google search rankings (SEO)? =
    53 Speed is a major ranking factor for Google, especially with Core Web Vitals. By serving ultra-fast static HTML and enabling Gzip compression and browser caching automatically, your site will likely see improved performance scores, which can lead to better visibility in search results.
    54 
    55 = What happens if I want to remove a single page from the cache? =
    56 Unlike simple "purge all" plugins, Static Porter gives you a persistent cache table. You can view a list of every cached URL and use individual "Delete" or "Recrawl" buttons for precise control without affecting the rest of your static site.
    57 
    58 = Can I choose which parts of my site to make static? =
    59 Yes. The dashboard allows you to toggle the crawling of Posts, Pages, Categories, and Tags independently. You can also use the "Excluded Paths" box to prevent specific directories from ever being turned into static files.
     37= Does this work with WooCommerce? =
     38It is recommended to exclude checkout, cart, and account pages using the "Excluded Paths" setting to ensure dynamic functionality remains intact.
    6039
    6140= How do I know if it's working? =
    6241Enable the "HTML Attribution" setting. View your website's source code, and you will see a comment at the top confirming the page is being served as static HTML.
    63 
    64 = Does this work with WooCommerce? =
    65 It is recommended to exclude checkout, cart, and account pages using the "Excluded Paths" setting to ensure dynamic functionality remains intact.
    6642
    6743== Screenshots ==
     
    7349== Upgrade Notice ==
    7450
     51= 3.5.4 =
     52This version introduces the new professional "Porter" branding, optimized UI, and a faster 5-second auto-refresh after crawling. Highly recommended for all users.
     53
     54== Changelog ==
     55
     56= 3.5.4 =
     57* **New Icon:** Updated plugin branding to a professional "Porter/Package" box icon.
     58* **UI Refresh:** Restored sidebar labels and updated dashboard header icons.
     59* **Timer Update:** Reduced post-crawl auto-refresh from 10 seconds to 5 seconds for a faster workflow.
     60
     61
    7562= 3.4.7 =
    7663This version adds a persistent cache management table and a manual "Stop Crawl" safety button. Highly recommended for all users.
     
    7865== Changelog ==
    7966
    80 = 3.5.2 =
     67= 3.4.7 =
    8168* Major fixes
    8269* Added Stop Crawl functionality.
  • static-porter/trunk/static-porter.php

    r3441902 r3442759  
    33 * Plugin Name: Static Porter
    44 * Description: High-performance static site generator with optional Gzip, Minification, Security Headers, and Cache-Control settings.
    5  * Version: 3.5.2
    6  * Author: kturgutoglu
     5 * Version: 3.5.4
     6 * Author: KAYIHAN TURGUTOGLU, KAYA TURK
    77 * License: GPLv2 or later
    88 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    1111
    1212// --- Configuration ---
    13 define('STATIC_PORTER_VERSION', '3.5.2');
     13define('STATIC_PORTER_VERSION', '3.5.4');
    1414
    1515// Use a function to get the cache directory to ensure wp_upload_dir is available
     
    3636if (!function_exists('static_porter_add_sidebar_menu')) {
    3737    function static_porter_add_sidebar_menu() {
    38         $icon_svg = 'data:image/svg+xml;base64,' . base64_encode('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"><path d="M10 2L8 5h4l-2-3zM8 6l-1 8h6l-1-8H8zm-1 9v1h6v-1H7zm-1 2v1h8v-1H6z"/></svg>');
     38        // Modern 3D Isometric Box (Porter Package)
     39        $icon_svg = 'data:image/svg+xml;base64,' . base64_encode('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"><path d="M11 2a1 1 0 011 1v1h3a1 1 0 011 1v12a1 1 0 01-1 1H5a1 1 0 01-1-1V5a1 1 0 011-1h3V3a1 1 0 011-1h2zM9 4v1h2V4H9zM8 6H6v10h8V6h-2v1a1 1 0 11-2 0V6z"/></svg>');
     40       
    3941        add_menu_page(
    40             'Static Porter',
    41             'Static Porter',
    42             'manage_options',
    43             'static-porter',
     42            'Static Porter',    // Page Title
     43            'Static Porter',    // Menu Label
     44            'manage_options',   // Permission
     45            'static-porter',    // Slug
    4446            'static_porter_dashboard',
    45             $icon_svg,
     47            $icon_svg,          // The Box Icon
    4648            3
    4749        );
     
    4951}
    5052
     53 
    5154// --- Assets & Scripts ---
    5255if (!function_exists('static_porter_enqueue_assets')) {
     
    6467            'nonce'   => wp_create_nonce('static_porter_nonce')
    6568        ];
    66         // Use wp_json_encode instead of json_encode
    6769        wp_add_inline_script('static-porter-admin-js', 'var spConfig = ' . wp_json_encode($script_vars) . ';');
    6870
    6971        $js_logic = "
    7072        jQuery(document).ready(function($) {
    71             let currentLiveCount = parseInt($('#sp-live-count').text()) || 0;
    7273            let stopCrawl = false;
    7374
     
    8990                        \$btn.text('Recrawl').css('color', '#2271b1').prop('disabled', false);
    9091                        \$row.find('.row-size').text('—');
    91                         currentLiveCount--;
    92                         $('#sp-live-count').text(currentLiveCount);
    9392                    });
    9493                } else {
     
    9897                            \$btn.text('Delete').css('color', '#d63638').prop('disabled', false);
    9998                            \$row.find('.row-size').text(res.data.size);
    100                             currentLiveCount++;
    101                             $('#sp-live-count').text(currentLiveCount);
    10299                        }
    103100                    });
     
    143140                                $('#sp-summary-text').text('Now your ' + processedSuccessfully + ' pages are being served as HTML. They will load way faster.');
    144141                                $('#sp-finish-area').fadeIn();
    145                                 let timeLeft = 10;
     142                                let timeLeft = 5;
    146143                                setInterval(() => {
    147144                                    timeLeft--;
     
    164161                                if(response.success) {
    165162                                    processedSuccessfully++;
    166                                     currentLiveCount++;
    167                                     $('#sp-live-count').text(currentLiveCount).fadeOut(100).fadeIn(100);
    168163                                    if ($('tr[data-url=\"'+url+'\"]').length > 0) {
    169164                                        const \$existingRow = $('tr[data-url=\"'+url+'\"]');
     
    314309        }
    315310       
    316         // 2. Attribution Branding (FIXED)
     311        // 2. Attribution Branding
    317312        if (get_option('static_porter_enable_attr', '1') === '1') {
    318313            $msg_template = get_option('static_porter_attr_msg');
    319             // If the message is empty in database, use this hard fallback string
    320314            if (empty($msg_template)) {
    321315                $msg_template = 'Verification: Page served as static HTML by Static Porter v{version} at {timestamp}';
    322316            }
    323317            $processed_msg = str_replace(['{version}', '{timestamp}'], [STATIC_PORTER_VERSION, current_time('mysql')], $msg_template);
    324            
    325             // Starts strictly at the first character, then newline for Line 2
    326             $attribution = "<!-- " . esc_html($processed_msg) . " -->\n";
    327     $html = $attribution . ltrim($html);
     318            $attribution = "\n";
     319            $html = $attribution . ltrim($html);
    328320        }
    329321
     
    406398        $cache_dir = static_porter_get_cache_dir();
    407399        if (isset($_POST['save_sp_settings'])) {
    408             check_admin_referer('static_porter_save_settings');
     400            if (!isset($_POST['_wpnonce']) || !wp_verify_nonce($_POST['_wpnonce'], 'static_porter_save_settings')) {
     401                wp_die('Security check failed. Please refresh the page and try again.');
     402            }
    409403            update_option('static_porter_excluded_paths', sanitize_textarea_field($_POST['excluded_paths']));
    410404            update_option('static_porter_enable_gzip', isset($_POST['static_porter_enable_gzip']) ? '1' : '0');
     
    422416            echo '<div class="updated"><p>Settings updated.</p></div>';
    423417        }
    424         if (isset($_POST['purge_sp_cache'])) { check_admin_referer('static_porter_purge_cache'); static_porter_clear_cache($cache_dir); delete_option('static_porter_last_crawl_time'); echo '<div class="updated"><p>Cache purged.</p></div>'; }
     418        if (isset($_POST['purge_sp_cache'])) {
     419            if (!isset($_POST['_wpnonce']) || !wp_verify_nonce($_POST['_wpnonce'], 'static_porter_save_settings')) {
     420                wp_die('Security check failed. Please refresh the page and try again.');
     421            }
     422            static_porter_clear_cache($cache_dir);
     423            delete_option('static_porter_last_crawl_time');
     424            echo '<div class="updated"><p>Cache purged.</p></div>';
     425        }
    425426       
    426427        $excluded = get_option('static_porter_excluded_paths', '');
     
    446447        $peak_mem = (int)get_option('static_porter_peak_memory_usage', 0);
    447448        $server_icon = (stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) ? 'Nginx' : ((stripos($_SERVER['SERVER_SOFTWARE'], 'litespeed') !== false) ? 'LiteSpeed' : 'Apache');
    448         global $wp_version; $avg_size = ($file_count > 0) ? $disk_usage / $file_count : 0;
    449         $os_info = php_uname('s') . ' ' . php_uname('r');
     449        $avg_size = ($file_count > 0) ? $disk_usage / $file_count : 0;
     450       
     451        // --- DATA PREP FOR CARDS ---
     452        $count_posts = wp_count_posts('post'); $published_posts = $count_posts->publish;
     453        $count_pages = wp_count_posts('page'); $published_pages = $count_pages->publish;
     454        $total_public = $published_posts + $published_pages;
     455        $coverage_pct = ($total_public > 0) ? round(($file_count / $total_public) * 100) : 0;
     456       
     457        $cards = [
     458            ['Static Coverage', $coverage_pct . '%', $file_count . ' of ' . $total_public . ' urls'],
     459            ['PHP & MySQL Requests Avoided', $file_count, 'Estimated'],
     460            ['Peak Memory', size_format($peak_mem, 2), 'Max usage during crawl'],
     461            ['Static Files Size', size_format($disk_usage), 'On disk']
     462        ];
    450463        ?>
    451464        <div class="wrap">
    452465            <div style="display: flex; align-items: center; gap: 15px; margin-top: 10px; margin-bottom: 20px;">
    453466                <div style="width: 50px; height: 50px; background: #2271b1; border-radius: 6px; display: flex; align-items: center; justify-content: center;">
    454                     <svg width="30" height="30" viewBox="0 0 20 20" fill="#fff" xmlns="http://www.w3.org/2000/svg"><path d="M10 2L8 5h4l-2-3zM8 6l-1 8h6l-1-8H8zm-1 9v1h6v-1H7zm-1 2v1h8v-1H6z"/></svg>
     467                    <svg width="30" height="30" viewBox="0 0 20 20" fill="#fff" xmlns="http://www.w3.org/2000/svg"><path d="M11 2a1 1 0 011 1v1h3a1 1 0 011 1v12a1 1 0 01-1 1H5a1 1 0 01-1-1V5a1 1 0 011-1h3V3a1 1 0 011-1h2zM8 6H6v10h8V6h-2v1a1 1 0 11-2 0V6zM9 4v1h2V4H9z"/></svg>
    455468                </div>
    456469                <h1 style="margin:0;">Static Porter <small style="font-size: 12px; opacity: 0.6;">v<?php echo esc_html(STATIC_PORTER_VERSION); ?></small></h1>
    457470            </div>
    458             <div style="display: grid; grid-template-columns: 1fr 320px; gap: 20px;">
     471
     472            <div style="display:flex; gap:16px; margin-bottom:20px; flex-wrap:wrap;">
     473            <?php foreach($cards as $c): ?>
     474                <div style="flex:1; min-width: 200px; background:#fff; border:1px solid #ccd0d4; border-radius:4px; padding:16px;">
     475                    <strong><?php echo esc_html($c[0]); ?></strong>
     476                    <div style="font-size:24px; margin:8px 0;"><?php echo esc_html($c[1]); ?></div>
     477                    <div style="font-size:12px; color:#666;"><?php echo esc_html($c[2]); ?></div>
     478                </div>
     479            <?php endforeach; ?>
     480            </div>
     481            <div>
    459482                <div class="sp-main">
    460                     <form method="post">
     483                    <form method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>">
    461484                    <?php wp_nonce_field('static_porter_save_settings'); ?>
    462485                    <div class="card">
     
    490513                            <button type="button" id="sp-start" class="button button-secondary" style="margin-left:10px;">Start Full Crawl</button>
    491514                            <button type="button" id="sp-stop" class="button" style="margin-left:10px; display:none; color: #d63638; border-color: #d63638;">Stop Crawl</button>
    492                         </div>
     515                            <input type="submit" name="purge_sp_cache" class="button" value="Purge Cache" style="margin-left:10px;" onclick="return confirm('Are you sure you want to clear all static files?');">
     516                        </div>
     517                       
    493518                        <div id="sp-progress" style="display:none; margin-top: 30px; padding: 20px; background: #f6f7f7; border: 1px solid #dcdcde;">
    494519                            <div style="display: flex; justify-content: space-between; margin-bottom: 10px;"><strong id="sp-label">Initialising...</strong><span id="sp-percent">0%</span></div>
     
    496521                            <p id="sp-status" style="font-family: monospace; font-size: 11px; color: #666;"></p>
    497522                            <div id="sp-finish-area" style="display:none; border-top: 1px solid #dcdcde; padding-top: 20px;">
    498                                 <h3>✅ Crawl Complete!</h3><p id="sp-summary-text"></p><p>Refreshing page in <span id="sp-timer">10</span> seconds...</p>
     523                                <h3>✅ Crawl Complete!</h3><p id="sp-summary-text"></p><p>Refreshing page in <span id="sp-timer">5</span> seconds...</p>
    499524                            </div>
    500525                        </div>
     
    507532                    </div>
    508533                    </form>
    509                     <form method="post" style="margin-top: 20px;"><?php wp_nonce_field('static_porter_purge_cache'); ?><input type="submit" name="purge_sp_cache" class="button" value="Purge Cache" style="margin-left:10px;"></form>
    510                 </div>
    511                 <div class="sp-sidebar">
    512                     <div class="card">
    513                         <h3>Status</h3>
    514                         <table class="widefat" style="border:0; font-size: 12px;">
    515                             <tr><td><strong>Cached Pages</strong></td><td style="text-align:right; font-size:22px; font-weight:800; color:#2271b1;" id="sp-live-count"><?php echo esc_html($file_count); ?></td></tr>
    516                             <tr><td><strong>Efficiency</strong></td><td style="text-align:right; color:#46b450;">-<?php echo esc_html($efficiency); ?>%</td></tr>
    517                             <tr><td><strong>Disk Usage</strong></td><td style="text-align:right;"><?php echo size_format($disk_usage, 2); ?></td></tr>
    518                             <tr><td><strong>Avg. Page Size</strong></td><td style="text-align:right;"><?php echo size_format($avg_size, 2); ?></td></tr>
    519                             <tr><td><strong>Peak Memory</strong></td><td style="text-align:right;"><?php echo size_format($peak_mem, 2); ?></td></tr>
    520                             <tr><td><strong>Cache Health</strong></td><td style="text-align:right;"><?php echo wp_kses_post($cache_writable); ?></td></tr>
    521                             <tr><td><strong>Server</strong></td><td style="text-align:right;"><?php echo esc_html($server_icon); ?></td></tr>
    522                         </table>
    523                     </div>
    524534                </div>
    525535            </div>
Note: See TracChangeset for help on using the changeset viewer.