You are here

public function FrxRenderer::validateTextFormats in Forena Reports 7.4

Helper funciton for validating text_format type controls.

Parameters

unknown $config:

unknown $elements:

Return value

multitype:Ambigous <The, string, A, Optional>

4 calls to FrxRenderer::validateTextFormats()
FrxCrosstab::configValidate in renderers/FrxCrosstab.inc
Default configuration validator. Simply validates header and footer attributes.
FrxEmailMerge::configValidate in renderers/FrxEmailMerge.inc
Default configuration validator. Simply validates header and footer attributes.
FrxMergeDocument::configValidate in renderers/FrxMergeDocument.inc
Default configuration validator. Simply validates header and footer attributes.
FrxRenderer::configValidate in renderers/FrxRenderer.inc
Default configuration validator. Simply validates header and footer attributes.

File

renderers/FrxRenderer.inc, line 557
FrxRenderer.inc Base class for Frx custom renderers @author davidmetzler

Class

FrxRenderer
@file FrxRenderer.inc Base class for Frx custom renderers @author davidmetzler

Code

public function validateTextFormats(&$config, $elements) {
  $temp_dom = Frx::tempDOM();
  $errors = array();
  foreach ($elements as $element) {
    if (isset($config[$element]['value'])) {
      if ($config[$element]['value']) {
        $body_xml = '<?xml version="1.0" encoding="UTF-8"?>
           <!DOCTYPE root [
           <!ENTITY nbsp "&#160;">
           ]><html xmlns:frx="' . $this->xmlns . '"><body>' . $config[$element]['value'] . '</body></html>';
        @$temp_dom
          ->loadXML($body_xml);
        if (!$temp_dom->documentElement) {
          $errors[$element] = t('Invalid XHTML in %s', array(
            '%s' => $element,
          ));
        }
      }
    }
  }
  return $errors;
}