@@ -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( |
@@ -701,9 +701,15 @@ |
||
| 701 | 701 | private function hue_to_rgb($v1, $v2, $vh) |
| 702 | 702 | { |
| 703 | 703 | $vh = $vh < 0 ? $vh + 1 : ($vh > 1 ? $vh - 1 : $vh); |
| 704 | - if ($vh * 6 < 1) return $v1 + ($v2 - $v1) * 6 * $vh; |
|
| 705 | - if ($vh * 2 < 1) return $v2; |
|
| 706 | - if ($vh * 3 < 2) return $v1 + ($v2 - $v1) * ((2/3) - $vh) * 6; |
|
| 704 | + if ($vh * 6 < 1) { |
|
| 705 | + return $v1 + ($v2 - $v1) * 6 * $vh; |
|
| 706 | + } |
|
| 707 | + if ($vh * 2 < 1) { |
|
| 708 | + return $v2; |
|
| 709 | + } |
|
| 710 | + if ($vh * 3 < 2) { |
|
| 711 | + return $v1 + ($v2 - $v1) * ((2/3) - $vh) * 6; |
|
| 712 | + } |
|
| 707 | 713 | return $v1; |
| 708 | 714 | } |
| 709 | 715 | |