ZenphotoCMS 1.6.2

ZenpageNews extends ZenpageItems

zenpage news class

Tags
author

Malte Müller (acrylian)

Table of Contents

Properties

$categories  : mixed
$comments  : mixed
$exists  : mixed
$index  : mixed
$loaded  : mixed
$manage_rights  : mixed
$manage_some_rights  : mixed
$table  : mixed
$transient  : mixed
$view_rights  : mixed
$id  : mixed
$is_protected  : mixed
$is_public  : mixed
$sortdirection  : mixed
$sortSticky  : mixed
$sorttype  : mixed
$cache_by  : mixed
$commentcount  : mixed
$data  : mixed
$tempdata  : mixed
$unique_set  : mixed
$updates  : mixed
$use_cache  : mixed

Methods

__construct()  : mixed
Class instantiator
__toString()  : string
"Magic" function to return a string identifying the object when it is treated as a string
addComment()  : object
Adds comments to the album assumes data is coming straight from GET or POST
categoryIsVisible()  : mixed
returns true if the article exists in any published category (or in no categories)
checkAccess()  : mixed
Checks if viewing of object is allowed by rights or protection status
checkChanges()  : bool
By default the object is saved if there are any updates within the property `$updates` no matter if these are actual changes to existing data.
checkForGuest()  : mixed
Checks if the item is password protected and if the password has been entered
checkforGuest()  : mixed
See if a guest is logged on to the news category.
checkPublishDates()  : bool
Checks if the item is either expired or needs to be scheduled published
checkScheduledPublishing()  : int
Checks if the item has expired or is in scheduled publishing
clearCache()  : mixed
Clears the object cache by setting it to an empty array completely or a specific object (class name) cache.
clearObjectCache()  : mixed
Shortcut to clear the cache of the current object class only
copy()  : mixed
duplicates an article
countHit()  : mixed
counts visits to the object
get()  : mixed
Get the value of a variable. If $current is false, return the value as of the last save of this object.
getAuthor()  : string
Returns the author
getCategories()  : array<string|int, mixed>
Gets the categories assigned to an news article
getCodeblock()  : array<string|int, mixed>
Returns the codeblocks as an serialized array
getCommentCount()  : int
Returns the count of comments in the album. Ignores comments in moderation
getComments()  : array<string|int, mixed>
Returns an array of comments for this album
getCommentsAllowed()  : bool
Retuns true if comments are allowed
getContent()  : string
Returns the content
getCustomData()  : string
returns the custom data field
getData()  : array<string|int, mixed>
returns the database record of the object
getDateTime()  : int
Returns the unformatted date
getExpireDate()  : string
Returns the expired date if available,
getExtraContent()  : string
Returns the extra content
getHitcounter()  : int
Returns the hitcount
getID()  : string
Returns the id
getIndex()  : int
Get the index of this article
getLastChange()  : string
Returns the last change user
getLastChangeUser()  : string
Returns the last change user
getLevel()  : int
Gets the level based on the sort order if the theme object is hierachical. Otherwise returns 1 (top level)
getLink()  : string
Returns the url to a news article
getLocked()  : string
Returns the locked status , "1" if locked (only used on the admin)
getName()  : string
Returns the name (titlelink)
getNewsLoopPage()  : int
Returns the page number in the news loop
getNextArticle()  : object
Returns the next article.
getParentID()  : string
Returns the partent id
getPassword()  : null
Gets the password if set
getPermalink()  : string
Returns the perma link status (only used on admin)
getPrevArticle()  : object
Return the previous article
getShow()  : bool
Returns true published
getSticky()  : bool
Returns true if the article is sticky
getTags()  : string
Returns the tag data
getTitle()  : string
Returns the title
getTitlelink()  : string
Returns the titlelink
getTruncation()  : mixed
getUrParent()  : mixed
Gets the object of the oldest ancester of the page or category. Returns the object of the page/category itself if there is no urparent
hasExpiration()  : bool
Returns true if the item will be automatically unpublished by a not yet reached future expire date
hasExpired()  : bool
Returns true if the items has been unpublished after reaching the set expire date.
hasExpireDate()  : bool
Returns true if the item has a proper expire date set no matter if it has expired already or will expire in the future
hasFutureDate()  : string
Returns the future date (publishdate for gallery, date for Zenpage items) if set to the future only
hasInactiveExpiration()  : bool
Returns true if a future expiredate is set but the item is unpublished
hasInactivePublishSchedule()  : bool
Returns true if the item has a future date but is not published
hasPublishSchedule()  : bool
Returns true if the item will be automatically published by a future date set
hasTag()  : bool
Checks if an object has a tag assigned.
inNewsCategory()  : bool
Checks if an article is in a category and returns TRUE or FALSE
inProtectedCategory()  : bool
Checks if an article is in a password protected category and returns TRUE or FALSE
instantiate()  : bool
}
inSubNewsCategoryOf()  : bool
Checks if an article is in a sub category of $catlink
isMyItem()  : mixed
Checks if user is news author
isProtected()  : bool
Returns true if the article is protected by a category
isProtectedByParent()  : bool
Returns true if not protected but protection is inherited by a parent Note: Here the same as isProtected() to align with other objects
isPublic()  : bool
Returns true if this article is published and in any published category
isPublished()  : bool
Returns true if the item itself is published
isUnpublishedByParent()  : bool
Returns true if itself published but unpublished status is inheretited by a parent
isVisible()  : bool
Checks if the current item is visible (= listed) to the current visitor via rights, publish status or protection status
move()  : mixed
Change one or more values of the unique set assigned to this record.
remove()  : mixed
Deletes an news article from the database
save()  : mixed
Save the updates made to this object since the last update. Returns true if successful, false if not.
set()  : mixed
Set a variable in this object. Does not persist to the database until save() is called. So, IMPORTANT: Call save() after set() to persist.
setAuthor()  : mixed
sets the author attribute
setCategories()  : mixed
setCodeblock()  : mixed
set the codeblocks as an serialized array
setCommentsAllowed()  : mixed
Sets the comments allowed flag
setContent()  : mixed
Set the content datum
setCustomData()  : mixed
Sets the custom data field
setDateTime()  : mixed
Stores the date
setExpireDate()  : mixed
sets the expire date
setExtraContent()  : mixed
sets the extra content
setLastChange()  : mixed
stores the current date in the format 'Y-m-d H:i:s' as the last change date
setLastchangeUser()  : mixed
stores the last change user
setLocked()  : mixed
sets the locked status , "1" if locked (only used on the admin)
setName()  : mixed
sets the name (title link)
setParentID()  : mixed
Sets the ParentID field
setPermalink()  : mixed
setPublished()  : mixed
Stores the published value
setShow()  : mixed
Stores the published value
setSticky()  : mixed
setTags()  : mixed
Stores tag information
setTitle()  : mixed
Stores the title
setTitlelink()  : mixed
sets the title link
setTruncation()  : mixed
setDefaults()  : mixed
Sets default values for new objects using the set() method.
addToCache()  : mixed
add the entry to the cache
getFromCache()  : mixed
check the cache for presence of the entry and return it if found
load()  : false
Load the data array from the database, using the unique id set to get the unique record.

Properties

Methods

__construct()

Class instantiator

public __construct(mixed $titlelink[, mixed $allowCreate = NULL ]) : mixed
Parameters
$titlelink : mixed
$allowCreate : mixed = NULL

__toString()

"Magic" function to return a string identifying the object when it is treated as a string

public __toString() : string
Return values
string

addComment()

Adds comments to the album assumes data is coming straight from GET or POST

public addComment(string $name, string $email, string $website, string $comment, string $code, string $code_ok, string $ip, bool $private, bool $anon, string $customdata, bool $dataconfirmation) : object

Returns a comment object

Parameters
$name : string

Comment author name

$email : string

Comment author email

$website : string

Comment author website

$comment : string

body of the comment

$code : string

CAPTCHA code entered

$code_ok : string

CAPTCHA hash expected

$ip : string

the IP address of the comment poster

$private : bool

set to true if the comment is for the admin only

$anon : bool

set to true if the poster wishes to remain anonymous

$customdata : string
$dataconfirmation : bool

true or false if data privacy confirmation was required

Return values
object

categoryIsVisible()

returns true if the article exists in any published category (or in no categories)

public categoryIsVisible() : mixed
Tags
deprecated
2.0

Use if($obj->isPublic() || zp_loggedin(ALL_NEWS_RIGHTS)) { … } for a equivalent check instead.

checkAccess()

Checks if viewing of object is allowed by rights or protection status

public checkAccess([string &$hint = NULL ][, string &$show = NULL ]) : mixed
Parameters
$hint : string = NULL
$show : string = NULL

checkChanges()

By default the object is saved if there are any updates within the property `$updates` no matter if these are actual changes to existing data.

public checkChanges([bool $update = true ]) : bool

This checks that and internally updates the $updates property with the actual changes obky so you optionally can skip unnecessary object saves.

Standard object fields lastchange and lastchangeuser are exclude because lastchange always changes and both make no sense if there is no actual content change at all.

This can be used before calling the save() method or enabled within the save() method optionally

Parameters
$update : bool = true

True (default) to also update the $updates property with changes found or clear it. False to only check for changes.

Tags
see
save()
since
1.5.2
Return values
bool

checkForGuest()

Checks if the item is password protected and if the password has been entered

public checkForGuest([ &$hint = NULL ][,  &$show = NULL ]) : mixed
Parameters
$hint : = NULL
$show : = NULL

checkforGuest()

See if a guest is logged on to the news category.

public checkforGuest([ &$hint = NULL ][,  &$show = NULL ]) : mixed

Note: If any belonging category is plublic or he is logged on, then success.

Parameters
$hint : = NULL
$show : = NULL

checkPublishDates()

Checks if the item is either expired or needs to be scheduled published

public checkPublishDates() : bool

Unpublishes the item if expired (saves to db) or scheduled (temporary) and returns false if expired or scheduled.

Return values
bool

checkScheduledPublishing()

Checks if the item has expired or is in scheduled publishing

public static checkScheduledPublishing(array<string|int, mixed> $row) : int

Returns 1 if expired, 2 if in scheduled future publishing

Parameters
$row : array<string|int, mixed>

database row of the object

Tags
since
1.5.7
  • Code moved from the deprecated checKPublishDates() function
Return values
int

clearCache()

Clears the object cache by setting it to an empty array completely or a specific object (class name) cache.

public static clearCache([mixed $class = null ]) : mixed

Note: You normally never need to use this. But on certain occasions it may be necessary to avoid memory issues if you loop through a lot of object creations.

Parameters
$class : mixed = null
Tags
since
1.5.8
since
1.6:

Method was made static

global

array $_zp_object_cache

clearObjectCache()

Shortcut to clear the cache of the current object class only

public clearObjectCache() : mixed
Tags
since
1.6

copy()

duplicates an article

public copy(string $newtitle) : mixed
Parameters
$newtitle : string

the title for the new article

get()

Get the value of a variable. If $current is false, return the value as of the last save of this object.

public get(mixed $var[, mixed $current = true ]) : mixed
Parameters
$var : mixed
$current : mixed = true

getAuthor()

Returns the author

public getAuthor([bool $fullname = false ]) : string
Parameters
$fullname : bool = false

Set to true to get the full name (if the author is a vaild user of the site and has the full name defined)

Return values
string

getCategories()

Gets the categories assigned to an news article

public getCategories() : array<string|int, mixed>
Return values
array<string|int, mixed>

getCodeblock()

Returns the codeblocks as an serialized array

public getCodeblock() : array<string|int, mixed>
Return values
array<string|int, mixed>

getCommentCount()

Returns the count of comments in the album. Ignores comments in moderation

public getCommentCount() : int
Return values
int

getComments()

Returns an array of comments for this album

public getComments([bool $moderated = false ][, bool $private = false ][, bool $desc = false ]) : array<string|int, mixed>
Parameters
$moderated : bool = false

if false, ignores comments marked for moderation

$private : bool = false

if false ignores private comments

$desc : bool = false

set to true for descending order

Return values
array<string|int, mixed>

getCommentsAllowed()

Retuns true if comments are allowed

public getCommentsAllowed() : bool
Return values
bool

getContent()

Returns the content

public getContent([mixed $locale = NULL ]) : string
Parameters
$locale : mixed = NULL
Return values
string

getCustomData()

returns the custom data field

public getCustomData([mixed $locale = NULL ]) : string
Parameters
$locale : mixed = NULL
Return values
string

getData()

returns the database record of the object

public getData() : array<string|int, mixed>
Return values
array<string|int, mixed>

getDateTime()

Returns the unformatted date

public getDateTime() : int
Return values
int

getExpireDate()

Returns the expired date if available,

public getExpireDate() : string
Tags
since
1.6.1

Added as placeholder for general class compatibility. Child classes need to override properly

Return values
string

getExtraContent()

Returns the extra content

public getExtraContent([mixed $locale = NULL ]) : string
Parameters
$locale : mixed = NULL
Return values
string

getHitcounter()

Returns the hitcount

public getHitcounter() : int
Return values
int

getIndex()

Get the index of this article

public getIndex() : int
Return values
int

getLastChange()

Returns the last change user

public getLastChange() : string
Return values
string

getLastChangeUser()

Returns the last change user

public getLastChangeUser() : string
Tags
since
1.5.2
Return values
string

getLevel()

Gets the level based on the sort order if the theme object is hierachical. Otherwise returns 1 (top level)

public getLevel() : int
Tags
since
1.6.1
Return values
int

Returns the url to a news article

public getLink([string $path = null ]) : string
Parameters
$path : string = null

Default null, optionally pass a path constant like WEBPATH or FULLWEBPATH

Return values
string

getLocked()

Returns the locked status , "1" if locked (only used on the admin)

public getLocked() : string
Return values
string

getName()

Returns the name (titlelink)

public getName() : string
Tags
since
1.6
Return values
string

getNewsLoopPage()

Returns the page number in the news loop

public getNewsLoopPage() : int
Return values
int

getNextArticle()

Returns the next article.

public getNextArticle() : object
Return values
object

getParentID()

Returns the partent id

public getParentID() : string
Return values
string

getPassword()

Gets the password if set

public getPassword() : null

Placeholder for all child classes. Needs to be properly overriden there if password functionality is available

Tags
since
1.6.1

Added for general class compatibility

Return values
null

Returns the perma link status (only used on admin)

public getPermalink() : string
Return values
string

getPrevArticle()

Return the previous article

public getPrevArticle() : object
Return values
object

getShow()

Returns true published

public getShow() : bool
Tags
deprecated
2.0

– Use isPublished() instead

Return values
bool

getSticky()

Returns true if the article is sticky

public getSticky() : bool
Return values
bool

getTags()

Returns the tag data

public getTags() : string
Return values
string

getTitle()

Returns the title

public getTitle([mixed $locale = NULL ]) : string
Parameters
$locale : mixed = NULL
Return values
string

Returns the titlelink

public getTitlelink() : string
Tags
deprecated
2.0
  • use getName() instead
Return values
string

getUrParent()

Gets the object of the oldest ancester of the page or category. Returns the object of the page/category itself if there is no urparent

public getUrParent() : mixed
Tags
since
1.6.1

return object

hasExpiration()

Returns true if the item will be automatically unpublished by a not yet reached future expire date

public hasExpiration() : bool
Tags
since
1.5.7
Return values
bool

hasExpired()

Returns true if the items has been unpublished after reaching the set expire date.

public hasExpired() : bool
Tags
since
1.5.7
Return values
bool

hasExpireDate()

Returns true if the item has a proper expire date set no matter if it has expired already or will expire in the future

public hasExpireDate() : bool
Tags
since
1.5.7
Return values
bool

hasFutureDate()

Returns the future date (publishdate for gallery, date for Zenpage items) if set to the future only

public hasFutureDate() : string
Tags
since
1.5.7
Return values
string

| null

hasInactiveExpiration()

Returns true if a future expiredate is set but the item is unpublished

public hasInactiveExpiration() : bool
Tags
since
1.5.7
Return values
bool

hasInactivePublishSchedule()

Returns true if the item has a future date but is not published

public hasInactivePublishSchedule() : bool
Tags
since
1.5.7
Return values
bool

hasPublishSchedule()

Returns true if the item will be automatically published by a future date set

public hasPublishSchedule() : bool
Tags
since
1.5.7
Return values
bool

hasTag()

Checks if an object has a tag assigned.

public hasTag(string $checktag) : bool
Parameters
$checktag : string

tag to check for

Return values
bool

inNewsCategory()

Checks if an article is in a category and returns TRUE or FALSE

public inNewsCategory(string $catlink) : bool
Parameters
$catlink : string

The titlelink of a category

Return values
bool

inProtectedCategory()

Checks if an article is in a password protected category and returns TRUE or FALSE

public inProtectedCategory([bool $only = false ]) : bool
Parameters
$only : bool = false

set to true to know if the news article belongs only to protected categories

Return values
bool

instantiate()

}

public instantiate( $tablename,  $unique_set[,  $cache_by = NULL ][,  $use_cache = true ][,  $is_transient = false ][,  $allowCreate = true ]) : bool

Prime instantiator for Zenphoto objects

Parameters
$tablename :

The name of the database table

$unique_set :

An array of unique fields

$cache_by : = NULL
$use_cache : = true
$is_transient : = false

Set true to prevent database insertion

$allowCreate : = true

Set true to allow a new object to be made.

Return values
bool

will be true if the unique_set does not already exist

inSubNewsCategoryOf()

Checks if an article is in a sub category of $catlink

public inSubNewsCategoryOf(string $catlink) : bool
Parameters
$catlink : string

The titlelink of a category

Return values
bool

isMyItem()

Checks if user is news author

public isMyItem([bit $action = LIST_RIGHTS ]) : mixed
Parameters
$action : bit = LIST_RIGHTS

User rights level, default LIST_RIGHTS

returns true of access is allowed

isProtected()

Returns true if the article is protected by a category

public isProtected() : bool
Tags
since
1.6.1

Returns true if the article is in any protected category instead if protected categories only

Return values
bool

isProtectedByParent()

Returns true if not protected but protection is inherited by a parent Note: Here the same as isProtected() to align with other objects

public isProtectedByParent() : bool
Tags
since
1.6.1
Return values
bool

isPublic()

Returns true if this article is published and in any published category

public isPublic() : bool
Tags
since
1.5.5
Return values
bool

isPublished()

Returns true if the item itself is published

public isPublished([bool $use_dbvalue = false ]) : bool
Parameters
$use_dbvalue : bool = false

Set to true to use the actual db value stored and not the possibly temporary modified value (e.g. if in scheduled publishing or expiration)

Tags
since
1.5.8

For a check including inheritance use isPublic()

Return values
bool

isUnpublishedByParent()

Returns true if itself published but unpublished status is inheretited by a parent

public isUnpublishedByParent() : bool
Tags
since
1.6.1
Return values
bool

isVisible()

Checks if the current item is visible (= listed) to the current visitor via rights, publish status or protection status

public isVisible([bit $action = LIST_RIGHTS ]) : bool

Convenience wrapper for various methods.

Parameters
$action : bit = LIST_RIGHTS

User rights level, default LIST_RIGHTS

Tags
since
1.6.1
see
isPublic()
see
isProtectedByParent()
see
isMyItem()
Return values
bool

move()

Change one or more values of the unique set assigned to this record.

public move(mixed $new_unique_set) : mixed

Checks if the record already exists first, if so returns false. If successful returns true and changes $this->unique_set A call to move is instant, it does not require a save() following it.

Parameters
$new_unique_set : mixed

save()

Save the updates made to this object since the last update. Returns true if successful, false if not.

public save([bool $checkupdates = false ]) : mixed
Parameters
$checkupdates : bool = false

Default false. If true the internal $updates property is checked for actual changes so unnecessary saving is skipped. Applies to already existing objects only.

set()

Set a variable in this object. Does not persist to the database until save() is called. So, IMPORTANT: Call save() after set() to persist.

public set(mixed $var, mixed $value) : mixed

If the requested variable is not in the database, sets it in temp storage, which won't be persisted to the database.

Parameters
$var : mixed
$value : mixed

setAuthor()

sets the author attribute

public setAuthor(mixed $a) : mixed
Parameters
$a : mixed

setCategories()

public setCategories(mixed $categories) : mixed
Parameters
$categories : mixed

setCodeblock()

set the codeblocks as an serialized array

public setCodeblock(mixed $cb) : mixed
Parameters
$cb : mixed

setCommentsAllowed()

Sets the comments allowed flag

public setCommentsAllowed(bool $commentson) : mixed
Parameters
$commentson : bool

true if they are allowed

setContent()

Set the content datum

public setContent( $c) : mixed
Parameters
$c :

full language string

setCustomData()

Sets the custom data field

public setCustomData(string $val) : mixed
Parameters
$val : string

the value to be put in custom_data

setDateTime()

Stores the date

public setDateTime(string $datetime) : mixed
Parameters
$datetime : string

formatted date

setExpireDate()

sets the expire date

public setExpireDate(mixed $ed) : mixed
Parameters
$ed : mixed

setExtraContent()

sets the extra content

public setExtraContent(mixed $ec) : mixed
Parameters
$ec : mixed

setLastChange()

stores the current date in the format 'Y-m-d H:i:s' as the last change date

public setLastChange() : mixed

setLastchangeUser()

stores the last change user

public setLastchangeUser(mixed $a) : mixed
Parameters
$a : mixed
Tags
since
1.5.2

setLocked()

sets the locked status , "1" if locked (only used on the admin)

public setLocked(mixed $l) : mixed
Parameters
$l : mixed

setName()

sets the name (title link)

public setName( $v) : mixed
Parameters
$v :
Tags
since
1.6

setParentID()

Sets the ParentID field

public setParentID( $v) : mixed
Parameters
$v :

id of the parent

setPublished()

Stores the published value

public setPublished(bool $published) : mixed
Parameters
$published : bool

True if the item is published

Tags
since
1.5.8

setShow()

Stores the published value

public setShow(bool $show) : mixed
Parameters
$show : bool

True if the album is published

Tags
deprecated
2.0

– Use setPublished() instead

setTags()

Stores tag information

public setTags(string $tags) : mixed
Parameters
$tags : string

the tag list

setTitle()

Stores the title

public setTitle(string $title) : mixed
Parameters
$title : string

the title

sets the title link

public setTitlelink( $v) : mixed
Parameters
$v :
Tags
deprecated
2.0
  • use setName() instead

setTruncation()

public setTruncation(mixed $v) : mixed
Parameters
$v : mixed

setDefaults()

Sets default values for new objects using the set() method.

protected setDefaults() : mixed

Should do nothing in the base class; subclasses should override.

addToCache()

add the entry to the cache

private addToCache( $entry) : mixed
Parameters
$entry :

getFromCache()

check the cache for presence of the entry and return it if found

private getFromCache() : mixed

load()

Load the data array from the database, using the unique id set to get the unique record.

private load(bool $allowCreate) : false
Parameters
$allowCreate : bool

set to true to enable new object creation.

Return values
false

if the record already exists, true if a new record was created.


        
On this page

Search results