You are here

function FrxInclude::render_reference in Forena Reports 7.2

Same name and namespace in other branches
  1. 6.2 plugins/FrxInclude.inc \FrxInclude::render_reference()
  2. 7.3 renderers/FrxInclude.inc \FrxInclude::render_reference()
  3. 7.4 renderers/FrxInclude.inc \FrxInclude::render_reference()
1 call to FrxInclude::render_reference()
FrxInclude::render in plugins/FrxInclude.inc

File

plugins/FrxInclude.inc, line 31

Class

FrxInclude

Code

function render_reference($url, $ext, $attributes) {
  $ext = strtolower($ext);
  $attributes = $this->teng
    ->replace($attributes);
  switch ($ext) {
    case 'png':
    case 'gif':
    case 'jpg':
    case 'jpeg':
      $x = new SimpleXMLElement('<img/>');
      $x['src'] = $url;
      if (isset($attributes['height'])) {
        $x['height'] = $attributes['height'];
      }
      if (isset($attributes['width'])) {
        $x['width'] = $attributes['width'];
      }
      break;
    case 'svg':
      $x = new SimpleXMLElement('<embed/>');
      $x['src'] = $url;
      $x['type'] = 'image/svg+xml';
      $x['pluginspage'] = "http://www.adobe.com/svg/viewer/install/";
      if (isset($attributes['height'])) {
        $x['height'] = $attributes['height'];
      }
      if (isset($attributes['width'])) {
        $x['width'] = $attributes['width'];
      }
      break;
    default:
      $x = new SimpleXMLElement('<a>' . $ext . ' document</a>');
      $x['href'] = $url;
  }
  if (isset($attributes['id'])) {
    $x['id'] = $attributes['id'];
  }
  return $x
    ->asXML();
}