@@ -1,5 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | + exit; |
|
| 4 | +} |
|
| 5 | +// Exit if accessed directly |
|
| 3 | 6 | |
| 4 | 7 | class autoptimizeStyles extends autoptimizeBase {
|
| 5 | 8 | private $css = array(); |
@@ -22,7 +25,9 @@ discard block |
||
| 22 | 25 | //Reads the page and collects style tags |
| 23 | 26 | public function read($options) {
|
| 24 | 27 | $noptimizeCSS = apply_filters( 'autoptimize_filter_css_noptimize', false, $this->content ); |
| 25 | - if ($noptimizeCSS) return false; |
|
| 28 | + if ($noptimizeCSS) { |
|
| 29 | + return false; |
|
| 30 | + } |
|
| 26 | 31 | |
| 27 | 32 | $whitelistCSS = apply_filters( 'autoptimize_filter_css_whitelist', '' ); |
| 28 | 33 | if (!empty($whitelistCSS)) {
|
@@ -136,7 +141,7 @@ discard block |
||
| 136 | 141 | if($path!==false && preg_match('#\.css$#',$path)) {
|
| 137 | 142 | // Good link |
| 138 | 143 | $this->css[] = array($media,$path); |
| 139 | - }else{
|
|
| 144 | + } else{
|
|
| 140 | 145 | // Link is dynamic (.php etc) |
| 141 | 146 | $tag = ''; |
| 142 | 147 | } |
@@ -199,8 +204,9 @@ discard block |
||
| 199 | 204 | } |
| 200 | 205 | |
| 201 | 206 | foreach($media as $elem) {
|
| 202 | - if(!isset($this->csscode[$elem])) |
|
| 203 | - $this->csscode[$elem] = ''; |
|
| 207 | + if(!isset($this->csscode[$elem])) { |
|
| 208 | + $this->csscode[$elem] = ''; |
|
| 209 | + } |
|
| 204 | 210 | $this->csscode[$elem] .= "\n/*FILESTART*/".$css; |
| 205 | 211 | } |
| 206 | 212 | } |
@@ -1,5 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | + exit; |
|
| 4 | +} |
|
| 5 | +// Exit if accessed directly |
|
| 3 | 6 | |
| 4 | 7 | class autoptimizeConfig { |
| 5 | 8 | private $config = null; |
@@ -562,8 +565,9 @@ discard block |
||
| 562 | 565 | //Inspired on http://wpengineer.com/meta-links-for-wordpress-plugins/ |
| 563 | 566 | //Do it only once - saves time |
| 564 | 567 | static $plugin; |
| 565 | - if(empty($plugin)) |
|
| 566 | - $plugin = plugin_basename(AUTOPTIMIZE_PLUGIN_DIR.'autoptimize.php'); |
|
| 568 | + if(empty($plugin)) { |
|
| 569 | + $plugin = plugin_basename(AUTOPTIMIZE_PLUGIN_DIR.'autoptimize.php'); |
|
| 570 | + } |
|
| 567 | 571 | |
| 568 | 572 | if($file===null) { |
| 569 | 573 | //2.7 |
@@ -619,8 +623,9 @@ discard block |
||
| 619 | 623 | $this->config = $config; |
| 620 | 624 | } |
| 621 | 625 | |
| 622 | - if(isset($this->config[$key])) |
|
| 623 | - return $this->config[$key]; |
|
| 626 | + if(isset($this->config[$key])) { |
|
| 627 | + return $this->config[$key]; |
|
| 628 | + } |
|
| 624 | 629 | |
| 625 | 630 | return false; |
| 626 | 631 | } |
@@ -638,10 +643,13 @@ discard block |
||
| 638 | 643 | <ul> |
| 639 | 644 | <?php if ( $maxitems == 0 ) : ?> |
| 640 | 645 | <li><?php _e( 'No items', 'autoptimize' ); ?></li> |
| 641 | - <?php else : ?> |
|
| 646 | + <?php else { |
|
| 647 | + : ?> |
|
| 642 | 648 | <?php foreach ( $rss_items as $item ) : ?> |
| 643 | 649 | <li> |
| 644 | - <a href="<?php echo esc_url( $item->get_permalink() ); ?>" |
|
| 650 | + <a href="<?php echo esc_url( $item->get_permalink() ); |
|
| 651 | +} |
|
| 652 | +?>" |
|
| 645 | 653 | title="<?php printf( __( 'Posted %s', 'autoptimize' ), $item->get_date('j F Y | g:i a') ); ?>"> |
| 646 | 654 | <?php echo esc_html( $item->get_title() ); ?> |
| 647 | 655 | </a> |
@@ -1,12 +1,17 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | + exit; |
|
| 4 | +} |
|
| 5 | +// Exit if accessed directly |
|
| 3 | 6 | |
| 4 | 7 | class autoptimizeToolbar { |
| 5 | 8 | |
| 6 | 9 | public function __construct() |
| 7 | 10 | { |
| 8 | 11 | // If Cache is not available we don't add the Autoptimize Toolbar |
| 9 | - if( !autoptimizeCache::cacheavail() ) return; |
|
| 12 | + if( !autoptimizeCache::cacheavail() ) { |
|
| 13 | + return; |
|
| 14 | + } |
|
| 10 | 15 | |
| 11 | 16 | // Load admin toolbar feature once WordPress, all plugins, and the theme are fully loaded and instantiated. |
| 12 | 17 | add_action( 'wp_loaded', array( $this, 'load_toolbar' ) ); |
@@ -53,7 +58,9 @@ discard block |
||
| 53 | 58 | |
| 54 | 59 | // We calculated the percentage of cache used |
| 55 | 60 | $percentage = ceil( $bytes / $max_size * 100 ); |
| 56 | - if( $percentage > 100 ) $percentage = 100; |
|
| 61 | + if( $percentage > 100 ) { |
|
| 62 | + $percentage = 100; |
|
| 63 | + } |
|
| 57 | 64 | |
| 58 | 65 | // We define the type of color indicator for the current state of cache size. |
| 59 | 66 | // "green" if the size is less than 80% of the total recommended |
@@ -12,7 +12,10 @@ discard block |
||
| 12 | 12 | http://www.gnu.org/licenses/gpl.txt |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
| 15 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 16 | + exit; |
|
| 17 | +} |
|
| 18 | +// Exit if accessed directly |
|
| 16 | 19 | |
| 17 | 20 | define('AUTOPTIMIZE_PLUGIN_DIR',plugin_dir_path(__FILE__)); |
| 18 | 21 | |
@@ -224,12 +227,15 @@ discard block |
||
| 224 | 227 | |
| 225 | 228 | // Choose the classes |
| 226 | 229 | $classes = array(); |
| 227 | - if($conf->get('autoptimize_js')) |
|
| 228 | - $classes[] = 'autoptimizeScripts'; |
|
| 229 | - if($conf->get('autoptimize_css')) |
|
| 230 | - $classes[] = 'autoptimizeStyles'; |
|
| 231 | - if($conf->get('autoptimize_html')) |
|
| 232 | - $classes[] = 'autoptimizeHTML'; |
|
| 230 | + if($conf->get('autoptimize_js')) { |
|
| 231 | + $classes[] = 'autoptimizeScripts'; |
|
| 232 | + } |
|
| 233 | + if($conf->get('autoptimize_css')) { |
|
| 234 | + $classes[] = 'autoptimizeStyles'; |
|
| 235 | + } |
|
| 236 | + if($conf->get('autoptimize_html')) { |
|
| 237 | + $classes[] = 'autoptimizeHTML'; |
|
| 238 | + } |
|
| 233 | 239 | |
| 234 | 240 | // Set some options |
| 235 | 241 | $classoptions = array( |