/** * Process specifically script-related functionality for modScript objects. * * {@inheritdoc} */ public function process($properties = null, $content = null) { parent::process($properties, $content); if (!$this->_processed) { $scriptName = $this->getScriptName(); $this->_result = function_exists($scriptName); if (!$this->_result) { $this->_result = $this->loadScript(); } if ($this->_result) { if (empty($this->xpdo->event)) { $this->xpdo->event = new stdClass(); } $this->xpdo->event->params = $this->_properties; /* store params inside event object */ ob_start(); $this->_output = $scriptName($this->_properties); $this->_output = ob_get_contents() . $this->_output; ob_end_clean(); if ($this->_output && is_string($this->_output)) { /* collect element tags in the evaluated content and process them */ $maxIterations = intval($this->xpdo->getOption('parser_max_iterations', null, 10)); $this->xpdo->parser->processElementTags($this->_tag, $this->_output, $this->xpdo->parser->isProcessingUncacheable(), $this->xpdo->parser->isRemovingUnprocessed(), '[[', ']]', array(), $maxIterations); } $this->filterOutput(); unset($this->xpdo->event->params); $this->cache(); } } $this->_processed = true; /* finally, return the processed element content */ return $this->_output; }
/** * Process the template variable and return the output. * * {@inheritdoc} */ public function process($properties = null, $content = null) { parent::process($properties, $content); if (!$this->_processed) { $this->_content = $this->renderOutput($this->xpdo->resourceIdentifier); /* copy the content source to the output buffer */ $this->_output = $this->_content; if (is_string($this->_output) && !empty($this->_output)) { /* turn the processed properties into placeholders */ $scope = $this->xpdo->toPlaceholders($this->_properties, '', '.', true); /* collect element tags in the content and process them */ $maxIterations = intval($this->xpdo->getOption('parser_max_iterations', null, 10)); $this->xpdo->parser->processElementTags($this->_tag, $this->_output, false, false, '[[', ']]', array(), $maxIterations); /* remove the placeholders set from the properties of this element and restore global values */ if (isset($scope['keys'])) { $this->xpdo->unsetPlaceholders($scope['keys']); } if (isset($scope['restore'])) { $this->xpdo->toPlaceholders($scope['restore']); } } /* apply output filtering */ $this->filterOutput(); /* cache the content */ $this->cache(); $this->_processed = true; } /* finally, return the processed element content */ return $this->_output; }
/** * Process the template content and return the output. * * {@inheritdoc} */ public function process($properties = null, $content = null) { parent::process($properties, $content); if (!$this->_processed) { $this->_output = $this->_content; if (is_string($this->_output) && !empty($this->_output)) { /* turn the processed properties into placeholders */ $this->toPlaceholders($this->_properties); /* collect element tags in the content and process them */ $maxIterations = intval($this->xpdo->getOption('parser_max_iterations', null, 10)); $this->xpdo->parser->processElementTags($this->_tag, $this->_output, false, false, '[[', ']]', array(), $maxIterations); } $this->filterOutput(); $this->_processed = true; } return $this->_output; }
/** * Process specifically script-related functionality for modScript objects. * * {@inheritdoc} */ public function process($properties = null, $content = null) { parent::process($properties, $content); if (!$this->_processed) { $this->_scriptFilename = $this->loadScript(); $this->_result = $this->_scriptFilename !== false && is_readable($this->_scriptFilename); if ($this->_result) { if (empty($this->xpdo->event)) { $this->xpdo->event = new stdClass(); } $modx =& $this->xpdo; $scriptProperties = $this->xpdo->event->params = $this->_properties; /* store params inside event object */ ob_start(); unset($properties, $content); extract($scriptProperties, EXTR_SKIP); $includeResult = (include $this->_scriptFilename); $includeResult = $includeResult === null ? '' : $includeResult; if (ob_get_length()) { $this->_output = ob_get_contents() . $includeResult; } else { $this->_output = $includeResult; } ob_end_clean(); if ($this->_output && is_string($this->_output)) { /* collect element tags in the evaluated content and process them */ $maxIterations = intval($this->xpdo->getOption('parser_max_iterations', null, 10)); $this->xpdo->parser->processElementTags($this->_tag, $this->_output, $this->xpdo->parser->isProcessingUncacheable(), $this->xpdo->parser->isRemovingUnprocessed(), '[[', ']]', array(), $maxIterations); } $this->filterOutput(); unset($this->xpdo->event->params); $this->cache(); } } $this->_processed = true; $this->xpdo->parser->setProcessingElement(false); /* finally, return the processed element content */ return $this->_output; }