* @package SimpleSAMLphp */ class SimpleSAML_XHTML_Template { /** * The data associated with this template, accessible within the template itself. * * @var array */ public $data = array(); /** * A translator instance configured to work with this template. * * @var \SimpleSAML\Locale\Translate */ private $translator; /** * The configuration to use in this template. * * @var SimpleSAML_Configuration */ private $configuration; /** * The file to load in this template. * * @var string */ private $template = 'default.php'; /** * Constructor * * @param SimpleSAML_Configuration $configuration Configuration object * @param string $template Which template file to load * @param string|null $defaultDictionary The default dictionary where tags will come from. */ public function __construct(SimpleSAML_Configuration $configuration, $template, $defaultDictionary = null) { $this->configuration = $configuration; $this->template = $template; $this->data['baseurlpath'] = $this->configuration->getBaseURL(); $this->translator = new SimpleSAML\Locale\Translate($configuration, $defaultDictionary = null); } /** * Return the internal translator object used by this template. * * @return \SimpleSAML\Locale\Translate The translator that will be used with this template. */ public function getTranslator() { return $this->translator; } /** * Show the template to the user. */ public function show() { $filename = $this->findTemplatePath($this->template); require($filename); } /** * Find template path. * * This function locates the given template based on the template name. It will first search for the template in * the current theme directory, and then the default theme. * * The template name may be on the form :