[ Index ]

PHP Cross Reference of zeList

title

Body

[close]

/includes/ -> metas.php (summary)

Links Metas functions

File Size: 316 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 9 functions

  add_link_meta()
  delete_link_meta()
  get_link_meta()
  update_link_meta()
  delete_link_meta_by_key()
  get_link_custom()
  get_link_custom_keys()
  get_link_custom_values()
  update_linkmeta_cache()

Functions
Functions that are not part of a class:

add_link_meta($link_id, $meta_key, $meta_value, $unique = false)   X-Ref
Add meta data field to a link.

link meta data is called "Custom Fields" on the Administration Panels.

param: int $link_id link ID.
param: string $key Metadata name.
param: mixed $value Metadata value.
param: bool $unique Optional, default is false. Whether the same key should not be added.
return: bool False for failure. True for success.

delete_link_meta($link_id, $meta_key, $meta_value = '')   X-Ref
Remove metadata matching criteria from a link.

You can match based on the key, or key and value. Removing based on key and
value, will keep from removing duplicate metadata with the same key. It also
allows removing all metadata matching key, if needed.

param: int $link_id link ID
param: string $meta_key Metadata name.
param: mixed $meta_value Optional. Metadata value.
return: bool False for failure. True for success.

get_link_meta($link_id, $key, $single = false)   X-Ref
Retrieve link meta field for a link.

param: int $link_id link ID.
param: string $key The meta key to retrieve.
param: bool $single Whether to return a single value.
return: mixed Will be an array if $single is false. Will be value of meta data field if $single is true.

update_link_meta($link_id, $meta_key, $meta_value, $prev_value = '')   X-Ref
Update link meta field based on link ID.

Use the $prev_value parameter to differentiate between meta fields with the
same key and link ID.

If the meta field for the link does not exist, it will be added.

param: int $link_id link ID.
param: string $key Metadata key.
param: mixed $value Metadata value.
param: mixed $prev_value Optional. Previous value to check before removing.
return: bool False on failure, true if success.

delete_link_meta_by_key($link_meta_key)   X-Ref
Delete everything from link meta matching meta key.

param: string $link_meta_key Key to search for when deleting.
return: bool Whether the link meta key was deleted from the database

get_link_custom($link_id = 0)   X-Ref
Retrieve link meta fields, based on link ID.

The link meta fields are retrieved from the cache, so the function is
optimized to be called more than once. It also applies to the functions, that
use this function.

param: int $link_id link ID
return: array

get_link_custom_keys( $link_id = 0 )   X-Ref
Retrieve meta field names for a link.

If there are no meta fields, then nothing (null) will be returned.

param: int $link_id link ID
return: array|null Either array of the keys, or null if keys could not be retrieved.

get_link_custom_values( $key = '', $link_id = 0 )   X-Ref
Retrieve values for a custom link field.

The parameters must not be considered optional. All of the link meta fields
will be retrieved and only the meta field key values returned.

param: string $key Meta field key.
param: int $link_id link ID
return: array Meta field values.

update_linkmeta_cache($link_ids)   X-Ref
Updates metadata cache for list of link IDs.

Performs SQL query to retrieve the metadata for the link IDs and updates the
metadata cache for the links. Therefore, the functions, which call this
function, do not need to perform SQL queries on their own.

param: array $link_ids List of link IDs.
return: bool|array Returns false if there is nothing to update or an array of metadata.



Generated: Sat May 30 23:51:06 2009 Cross-referenced by PHPXref 0.7