ZenphotoCMS 1.6.5

Comment extends PersistentObject

Comment Class

Table of Contents

Properties

$comment_error_text  : mixed
$dataconfirmation  : mixed
$exists  : mixed
$loaded  : mixed
$mathquiz  : mixed
$table  : mixed
$textquiz  : mixed
$transient  : mixed
$id  : mixed
$cache_by  : mixed
$data  : mixed
$tempdata  : mixed
$unique_set  : mixed
$updates  : mixed
$use_cache  : mixed

Methods

__construct()  : Comment
Constructor for a comment
__toString()  : string
"Magic" function to return a string identifying the object when it is treated as a string
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.
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
Copy this record to another unique set. Checks if the record exists there first, if so returns false. If successful returns true. No changes are made to this object and no other objects are created, just the database entry.
get()  : mixed
Get the value of a variable. If $current is false, return the value as of the last save of this object.
getAnon()  : bool
Returns true if the comment is flagged anonymous
getComment()  : string
Returns the comment text
getCustomData()  : string
Returns the custom data field of the comment
getData()  : array<string|int, mixed>
returns the database record of the object
getDateTime()  : string
returns the comment date/time
getEmail()  : string
returns the email address of the commentor
getID()  : string
Returns the id
getInModeration()  : int
Returns true if the comment is marked for moderation
getIP()  : string
Returns the IP address of the comment poster
getLastChange()  : string
Returns the last change user
getLastChangeUser()  : string
Returns the last change user
getName()  : string
Returns the commentor's name
getOwnerID()  : int
Returns the id of the comment owner
getPrivate()  : bool
Returns true if the comment is flagged private
getType()  : string
Returns the 'type' of the comment. i.e. the class of the owner object
getWebsite()  : string
returns the Website of the commentor
instantiate()  : bool
}
move()  : mixed
Change one or more values of the unique set assigned to this record.
remove()  : bool
Deletes object 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.
setAnon()  : mixed
Sets the anonymous flag of the comment
setComment()  : mixed
Stores the comment text
setCustomData()  : mixed
Stores the custom data field of the comment
setDateTime()  : mixed
Sets a comment date/time value
setDefaults()  : mixed
Sets up default items on new comment objects
setEmail()  : mixed
Sets the email address of the commentor
setInModeration()  : mixed
Sets the moderation flag of the comment
setIP()  : mixed
Sets the IP address field of the comment
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
setName()  : mixed
Sets the commentor's name
setOwnerID()  : mixed
Sets the id of the owner of the comment
setPrivate()  : mixed
Sets the private flag of the comment
setType()  : mixed
Sets the 'type' field of the comment
setWebsite()  : mixed
Stores the website of the commentor
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

$comment_error_text

public mixed $comment_error_text = \NULL

Methods

__construct()

Constructor for a comment

public __construct([int $id = NULL ]) : Comment
Parameters
$id : int = NULL

set to the ID of the comment if not a new one.

Return values
Comment

__toString()

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

public __toString() : string
Return values
string

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

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()

Copy this record to another unique set. Checks if the record exists there first, if so returns false. If successful returns true. No changes are made to this object and no other objects are created, just the database entry.

public copy(mixed $new_unique_set) : mixed

A call to copy is instant, it does not require a save() following it.

Parameters
$new_unique_set : mixed

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

getAnon()

Returns true if the comment is flagged anonymous

public getAnon() : bool
Return values
bool

getComment()

Returns the comment text

public getComment() : string
Return values
string

getCustomData()

Returns the custom data field of the comment

public getCustomData() : string
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 comment date/time

public getDateTime() : string
Return values
string

getEmail()

returns the email address of the commentor

public getEmail() : string
Return values
string

getInModeration()

Returns true if the comment is marked for moderation

public getInModeration() : int
Return values
int

getIP()

Returns the IP address of the comment poster

public getIP() : string
Return values
string

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

getName()

Returns the commentor's name

public getName() : string
Return values
string

getOwnerID()

Returns the id of the comment owner

public getOwnerID() : int
Return values
int

getPrivate()

Returns true if the comment is flagged private

public getPrivate() : bool
Return values
bool

getType()

Returns the 'type' of the comment. i.e. the class of the owner object

public getType() : string
Return values
string

getWebsite()

returns the Website of the commentor

public getWebsite() : string
Return values
string

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

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

setAnon()

Sets the anonymous flag of the comment

public setAnon(bool $value) : mixed
Parameters
$value : bool

setComment()

Stores the comment text

public setComment(string $value) : mixed
Parameters
$value : string

setCustomData()

Stores the custom data field of the comment

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

setDateTime()

Sets a comment date/time value

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

setDefaults()

Sets up default items on new comment objects

public setDefaults() : mixed

setEmail()

Sets the email address of the commentor

public setEmail(string $value) : mixed
Parameters
$value : string

setInModeration()

Sets the moderation flag of the comment

public setInModeration(int $value) : mixed
Parameters
$value : int

setIP()

Sets the IP address field of the comment

public setIP(string $value) : mixed
Parameters
$value : string

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

setName()

Sets the commentor's name

public setName(string $value) : mixed
Parameters
$value : string

setOwnerID()

Sets the id of the owner of the comment

public setOwnerID(int $value) : mixed
Parameters
$value : int

setPrivate()

Sets the private flag of the comment

public setPrivate(bool $value) : mixed
Parameters
$value : bool

setType()

Sets the 'type' field of the comment

public setType(string $type) : mixed
Parameters
$type : string

setWebsite()

Stores the website of the commentor

public setWebsite(string $value) : mixed
Parameters
$value : string

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