| | 127 | if ( isset( $this->registered[$handle]->extra['conditional'] ) && $this->registered[$handle]->extra['conditional'] ) { |
| | 128 | // By default, assume the conditional will target IE |
| | 129 | $target_ie = true; |
| | 130 | |
| | 131 | // If an array is passed in the conditional parameter, extract conditional and browser target |
| | 132 | if ( is_array( $this->registered[$handle]->extra['conditional'] ) ) { |
| | 133 | if ( isset( $this->registered[$handle]->extra['conditional']['condition'] ) ) { |
| | 134 | $target_ie = isset( $this->registered[$handle]->extra['conditional']['target_ie'] ) ? (bool) $this->registered[$handle]->extra['conditional']['target_ie'] : true; |
| | 135 | |
| | 136 | $this->registered[$handle]->extra['conditional'] = $this->registered[$handle]->extra['conditional']['condition']; |
| | 137 | } |
| | 138 | else { |
| | 139 | $this->registered[$handle]->extra['conditional'] = ''; |
| | 140 | } |
| | 141 | } |
| | 142 | |
| | 143 | // Build the conditional, including the non-IE comment if necessary. |
| | 144 | $start_cond = "<!--[if {$this->registered[$handle]->extra['conditional']}]>"; |
| | 145 | |
| | 146 | if ( ! $target_ie ) |
| | 147 | $start_cond .= '<!-->'; |
| | 148 | |
| | 149 | $start_cond .= "\n"; |
| | 150 | |
| | 151 | $end_cond = "<![endif]-->\n"; |
| | 152 | |
| | 153 | // Fail gracefully if the user doesn't pass the right data |
| | 154 | if ( empty( $this->registered[$handle]->extra['conditional'] ) ) |
| | 155 | $start_cond = $end_cond = ''; |
| | 156 | } |
| | 157 | |
| | 158 | echo "{$start_cond}<script type='text/javascript' src='$src'></script>\n{$end_cond}"; |
| | 159 | } |
| | 160 | |