Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

Commit

Permalink
Cleanup handler methods and add html option.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathantneal authored and paulirish committed Feb 24, 2012
1 parent 6662a8a commit 582a5d4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions handler.methods.php
Expand Up @@ -255,6 +255,7 @@ function filter_options() {
$array[$key . 'callback'] = @$_GET['callback'];
$array[$key . 'features'] = explode(' ', @$_GET['features']);
$array[$key . 'format'] = first_match('/(html|js|json|php|xml)/', @$_GET['format'], 'js');
$array[$key . 'html'] = isset($_GET['html']);
$array[$key . 'readable'] = isset($_GET['readable']);
$array[$key . 'noagent'] = isset($_GET['noagent']);
$array[$key . 'noagents'] = isset($_GET['noagents']);
Expand Down Expand Up @@ -369,15 +370,13 @@ function html_encode(&$return_array = array(), $requested_style_string = '', $re

if ($requested_style_boolean) {

if($request_style_string == 'text') {

$styles = @file_get_contents('css/text.css');

} else {

$styles = @file_get_contents('css/text.css') . @file_get_contents('css/icon.css');

}
if ($requested_style_string == 'text') {
$styles = @file_get_contents('css/text.css');
} else if ($requested_style_string == 'icon') {
$styles = @file_get_contents('css/icon.css');
} else {
$styles = @file_get_contents('css/text.css') . @file_get_contents('css/icon.css');
}

$html .= '&shy;<style>' . preg_replace('/[\s]+/', ' ', $styles) . '</style>';
}
Expand Down
2 changes: 1 addition & 1 deletion handler.php
Expand Up @@ -56,7 +56,7 @@
header('Content-Type: text/javascript');
}

if ($option_format === 'html') {
if ($option_format === 'html' || $option_html) {
$support_array['html'] = html_encode($support_array, $option_style, !$option_nocss);
}

Expand Down

0 comments on commit 582a5d4

Please sign in to comment.