comparison program/lib/Roundcube/rcube_washtml.php @ 22:303b85d5b561

More cleaning up php8 Warnings/deprecations
author Charlie Root
date Wed, 15 Oct 2025 14:06:27 -0400
parents 73124dd49283
children c32b53434b47
comparison
equal deleted inserted replaced
21:73124dd49283 22:303b85d5b561
213 * Class constructor 213 * Class constructor
214 */ 214 */
215 public function __construct($p = array()) 215 public function __construct($p = array())
216 { 216 {
217 $this->_html_elements = array_flip((array)$p['html_elements']) + array_flip(self::$html_elements); 217 $this->_html_elements = array_flip((array)$p['html_elements']) + array_flip(self::$html_elements);
218 $this->_html_attribs = array_flip((array)$p['html_attribs']) + array_flip(self::$html_attribs); 218 $this->_html_attribs = array_flip((array)$p['html_attribs']??array()) + array_flip(self::$html_attribs);
219 $this->_ignore_elements = array_flip((array)$p['ignore_elements']) + array_flip(self::$ignore_elements); 219 $this->_ignore_elements = array_flip((array)$p['ignore_elements']??array()) + array_flip(self::$ignore_elements);
220 $this->_void_elements = array_flip((array)$p['void_elements']) + array_flip(self::$void_elements); 220 $this->_void_elements = array_flip((array)$p['void_elements']??array()) + array_flip(self::$void_elements);
221 221
222 unset($p['html_elements'], $p['html_attribs'], $p['ignore_elements'], $p['void_elements']); 222 unset($p['html_elements'], $p['html_attribs'], $p['ignore_elements'], $p['void_elements']);
223 223
224 $this->config = $p + array('show_washed' => true, 'allow_remote' => false, 'cid_map' => array()); 224 $this->config = $p + array('show_washed' => true, 'allow_remote' => false, 'cid_map' => array());
225 } 225 }
364 /** 364 /**
365 * Wash URI value 365 * Wash URI value
366 */ 366 */
367 private function wash_uri($uri, $blocked_source = false) 367 private function wash_uri($uri, $blocked_source = false)
368 { 368 {
369 if (($src = $this->config['cid_map'][$uri]) 369 if (!empty($this->config) &&
370 || ($src = $this->config['cid_map'][$this->config['base_url'].$uri]) 370 (($src = $this->config['cid_map'][$uri])
371 || ($src = $this->config['cid_map'][$this->config['base_url'].$uri]))
371 ) { 372 ) {
372 return $src; 373 return $src;
373 } 374 }
374 375
375 // allow url(#id) used in SVG 376 // allow url(#id) used in SVG
453 454
454 do { 455 do {
455 switch ($node->nodeType) { 456 switch ($node->nodeType) {
456 case XML_ELEMENT_NODE: //Check element 457 case XML_ELEMENT_NODE: //Check element
457 $tagName = strtolower($node->nodeName); 458 $tagName = strtolower($node->nodeName);
458 if ($callback = $this->handlers[$tagName]) { 459 if ($callback = $this->handlers[$tagName]??null) {
459 $dump .= call_user_func($callback, $tagName, 460 $dump .= call_user_func($callback, $tagName,
460 $this->wash_attribs($node), $this->dumpHtml($node, $level), $this); 461 $this->wash_attribs($node), $this->dumpHtml($node, $level), $this);
461 } 462 }
462 else if (isset($this->_html_elements[$tagName])) { 463 else if (isset($this->_html_elements[$tagName])) {
463 $content = $this->dumpHtml($node, $level); 464 $content = $this->dumpHtml($node, $level);