Server : Apache System : Linux indy02.toastserver.com 3.10.0-962.3.2.lve1.5.85.el7.x86_64 #1 SMP Thu Apr 18 15:18:36 UTC 2024 x86_64 User : palandch ( 1163) PHP Version : 7.1.33 Disable Function : NONE Directory : /home/palandch/www/core/model/modx/processors/element/tv/renders/web/output/ |
<?php /** * @package modx * @subpackage processors.element.tv.renders.mgr.output */ class modTemplateVarOutputRenderImage extends modTemplateVarOutputRender { public function process($value,array $params = array()) { $images= $this->tv->parseInput($value, '||', 'array'); $o= ''; foreach ($images as $image) { if (!is_array($image)) { $image= explode('==', $image); } $src= $image[0]; if ($src) { $attributes = array(); $attr = array( 'class' => $params['class'], 'src' => $src, 'id' => ($params['id'] ? $params['id'] : ''), 'alt' => htmlspecialchars($params['alttext']), 'style' => $params['style'] ); foreach ($attr as $k => $v) { if (!empty($v)) { $attributes[] = $k.'="'.$v.'"'; } } if (empty($attr['alt'])) $attributes[] = 'alt=""'; $attributes = implode(' ',$attributes); $attributes .= ' '.$params['attributes']; /* Output the image with attributes */ $o .= '<img '.rtrim($attributes).' />'; } } return $o; } } return 'modTemplateVarOutputRenderImage';