Plugin Directory

Changeset 1693698


Ignore:
Timestamp:
07/10/2017 12:26:21 PM (9 years ago)
Author:
optimality
Message:

Changes towards 0.6.0

Location:
optimality/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • optimality/trunk/index.php

    r1688780 r1693698  
    55 * Plugin URI:  https://wordpress.org/plugins/optimality
    66 * Description: Optimizes website's content delivery, images, database, permalink structure, search engines and social media markup.
    7  * Version:     0.5.1
     7 * Version:     0.6.0
    88 * License:     GPLv2 or later
    99 * Author:      Optimality
     
    2323require_once('markup/comment.php');
    2424require_once('markup/media.php');
     25require_once('markup/error.php');
    2526require_once('markup/sitemap.php');
    2627
     
    5758            Html::PREDNS    => NULL,
    5859            Html::MINIFY    => NULL,
    59             Html::STATIC    => NULL,
     60            Html::CACHE     => NULL,
    6061            Style::MINIFY   => NULL,
    6162            Style::CDNLIB   => NULL,
     
    8081            User::UNLINK    => NULL,
    8182            Media::UNLINK   => NULL,
     83            Error::PARENT   => NULL,
    8284
    8385            Site::SEMETA    => NULL,
     
    260262                case is_archive()   : $markup = Html::class;    break;
    261263                case is_sitemap()   : $markup = Sitemap::class; break;
     264                case is_404()       : $markup = Error::class;   break;
    262265                default             : return;
    263266            }
     
    273276            $method = strtoupper(@$_SERVER['REQUEST_METHOD']);
    274277           
    275             if ($static = isset( $this->option[ Html::STATIC ] ) &&
     278            if ($static = isset( $this->option[ Html::CACHE ] ) &&
    276279                $ishtml && empty($_REQUEST) && $method === 'GET' &&
    277280                !is_user_logged_in() && !defined('DOING_CRON'))
     
    335338            $this->addOption(Html::PREDNS   , __('Prefetch DNS'         ), $module, 'binary', __('Reduce DNS lookup time by pre-resolving all external domains.'));
    336339            $this->addOption(Html::MINIFY   , __('Optimize HTML'        ), $module, 'binary', __('Remove comments, unnecessary whitespace and empty nodes.'));
    337             $this->addOption(Html::STATIC   , __('Cache HTML'           ), $module, 'binary', __('Cache dynamic HTML content and serve it as static HTML files.'));
    338             $this->addAction(Html::STATIC   , __('Clean HTML Cache'     ), 'trash', [Html::class, 'cleanCache'], [Html::class, 'countCache']);
     340            $this->addOption(Html::CACHE    , __('Cache HTML'           ), $module, 'binary', __('Cache dynamic HTML content and serve it as static HTML files.'));
     341            $this->addAction(Html::CACHE    , __('Clean HTML Cache'     ), 'trash', [Html::class, 'cleanCache'], [Html::class, 'countCache']);
    339342            $this->addOption(Style::MINIFY  , __('Optimize Styles'      ), $module, 'binary', __('Combine files, flatten imports, remove comments and cache.'));
    340343            $this->addAction(Style::MINIFY  , __('Clean Style Cache'    ), 'trash', [Style::class, 'cleanCache'], [Style::class, 'countCache']);
     
    372375            $this->addOption(Comment::UNLINK, __('Disable Reply Queries'), $module, 'binary', __('Redirect ?replytocom=id to #comment-id in comment replies.'));
    373376            $this->addOption(Comment::UNPAGE, __('Depaginate Comments'  ), $module, 'binary', __('Redirect paginated comments to the URL of the parent page.'));
     377            $this->addOption(Error::PARENT  , __('Redirect 404 Errors'  ), $module, 'binary', __('Redirect 404 error pages one level up in the website hierarchy.'));
    374378
    375379            $this->addModule($module = 'seo', __('Search Engines'       ));
  • optimality/trunk/markup/html.php

    r1688620 r1693698  
    1212    const PREDNS = 'html_predns';
    1313    const MINIFY = 'html_minify';
    14     const STATIC = 'html_static';
     14    const CACHE = 'html_static';
    1515    const CDNURL = 'html_cdnurl';
    1616    const SEMETA = 'html_semeta';
     
    225225        }
    226226
     227        $this->root = $this->documentElement;
     228        $this->head = @$this->root->childNodes[0];
     229        $this->body = @$this->root->childNodes[1];
     230
     231        if (empty($this->head) || empty($this->body))
     232        {
     233            return $string;
     234        }
     235
    227236        $schema = new \DOMXPath($this); $linked = [ ];
    228 
    229         $this->root = $this->documentElement;
    230         $this->head = $this->root->childNodes[0];
    231         $this->body = $this->root->childNodes[1];
    232237
    233238        foreach ($schema->query('/html/head/meta') as $object)
  • optimality/trunk/readme.txt

    r1688780 r1693698  
    2121* Removes comments, unnecessary whitespace and empty nodes from HTML.
    2222* Caches dynamic HTML content and serves it as static HTML files.
    23 * Combines CSS files, flattens imports, removes comments and caches.
     23* Combines styles, flattens imports, removes comments and caches.
    2424* Serves popular CSS libraries from content delivery networks.
    25 * Combines JS files, defers loading, removes comments and caches.
     25* Combines scripts, defers loading, removes comments and caches.
    2626* Serves popular JS libraries from content delivery networks.
    2727* Strips metadata and compresses thumbnail images (requires ImageMagick).
     
    4444* Redirects ?replytocom=id to #comment-id in comment replies.
    4545* Redirects paginated comment pages to the parent page.
     46* Redirects 404 error pages one level up in the website hierarchy.
    4647
    4748= Search Engines Optimization =
     
    7980== Changelog ==
    8081
     82= 0.6.0 =
     83* Feature: Redirect 404 error pages to the parent page
     84* Feature: Support for old versions of PHP (below 7.0)
     85
    8186= 0.5.1 =
    8287* Bug Fix: Category names not appearing in post titles
Note: See TracChangeset for help on using the changeset viewer.