Skip to content

Commit 398412a

Browse files
committed
remove unnecessary db hits
added to filter_headjs
1 parent fcce941 commit 398412a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

asynchronous-javascript.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class AsynchronousJS {
3434
private static $queue = array();
3535
private static $depends = array();
3636
private static $head_loaded = false;
37+
private static $default_head_file = 'head.load.min.js';
3738

3839
function init() {
3940
if(!defined('WP_ADMIN') || !WP_ADMIN){
@@ -93,15 +94,14 @@ function admin(){
9394
'title' => 'Select Head.js File',
9495
'desc' => 'Enter the filename of the head.js file in the js folder.',
9596
'sub_desc' => 'This is an advanced setting, leave it as default if you are unsure of what it does.',
96-
'std' => 'head.load.min.js'
97+
'std' => self::$default_head_file
9798
)
9899
)
99100
));
100101

101102
$NHP_Options = new NHP_Options($sections, $args);
102-
103-
if (!$NHP_Options->get('head_file'))
104-
$NHP_Options->set('head_file', $sections[0]['fields']['head_file']['std']);
103+
if (empty($NHP_Options->options['head_file']))
104+
$NHP_Options->set('head_file', self::$default_head_file);
105105
}
106106

107107
/**
@@ -135,6 +135,9 @@ function filter_headjs(){
135135
$names = split(',', $options['exclude_name']);
136136
$files = split(',', $options['exclude_js']);
137137

138+
if (empty($options['head_file']))
139+
$options['head_file'] == self::$default_head_file;
140+
138141
if(count(self::$depends) > 0){
139142
$handles = array();
140143

0 commit comments

Comments
 (0)