Small code style improvements

pull/5198/head
Aleksander Machniak 8 years ago
parent e8ab3d96bd
commit a0f38f5fd8

@ -2171,7 +2171,7 @@ class rcmail extends rcube
/** /**
* Returns supported font-family specifications * Returns supported font-family specifications
* *
* @param string $font Font name * @param string $font Font name
* *
* @param string|array Font-family specification array or string (if $font is used) * @param string|array Font-family specification array or string (if $font is used)
*/ */
@ -2203,8 +2203,8 @@ class rcmail extends rcube
/** /**
* Create a human readable string for a number of bytes * Create a human readable string for a number of bytes
* *
* @param int Number of bytes * @param int $bytes Number of bytes
* @param string Size unit * @param string &$unit Size unit
* *
* @return string Byte string * @return string Byte string
*/ */
@ -2235,7 +2235,7 @@ class rcmail extends rcube
/** /**
* Returns real size (calculated) of the message part * Returns real size (calculated) of the message part
* *
* @param rcube_message_part Message part * @param rcube_message_part $part Message part
* *
* @return string Part size (and unit) * @return string Part size (and unit)
*/ */
@ -2319,6 +2319,8 @@ class rcmail extends rcube
* Get resource file content (with assets_dir support) * Get resource file content (with assets_dir support)
* *
* @param string $name File name * @param string $name File name
*
* @return string File content
*/ */
public function get_resource_content($name) public function get_resource_content($name)
{ {

@ -25,14 +25,15 @@
class html class html
{ {
protected $tagname; protected $tagname;
protected $content;
protected $attrib = array(); protected $attrib = array();
protected $allowed = array(); protected $allowed = array();
protected $content;
public static $doctype = 'xhtml'; public static $doctype = 'xhtml';
public static $lc_tags = true; public static $lc_tags = true;
public static $common_attrib = array('id','class','style','title','align','unselectable','tabindex','role'); 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 @@ class html
/** /**
* Create string with attributes * 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 * @param array $allowed List of allowed attributes
* *
* @return string Valid attribute string * @return string Valid attribute string
@ -319,8 +320,9 @@ class html
} }
// attributes with no value // attributes with no value
if (in_array($key, array('checked', 'multiple', 'disabled', 'selected', 'autofocus'))) { if (in_array($key, self::$bool_attrib)) {
if ($value) { if ($value) {
// @TODO: minimize attribute in non-xhtml mode
$attrib_arr[] = $key . '="' . $key . '"'; $attrib_arr[] = $key . '="' . $key . '"';
} }
} }
@ -460,7 +462,7 @@ class html_hiddenfield extends html
protected $tagname = 'input'; protected $tagname = 'input';
protected $type = 'hidden'; protected $type = 'hidden';
protected $allowed = array('type','name','value','onchange','disabled','readonly'); protected $allowed = array('type','name','value','onchange','disabled','readonly');
protected $fields_arr = array(); protected $fields = array();
/** /**
* Constructor * Constructor
@ -481,7 +483,7 @@ class html_hiddenfield extends html
*/ */
public function add($attrib) public function add($attrib)
{ {
$this->fields_arr[] = $attrib; $this->fields[] = $attrib;
} }
/** /**
@ -492,7 +494,7 @@ class html_hiddenfield extends html
public function show() public function show()
{ {
$out = ''; $out = '';
foreach ($this->fields_arr as $attrib) { foreach ($this->fields as $attrib) {
$out .= self::tag($this->tagname, array('type' => $this->type) + $attrib); $out .= self::tag($this->tagname, array('type' => $this->type) + $attrib);
} }

@ -14,7 +14,7 @@ class Framework_LdapGeneric extends PHPUnit_Framework_TestCase
function test_class() function test_class()
{ {
// skip test if Net_LDAP3 does not exist // skip test if Net_LDAP3 does not exist
if (!class_exists('Net_LDAP3')) { if (!@class_exists('Net_LDAP3')) {
$this->markTestSkipped('The Net_LDAP3 package not available.'); $this->markTestSkipped('The Net_LDAP3 package not available.');
} }

Loading…
Cancel
Save