<?php
/**
* Represents a web resource managed by the modX framework.
*
* @package modx
*/
class modResource extends modAccessibleSimpleObject {
/**
* Represents the cacheable content for a resource.
*
* Note that this is not the raw source content, but the content that is the
* result of processing cacheable tags within the raw source content.
* @var string
*/
public $_content= '';
/**
* Represents the output the resource produces.
* @var string
*/
public $_output= '';
/**
* The context the resource is requested from.
*
* Note that this is different than the context_key field that describes a
* primary context for the resource.
* @var string
*/
public $_contextKey= null;
/**
* Indicates if the resource has already been processed.
* @var boolean
*/
protected $_processed= false;
/**
* The cache filename for the resource in the context.
* @var string
*/
public $_cacheKey= null;
/**
* Indicates if the site cache should be refreshed when saving changes.
* @var boolean
*/
protected $_refreshCache= true;
public $_jscripts = array();
public $_sjscripts = array();
public $_loadedjscripts = array();
function __construct(& $xpdo) {
parent :: __construct($xpdo);
$this->_contextKey= isset ($this->xpdo->context) ? $this->xpdo->context->get('key') : 'web';
$this->_cacheKey= "[contextKey]/resources/[id]";
}
/**
* Process a resource, transforming source content to output.
*
* @return string The processed cacheable content of a resource.
*/
public function process() {
if (!$this->get('cacheable') || !$this->_processed || !$this->_content) {
$this->_content= '';
$this->_output= '';
$this->xpdo->getParser();
if ($baseElement= $this->getOne('Template')) {
if ($baseElement->process()) {
$this->_content= $baseElement->_output;
$this->_processed= true;
}
} else {
$this->_content= $this->getContent();
$maxIterations= intval($this->xpdo->getOption('parser_max_iterations',10));
$this->xpdo->parser->processElementTags('', $this->_content, false, false, '[[', ']]', array(), $maxIterations);
$this->_processed= true;
}
}
$this->mergeKeywords();
$this->mergeMetatags();
return $this->_content;
}
/**
* Gets the raw, unprocessed source content for a resource.
*
* @param array $options An array of options implementations can use to
* accept language, revision identifiers, or other information to alter the
* behavior of the method.
* @return string The raw source content for the resource.
*/
public function getContent(array $options = array()) {
$content = '';
if (isset($options['content'])) {
$content = $options['content'];
} else {
$content = $this->get('content');
}
return $content;
}
/**
* Set the raw source content for this element.[2010-12-20 07:36:22] (ERROR @ /connectors/lang.js.php) Could not load class: modAccessibleSimpleObject from mysql.modaccessible