[ghelda-devel] [34] xHTML validity commit. |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/ghelda-devel Archives
]
Revision: 34
Author: odyx
Date: 2009-04-29 23:08:06 +0200 (Wed, 29 Apr 2009)
Log Message:
-----------
xHTML validity commit. Normally correct xHTML 1.1.
Modified Paths:
--------------
trunk/inc/outputs/xHTML.class.php
Modified: trunk/inc/outputs/xHTML.class.php
===================================================================
--- trunk/inc/outputs/xHTML.class.php 2009-04-29 12:31:21 UTC (rev 33)
+++ trunk/inc/outputs/xHTML.class.php 2009-04-29 21:08:06 UTC (rev 34)
@@ -424,9 +424,10 @@
} elseif(stripos($fieldProperties['type'],'text') !== false) {
$label = $this->tag('label',$fieldProperties['name'],array('for'=>$fieldName));
// Standard parameters
- $paramsArray['type'] = "text";
$paramsArray['name'] = $fieldName;
$paramsArray['id'] = $fieldName;
+ $paramsArray['rows'] = $fieldProperties['rows'];
+ $paramsArray['cols'] = $fieldProperties['cols'];
$value = !empty($fieldsContents[$fieldName_]) ? $fieldsContents[$fieldName_] : $fieldProperties['default'];
// Avoids the linereturn and so it's good
@@ -438,15 +439,16 @@
$fields .= $this->mark('p',$label.LB.$field);
} elseif(stripos($fieldProperties['type'],'date') !== false) {
- $fields .= $this->xdate($fieldProperties,$fieldsContents[$fieldName_],$fieldName,$paramsArray);
+ $field = $this->xdate($fieldProperties,$fieldsContents[$fieldName_],$fieldName,$paramsArray);
// Add the "_old" hidden stag
$paramsArray['type'] = 'hidden';
$paramsArray['name'] = g_appendOld($fieldName);
$paramsArray['id'] = g_appendOld($fieldName);
$paramsArray['value'] = $this->formatDateSimple($fieldsContents[$fieldName_]);
- $fields .= LB.$this->stag('input',$paramsArray);
+ $field .= LB.$this->stag('input',$paramsArray);
+ $fields .= $this->mark('p',LB.$field);
} elseif(stripos($fieldProperties['type'],'enum') !== false) {
- $label = $this->tag('legend',$fieldProperties['name'],array('for'=>$fieldName));
+ $label = $this->tag('legend',$fieldProperties['name'],array());
// Standard parameters
$paramsArray['type'] = "radio";
$paramsArray['name'] = $fieldName;
@@ -479,7 +481,7 @@
// Standard parameters
$paramsArray['name'] = $fieldName;
$paramsArray['id'] = $fieldName;
-
+gol('fn',$fieldName);
$options_selected = !empty($fieldsContents[$fieldName_]) ? $fieldsContents[$fieldName_] : $fieldProperties['default'];
if( $fieldProperties['multiple'] === true ) {
@@ -602,7 +604,7 @@
$mark = 'textarea';
$attributes = '';
foreach($attributes_array as $aa_key => $aa_value) {
- $attributes .= ' '.$aa_key.'="'.htmlspecialchars($aa_value).'"';
+ $attributes .= ' '.$aa_key.'="'.$this->hsc($aa_key,$aa_value).'"';
}
$LB = '';
if($do_break) $LB = LB;
@@ -614,7 +616,7 @@
{
$attributes = '';
foreach($attributes_array as $aa_key => $aa_value) {
- $attributes .= ' '.$aa_key.'="'.htmlspecialchars($aa_value).'"';
+ $attributes .= ' '.$aa_key.'="'.$this->hsc($aa_key,$aa_value).'"';
}
$LB = '';
if($do_break) $LB = LB;
@@ -626,7 +628,7 @@
{
$attributes = '';
foreach($attributes_array as $aa_key => $aa_value) {
- $attributes .= ' '.$aa_key.'="'.htmlspecialchars($aa_value).'"';
+ $attributes .= ' '.$aa_key.'="'.$this->hsc($aa_key,$aa_value).'"';
}
$LB = "";
@@ -639,7 +641,7 @@
{
$attributes = '';
foreach($attributes_array as $aa_key => $aa_value) {
- $attributes .= ' '.$aa_key.'="'.htmlspecialchars($aa_value).'"';
+ $attributes .= ' '.$aa_key.'="'.$this->hsc($aa_key,$aa_value).'"';
}
$to_return = $this->echo_("<$tag$attributes>".LB,1,$do_echo,$do_indent);
$to_return .= $this->echo_($code,0,$do_echo,$do_indent);
@@ -701,7 +703,7 @@
$dateOptions = array_key_exists('error',$fieldProperties) ? ($fieldProperties['error'] ? array("class" => "input_error") : array() ) : array();
// Get the global lists
global $DAYS,$MONTHS,$YEARS;
- $year = $this->select($YEARS,$regs[1],array_merge($paramsArray,array('name'=>g_appendOld($fieldName,'_year'))));
+ $year = $this->select($YEARS,$regs[1],array_merge($paramsArray,array('name'=>g_appendOld($fieldName,'_year'),'id'=>g_appendOld($fieldName,'_year'))));
$month = $this->select($MONTHS,$regs[2],array_merge($paramsArray,array('name'=>g_appendOld($fieldName,'_month'))));
$day = $this->select($DAYS,$regs[3],array_merge($paramsArray,array('name'=>g_appendOld($fieldName,'_day'))));
@@ -709,7 +711,7 @@
$formattedDate = str_replace('%MONTH%',$month,$formattedDate);
$formattedDate = str_replace('%DAY%',$day,$formattedDate);
// Stack the fields
- return $this->mark('p',$label.$formattedDate);
+ return $label.$formattedDate;
}
private function formatDate($date)
@@ -752,6 +754,12 @@
return $imageTitle;
}
}
-
+
+ private function hsc($key,$value) {
+ // xHTML Validity
+ if( $key == "id" || $key == "for")
+ $value = str_replace(array('[',']'),array('',''),$value);
+ return htmlspecialchars($value);
+ }
}
?>