Class modResource

Description

Represents a web resource managed by the modX framework.

Located in /model/modx/modresource.class.php (line 7)

xPDOObject
   |
   --modAccessibleObject
      |
      --modAccessibleSimpleObject
         |
         --modResource
Direct descendents
Class Description
 class modDocument
 class modJSONRPCResource Represents a MODx Resource that services JSON-RPC client requests.
 class modStaticResource A derivative of modResource that stores content on the filesystem.
 class modSymLink A modResource derivative the represents a symbolic link.
 class modWebLink A modResource derivative the represents a redirect link.
 class modXMLRPCResource Extends modResource to service XML-RPC client requests.
Variable Summary
 string $_cacheKey
 string $_content
 string $_contextKey
 mixed $_jscripts
 string $_output
 boolean $_processed
 boolean $_refreshCache
 mixed $_sjscripts
Method Summary
 modResource __construct ( &$xpdo)
 boolean addLock ([integer $user = 0], [ $options = array()])
 void addOne ( &$obj, [ $alias = ''])
 string cleanAlias (string $alias, [ $options = array()])
 mixed duplicate ([ $options = array()])
 void findPolicy ([ $context = ''])
 string getAliasPath ([string $alias = ''], [ $fields = array()])
 string getCacheKey ()
 string getContent ([ $options = array()])
 int getLock ()
 void &getMany ( $alias, [ $criteria = null], [ $cacheFlag = false])
 void getProcessed ()
 null/mixed getTVValue (mixed $pk)
 integer hasChildren ()
 mixed isDuplicateAlias ([string $aliasPath = ''], [string $contextKey = ''])
 boolean joinGroup (mixed $resourceGroupPk)
 void mergeKeywords ()
 void mergeMetaTags ()
 string process ()
 boolean removeLock ([ $user = 0])
 void save ([ $cacheFlag = null])
 void set ( $k, [ $v = null], [ $vType = ''])
 boolean setContent (mixed $content, [ $options = array()])
Variables
string $_cacheKey = null (line 38)

The cache filename for the resource in the context.

  • access: public
string $_content = '' (line 15)

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.

  • access: public
string $_contextKey = null (line 28)

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.

  • access: public
mixed $_jscripts = array() (line 44)
  • access: public
mixed $_loadedjscripts = array() (line 46)
  • access: public
string $_output = '' (line 20)

Represents the output the resource produces.

  • access: public
boolean $_processed = false (line 33)

Indicates if the resource has already been processed.

  • access: protected
boolean $_refreshCache = true (line 43)

Indicates if the site cache should be refreshed when saving changes.

  • access: protected
mixed $_sjscripts = array() (line 45)
  • access: public

Inherited Variables

Inherited from modAccessibleObject

modAccessibleObject::$_policies

Inherited from xPDOObject

xPDOObject::$container
xPDOObject::$fieldNames
xPDOObject::$xpdo
xPDOObject::$_aggregates
xPDOObject::$_alias
xPDOObject::$_cacheFlag
xPDOObject::$_class
xPDOObject::$_composites
xPDOObject::$_dirty
xPDOObject::$_fieldMeta
xPDOObject::$_fields
xPDOObject::$_lazy
xPDOObject::$_new
xPDOObject::$_options
xPDOObject::$_package
xPDOObject::$_pk
xPDOObject::$_pktype
xPDOObject::$_relatedObjects
xPDOObject::$_table
xPDOObject::$_tableMeta
xPDOObject::$_validated
xPDOObject::$_validationLoaded
xPDOObject::$_validationRules
xPDOObject::$_validator
Methods
Constructor __construct (line 48)
modResource __construct ( &$xpdo)
  • &$xpdo

Redefinition of:
xPDOObject::__construct()
Constructor

Redefined in descendants as:
addLock (line 408)

Adds a lock on the Resource

  • return: True if the lock was successful.
  • access: public
boolean addLock ([integer $user = 0], [ $options = array()])
  • integer $user
  • array $options: An array of options for the lock.
addOne (line 246)

Adds an object related to this modResource by a foreign key relationship.

Adds legacy support for keeping the existing contentType field in sync when a modContentType is set using this function.

  • access: public
void addOne ( &$obj, [ $alias = ''])
  • &$obj
  • $alias

Redefinition of:
xPDOObject::addOne()
Adds an object related to this instance by a foreign key relationship.
cleanAlias (line 262)

Transforms a string to form a valid URL representation.

  • return: The transformed string.
  • access: public
string cleanAlias (string $alias, [ $options = array()])
  • string $alias: A string to transform into a valid URL representation.
  • array $options: Options to append to or override configuration settings.
duplicate (line 629)
  • return: Returns either an error message, or the newly created modResource object.
  • access: public
mixed duplicate ([ $options = array()])
  • array $options
findPolicy (line 476)

Loads the access control policies applicable to this resource.

  • access: public
void findPolicy ([ $context = ''])
  • $context

Redefinition of:
modAccessibleObject::findPolicy()
Find access policies applicable to this object in a specific context.
getAliasPath (line 551)

Get the Resource's full alias path.

  • access: public
string getAliasPath ([string $alias = ''], [ $fields = array()])
  • string $alias: Optional. The alias to check. If not set, will then build it from the pagetitle if automatic_alias is set to true.
  • array $fields: Optional. An array of field values to use instead of using the current modResource fields.
getCacheKey (line 152)

Returns the cache key for this instance in the current context.

  • return: The cache key.
  • access: public
string getCacheKey ()
getContent (line 89)

Gets the raw, unprocessed source content for a resource.

  • return: The raw source content for the resource.
  • access: public
string getContent ([ $options = array()])
  • array $options: An array of options implementations can use to accept language, revision identifiers, or other information to alter the behavior of the method.

Redefined in descendants as:
getLock (line 432)

Gets the lock on the Resource.

  • access: public
int getLock ()
getMany (line 173)

Gets a collection of objects related by aggregate or composite relations.

Includes special handling for related objects with alias modTemplateVar, respecting framework security unless specific criteria are provided.

  • todo: Refactor to use the new ABAC security model.
  • access: public
void &getMany ( $alias, [ $criteria = null], [ $cacheFlag = false])
  • $alias
  • $criteria
  • $cacheFlag

Redefinition of:
xPDOObject::getMany()
Gets a collection of objects related by aggregate or composite relations.
getProcessed (line 396)

Return whether or not the resource has been processed.

  • access: public
void getProcessed ()
getTVValue (line 534)

Gets the value of a TV for the Resource.

  • return: The value of the TV for the Resource, or null if the TV is not found.
  • access: public
null/mixed getTVValue (mixed $pk)
  • mixed $pk: Either the ID of the TV, or the name of the TV.
hasChildren (line 518)

Checks to see if the Resource has children or not. Returns the number of children.

  • return: The number of children of the Resource
  • access: public
integer hasChildren ()
isDuplicateAlias (line 604)

Tests to see if an alias is a duplicate.

  • return: The ID of the Resource using the alias, if a duplicate, otherwise false.
  • access: public
mixed isDuplicateAlias ([string $aliasPath = ''], [string $contextKey = ''])
  • string $aliasPath: The current full alias path. If none is passed, will build it from the Resource's currently set alias.
  • string $contextKey: The context to search for a duplicate alias in.
joinGroup (line 716)

Joins a Resource to a Resource Group

  • return: True if successful.
  • access: public
boolean joinGroup (mixed $resourceGroupPk)
  • mixed $resourceGroupPk: Either the ID, name or object of the Resource Group
mergeKeywords (line 119)

Merge in Keywords into content.

  • deprecated: 2.0
  • access: public
void mergeKeywords ()
mergeMetaTags (line 133)

Merge in META tags to content.

  • deprecated: 2.0
  • access: public
void mergeMetaTags ()
process (line 59)

Process a resource, transforming source content to output.

  • return: The processed cacheable content of a resource.
  • access: public
string process ()

Redefined in descendants as:
removeLock (line 454)

Removes all locks on a Resource.

  • return: True if locks were removed.
  • access: public
boolean removeLock ([ $user = 0])
  • $user
save (line 382)

Persist new or changed modResource instances to the database container.

If the modResource is new, the createdon and createdby fields will be set using the current time and user authenticated in the context.

  • access: public
void save ([ $cacheFlag = null])
  • $cacheFlag

Redefinition of:
modAccessibleObject::save()
Custom save that respects access policies.
set (line 209)

Set a field value by the field key or name.

Additional logic added for the following fields: -alias: Applies modResource::cleanAlias() -contentType: Calls modResource::addOne() to sync contentType -content_type: Sets the contentType field appropriately

  • access: public
void set ( $k, [ $v = null], [ $vType = ''])
  • $k
  • $v
  • $vType

Redefinition of:
xPDOObject::set()
Set a field value by the field key or name.
setContent (line 109)

Set the raw source content for this element.

  • return: True indicates the content was set.
  • access: public
boolean setContent (mixed $content, [ $options = array()])
  • mixed $content: The source content; implementations can decide if it can only be a string, or some other source from which to retrieve it.
  • array $options: An array of options implementations can use to accept language, revision identifiers, or other information to alter the behavior of the method.

Inherited Methods

Inherited From modAccessibleObject

 modAccessibleObject::checkPolicy()
 modAccessibleObject::findPolicy()
 modAccessibleObject::getPolicies()
 modAccessibleObject::load()
 modAccessibleObject::loadCollection()
 modAccessibleObject::remove()
 modAccessibleObject::save()
 modAccessibleObject::setPolicies()
 modAccessibleObject::_loadCollectionInstance()
 modAccessibleObject::_loadInstance()

Inherited From xPDOObject

 xPDOObject::__construct()
 xPDOObject::addMany()
 xPDOObject::addOne()
 xPDOObject::addValidationRule()
 xPDOObject::encode()
 xPDOObject::fromArray()
 xPDOObject::fromJSON()
 xPDOObject::get()
 xPDOObject::getFieldName()
 xPDOObject::getFKClass()
 xPDOObject::getFKDefinition()
 xPDOObject::getMany()
 xPDOObject::getOne()
 xPDOObject::getOption()
 xPDOObject::getPK()
 xPDOObject::getPKType()
 xPDOObject::getPrimaryKey()
 xPDOObject::getSelectColumns()
 xPDOObject::getValidator()
 xPDOObject::isDirty()
 xPDOObject::isLazy()
 xPDOObject::isNew()
 xPDOObject::isValidated()
 xPDOObject::load()
 xPDOObject::loadCollection()
 xPDOObject::loadCollectionGraph()
 xPDOObject::remove()
 xPDOObject::removeValidationRules()
 xPDOObject::save()
 xPDOObject::set()
 xPDOObject::setDirty()
 xPDOObject::setOption()
 xPDOObject::toArray()
 xPDOObject::toJSON()
 xPDOObject::validate()
 xPDOObject::_getAliases()
 xPDOObject::_getDataType()
 xPDOObject::_getPHPType()
 xPDOObject::_getRelatedObjectsByFK()
 xPDOObject::_initFields()
 xPDOObject::_loadCollectionInstance()
 xPDOObject::_loadFieldData()
 xPDOObject::_loadInstance()
 xPDOObject::_loadRows()
 xPDOObject::_loadValidation()
 xPDOObject::_saveRelatedObject()
 xPDOObject::_saveRelatedObjects()
 xPDOObject::_setRaw()

Documentation generated on Fri, 17 Jun 2011 10:03:45 -0600 by phpDocumentor 1.4.3