@ 2015-05-04T16:18:44Z <?PHP
/*
LookingGlass dgs-bootstraphtml.php
*/
define('dgs_void_tags', '<area><base><br><col><command><embed><hr><img><input><link><meta><param><source>');
define('dgs_CG_OPEN', '<div class="control-group">');
define('dgs_CG_CLOSE', '</div>');
define('dgs_HELP_OPEN', '<p class="help-block">');
define('dgs_HELP_CLOSE', '</p>');
$dgs_regNames = array();
function dgs_isVoidTag( $tagName ) {
return (stripos(dgs_void_tags,'<'.$element.'>')!==false);
}
function dgs_nextRegNameID( $regName ) {
global $dgs_regNames;
if(isset($dgs_regNames[$regName])) {
$dgs_regNames[$regName]++;
} else {
$dgs_regNames[$regName] = 0;
}
return $regName.$dgs_regNames[$regName];
}
function dgs_attributes($OPTIONS) {
$out = '';
foreach($OPTIONS as $parm => $val) {
if(($parm[0]!='_')&&(!empty($val))) $out .= ' '.$parm.'="'.$val.'"';
}
return $out;
}
function dgs_element($type, $text, $OPTIONS=array(), $print=true) {
// create an element
// $OPTIONS = array of option settings {including but not limited to:}
// '_style' => {blank} | primary | success | info | warning | danger | inverse | link (string)
// '_size' => large | {blank} | small | mini (string)
// '_disabled' => true | false (boolean)
// '_element' => a | button | input (string)
// 'href' => {target URL} | #
// 'type' => {blank} | button | input | submit
// 'name' => {element name}
// 'id' => {element id}
// 'value' => {element value}
$o = $OPTIONS;
if(!isset($o['_element'])) return false;
$element = strtolower($o['_element']);
$class = (($type!='icon')?$type:'');
$class .= ((!empty($o['_style']))?" $type-".$o['_style']:'');
$class .= ((!empty($o['_size']))?" $type-".$o['_size']:'');
$class .= ((!empty($o['_disabled']))&&($o['_disabled']==true))?' disabled':'');
$class .= ((!empty($o['_inline']))&&($o['_inline']==true))?' inline':'');
$class .= ((isset($o['class']))?' '.$o['class']:'');
$class = trim($class);
$o['class'] = $class;
if($o['_disabled']==true)$o['disabled']='disabled';
$attr = dgs_attributes($o);
$out = vsprintf('<%1$s %2$s>%3$s'.((!dgs_isVoidTag($element))?'</%1$s>':''), array(
$element,
$attr,
$text,
));
if(!empty($o['_help'])) $out.=dgs_HELP_OPEN.$o['_help'].dgs_HELP_CLOSE;
if ($print==true) {
echo $out;
return true;
} else {
return $out;
}
}
function dgs_button($text, $OPTIONS=array(), $print=true) {
// create a button
// $OPTIONS = array of option settings {including but not limited to:}
// '_style' => {blank} | primary | info | success | warning | danger | inverse | link
// '_size' => large | {blank} | small | mini
$o = array(
'_element' => 'button',
'type' => (empty($OPTIONS['type'])?'button':$OPTIONS['type']),
);
return dgs_element('btn', $text, array_merge($OPTIONS, $o), $print);
}
function dgs_buttonA($text, $OPTIONS=array(), $print=true) {
// create a button
// $OPTIONS = array of option settings {including but not limited to:}
// '_style' => {blank} | primary | info | success | warning | danger | inverse | link
// '_size' => large | {blank} | small | mini
$o = array(
'_element' => 'a',
'href' => (empty($OPTIONS['href'])?'#':$OPTIONS['href']),
);
return dgs_element('btn', $text, array_merge($OPTIONS, $o), $print);
}
function dgs_buttonI($text, $OPTIONS=array(), $print=true) {
// create a button
// $OPTIONS = array of option settings {including but not limited to:}
// '_style' => {blank} | primary | info | success | warning | danger | inverse | link
// '_size' => large | {blank} | small | mini
$o = array(
'_element' => 'input',
'type' => (empty($OPTIONS['type'])?'button':$OPTIONS['type']),
'value' => (empty($OPTIONS['value'])?((!empty($text))?$text:'Submit'):$OPTIONS['value']),
);
return dgs_element('btn', '', array_merge($OPTIONS, $o), $print);
}
function dgs_checkbox($name, $label, $value="1", $checked=false, $OPTIONS=array(), $print=true) {
// create a checkbox input
// wrapped in CLASS GROUP unless _inline option is true.
// $OPTIONS = array of option settings {including but not limited to:}
// _inline = false | true (boolean)
// _disabled = false | true (boolean)
// _help = {help block text, shown after element}
// id = {automatically assigned if left blank}
if(empty($name)) return false;
$o = array(
'checked' => (($checked)?'checked':''),
'value' => $value,
'id' => ((empty($OPTIONS['id']))?dgs_nextRegNameID($name):$OPTIONS['id']),
'_element' => 'input',
'type' => 'checkbox',
'name' => $name,
'class' => '',
'_help' => '',
);
$class = "checkbox".((!empty($OPTIONS['class']))?' '.$OPTIONS['class']:'').(((!empty($OPTIONS['_inline']))&&($OPTIONS['_inline']==true))?' inline':'');
$out = '<label class="'.$class.'">'.dgs_element('','', array_merge($OPTIONS, $o), false).'</label>';
if(!empty($OPTIONS['_help'])) $out.=dgs_HELP_OPEN.$OPTIONS['_help'].dgs_HELP_CLOSE;
if ((!empty($OPTIONS['_inline']))&&($OPTIONS['_inline']!=true)) $out = dgs_CG_OPEN.$out.dgs_CG_CLOSE;
if ($print) {
echo $out;
return true;
}
return $out;
}
function dgs_alert($text, $OPTIONS=array(), $print=true) {
// create a dismissable alert box
// $OPTIONS = array of option settings {including but not limited to:}
// '_style' => {blank} | "error" | "success" | "info"
$o = $OPTIONS;
$o['_size'] = ((strlen($text) > 80)?'block':'');
$o['_element'] = 'div';
$b = array(
'_element' => 'button',
'type' => 'button',
'data-dismiss' => 'alert'
);
$btn = dgs_element('close', '×', $b, false);
return dgs_element('alert', $btn.$text, $o, $print );
}
dgs_checkbox('mybox', "My Checkbox");
?>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 5.6.8 0.007 0.060 20.52 5.5.24 0.020 0.040 20.29 5.4.40 0.127 0.060 18.52 5.4.39 0.113 0.057 18.84 5.4.38 0.127 0.073 18.63 5.4.37 0.147 0.073 18.61 5.4.36 0.137 0.047 18.60 5.4.35 0.117 0.060 18.78 5.4.34 0.127 0.053 18.78 5.4.32 0.097 0.063 18.62 5.4.31 0.113 0.080 18.50 5.4.30 0.120 0.070 18.48 5.4.29 0.117 0.060 18.52 5.4.28 0.087 0.067 18.81 5.4.27 0.107 0.057 18.77 5.4.26 0.110 0.060 18.73 5.4.25 0.100 0.063 18.57 5.4.24 0.120 0.060 18.76 5.4.23 0.107 0.047 18.75 5.4.22 0.090 0.057 18.79 5.4.21 0.103 0.047 18.73 5.4.20 0.100 0.047 16.64 5.4.19 0.097 0.057 18.47 5.4.18 0.100 0.070 18.50 5.4.17 0.097 0.060 18.74 5.4.16 0.143 0.063 18.45 5.4.15 0.137 0.050 18.61 5.4.14 0.133 0.043 16.47 5.4.13 0.100 0.053 16.39 5.4.12 0.097 0.050 16.20 5.4.11 0.157 0.057 16.44 5.4.10 0.140 0.073 16.44 5.4.9 0.160 0.053 16.42 5.4.8 0.157 0.053 16.44 5.4.7 0.150 0.060 16.26 5.4.6 0.127 0.057 16.25 5.4.5 0.130 0.057 16.35 5.4.4 0.117 0.053 16.25 5.4.3 0.117 0.060 16.42 5.4.2 0.127 0.040 16.21 5.4.1 0.117 0.057 16.29 5.4.0 0.130 0.037 15.77 5.3.29 0.130 0.060 14.90 5.3.28 0.130 0.050 14.74 5.3.27 0.153 0.063 14.80 5.3.26 0.100 0.063 14.64 5.3.25 0.090 0.060 14.84 5.3.24 0.090 0.057 14.79 5.3.23 0.140 0.057 14.84 5.3.22 0.127 0.047 14.80 5.3.21 0.123 0.053 14.71 5.3.20 0.127 0.047 14.77 5.3.19 0.127 0.050 14.71 5.3.18 0.130 0.050 14.63 5.3.17 0.110 0.070 14.68 5.3.16 0.110 0.070 14.71 5.3.15 0.090 0.063 14.69 5.3.14 0.143 0.070 14.57 5.3.13 0.130 0.053 14.65 5.3.12 0.140 0.063 14.75 5.3.11 0.117 0.070 14.59 5.3.10 0.127 0.047 14.23 5.3.9 0.123 0.067 14.05 5.3.8 0.120 0.070 14.08 5.3.7 0.143 0.067 14.07 5.3.6 0.140 0.050 14.16 5.3.5 0.140 0.063 14.01 5.3.4 0.100 0.067 13.96 5.3.3 0.100 0.047 14.07 5.3.2 0.100 0.050 13.76 5.3.1 0.127 0.043 13.79 5.3.0 0.130 0.073 13.77 5.2.17 0.130 0.043 11.29 5.2.16 0.083 0.053 11.14 5.2.15 0.103 0.050 11.20 5.2.14 0.100 0.047 11.28 5.2.13 0.100 0.043 11.14 5.2.12 0.103 0.037 11.34 5.2.11 0.080 0.047 11.14 5.2.10 0.107 0.033 11.12 5.2.9 0.097 0.043 11.18 5.2.8 0.100 0.047 11.16 5.2.7 0.093 0.047 11.23 5.2.6 0.093 0.043 11.13 5.2.5 0.073 0.047 11.25 5.2.4 0.073 0.047 11.02 5.2.3 0.077 0.043 11.05 5.2.2 0.077 0.047 11.03 5.2.1 0.077 0.040 10.86 5.2.0 0.073 0.060 10.77 5.1.6 0.080 0.040 10.12 5.1.5 0.067 0.033 10.20 5.1.4 0.060 0.040 10.11 5.1.3 0.070 0.047 10.41 5.1.2 0.063 0.040 10.51 5.1.1 0.067 0.033 10.27 5.1.0 0.090 0.033 10.29 5.0.5 0.037 0.030 8.57 5.0.4 0.037 0.030 8.54 5.0.3 0.040 0.037 8.26 5.0.2 0.040 0.020 8.25 5.0.1 0.040 0.027 8.34 5.0.0 0.040 0.040 8.33 4.4.9 0.037 0.027 5.93 4.4.8 0.033 0.027 5.91 4.4.7 0.050 0.023 5.91 4.4.6 0.053 0.010 5.95 4.4.5 0.040 0.023 5.92 4.4.4 0.043 0.030 5.92 4.4.3 0.043 0.027 5.95 4.4.2 0.037 0.023 5.98 4.4.1 0.033 0.023 5.96 4.4.0 0.037 0.033 5.96 4.3.11 0.027 0.027 5.93 4.3.10 0.037 0.017 5.92 4.3.9 0.033 0.020 5.83 4.3.8 0.030 0.033 5.95 4.3.7 0.037 0.017 5.84 4.3.6 0.037 0.023 5.88 4.3.5 0.037 0.020 5.83 4.3.4 0.040 0.033 5.82 4.3.3 0.017 0.027 4.61 4.3.2 0.017 0.027 4.70 4.3.1 0.020 0.023 4.56 4.3.0 0.000 0.030 6.80
preferences:dark mode live preview
143.9 ms | 1394 KiB | 7 Q