@@ -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 autoptimizeScripts extends autoptimizeBase { |
| 5 | 8 | private $scripts = array(); |
@@ -22,7 +25,9 @@ discard block |
||
| 22 | 25 | //Reads the page and collects script tags |
| 23 | 26 | public function read($options) { |
| 24 | 27 | $noptimizeJS = apply_filters( 'autoptimize_filter_js_noptimize', false, $this->content ); |
| 25 | - if ($noptimizeJS) return false; |
|
| 28 | + if ($noptimizeJS) { |
|
| 29 | + return false; |
|
| 30 | + } |
|
| 26 | 31 | |
| 27 | 32 | // only optimize known good JS? |
| 28 | 33 | $whitelistJS = apply_filters( 'autoptimize_filter_js_whitelist', '', $this->content ); |
@@ -75,8 +80,9 @@ discard block |
||
| 75 | 80 | } |
| 76 | 81 | |
| 77 | 82 | //Should we add try-catch? |
| 78 | - if($options['trycatch'] == true) |
|
| 79 | - $this->trycatch = true; |
|
| 83 | + if($options['trycatch'] == true) { |
|
| 84 | + $this->trycatch = true; |
|
| 85 | + } |
|
| 80 | 86 | |
| 81 | 87 | // force js in head? |
| 82 | 88 | if($options['forcehead'] == true) { |
@@ -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 | |
@@ -24,7 +27,9 @@ discard block |
||
| 24 | 27 | //Reads the page and collects style tags |
| 25 | 28 | public function read($options) {
|
| 26 | 29 | $noptimizeCSS = apply_filters( 'autoptimize_filter_css_noptimize', false, $this->content ); |
| 27 | - if ($noptimizeCSS) return false; |
|
| 30 | + if ($noptimizeCSS) { |
|
| 31 | + return false; |
|
| 32 | + } |
|
| 28 | 33 | |
| 29 | 34 | $whitelistCSS = apply_filters( 'autoptimize_filter_css_whitelist', '', $this->content ); |
| 30 | 35 | if (!empty($whitelistCSS)) {
|
@@ -139,7 +144,7 @@ discard block |
||
| 139 | 144 | if($path!==false && preg_match('#\.css$#',$path)) {
|
| 140 | 145 | // Good link |
| 141 | 146 | $this->css[] = array($media,$path); |
| 142 | - }else{
|
|
| 147 | + } else{
|
|
| 143 | 148 | // Link is dynamic (.php etc) |
| 144 | 149 | $tag = ''; |
| 145 | 150 | } |
@@ -228,8 +233,9 @@ discard block |
||
| 228 | 233 | } |
| 229 | 234 | |
| 230 | 235 | foreach($media as $elem) {
|
| 231 | - if(!isset($this->csscode[$elem])) |
|
| 232 | - $this->csscode[$elem] = ''; |
|
| 236 | + if(!isset($this->csscode[$elem])) { |
|
| 237 | + $this->csscode[$elem] = ''; |
|
| 238 | + } |
|
| 233 | 239 | $this->csscode[$elem] .= "\n/*FILESTART*/".$css; |
| 234 | 240 | } |
| 235 | 241 | } |
@@ -3,7 +3,10 @@ |
||
| 3 | 3 | * below code handles updates and is only included by autoptimize.php if/ when needed |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
| 6 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 7 | + exit; |
|
| 8 | +} |
|
| 9 | +// Exit if accessed directly |
|
| 7 | 10 | |
| 8 | 11 | $majorUp = false; |
| 9 | 12 | $autoptimize_major_version=substr($autoptimize_db_version,0,3); |
@@ -3,7 +3,10 @@ |
||
| 3 | 3 | Classlessly add a "more tools" tab to promote (future) AO addons and/ or affiliate services |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
| 6 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 7 | + exit; |
|
| 8 | +} |
|
| 9 | +// Exit if accessed directly |
|
| 7 | 10 | |
| 8 | 11 | add_action('admin_init', 'ao_partner_tabs_preinit'); |
| 9 | 12 | function ao_partner_tabs_preinit() { |
@@ -2,7 +2,10 @@ |
||
| 2 | 2 | // flush as many page cache plugin's caches as possible |
| 3 | 3 | // hyper cache and gator cache hook into AO, so we don't need to :-) |
| 4 | 4 | |
| 5 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
| 5 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 6 | + exit; |
|
| 7 | +} |
|
| 8 | +// Exit if accessed directly |
|
| 6 | 9 | |
| 7 | 10 | function autoptimize_flush_pagecache() { |
| 8 | 11 | if(function_exists('wp_cache_clear_cache')) { |
@@ -4,7 +4,10 @@ |
||
| 4 | 4 | * new in Autoptimize 2.2 |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
| 7 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 8 | + exit; |
|
| 9 | +} |
|
| 10 | +// Exit if accessed directly |
|
| 8 | 11 | |
| 9 | 12 | function ao_js_snippetcacher($jsin,$jsfilename) { |
| 10 | 13 | $md5hash = "snippet_".md5($jsin); |
@@ -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; |
@@ -597,8 +600,9 @@ discard block |
||
| 597 | 600 | //Inspired on http://wpengineer.com/meta-links-for-wordpress-plugins/ |
| 598 | 601 | //Do it only once - saves time |
| 599 | 602 | static $plugin; |
| 600 | - if(empty($plugin)) |
|
| 601 | - $plugin = plugin_basename(AUTOPTIMIZE_PLUGIN_DIR.'autoptimize.php'); |
|
| 603 | + if(empty($plugin)) { |
|
| 604 | + $plugin = plugin_basename(AUTOPTIMIZE_PLUGIN_DIR.'autoptimize.php'); |
|
| 605 | + } |
|
| 602 | 606 | |
| 603 | 607 | if($file===null) { |
| 604 | 608 | //2.7 |
@@ -656,8 +660,9 @@ discard block |
||
| 656 | 660 | $this->config = apply_filters( 'autoptimize_filter_get_config', $config ); |
| 657 | 661 | } |
| 658 | 662 | |
| 659 | - if(isset($this->config[$key])) |
|
| 660 | - return $this->config[$key]; |
|
| 663 | + if(isset($this->config[$key])) { |
|
| 664 | + return $this->config[$key]; |
|
| 665 | + } |
|
| 661 | 666 | |
| 662 | 667 | return false; |
| 663 | 668 | } |
@@ -675,10 +680,13 @@ discard block |
||
| 675 | 680 | <ul> |
| 676 | 681 | <?php if ( $maxitems == 0 ) : ?> |
| 677 | 682 | <li><?php _e( 'No items', 'autoptimize' ); ?></li> |
| 678 | - <?php else : ?> |
|
| 683 | + <?php else { |
|
| 684 | + : ?> |
|
| 679 | 685 | <?php foreach ( $rss_items as $item ) : ?> |
| 680 | 686 | <li> |
| 681 | - <a href="<?php echo esc_url( $item->get_permalink() ); ?>" |
|
| 687 | + <a href="<?php echo esc_url( $item->get_permalink() ); |
|
| 688 | +} |
|
| 689 | +?>" |
|
| 682 | 690 | title="<?php printf( __( 'Posted %s', 'autoptimize' ), $item->get_date('j F Y | g:i a') ); ?>"> |
| 683 | 691 | <?php echo esc_html( $item->get_title() ); ?> |
| 684 | 692 | </a> |