public function add_cache_static_assets($rules)
    {
        if (Load_Me_Quickly::get_option('plugin_activated') == 1 && Load_Me_Quickly::get_option('cache_static_assets') == 1) {
            return $rules . '
# Load Me Quickly
#1 Year
<FilesMatch "\\.(ico|swf|unity3d)$">
Header set Cache-Control "max-age=29030400, public"
</FilesMatch>
#30 Days
<FilesMatch "\\.(mp3|mp4|avi|mov|flv|mpeg|wmv)$">
Header set Cache-Control "max-age=2592000, public"
</FilesMatch>
#7 Days
<FilesMatch "\\.(pdf|jpg|jpeg|png|gif)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
#7 Days
<FilesMatch "\\.(js|css)$">
Header set Cache-Control "max-age=604800, public, must-revalidate"
</FilesMatch>
# /Load Me Quickly

	';
        } else {
            return $rules;
        }
    }
 public static function instance()
 {
     if (null === self::$instance) {
         self::$instance = new self();
         self::$instance->includes();
         self::$instance->options = new Load_Me_Quickly_Options(self::SLUG);
         self::$instance->view = new Load_Me_Quickly_View();
         self::$instance->admin = new Load_Me_Quickly_Admin();
         self::$instance->static_files = new Load_Me_Quickly_Static_Files();
         self::$instance->htaccess = new Load_Me_Quickly_Htaccess();
         // Load the text domain for i18n
         add_action('plugins_loaded', array(self::$instance, 'load_textdomain'));
         // Enqueue admin styles
         //add_action( 'admin_enqueue_scripts', array( self::$instance, 'enqueue_admin_styles' ) );
         // Enqueue admin scripts
         add_action('admin_enqueue_scripts', array(self::$instance, 'enqueue_admin_scripts'));
         // Add the options page and menu item.
         add_action('admin_menu', array(self::$instance, 'add_plugin_admin_menu'), 2);
     }
     return self::$instance;
 }
 /**
  * Check Load_Me_Quickly's system requirements and add errors as necessary.
  *
  * @return void
  */
 private function check_for_errors()
 {
     $errors = Load_Me_Quickly::instance()->check_system_requirements();
     foreach ($errors as $field) {
         foreach ($field as $error) {
             $this->add_flash('error', $error);
         }
     }
 }
예제 #4
0
<?php

if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
/**
 * Plugin Name: 	Load Me Quickly
 * Plugin URI: 		http://www.solidwebmedia.com
 * Description: 	Create static HTML copy of selected posts & pages (uses htaccess mod_rewrites).
 * Version: 		1.1.1
 * Author: 			Vincent Dulac
 * Author URI: 		http://www.solidwebmedia.com
 * License:         GPL-2.0+
 * License URI:     http://www.gnu.org/licenses/gpl-2.0.txt
 * Text Domain:     load-me-quickly
 * Domain Path:     /languages
 */
require plugin_dir_path(__FILE__) . 'includes/class-load-me-quickly.php';
Load_Me_Quickly::init(__FILE__);
 public function save_checkbox_postdata($post_id)
 {
     /* check if this is an autosave */
     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
         return false;
     }
     /* check if this is a revision */
     if (wp_is_post_revision($post_id)) {
         return false;
     }
     /* check if the user can edit this page */
     if (!current_user_can('edit_page', $post_id)) {
         return false;
     }
     /* check if there's a post id and check if this is a post */
     /* make sure this is the same post type as above */
     if (empty($post_id) || !isset($_POST['post_type']) || $_POST['post_type'] != 'page' && $_POST['post_type'] != 'post') {
         return false;
     }
     /* check if the custom field is submitted (checkboxes that aren't marked, aren't submitted) */
     if (isset($_POST['static_field_input'])) {
         /* store the value in the database */
         update_post_meta($post_id, Load_Me_Quickly::SINGLE_POST_STATIC_FIELD_NAME, 1);
         Load_Me_Quickly::write_file($post_id);
     } else {
         /* not marked? delete the value in the database */
         update_post_meta($post_id, Load_Me_Quickly::SINGLE_POST_STATIC_FIELD_NAME, 0);
     }
     flush_rewrite_rules();
 }