From a0f38f5fd87ca6e5a5cab916e48c15877d52b3b1 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Tue, 12 Apr 2016 07:46:30 -0400
Subject: [PATCH] Small code style improvements
---
program/lib/Roundcube/html.php | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/program/lib/Roundcube/html.php b/program/lib/Roundcube/html.php
index 9cdc971..8c2534a 100644
--- a/program/lib/Roundcube/html.php
+++ b/program/lib/Roundcube/html.php
@@ -25,14 +25,15 @@
class html
{
protected $tagname;
+ protected $content;
protected $attrib = array();
protected $allowed = array();
- protected $content;
public static $doctype = 'xhtml';
public static $lc_tags = true;
public static $common_attrib = array('id','class','style','title','align','unselectable','tabindex','role');
- public static $containers = array('iframe','div','span','p','h1','h2','h3','ul','form','textarea','table','thead','tbody','tr','th','td','style','script');
+ public static $containers = array('iframe','div','span','p','h1','h2','h3','ul','form','textarea','table','thead','tbody','tr','th','td','style','script');
+ public static $bool_attrib = array('checked','multiple','disabled','selected','autofocus','readonly');
/**
@@ -279,7 +280,7 @@
/**
* Create string with attributes
*
- * @param array $attrib Associative arry with tag attributes
+ * @param array $attrib Associative array with tag attributes
* @param array $allowed List of allowed attributes
*
* @return string Valid attribute string
@@ -319,8 +320,9 @@
}
// attributes with no value
- if (in_array($key, array('checked', 'multiple', 'disabled', 'selected', 'autofocus'))) {
+ if (in_array($key, self::$bool_attrib)) {
if ($value) {
+ // @TODO: minimize attribute in non-xhtml mode
$attrib_arr[] = $key . '="' . $key . '"';
}
}
@@ -460,7 +462,7 @@
protected $tagname = 'input';
protected $type = 'hidden';
protected $allowed = array('type','name','value','onchange','disabled','readonly');
- protected $fields_arr = array();
+ protected $fields = array();
/**
* Constructor
@@ -481,7 +483,7 @@
*/
public function add($attrib)
{
- $this->fields_arr[] = $attrib;
+ $this->fields[] = $attrib;
}
/**
@@ -492,7 +494,7 @@
public function show()
{
$out = '';
- foreach ($this->fields_arr as $attrib) {
+ foreach ($this->fields as $attrib) {
$out .= self::tag($this->tagname, array('type' => $this->type) + $attrib);
}
--
Gitblit v1.9.1