Class for static methods related to content
| abstract | |
|---|---|
| since | 0.8 |
| package |
CMS |
| license |
GPL |
get_instance() : \ContentOperations
getContentObject() : \getContentObject()
\getContentObject()
LoadContentFromSerializedData(array &$data) : \ContentBase
Expects an associative array with 2 elements: content_type: string A content type name serialized_content: string Serialized form data
array $dataA content object derived from ContentBase
CreateNewContent(mixed $type) : \ContentBase
if the content type is registered with the system, and the class does not exist, the appropriate filename will be included and then, if possible a new object of the designated type will be instantiated.
mixed $typeThe type. Either a string, or an instance of CmsContentTypePlaceHolder
(A valid object derived from ContentBase)
LoadContentFromId(integer $id = null) : mixed
integer $idThe id of the content object to load
mixed
The loaded content object. If nothing is found, returns void
SmartLoadContentFromAlias(mixed $alias) : \ContentBase|null
Uses various optimization routines to increase performance. This method will generate notices or errors if the input is invalid.
mixed $aliasEither an integer id OR a string alias
\ContentBase|null
LoadContentFromAlias(integer $alias, boolean $only_active = false) : \ContentBase
integer $aliasThe alias of the content object to load
boolean $only_activeIf true, only return the object if it's active flag is true. Defaults to false.
The loaded content object. If nothing is found, returns NULL.
GetDefaultContent() : integer
integer
The id of the default content page
register_content_type(\CmsContentTypePlaceHolder $obj)
\CmsContentTypePlaceHolder $objListContentTypes(boolean $byclassname = false, boolean $allowed = false, boolean $system = FALSE) : array
boolean $byclassnameoptionally return keys as class names.
boolean $allowedoptionally trim the list of content types that are allowed by the site preference.
boolean $systemreturn only system content types.
array
List of content types registered in the system.
SetAllHierarchyPositions()
This is an expensive operation on the database, but must be called once each time one or more content pages are updated if positions have changed in the page structure.
GetLastContentModification() : \unix
\unix
timestamp representing the last time a content page was modified.
GetAllContentAsHierarchy() : \cms_content_tree
LoadAllContent(boolean $loadprops = FALSE, boolean $inactive = FALSE, boolean $showinmenu = FALSE)
boolean $loadpropsLoad extended content properties or just the page structure and basic properties
boolean $inactiveLoad inactive pages as well
boolean $showinmenuLoad pages marked as show in menu
LoadChildren(integer $id = null, boolean $loadprops = false, boolean $all = false, array $explicit_ids = array())
This is a smart method that determines what needs to be loaded, and adds them to the content cache the idea is to optimize memory by requests.
integer $idThe parent of the content objects to load into the tree
boolean $loadpropsIf true, load the properties of all loaded content objects
boolean $allIf true, load all content objects, even inactive ones.
array $explicit_ids(optional) array of explicit content ids to load
SetDefaultContent(integer $id)
integer $idThe id to set as default
GetAllContent() : array
Caution: it is entirely possible that this method (and other similar methods of loading content) will result in a memory outage if there are large amounts of content objects AND/OR large amounts of content properties. Use with caution.
array
The array of content objects
CreateHierarchyDropdown(integer $current = '', integer $value = '', string $name = 'parent_id', boolean $allowcurrent, boolean $use_perms, boolean $ignore_current, boolean $allow_all = false, boolean $for_child = false) : string
This method was rewritten for 2.0 to use the jquery hierselector plugin to better accommodate larger websites.
Since many parameters are now ignored, A new method needs to be writtent o replace this archaic method... so consider this method to be deprecateed.
integer $currentThe id of the content object we are working with. Used with allowcurrent to not show children of the current conrent object, or itself.
integer $valueThe id of the currently selected content object.
string $nameThe html name of the dropdown.
boolean $allowcurrentEnsures that the current value cannot be selected, or $current and it's childrern. Used to prevent circular deadlocks.
boolean $use_permsIf true, checks authorship permissions on pages and only shows those the current user has authorship of (can edit)
boolean $ignore_current(ignored as of 2.0) (Before 2.2 this parameter was called ignore_current
boolean $allow_allIf true, show all items, even if the content object doesn't have a valid link. Defaults to false.
boolean $for_childIf true, assume that we want to add a new child and obey the WantsChildren flag of each content page. (new in 2.2).
string
The html dropdown of the hierarchy.
GetDefaultPageID() : integer
integer
The id of the default page. false if not found.
GetPageIDFromAlias(string $alias) : integer
string $aliasThe alias to query
integer
The resulting id. null if not found.
GetPageIDFromHierarchy(string $position) : integer
string $positionThe position to query
integer
The resulting id. false if not found.
GetPageAliasFromID(integer $id) : string
integer $idThe content id to query
string
The resulting content alias. false if not found.
CheckAliasUsed(string $alias, integer $content_id = -1) : boolean
string $aliasThe alias to check
integer $content_idThe id of hte current page, if any
boolean
CheckAliasValid(string $alias) : boolean
string $aliasThe alias to check
boolean
CheckAliasError(string $alias, integer $content_id = -1) : string
string $aliasThe content alias to check
integer $content_idThe id of the current page, for used alias checks on existing pages
string
The error, if any. If there is no error, returns FALSE.
CreateFriendlyHierarchyPosition(string $position) : string
string $positionThe hierarchy position to convert
string
The unfriendly version of the hierarchy string
CreateUnfriendlyHierarchyPosition(string $position) : string
string $positionThe hierarchy position to convert
string
The friendly version of the hierarchy string
CheckParentage(integer $test_id, integer $base_id = null) : boolean
integer $test_idPage ID to test
integer $base_id(optional) Page ID to act as the base page. The current page is used if not specified.
boolean
GetOwnedPages(integer $userid) : array
integer $useridThe userid
array
Array of integer page id's
CheckPageOwnership(integer $userid, integer $pageid) : boolean
integer $useridinteger $pageid boolean
GetPageAccessForUser(integer $userid) : array<mixed,integer>
integer $useridThe userid
array<mixed,integer>
Array of page id's
CheckPageAuthorship(integer $userid, integer $contentid) : boolean
integer $useridinteger $contentid boolean
CheckPeerAuthorship(integer $userid, integer $contentid) : boolean
integer $useridinteger $contentid boolean
quickfind_node_by_id(integer $id) : \cms_content_tree
save_content(\ContentBase $content)
delete_content(\ContentBase $content)
This method assumes that the input content object has an id. If it does then the database record will be removed. This method also deletes all associated data, calls hooks, and updates hierarchy positions of other content items as appropriate.
This method does not alter the input content object, so users must exercise caution with the content object after it has been removed.
\ContentBase $contentThe object to delete.
change_content_order(\ContentBase $content, integer $direction)
This method will also update content hierarchy positions as is a appropriate.
\ContentBase $contentThe content object to modify
integer $directionA negative value indicates to move the item up, a positive value indicates to move the item down amongst its peers.
set_default_content(\ContentBase $content)
This method does not alter the input content object, it merely modifies the database.
\ContentBase $contentcalculate_unused_content_alias(\ContentBase $content, string $seed = null) : string
\ContentBase $contentThe content object to use when generating an alias
string $seedan optional seed string. If not used, look at the content object.
string