/**
* Ask plugin for information about one of its items
*
* Item properties that can be requested:
* - 'date-created'  - creation date, if available
* - 'date-modified' - date of last modification, if available
* - 'description'   - full description of the item
* - 'excerpt'       - short description of the item
* - 'id'            - ID of the item, e.g. sid for articles
* - 'title'         - title of the item
* - 'url'           - URL of the item
*
* 'excerpt' and 'description' may return the same value. Properties should be
* returned in the order they are listed in $what. Properties that are not
* available should return an empty string.
* Return false for errors (e.g. access denied, item does not exist, etc.).
*
* @param    string  $type       plugin type (incl. 'article' for stories)
* @param    string  $id         ID of an item under the plugin's control or '*'
* @param    string  $what       comma-separated list of item properties
* @param    int     $uid        user ID or 0 = current user
* @param    array   $options    (reserved for future extensions)
* @return   mixed               string or array of strings with the information
* @link     http://wiki.geeklog.net/index.php/PLG_getItemInfo
*
*/
function PLG_getItemInfo($type, $id, $what, $uid = 0, $options = array())
{
    if ($type == 'article') {
        global $_CONF;
        require_once $_CONF['path_system'] . 'lib-story.php';
        return STORY_getItemInfo($id, $what, $uid, $options);
    } else {
        $args[1] = $id;
        $args[2] = $what;
        $args[3] = $uid;
        $args[4] = $options;
        $function = 'plugin_getiteminfo_' . $type;
        return PLG_callFunctionForOnePlugin($function, $args);
    }
}
示例#2
0
/**
* Ask plugin for information about a specific item
*
* Item properties that can be requested:
* - 'date-created'    - creation date, if available
* - 'date-modified'   - date of last modification, if available
* - 'description'     - full description of the item (formatted)
* - 'raw-description' - full raw description (no parsing of tags, etc.)
* - 'excerpt'         - short description of the item
* - 'id'              - ID of the item, e.g. sid for articles
* - 'title'           - title of the item
* - 'url'             - URL of the item
* - 'label'           - Plugin label
*
* 'excerpt' and 'description' may return the same value. Properties that are
* not available should return an empty string.
* Return false for errors (e.g. access denied, item does not exist, etc.).
*
* @param    string  $type       plugin type (incl. 'article' for stories)
* @param    string  $id         ID of an item under the plugin's control or '*'
* @param    string  $what       comma-separated list of item properties
* @param    int     $uid        user ID or 0 = current user
* @param    array   $options    (reserved for future extensions)
* @return   mixed               string or array of strings with the information
*
*/
function PLG_getItemInfo($type, $id, $what, $uid = 0, $options = array())
{
    global $_CONF;
    if ($type == 'article') {
        USES_lib_story();
        return STORY_getItemInfo($id, $what, $uid, $options);
    } else {
        $args[1] = $id;
        $args[2] = $what;
        $args[3] = $uid;
        $args[4] = $options;
        $function = 'plugin_getiteminfo_' . $type;
        return PLG_callFunctionForOnePlugin($function, $args);
    }
}
示例#3
0
/**
* Wrapper for STORY_getItemInfo / PLG_getItemInfo to keep things readable
*
* @param    string  $type   type of entry ('article' = story, else plugin)
* @param    string  $id     ID of that entry
* @param    string  $what   info requested
* @return   mixed           requested info, as a string or array of strings
*
*/
function TRACKBACK_getItemInfo($type, $id, $what)
{
    if ($type == 'article') {
        return STORY_getItemInfo($id, $what);
    } else {
        return PLG_getItemInfo($type, $id, $what);
    }
}