|
| __construct () |
|
| splitMetaValues (string $str) |
|
| getMetaArray (?string $str) |
|
| getMetaStr (?string $str, string $type) |
|
| getMetaRecordset (?string $str, string $type) |
|
| getPostsByMeta (array $params=[], bool $count_only=false, ?dcSelectStatement $ext_sql=null) |
|
| getCommentsByMeta (array $params=[], bool $count_only=false, ?dcSelectStatement $ext_sql=null) |
|
| getMetadata (array $params=[], bool $count_only=false, ?dcSelectStatement $ext_sql=null) |
|
| computeMetaStats (dcRecord $rs) |
|
| setPostMeta ($post_id, ?string $type, ?string $value) |
|
| delPostMeta ($post_id, ?string $type=null, ?string $meta_id=null) |
|
| updateMeta (string $meta_id, string $new_meta_id, ?string $type=null, ?string $post_type=null) |
|
| delMeta (string $meta_id, ?string $type=null, ?string $post_type=null) |
|
◆ __construct()
◆ splitMetaValues()
splitMetaValues |
( |
string |
$str | ) |
|
Splits up comma-separated values into an array of unique, URL-proof metadata values.
- Parameters
-
string | $str | Comma-separated metadata |
- Returns
- array The array of sanitized metadata
References sanitizeMetaID().
◆ sanitizeMetaID()
static sanitizeMetaID |
( |
string |
$str | ) |
|
|
static |
◆ getMetaArray()
getMetaArray |
( |
?string |
$str | ) |
|
Converts serialized metadata (for instance in dc_post post_meta) into a meta array.
- Parameters
-
string | $str | The serialized metadata |
- Returns
- array The meta array.
Referenced by getMetaRecordset(), and getMetaStr().
◆ getMetaStr()
getMetaStr |
( |
?string |
$str, |
|
|
string |
$type |
|
) |
| |
Converts serialized metadata (for instance in dc_post post_meta) into a comma-separated meta list for a given type.
- Parameters
-
string | $str | The serialized metadata |
string | $type | The meta type to retrieve metaIDs from |
- Returns
- string The comma-separated list of meta.
References getMetaArray().
◆ getMetaRecordset()
getMetaRecordset |
( |
?string |
$str, |
|
|
string |
$type |
|
) |
| |
Converts serialized metadata (for instance in dc_post post_meta) into a "fetchable" metadata dcRecord.
- Parameters
-
string | $str | The serialized metadata |
string | $type | The meta type to retrieve metaIDs from |
- Returns
- dcRecord The meta recordset.
References getMetaArray(), and dcRecord\newFromArray().
◆ getPostsByMeta()
getPostsByMeta |
( |
array |
$params = [] , |
|
|
bool |
$count_only = false , |
|
|
?dcSelectStatement |
$ext_sql = null |
|
) |
| |
Retrieves posts corresponding to given meta criteria. $params is an array taking the following optional parameters:
- meta_id : get posts having meta id
- meta_type : get posts having meta type
- Parameters
-
- Returns
- dcRecord The resulting posts record.
References dcCore\app().
◆ getCommentsByMeta()
getCommentsByMeta |
( |
array |
$params = [] , |
|
|
bool |
$count_only = false , |
|
|
?dcSelectStatement |
$ext_sql = null |
|
) |
| |
Retrieves comments corresponding to given meta criteria. $params is an array taking the following optional parameters:
- meta_id : get posts having meta id
- meta_type : get posts having meta type
- Parameters
-
- Returns
- dcRecord The resulting comments record.
References dcCore\app().
◆ getMetadata()
getMetadata |
( |
array |
$params = [] , |
|
|
bool |
$count_only = false , |
|
|
?dcSelectStatement |
$ext_sql = null |
|
) |
| |
Generic-purpose metadata retrieval : gets metadatas according to given criteria. $params is an array taking the following optionnal parameters:
- type: get metas having the given type
- meta_id: if not null, get metas having the given id
- post_id: get metas for the given post id
- limit: number of max fetched metas
- order: results order (default : posts count DESC)
- Parameters
-
- Returns
- dcRecord The metadata.
References dcCore\app(), dcAuth\PERMISSION_CONTENT_ADMIN, dcBlog\POST_PUBLISHED, and dcBlog\POST_TABLE_NAME.
◆ computeMetaStats()
◆ setPostMeta()
setPostMeta |
( |
|
$post_id, |
|
|
?string |
$type, |
|
|
?string |
$value |
|
) |
| |
Adds a metadata to a post.
- Parameters
-
mixed | $post_id | The post identifier |
string | $type | The type |
string | $value | The value |
◆ delPostMeta()
delPostMeta |
( |
|
$post_id, |
|
|
?string |
$type = null , |
|
|
?string |
$meta_id = null |
|
) |
| |
Removes metadata from a post.
- Parameters
-
mixed | $post_id | The post identifier |
string | $type | The meta type (if null, delete all types) |
string | $meta_id | The meta identifier (if null, delete all values) |
◆ updateMeta()
updateMeta |
( |
string |
$meta_id, |
|
|
string |
$new_meta_id, |
|
|
?string |
$type = null , |
|
|
?string |
$post_type = null |
|
) |
| |
◆ delMeta()
delMeta |
( |
string |
$meta_id, |
|
|
?string |
$type = null , |
|
|
?string |
$post_type = null |
|
) |
| |
Mass delete metadata for a given post_type.
- Parameters
-
string | $meta_id | The meta identifier |
string | $type | The meta type (if null, select all types) |
string | $post_type | The post type (if null, select all types) |
- Returns
- array The list of impacted post_ids
References dcCore\app(), and dcBlog\POST_TABLE_NAME.
◆ META_TABLE_NAME
const META_TABLE_NAME = 'meta' |
The documentation for this class was generated from the following file: