Plugin Directory

Changeset 3450714


Ignore:
Timestamp:
01/30/2026 09:24:49 PM (5 weeks ago)
Author:
painlessanalytics
Message:

Update to version 1.1 from GitHub

Location:
frontpup
Files:
968 added
9 edited
1 copied

Legend:

Unmodified
Added
Removed
  • frontpup/tags/1.1/frontpup-admin.class.php

    r3435512 r3450714  
    55if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    66
     7require_once plugin_dir_path( __FILE__ ) . 'admin/cache-control.class.php';
     8require_once plugin_dir_path( __FILE__ ) . 'admin/clear-cache.class.php';
     9require_once plugin_dir_path( __FILE__ ) . 'admin/welcome.class.php';
     10
    711class FrontPup_Admin {
    812
    913    private static $instance = null;
    10     private $settings_key = 'frontpup_plugin_settings';
    11     private $settings = [];
     14    private $admin_views = [];
    1215
    1316    /**
     
    2528     */
    2629    private function __construct() {
    27         $this->settings = get_option( $this->settings_key, [] );
    28 
    29         add_action( 'admin_menu', [ $this, 'register_menu' ] );
    30         add_action( 'admin_init', [ $this, 'register_settings' ] );
     30        // Create the admin views and their controller classes
     31        $this->admin_views['welcome'] = new FrontPup_Admin_Welcome(); // __('Welcome', 'frontpup') );
     32        $this->admin_views['cache-control'] = new FrontPup_Admin_Cache_Control(); // __('Cache Control Settings', 'frontpup') );
     33        $this->admin_views['clear-cache'] = new FrontPup_Admin_Clear_Cache(); // __('Clear Cache Settings', 'frontpup') );
     34       
     35        // Admin hooks
     36        add_action( 'admin_menu', [$this, 'admin_menu'] );
     37        add_action( 'admin_init', [$this, 'admin_init'] );
     38        add_action( 'admin_bar_menu', [$this, 'admin_bar_menu'], 801 );
     39
     40        // Clear cache ajax action
     41        add_action( 'admin_enqueue_scripts', [$this, 'admin_enqueue_scripts'] );
     42        add_action( 'wp_ajax_frontpup_clear_cache_action', [$this, 'wp_ajax_frontpup_clear_cache_action']);
    3143    }
    3244
     
    3446     * Add top-level admin menu
    3547     */
    36     public function register_menu() {
    37 
    38         add_options_page(
    39             'FrontPup Settings',       // Page title
    40             'FrontPup',                      // Menu title
    41             'manage_options',                 // Capability required to access
    42             'frontpup-plugin',        // Menu slug
    43             [ $this, 'settings_page' ]  // Callback function to render the page content
     48    public function admin_menu() {
     49
     50        $icon_url = 'dashicons-cloud-upload';
     51        //$icon_url = plugin_dir_url( __FILE__ ) . 'images/frontpup-icon-16.png';
     52        //echo $icon_url;
     53
     54        add_menu_page(
     55            'Welcome',
     56            __('FrontPup', 'frontpup'),
     57            'manage_options',
     58            'frontpup-plugin', // menu slug
     59            [$this->admin_views['welcome'], 'view'],
     60            $icon_url
     61        );
     62
     63        add_submenu_page(
     64            'frontpup-plugin',
     65            __('Welcome', 'frontpup'),
     66            __('Welcome', 'frontpup'),
     67            'manage_options',
     68            'frontpup-plugin', // menu slug
     69            [$this->admin_views['welcome'], 'view']
     70        );
     71
     72        add_submenu_page(
     73            'frontpup-plugin',
     74            __('Cache Settings', 'frontpup'),
     75            __('Cache Settings', 'frontpup'),
     76            'manage_options',
     77            'frontpup-cache-settings', // menu slug
     78            [$this->admin_views['cache-control'], 'view']
     79        );
     80
     81        add_submenu_page(
     82            'frontpup-plugin',
     83            __('Clear Cache Settings', 'frontpup'),
     84            __('Clear Cache Settings', 'frontpup'),
     85            'manage_options',
     86            'frontpup-clear-cache', // menu slug
     87            [$this->admin_views['clear-cache'], 'view']
    4488        );
    4589    }
     
    4892     * Register plugin settings
    4993     */
    50     public function register_settings() {
    51 
    52         register_setting(
    53             'frontpup_plugin_settings_group',
    54             $this->settings_key,
    55             [ 'sanitize_callback' => [ $this, 'sanitize_settings' ] ]
    56         );
    57     }
    58  
    59     /**
    60      * Settings content HTML
    61      */
    62     public function settings_content( ) {
    63         // Set default values if not set
    64         $settings = $this->settings;
    65         if( !isset( $settings['custom_smaxage_enabled'] ) ) {
    66             $settings['custom_smaxage_enabled'] = 0; // Default value
    67         }
    68         if( !isset( $settings['smaxage'] ) ) {
    69             $settings['smaxage'] = 31536000; // Default value
    70         }
    71         if( !isset( $settings['maxage'] ) ) {
    72             $settings['maxage'] = 31536000; // Default value
    73         }
    74         if( !isset( $settings['cachecontrol'] ) ) {
    75             $settings['cachecontrol'] = 0; // Default value
    76         }
    77 ?>
    78 <p><?php echo esc_html(__('The caching settings control how your pages are cached by CloudFront.', 'frontpup')); ?></p>
    79 <p><?php echo esc_html(__('The following settings only apply to public pages.', 'frontpup')); ?></p>
    80 <p><?php echo esc_html(__('Enable the options below if your `Minimum TTL` cache policy setting in CloudFront is set to 0 seconds.', 'frontpup')); ?></p>
    81 <h2><?php echo esc_html(__('Page Caching Settings', 'frontpup')); ?></h2>
    82 <table class="form-table permalink-structure" role="presentation">
    83 <tbody>
    84 <tr>
    85     <th scope="row"><?php echo esc_html(__( 'Cache-Control', 'frontpup' )); ?></th>
    86     <td>
    87         <fieldset class="structure-selection">
    88             <legend class="screen-reader-text"><?php echo 'test'; ?></legend>
    89             <div class="row">
    90                 <input id="cachecontrol-input-none"
    91                     name="<?php echo esc_attr($this->settings_key); ?>[cachecontrol]" aria-describedby="cachecontrol-input-none-description"
    92                     type="radio" value="0"
    93                     <?php checked( $settings['cachecontrol'], 0 ); ?>
    94                 />
    95                 <div>
    96                     <label for="cachecontrol-input-none"><?php esc_html( 'None', 'frontpup' ); ?></label>
    97                     <p id="cachecontrol-input-none-description">
    98                         <?php echo esc_html(__( 'No Cache-Control header is added.', 'frontpup' )); ?>
    99                     </p>
    100                 </div>
    101             </div><!-- .row -->
    102 
    103             <legend class="screen-reader-text"><?php echo 'test'; ?></legend>
    104             <div class="row">
    105                 <input id="cachecontrol-input-nocache"
    106                     name="<?php echo esc_attr($this->settings_key); ?>[cachecontrol]" aria-describedby="cachecontrol-input-nocache-description"
    107                     type="radio" value="1"
    108                     <?php checked( $settings['cachecontrol'], 1 ); ?>
    109                 />
    110                 <div>
    111                     <label for="cachecontrol-input-nocache"><?php esc_html( 'No-cache', 'frontpup' ); ?></label>
    112                     <p id="cachecontrol-input-nocache-description">
    113                         <code><?php echo esc_html(__( 'Cache-Control: no-cache', 'frontpup' )); ?></code>
    114                     </p>
    115                     <p style="margin-top:10px;">
    116                         <?php echo esc_html(__( 'No-cache headers.', 'frontpup' )); ?>
    117                     </p>
    118                 </div>
    119             </div><!-- .row -->
    120 
    121             <legend class="screen-reader-text"><?php echo 'test'; ?></legend>
    122             <div class="row">
    123                 <input id="cachecontrol-input-browser"
    124                     name="<?php echo esc_attr($this->settings_key); ?>[cachecontrol]" aria-describedby="cachecontrol-input-browser-description"
    125                     type="radio" value="2"
    126                     <?php checked( $settings['cachecontrol'], 2 ); ?>
    127                    
    128                 />
    129                 <div>
    130                     <label for="cachecontrol-input-browser"><?php esc_html( 'Browser Cache Only', 'frontpup'  ); ?></label>
    131                     <p id="cachecontrol-input-browser-description">
    132                         <code><?php echo esc_html(__( 'Cache-Control: private, max-age=VALUE', 'frontpup' )); ?></code>
    133                     </p>
    134                     <p style="margin-top:10px;">
    135                         <?php echo esc_html(__( 'CloudFront will not cache content, only the browser..', 'frontpup' )); ?>
    136                     </p>
    137                 </div>
    138             </div><!-- .row -->
    139 
    140             <legend class="screen-reader-text"><?php echo 'test'; ?></legend>
    141             <div class="row">
    142                 <input id="cachecontrol-input-browser-cloudfront"
    143                     name="<?php echo esc_attr($this->settings_key); ?>[cachecontrol]" aria-describedby="cachecontrol-input-browser-cloudfront-description"
    144                     type="radio" value="3"
    145                     <?php checked( $settings['cachecontrol'], 3 ); ?>
    146                 />
    147                 <div>
    148                     <label for="cachecontrol-input-browser-cloudfront"><?php esc_html( 'Browser and CloudFront Cache', 'frontpup' ); ?></label>
    149                     <p id="cachecontrol-input-browser-cloudfront-description">
    150                         <code><?php echo esc_html(__( 'Cache-Control: public, max-age=VALUE', 'frontpup' )); ?></code>
    151                     </p>
    152                     <p style="margin-top:10px;">
    153                         <?php echo esc_html(__( 'CloudFront and browser caching headers are added.', 'frontpup' )); ?>
    154                     </p>
    155                 </div>
    156             </div><!-- .row -->
    157 </fieldset><!-- .structure-selection -->
    158     </td>
    159 </tr>
    160 </tbody>
    161 </table>
    162 
    163 <div id="frontpup-ttl-input-container">
    164 <table class="form-table permalink-structure" role="presentation">
    165 <tbody>
    166 <tr>
    167     <th scope="row"><?php echo esc_html(__( 'Max Age', 'frontpup' )); ?></th>
    168     <td>
    169         <p>
    170             <input name="<?php echo esc_attr($this->settings_key); ?>[maxage]" id="frontpup-maxage"
    171                 type="number" value="<?php echo esc_attr( $settings['maxage'] ); ?>"
    172                 min="0" max="31536000"
    173                 aria-describedby="permalink-custom" class="medium-text"
    174             />
    175         </p>
    176         <p>
    177             <?php echo esc_html(__( 'Specify the max age (in seconds) to cache content.', 'frontpup' )); ?>
    178         </p>
    179         <p id="frontpup-smaxage-checkbox">
    180         <label>
    181             <input
    182                 type="hidden"
    183                 name="<?php echo esc_attr($this->settings_key); ?>[custom_smaxage_enabled]"
    184                 value="0" />
    185             <input
    186                 type="checkbox"
    187                 name="<?php echo esc_attr($this->settings_key); ?>[custom_smaxage_enabled]"
    188                 value="1"
    189                 onclick="document.getElementById('frontpup-smaxage-input-container').style.display = this.checked ? '' : 'none';"
    190                 <?php checked( isset( $settings['custom_smaxage_enabled'] ) && $settings['custom_smaxage_enabled'] ); ?>
    191             />
    192             <?php echo esc_html(__( 'Set a specific max age for CloudFront caching.', 'frontpup' )); ?>
    193            
    194         </label>
    195         </p>
    196     </td>
    197 </tr>
    198 </tbody>
    199 </table>
    200 <div id="frontpup-smaxage-input-container" style="<?php echo ( isset( $settings['custom_smaxage_enabled'] ) && $settings['custom_smaxage_enabled'] ) ? '' : 'display:none;'; ?>">
    201 <table class="form-table" role="presentation">
    202 <tbody>
    203 <tr>
    204     <th scope="row"><?php echo esc_html(__( 'CloudFront Max Age', 'frontpup' )); ?></th>
    205     <td>
    206         <p>
    207             <input name="<?php echo esc_attr($this->settings_key); ?>[smaxage]" id="frontpup-smaxage"
    208                 type="number" value="<?php echo esc_attr( $settings['smaxage'] ); ?>"
    209                 min="0" max="31536000"
    210                 aria-describedby="permalink-custom" class="medium-text"
    211             />
    212         </p>
    213         <p>
    214             <?php echo esc_html(__( 'Specify the max age (in seconds) for CloudFront to cache content.', 'frontpup' )); ?>
    215         </p>
    216         <p>
    217             <?php echo esc_html(__( 'Adds s-maxage=VALUE to Cache-Control header.', 'frontpup' )); ?>
    218         </p>
    219     </td>
    220 </tr>
    221 </tbody>
    222 </table>
    223 </div><!-- end of frontpup-smaxage-input-container -->
    224 </div><!-- end of frontpup-ttl-input-container -->
    225 <?php
    226     }
    227 
    228     /**
    229      * Sanitize settings before saving
    230      */
    231     public function sanitize_settings( $input ) {
    232         $output = [];
    233 
    234         // boolean values
    235         foreach ( ['custom_smaxage_enabled'] as $field ) {
    236             $output[$field] = isset( $input[$field] ) ? boolval( $input[$field] ) : 0;
    237         }
    238 
    239         // Numeric values
    240         foreach ( ['maxage', 'smaxage', 'cachecontrol'] as $field ) {
    241             if ( isset( $input[$field] ) ) {
    242                 $output[$field] = intval( $input[$field] );
    243             } else {
    244                 $output[$field] = 0;
    245             }
    246         }
    247 
    248         return $output;
    249     }
    250 
    251     /**
    252      * Settings page HTML
    253      */
    254     public function settings_page() {
    255         ?>
    256         <div class="wrap">
    257             <h1><?php echo esc_html(__('FrontPup, your CloudFront companion', 'frontpup')); ?></h1>
    258 
    259             <form method="post" action="options.php">
    260                 <?php
    261                 settings_fields( 'frontpup_plugin_settings_group' );
    262                 do_settings_sections( 'frontpup-plugin' );
    263                 $this->settings_content();
    264                 submit_button();
    265                 ?>
    266             </form>
    267         </div>
    268         <?php
     94    public function admin_init() {
     95        // Set the page titles
     96        $this->admin_views['welcome']->set_page_title( __('Welcome to FrontPup', 'frontpup') );
     97        $this->admin_views['cache-control']->set_page_title( __('Cache Settings', 'frontpup') );
     98        $this->admin_views['clear-cache']->set_page_title( __('Clear Cache Settings', 'frontpup') );
     99
     100        // Register settings for each admin view
     101        foreach( $this->admin_views as $view ) {
     102            $view->register_settings();
     103        }
     104    }
     105
     106    /**
     107     * Add admin bar menu
     108     * Include a drop down menu in the admin bar for quick access
     109     */
     110    public function admin_bar_menu( $wp_admin_bar ) {
     111        if ( !current_user_can( 'manage_options' ) ) {
     112            return;
     113        }
     114
     115        // Return if the enable clear cache is not set
     116        $settings = get_option( 'frontpup_clear_cache', [] );
     117        if( empty($settings['clear_cache_enabled']) ) {
     118            return;
     119        }
     120
     121        $args = array(
     122            'id'    => 'frontpup_admin_menu',
     123            'title' => __('FrontPup', 'frontpup'),
     124            'href'  => '',
     125            'meta'  => array( 'class' => 'frontpup-admin-bar-menu' )
     126        );
     127        $wp_admin_bar->add_node( $args );
     128
     129        // Submenu: Cache Settings
     130        $url = admin_url( 'admin.php?action=frontpup_clear_cache' );
     131        $nonceUrl = wp_nonce_url( $url, 'frontpup_clear_cache', 'frontpup_clear_cache_nonce' );
     132        $args = array(
     133            'id'    => 'frontpup-clear-cache',
     134            'title' => __('Clear CloudFront Cache', 'frontpup'),
     135            'href'  => '#',
     136            'parent'=> 'frontpup_admin_menu',
     137        );
     138        $wp_admin_bar->add_node( $args );
     139    }
     140
     141    /**
     142     * Admin enqueue scripts
     143     */
     144    public function admin_enqueue_scripts( $hook ) {
     145
     146        // Determine if we have the clear cache enabled
     147        $settings = get_option( 'frontpup_clear_cache', [] );
     148        if( empty($settings['clear_cache_enabled']) ) {
     149            return;
     150        }
     151
     152        $translation_array = array(
     153            'dismiss' => __( 'Dismiss', 'frontpup' ),
     154            'ajax_url' => admin_url('admin-ajax.php'),
     155            'security_nonce' => wp_create_nonce('frontpup_clear_cache_nonce'),
     156        );
     157
     158        wp_enqueue_script( 'frontpup-clear-cache-script', plugin_dir_url( __FILE__ ) . 'admin/js/clear-cache.js', [], FRONTPUP_VERSION, true );
     159        wp_localize_script( 'frontpup-clear-cache-script', 'frontpupClearCache', $translation_array );
     160    }
     161
     162    /**
     163     * WP AJax action for clearing cache
     164     */
     165    public function wp_ajax_frontpup_clear_cache_action() {
     166
     167        $settings = get_option( 'frontpup_clear_cache', [] );
     168        if( empty($settings['clear_cache_enabled']) ) {
     169            wp_send_json_error( __( 'This option is not available.', 'frontpup' ) );
     170            return;
     171        }
     172       
     173        // Check user capabilities
     174        if ( !current_user_can( 'manage_options' ) ) {
     175            wp_send_json_error( __( 'You do not have sufficient permissions to access this action.', 'frontpup' ) );
     176            return;
     177        }
     178
     179        // Check nonce
     180        if( !check_ajax_referer( 'frontpup_clear_cache_nonce', 'nonce', false ) ) {
     181            wp_send_json_error( __( 'Invalid security token sent.', 'frontpup' ) );
     182            return;
     183        }
     184
     185        // Perform cache clearing
     186        $FrontPupObj = FrontPup::get_instance();
     187        $clearCacheObj = $FrontPupObj->get_clear_cache_instance();
     188        $result = $clearCacheObj->clear_cache();
     189
     190        if ( $result === false ) {
     191            $error_message = sprintf( '%s.', $clearCacheObj->get_last_error() == '' ? __( 'Unknown error occurred', 'frontpup' ) : $clearCacheObj->get_last_error() );
     192            wp_send_json_error( __( 'Error occurred while clearing cache: ', 'frontpup' ) . $error_message );
     193            return;
     194        } else {
     195            wp_send_json_success( __( 'CloudFront cache invalidation request completed successfully.', 'frontpup' ) );
     196        }
    269197    }
    270198}
    271199
    272200FrontPup_Admin::get_instance();
     201
     202// eof
  • frontpup/tags/1.1/frontpup.class.php

    r3435512 r3450714  
    122122        }
    123123    }
     124
     125    public function get_clear_cache_instance( $clearCacheSettings = [] ) {
     126        require_once plugin_dir_path( __FILE__ ) . 'clear-cache.class.php';
     127        if( empty($clearCacheSettings) ) {
     128            $clearCacheSettings = get_option( 'frontpup_clear_cache', [] ); // Clear cache settings
     129        }
     130       
     131        if( empty($clearCacheSettings) ) {
     132            return null;
     133        }
     134        return new FrontPup_Clear_Cache( $clearCacheSettings );
     135    }
    124136};
    125137
  • frontpup/tags/1.1/frontpup.php

    r3435512 r3450714  
    55 * @package           FrontPup
    66 * @author            Painless Analytics
    7  * @copyright         2025 Painless Analytics
     7 * @copyright         2026 Painless Analytics
    88 * @license           GPL-2.0-or-later
    99 *
     
    1111 * Plugin Name:       FrontPup
    1212 * Plugin URI:        https://www.painlessanalytics.com/frontpup-cloudfront-wordpress-plugin/
    13  * Description:       FrontPup, your CloudFront companion - optimize your CloudFront distribution for your WordPress website.
    14  * Version:           1.0
    15  * Requires at least: 5.5
     13 * Description:       FrontPup, your CloudFront companion - Clear cache and optimize your CloudFront distribution for your WordPress website.
     14 * Version:           1.1
     15 * Requires at least: 6.0
    1616 * Tested up to:      6.9
    17  * Requires PHP:      7.0
     17 * Requires PHP:      8.1
    1818 * Author:            Painless Analytics
    1919 * Author URI:        https://www.painlessanalytics.com
     
    2626
    2727define('FRONTPUP_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
     28if( !defined('FRONTPUP_VERSION') ) {
     29    define('FRONTPUP_VERSION', '1.1');
     30}
     31if( !defined('FRONTPUP_REGION') ) {
     32    define('FRONTPUP_REGION', 'us-east-1'); // Default region
     33}
    2834
    2935if( !class_exists('FrontPup') ) {
  • frontpup/tags/1.1/readme.txt

    r3435512 r3450714  
    11=== FrontPup ===
    2 Contributors: painlessanalytics, angelomandato
     2Contributors: painlessanalytics, amandato
    33Donate link: https://www.painlessanalytics.com/frontpup-cloudfront-wordpress-plugin/
    44Tags: cloudfront, aws, cdn, amazon, lightsail
    5 Requires at least: 5.5
     5Requires at least: 6.0
    66Tested up to: 6.9
    7 Stable tag: 1.0
    8 Requires PHP: 7.0
     7Stable tag: 1.1
     8Requires PHP: 8.1
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1111
    12 Your CloudFront companion.
     12Your AWS CloudFront companion. Clear cache and optimize your CloudFront distribution for your WordPress website
    1313
    1414== Description ==
    1515
    16 FrontPup allows you to maximize the settings available between the CloudFront Origin and your WordPress site.
     16Welcome to FrontPup, your CloudFront companion.
    1717
    18 Features include:
     18FrontPup allows you to maximize your WordPress website using the AWS CloudFront Content Delivery Network (CDN).
    1919
     20== REQUIREMENTS ==
     21
     22You __must__ be using the Amazon Web Services (AWS) [CloudFront](https://aws.amazon.com/cloudfront/) service to utilize this plugin.
     23
     24== FrontPup Features ==
     25
     26* Clear CloudFront Cache (creates an Invalidation request)
    2027* Set no-cache headers for all pages (great for development or testing)
    21 * Set public Cache-Control headers for CloudFront and Browsers
    22 * Set private Cache-Control headers for Browsers only
    23 * Set separate max-age and s-maxage values
     28* Set public and private Cache-Control headers for caching in CloudFront and Browsers
     29* Set separate max-age (browser) and s-maxage (CloudFront) cache duration values
     30
     31== Turbocharge your WordPress Website with CloudFront ==
     32Using Amazon CloudFront in front of your WordPress website offers significant benefits by improving performance, security, and scalability. CloudFront is a Delivery Network (CDN) with over 750+ Points of Presence (PoPs) around the world plus over 1,100 PoPs within ISP networks. This highly optimized network makes it _extremely efficient_ at delivering your website to your visitors anywhere around the world. "PoP" locations are designed to reduce latency by caching content closer to your site's visitors.
     33
     34**Performance**
     35
     36* **Faster Loading Times**, static content (pages, images, CSS, JavaScript) is cached at "edge locations" around the world
     37* **Improved User Experience**, Faster load times lead to higher user engagement, reduced bounce rates, and improved search engine optimization (SEO) rankings
     38* **Reduced Server Load**, by serving cached content from edge locations, CloudFront minimizes requests to your WordPress website
     39
     40When your website is optimized for performance your [PageSpeed Lighthouse scores](https://pagespeed.web.dev/) should improve.
     41
     42**Enhanced Security**
     43
     44* **DDoS Protection**, includes AWS Shield Standard
     45* **SSL/TLS Security**, force https only and includes free SSL Certificates
     46* **AWS WAF**, a Web Application Firewall with a depth of options including specific WordPress protections (may incur additional costs)
     47
     48You should achieve a grade of "A" on [Qualys SSL Server Test](https://www.ssllabs.com/ssltest/) when CloudFront is configured with the recommended TLSv1.2_2021 or newer security policy.
     49
     50**Scalability and Reliability**
     51
     52* **Global Reach** with over 750 PoPs plus over 1,100 PoPs within ISP networks
     53* **High Availability**, can serve cached content when site is down
     54* **Cost Efficiency**, can be cost-effective, especially for websites with high traffic with the new [CloudFront flat-rate pricing plans](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/flat-rate-pricing-plan.html)
     55
     56**Technology**
     57
     58* **IPv6**, a superior protocol to IPv4 and in some regions of the world is the only protocol that is available
     59* **HTTP/2 and HTTP/3** improve web performance through faster loading speeds, enhanced security, and better resource handling
     60* **Gzip and Brotli compression**, smaller file sizes improve application performance by delivering your content faster to visitors
     61* **Multi-Proxy**, route specific path patterns to other web applications easily by adding additional "Origins", allowing you to host more than just WordPress with the same hostname
     62
     63Learn more about [AWS CloudFront](https://aws.amazon.com/cloudfront/).
     64
     65== Developed by an AWS Community Builder ==
     66FrontPup is developed and maintained by [Angelo Mandato](https://angelo.mandato.com), an [AWS Community Builder](https://builder.aws.com/community/@angelomandato). Angelo has been developing WordPress plugins and themes since 2005 and has been architecting applications including WordPress hosted on Amazon Web Services since 2007.
     67
     68== Installation ==
     69
     70= Installation from within WordPress =
     71
     721. Visit **Plugins > Add New**.
     732. Search for **FrontPup**.
     743. Install and activate the FrontPup plugin.
     75
     76= Manual installation =
     77
     781. Upload the entire `frontpup` folder to the `/wp-content/plugins/` directory.
     792. Visit **Plugins**.
     803. Activate the FrontPup plugin.
     81
     82= After activation =
     83
     841. Visit the new **FrontPup** menu.
     852. Enable the options you would like to use.
     86
     87If you configure Clear Cache Settings, you can now use the FrontPup admin bar menu option to quickly clear the cache. This action uses AJAX and will perform the action without leaving the page or disrupting your work.
    2488
    2589== Frequently Asked Questions ==
     
    2791= Do I need an AWS CloudFront to use this plugin? =
    2892
    29 Yes, you need an AWS account with CloudFront setup for your website.
     93Yes, you need an AWS account with [CloudFront](https://aws.amazon.com/cloudfront/) setup for your website.
     94
     95= Do I need to host my WordPress site on AWS? =
     96
     97No, but CloudFront is most effective when used within the AWS network.
     98
     99= What is the best way to host a WordPress website on AWS? =
     100
     101There are many ways to host a WordPress website on AWS. Here is quick list.
     102
     103* Lightsail - A CPanel like approach to setting up a WordPress website with only a few clicks
     104* EC2 Instance(s) - Run your own server(s) to host your WordPress website
     105* ECS Tasks - Run Docker containers using the AWS Elastic Container Service
     106* EKS - Run WordPress on AWS Elastic Kubernetes Service
     107
     108There are thousands of formulas online that explain how to host WordPress on AWS. The method you pick comes down to the architecture you want to use and how much complexity you want with managing your website.
    30109
    31110== Screenshots ==
    32111
    33 1. Settings screenshot
     1121. Welcome to FrontPup with CloudFront
     1132. Welcome screen without CloudFront
     1143. Page Cache-Control settings
     1154. Clear cache settings
     1165. Clear CloudFront cache from WordPress admin bar
    34117
    35118== Changelog ==
    36119
     120The FrontPup plugin is maintained on GitHub [https://github.com/painlessanalytics/frontpup](https://github.com/painlessanalytics/frontpup). Code contributions are welcome.
     121
     122Changelog
     123
     124= 1.1 =
     125
     126Released: 2026-01-30
     127
     128Clear cache functionality added.
     129
     130* Added welcome page for the wp-admin
     131* Added clear cache settings page
     132* Reorganized admin class, new base class for future settings pages
     133* Moved views to subfolder of admin folder
     134* Added FrontPup admin bar menu bar option with "Clear CloudFront Cache" in sub menu (Made it a sub menu so you have to click twice to avoid accidental cache clearing)
     135* Ajax code for clearing cache created. For now only users who can manage settings can clear the cache (to be customizable in future versions)
     136
    37137= 1.0 =
     138
     139Released: 2026-01-08
     140
    38141* First version of this plugin
     142
     143The entire changelog is available on GitHub: [https://github.com/painlessanalytics/frontpup/blob/main/CHANGELOG.md](https://github.com/painlessanalytics/frontpup/blob/main/CHANGELOG.md)
    39144
    40145== Upgrade Notice ==
  • frontpup/trunk/frontpup-admin.class.php

    r3435512 r3450714  
    55if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    66
     7require_once plugin_dir_path( __FILE__ ) . 'admin/cache-control.class.php';
     8require_once plugin_dir_path( __FILE__ ) . 'admin/clear-cache.class.php';
     9require_once plugin_dir_path( __FILE__ ) . 'admin/welcome.class.php';
     10
    711class FrontPup_Admin {
    812
    913    private static $instance = null;
    10     private $settings_key = 'frontpup_plugin_settings';
    11     private $settings = [];
     14    private $admin_views = [];
    1215
    1316    /**
     
    2528     */
    2629    private function __construct() {
    27         $this->settings = get_option( $this->settings_key, [] );
    28 
    29         add_action( 'admin_menu', [ $this, 'register_menu' ] );
    30         add_action( 'admin_init', [ $this, 'register_settings' ] );
     30        // Create the admin views and their controller classes
     31        $this->admin_views['welcome'] = new FrontPup_Admin_Welcome(); // __('Welcome', 'frontpup') );
     32        $this->admin_views['cache-control'] = new FrontPup_Admin_Cache_Control(); // __('Cache Control Settings', 'frontpup') );
     33        $this->admin_views['clear-cache'] = new FrontPup_Admin_Clear_Cache(); // __('Clear Cache Settings', 'frontpup') );
     34       
     35        // Admin hooks
     36        add_action( 'admin_menu', [$this, 'admin_menu'] );
     37        add_action( 'admin_init', [$this, 'admin_init'] );
     38        add_action( 'admin_bar_menu', [$this, 'admin_bar_menu'], 801 );
     39
     40        // Clear cache ajax action
     41        add_action( 'admin_enqueue_scripts', [$this, 'admin_enqueue_scripts'] );
     42        add_action( 'wp_ajax_frontpup_clear_cache_action', [$this, 'wp_ajax_frontpup_clear_cache_action']);
    3143    }
    3244
     
    3446     * Add top-level admin menu
    3547     */
    36     public function register_menu() {
    37 
    38         add_options_page(
    39             'FrontPup Settings',       // Page title
    40             'FrontPup',                      // Menu title
    41             'manage_options',                 // Capability required to access
    42             'frontpup-plugin',        // Menu slug
    43             [ $this, 'settings_page' ]  // Callback function to render the page content
     48    public function admin_menu() {
     49
     50        $icon_url = 'dashicons-cloud-upload';
     51        //$icon_url = plugin_dir_url( __FILE__ ) . 'images/frontpup-icon-16.png';
     52        //echo $icon_url;
     53
     54        add_menu_page(
     55            'Welcome',
     56            __('FrontPup', 'frontpup'),
     57            'manage_options',
     58            'frontpup-plugin', // menu slug
     59            [$this->admin_views['welcome'], 'view'],
     60            $icon_url
     61        );
     62
     63        add_submenu_page(
     64            'frontpup-plugin',
     65            __('Welcome', 'frontpup'),
     66            __('Welcome', 'frontpup'),
     67            'manage_options',
     68            'frontpup-plugin', // menu slug
     69            [$this->admin_views['welcome'], 'view']
     70        );
     71
     72        add_submenu_page(
     73            'frontpup-plugin',
     74            __('Cache Settings', 'frontpup'),
     75            __('Cache Settings', 'frontpup'),
     76            'manage_options',
     77            'frontpup-cache-settings', // menu slug
     78            [$this->admin_views['cache-control'], 'view']
     79        );
     80
     81        add_submenu_page(
     82            'frontpup-plugin',
     83            __('Clear Cache Settings', 'frontpup'),
     84            __('Clear Cache Settings', 'frontpup'),
     85            'manage_options',
     86            'frontpup-clear-cache', // menu slug
     87            [$this->admin_views['clear-cache'], 'view']
    4488        );
    4589    }
     
    4892     * Register plugin settings
    4993     */
    50     public function register_settings() {
    51 
    52         register_setting(
    53             'frontpup_plugin_settings_group',
    54             $this->settings_key,
    55             [ 'sanitize_callback' => [ $this, 'sanitize_settings' ] ]
    56         );
    57     }
    58  
    59     /**
    60      * Settings content HTML
    61      */
    62     public function settings_content( ) {
    63         // Set default values if not set
    64         $settings = $this->settings;
    65         if( !isset( $settings['custom_smaxage_enabled'] ) ) {
    66             $settings['custom_smaxage_enabled'] = 0; // Default value
    67         }
    68         if( !isset( $settings['smaxage'] ) ) {
    69             $settings['smaxage'] = 31536000; // Default value
    70         }
    71         if( !isset( $settings['maxage'] ) ) {
    72             $settings['maxage'] = 31536000; // Default value
    73         }
    74         if( !isset( $settings['cachecontrol'] ) ) {
    75             $settings['cachecontrol'] = 0; // Default value
    76         }
    77 ?>
    78 <p><?php echo esc_html(__('The caching settings control how your pages are cached by CloudFront.', 'frontpup')); ?></p>
    79 <p><?php echo esc_html(__('The following settings only apply to public pages.', 'frontpup')); ?></p>
    80 <p><?php echo esc_html(__('Enable the options below if your `Minimum TTL` cache policy setting in CloudFront is set to 0 seconds.', 'frontpup')); ?></p>
    81 <h2><?php echo esc_html(__('Page Caching Settings', 'frontpup')); ?></h2>
    82 <table class="form-table permalink-structure" role="presentation">
    83 <tbody>
    84 <tr>
    85     <th scope="row"><?php echo esc_html(__( 'Cache-Control', 'frontpup' )); ?></th>
    86     <td>
    87         <fieldset class="structure-selection">
    88             <legend class="screen-reader-text"><?php echo 'test'; ?></legend>
    89             <div class="row">
    90                 <input id="cachecontrol-input-none"
    91                     name="<?php echo esc_attr($this->settings_key); ?>[cachecontrol]" aria-describedby="cachecontrol-input-none-description"
    92                     type="radio" value="0"
    93                     <?php checked( $settings['cachecontrol'], 0 ); ?>
    94                 />
    95                 <div>
    96                     <label for="cachecontrol-input-none"><?php esc_html( 'None', 'frontpup' ); ?></label>
    97                     <p id="cachecontrol-input-none-description">
    98                         <?php echo esc_html(__( 'No Cache-Control header is added.', 'frontpup' )); ?>
    99                     </p>
    100                 </div>
    101             </div><!-- .row -->
    102 
    103             <legend class="screen-reader-text"><?php echo 'test'; ?></legend>
    104             <div class="row">
    105                 <input id="cachecontrol-input-nocache"
    106                     name="<?php echo esc_attr($this->settings_key); ?>[cachecontrol]" aria-describedby="cachecontrol-input-nocache-description"
    107                     type="radio" value="1"
    108                     <?php checked( $settings['cachecontrol'], 1 ); ?>
    109                 />
    110                 <div>
    111                     <label for="cachecontrol-input-nocache"><?php esc_html( 'No-cache', 'frontpup' ); ?></label>
    112                     <p id="cachecontrol-input-nocache-description">
    113                         <code><?php echo esc_html(__( 'Cache-Control: no-cache', 'frontpup' )); ?></code>
    114                     </p>
    115                     <p style="margin-top:10px;">
    116                         <?php echo esc_html(__( 'No-cache headers.', 'frontpup' )); ?>
    117                     </p>
    118                 </div>
    119             </div><!-- .row -->
    120 
    121             <legend class="screen-reader-text"><?php echo 'test'; ?></legend>
    122             <div class="row">
    123                 <input id="cachecontrol-input-browser"
    124                     name="<?php echo esc_attr($this->settings_key); ?>[cachecontrol]" aria-describedby="cachecontrol-input-browser-description"
    125                     type="radio" value="2"
    126                     <?php checked( $settings['cachecontrol'], 2 ); ?>
    127                    
    128                 />
    129                 <div>
    130                     <label for="cachecontrol-input-browser"><?php esc_html( 'Browser Cache Only', 'frontpup'  ); ?></label>
    131                     <p id="cachecontrol-input-browser-description">
    132                         <code><?php echo esc_html(__( 'Cache-Control: private, max-age=VALUE', 'frontpup' )); ?></code>
    133                     </p>
    134                     <p style="margin-top:10px;">
    135                         <?php echo esc_html(__( 'CloudFront will not cache content, only the browser..', 'frontpup' )); ?>
    136                     </p>
    137                 </div>
    138             </div><!-- .row -->
    139 
    140             <legend class="screen-reader-text"><?php echo 'test'; ?></legend>
    141             <div class="row">
    142                 <input id="cachecontrol-input-browser-cloudfront"
    143                     name="<?php echo esc_attr($this->settings_key); ?>[cachecontrol]" aria-describedby="cachecontrol-input-browser-cloudfront-description"
    144                     type="radio" value="3"
    145                     <?php checked( $settings['cachecontrol'], 3 ); ?>
    146                 />
    147                 <div>
    148                     <label for="cachecontrol-input-browser-cloudfront"><?php esc_html( 'Browser and CloudFront Cache', 'frontpup' ); ?></label>
    149                     <p id="cachecontrol-input-browser-cloudfront-description">
    150                         <code><?php echo esc_html(__( 'Cache-Control: public, max-age=VALUE', 'frontpup' )); ?></code>
    151                     </p>
    152                     <p style="margin-top:10px;">
    153                         <?php echo esc_html(__( 'CloudFront and browser caching headers are added.', 'frontpup' )); ?>
    154                     </p>
    155                 </div>
    156             </div><!-- .row -->
    157 </fieldset><!-- .structure-selection -->
    158     </td>
    159 </tr>
    160 </tbody>
    161 </table>
    162 
    163 <div id="frontpup-ttl-input-container">
    164 <table class="form-table permalink-structure" role="presentation">
    165 <tbody>
    166 <tr>
    167     <th scope="row"><?php echo esc_html(__( 'Max Age', 'frontpup' )); ?></th>
    168     <td>
    169         <p>
    170             <input name="<?php echo esc_attr($this->settings_key); ?>[maxage]" id="frontpup-maxage"
    171                 type="number" value="<?php echo esc_attr( $settings['maxage'] ); ?>"
    172                 min="0" max="31536000"
    173                 aria-describedby="permalink-custom" class="medium-text"
    174             />
    175         </p>
    176         <p>
    177             <?php echo esc_html(__( 'Specify the max age (in seconds) to cache content.', 'frontpup' )); ?>
    178         </p>
    179         <p id="frontpup-smaxage-checkbox">
    180         <label>
    181             <input
    182                 type="hidden"
    183                 name="<?php echo esc_attr($this->settings_key); ?>[custom_smaxage_enabled]"
    184                 value="0" />
    185             <input
    186                 type="checkbox"
    187                 name="<?php echo esc_attr($this->settings_key); ?>[custom_smaxage_enabled]"
    188                 value="1"
    189                 onclick="document.getElementById('frontpup-smaxage-input-container').style.display = this.checked ? '' : 'none';"
    190                 <?php checked( isset( $settings['custom_smaxage_enabled'] ) && $settings['custom_smaxage_enabled'] ); ?>
    191             />
    192             <?php echo esc_html(__( 'Set a specific max age for CloudFront caching.', 'frontpup' )); ?>
    193            
    194         </label>
    195         </p>
    196     </td>
    197 </tr>
    198 </tbody>
    199 </table>
    200 <div id="frontpup-smaxage-input-container" style="<?php echo ( isset( $settings['custom_smaxage_enabled'] ) && $settings['custom_smaxage_enabled'] ) ? '' : 'display:none;'; ?>">
    201 <table class="form-table" role="presentation">
    202 <tbody>
    203 <tr>
    204     <th scope="row"><?php echo esc_html(__( 'CloudFront Max Age', 'frontpup' )); ?></th>
    205     <td>
    206         <p>
    207             <input name="<?php echo esc_attr($this->settings_key); ?>[smaxage]" id="frontpup-smaxage"
    208                 type="number" value="<?php echo esc_attr( $settings['smaxage'] ); ?>"
    209                 min="0" max="31536000"
    210                 aria-describedby="permalink-custom" class="medium-text"
    211             />
    212         </p>
    213         <p>
    214             <?php echo esc_html(__( 'Specify the max age (in seconds) for CloudFront to cache content.', 'frontpup' )); ?>
    215         </p>
    216         <p>
    217             <?php echo esc_html(__( 'Adds s-maxage=VALUE to Cache-Control header.', 'frontpup' )); ?>
    218         </p>
    219     </td>
    220 </tr>
    221 </tbody>
    222 </table>
    223 </div><!-- end of frontpup-smaxage-input-container -->
    224 </div><!-- end of frontpup-ttl-input-container -->
    225 <?php
    226     }
    227 
    228     /**
    229      * Sanitize settings before saving
    230      */
    231     public function sanitize_settings( $input ) {
    232         $output = [];
    233 
    234         // boolean values
    235         foreach ( ['custom_smaxage_enabled'] as $field ) {
    236             $output[$field] = isset( $input[$field] ) ? boolval( $input[$field] ) : 0;
    237         }
    238 
    239         // Numeric values
    240         foreach ( ['maxage', 'smaxage', 'cachecontrol'] as $field ) {
    241             if ( isset( $input[$field] ) ) {
    242                 $output[$field] = intval( $input[$field] );
    243             } else {
    244                 $output[$field] = 0;
    245             }
    246         }
    247 
    248         return $output;
    249     }
    250 
    251     /**
    252      * Settings page HTML
    253      */
    254     public function settings_page() {
    255         ?>
    256         <div class="wrap">
    257             <h1><?php echo esc_html(__('FrontPup, your CloudFront companion', 'frontpup')); ?></h1>
    258 
    259             <form method="post" action="options.php">
    260                 <?php
    261                 settings_fields( 'frontpup_plugin_settings_group' );
    262                 do_settings_sections( 'frontpup-plugin' );
    263                 $this->settings_content();
    264                 submit_button();
    265                 ?>
    266             </form>
    267         </div>
    268         <?php
     94    public function admin_init() {
     95        // Set the page titles
     96        $this->admin_views['welcome']->set_page_title( __('Welcome to FrontPup', 'frontpup') );
     97        $this->admin_views['cache-control']->set_page_title( __('Cache Settings', 'frontpup') );
     98        $this->admin_views['clear-cache']->set_page_title( __('Clear Cache Settings', 'frontpup') );
     99
     100        // Register settings for each admin view
     101        foreach( $this->admin_views as $view ) {
     102            $view->register_settings();
     103        }
     104    }
     105
     106    /**
     107     * Add admin bar menu
     108     * Include a drop down menu in the admin bar for quick access
     109     */
     110    public function admin_bar_menu( $wp_admin_bar ) {
     111        if ( !current_user_can( 'manage_options' ) ) {
     112            return;
     113        }
     114
     115        // Return if the enable clear cache is not set
     116        $settings = get_option( 'frontpup_clear_cache', [] );
     117        if( empty($settings['clear_cache_enabled']) ) {
     118            return;
     119        }
     120
     121        $args = array(
     122            'id'    => 'frontpup_admin_menu',
     123            'title' => __('FrontPup', 'frontpup'),
     124            'href'  => '',
     125            'meta'  => array( 'class' => 'frontpup-admin-bar-menu' )
     126        );
     127        $wp_admin_bar->add_node( $args );
     128
     129        // Submenu: Cache Settings
     130        $url = admin_url( 'admin.php?action=frontpup_clear_cache' );
     131        $nonceUrl = wp_nonce_url( $url, 'frontpup_clear_cache', 'frontpup_clear_cache_nonce' );
     132        $args = array(
     133            'id'    => 'frontpup-clear-cache',
     134            'title' => __('Clear CloudFront Cache', 'frontpup'),
     135            'href'  => '#',
     136            'parent'=> 'frontpup_admin_menu',
     137        );
     138        $wp_admin_bar->add_node( $args );
     139    }
     140
     141    /**
     142     * Admin enqueue scripts
     143     */
     144    public function admin_enqueue_scripts( $hook ) {
     145
     146        // Determine if we have the clear cache enabled
     147        $settings = get_option( 'frontpup_clear_cache', [] );
     148        if( empty($settings['clear_cache_enabled']) ) {
     149            return;
     150        }
     151
     152        $translation_array = array(
     153            'dismiss' => __( 'Dismiss', 'frontpup' ),
     154            'ajax_url' => admin_url('admin-ajax.php'),
     155            'security_nonce' => wp_create_nonce('frontpup_clear_cache_nonce'),
     156        );
     157
     158        wp_enqueue_script( 'frontpup-clear-cache-script', plugin_dir_url( __FILE__ ) . 'admin/js/clear-cache.js', [], FRONTPUP_VERSION, true );
     159        wp_localize_script( 'frontpup-clear-cache-script', 'frontpupClearCache', $translation_array );
     160    }
     161
     162    /**
     163     * WP AJax action for clearing cache
     164     */
     165    public function wp_ajax_frontpup_clear_cache_action() {
     166
     167        $settings = get_option( 'frontpup_clear_cache', [] );
     168        if( empty($settings['clear_cache_enabled']) ) {
     169            wp_send_json_error( __( 'This option is not available.', 'frontpup' ) );
     170            return;
     171        }
     172       
     173        // Check user capabilities
     174        if ( !current_user_can( 'manage_options' ) ) {
     175            wp_send_json_error( __( 'You do not have sufficient permissions to access this action.', 'frontpup' ) );
     176            return;
     177        }
     178
     179        // Check nonce
     180        if( !check_ajax_referer( 'frontpup_clear_cache_nonce', 'nonce', false ) ) {
     181            wp_send_json_error( __( 'Invalid security token sent.', 'frontpup' ) );
     182            return;
     183        }
     184
     185        // Perform cache clearing
     186        $FrontPupObj = FrontPup::get_instance();
     187        $clearCacheObj = $FrontPupObj->get_clear_cache_instance();
     188        $result = $clearCacheObj->clear_cache();
     189
     190        if ( $result === false ) {
     191            $error_message = sprintf( '%s.', $clearCacheObj->get_last_error() == '' ? __( 'Unknown error occurred', 'frontpup' ) : $clearCacheObj->get_last_error() );
     192            wp_send_json_error( __( 'Error occurred while clearing cache: ', 'frontpup' ) . $error_message );
     193            return;
     194        } else {
     195            wp_send_json_success( __( 'CloudFront cache invalidation request completed successfully.', 'frontpup' ) );
     196        }
    269197    }
    270198}
    271199
    272200FrontPup_Admin::get_instance();
     201
     202// eof
  • frontpup/trunk/frontpup.class.php

    r3435512 r3450714  
    122122        }
    123123    }
     124
     125    public function get_clear_cache_instance( $clearCacheSettings = [] ) {
     126        require_once plugin_dir_path( __FILE__ ) . 'clear-cache.class.php';
     127        if( empty($clearCacheSettings) ) {
     128            $clearCacheSettings = get_option( 'frontpup_clear_cache', [] ); // Clear cache settings
     129        }
     130       
     131        if( empty($clearCacheSettings) ) {
     132            return null;
     133        }
     134        return new FrontPup_Clear_Cache( $clearCacheSettings );
     135    }
    124136};
    125137
  • frontpup/trunk/frontpup.php

    r3435512 r3450714  
    55 * @package           FrontPup
    66 * @author            Painless Analytics
    7  * @copyright         2025 Painless Analytics
     7 * @copyright         2026 Painless Analytics
    88 * @license           GPL-2.0-or-later
    99 *
     
    1111 * Plugin Name:       FrontPup
    1212 * Plugin URI:        https://www.painlessanalytics.com/frontpup-cloudfront-wordpress-plugin/
    13  * Description:       FrontPup, your CloudFront companion - optimize your CloudFront distribution for your WordPress website.
    14  * Version:           1.0
    15  * Requires at least: 5.5
     13 * Description:       FrontPup, your CloudFront companion - Clear cache and optimize your CloudFront distribution for your WordPress website.
     14 * Version:           1.1
     15 * Requires at least: 6.0
    1616 * Tested up to:      6.9
    17  * Requires PHP:      7.0
     17 * Requires PHP:      8.1
    1818 * Author:            Painless Analytics
    1919 * Author URI:        https://www.painlessanalytics.com
     
    2626
    2727define('FRONTPUP_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
     28if( !defined('FRONTPUP_VERSION') ) {
     29    define('FRONTPUP_VERSION', '1.1');
     30}
     31if( !defined('FRONTPUP_REGION') ) {
     32    define('FRONTPUP_REGION', 'us-east-1'); // Default region
     33}
    2834
    2935if( !class_exists('FrontPup') ) {
  • frontpup/trunk/readme.txt

    r3435512 r3450714  
    11=== FrontPup ===
    2 Contributors: painlessanalytics, angelomandato
     2Contributors: painlessanalytics, amandato
    33Donate link: https://www.painlessanalytics.com/frontpup-cloudfront-wordpress-plugin/
    44Tags: cloudfront, aws, cdn, amazon, lightsail
    5 Requires at least: 5.5
     5Requires at least: 6.0
    66Tested up to: 6.9
    7 Stable tag: 1.0
    8 Requires PHP: 7.0
     7Stable tag: 1.1
     8Requires PHP: 8.1
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1111
    12 Your CloudFront companion.
     12Your AWS CloudFront companion. Clear cache and optimize your CloudFront distribution for your WordPress website
    1313
    1414== Description ==
    1515
    16 FrontPup allows you to maximize the settings available between the CloudFront Origin and your WordPress site.
     16Welcome to FrontPup, your CloudFront companion.
    1717
    18 Features include:
     18FrontPup allows you to maximize your WordPress website using the AWS CloudFront Content Delivery Network (CDN).
    1919
     20== REQUIREMENTS ==
     21
     22You __must__ be using the Amazon Web Services (AWS) [CloudFront](https://aws.amazon.com/cloudfront/) service to utilize this plugin.
     23
     24== FrontPup Features ==
     25
     26* Clear CloudFront Cache (creates an Invalidation request)
    2027* Set no-cache headers for all pages (great for development or testing)
    21 * Set public Cache-Control headers for CloudFront and Browsers
    22 * Set private Cache-Control headers for Browsers only
    23 * Set separate max-age and s-maxage values
     28* Set public and private Cache-Control headers for caching in CloudFront and Browsers
     29* Set separate max-age (browser) and s-maxage (CloudFront) cache duration values
     30
     31== Turbocharge your WordPress Website with CloudFront ==
     32Using Amazon CloudFront in front of your WordPress website offers significant benefits by improving performance, security, and scalability. CloudFront is a Delivery Network (CDN) with over 750+ Points of Presence (PoPs) around the world plus over 1,100 PoPs within ISP networks. This highly optimized network makes it _extremely efficient_ at delivering your website to your visitors anywhere around the world. "PoP" locations are designed to reduce latency by caching content closer to your site's visitors.
     33
     34**Performance**
     35
     36* **Faster Loading Times**, static content (pages, images, CSS, JavaScript) is cached at "edge locations" around the world
     37* **Improved User Experience**, Faster load times lead to higher user engagement, reduced bounce rates, and improved search engine optimization (SEO) rankings
     38* **Reduced Server Load**, by serving cached content from edge locations, CloudFront minimizes requests to your WordPress website
     39
     40When your website is optimized for performance your [PageSpeed Lighthouse scores](https://pagespeed.web.dev/) should improve.
     41
     42**Enhanced Security**
     43
     44* **DDoS Protection**, includes AWS Shield Standard
     45* **SSL/TLS Security**, force https only and includes free SSL Certificates
     46* **AWS WAF**, a Web Application Firewall with a depth of options including specific WordPress protections (may incur additional costs)
     47
     48You should achieve a grade of "A" on [Qualys SSL Server Test](https://www.ssllabs.com/ssltest/) when CloudFront is configured with the recommended TLSv1.2_2021 or newer security policy.
     49
     50**Scalability and Reliability**
     51
     52* **Global Reach** with over 750 PoPs plus over 1,100 PoPs within ISP networks
     53* **High Availability**, can serve cached content when site is down
     54* **Cost Efficiency**, can be cost-effective, especially for websites with high traffic with the new [CloudFront flat-rate pricing plans](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/flat-rate-pricing-plan.html)
     55
     56**Technology**
     57
     58* **IPv6**, a superior protocol to IPv4 and in some regions of the world is the only protocol that is available
     59* **HTTP/2 and HTTP/3** improve web performance through faster loading speeds, enhanced security, and better resource handling
     60* **Gzip and Brotli compression**, smaller file sizes improve application performance by delivering your content faster to visitors
     61* **Multi-Proxy**, route specific path patterns to other web applications easily by adding additional "Origins", allowing you to host more than just WordPress with the same hostname
     62
     63Learn more about [AWS CloudFront](https://aws.amazon.com/cloudfront/).
     64
     65== Developed by an AWS Community Builder ==
     66FrontPup is developed and maintained by [Angelo Mandato](https://angelo.mandato.com), an [AWS Community Builder](https://builder.aws.com/community/@angelomandato). Angelo has been developing WordPress plugins and themes since 2005 and has been architecting applications including WordPress hosted on Amazon Web Services since 2007.
     67
     68== Installation ==
     69
     70= Installation from within WordPress =
     71
     721. Visit **Plugins > Add New**.
     732. Search for **FrontPup**.
     743. Install and activate the FrontPup plugin.
     75
     76= Manual installation =
     77
     781. Upload the entire `frontpup` folder to the `/wp-content/plugins/` directory.
     792. Visit **Plugins**.
     803. Activate the FrontPup plugin.
     81
     82= After activation =
     83
     841. Visit the new **FrontPup** menu.
     852. Enable the options you would like to use.
     86
     87If you configure Clear Cache Settings, you can now use the FrontPup admin bar menu option to quickly clear the cache. This action uses AJAX and will perform the action without leaving the page or disrupting your work.
    2488
    2589== Frequently Asked Questions ==
     
    2791= Do I need an AWS CloudFront to use this plugin? =
    2892
    29 Yes, you need an AWS account with CloudFront setup for your website.
     93Yes, you need an AWS account with [CloudFront](https://aws.amazon.com/cloudfront/) setup for your website.
     94
     95= Do I need to host my WordPress site on AWS? =
     96
     97No, but CloudFront is most effective when used within the AWS network.
     98
     99= What is the best way to host a WordPress website on AWS? =
     100
     101There are many ways to host a WordPress website on AWS. Here is quick list.
     102
     103* Lightsail - A CPanel like approach to setting up a WordPress website with only a few clicks
     104* EC2 Instance(s) - Run your own server(s) to host your WordPress website
     105* ECS Tasks - Run Docker containers using the AWS Elastic Container Service
     106* EKS - Run WordPress on AWS Elastic Kubernetes Service
     107
     108There are thousands of formulas online that explain how to host WordPress on AWS. The method you pick comes down to the architecture you want to use and how much complexity you want with managing your website.
    30109
    31110== Screenshots ==
    32111
    33 1. Settings screenshot
     1121. Welcome to FrontPup with CloudFront
     1132. Welcome screen without CloudFront
     1143. Page Cache-Control settings
     1154. Clear cache settings
     1165. Clear CloudFront cache from WordPress admin bar
    34117
    35118== Changelog ==
    36119
     120The FrontPup plugin is maintained on GitHub [https://github.com/painlessanalytics/frontpup](https://github.com/painlessanalytics/frontpup). Code contributions are welcome.
     121
     122Changelog
     123
     124= 1.1 =
     125
     126Released: 2026-01-30
     127
     128Clear cache functionality added.
     129
     130* Added welcome page for the wp-admin
     131* Added clear cache settings page
     132* Reorganized admin class, new base class for future settings pages
     133* Moved views to subfolder of admin folder
     134* Added FrontPup admin bar menu bar option with "Clear CloudFront Cache" in sub menu (Made it a sub menu so you have to click twice to avoid accidental cache clearing)
     135* Ajax code for clearing cache created. For now only users who can manage settings can clear the cache (to be customizable in future versions)
     136
    37137= 1.0 =
     138
     139Released: 2026-01-08
     140
    38141* First version of this plugin
     142
     143The entire changelog is available on GitHub: [https://github.com/painlessanalytics/frontpup/blob/main/CHANGELOG.md](https://github.com/painlessanalytics/frontpup/blob/main/CHANGELOG.md)
    39144
    40145== Upgrade Notice ==
Note: See TracChangeset for help on using the changeset viewer.