/**
 * Return Page Field
 *
 * Retrieve the requested field from the given page cache, fallback to page file
 * If the field is "content" and not raw it will run it through content filter
 *
 * @since 3.1
 * @param $page  slug of the page to retrieve content
 * @param $field the Field to display
 * @param $raw   if true, prevent any processing of data, use with caution as result can vary if falls back to page file
 * @param $cache if false, bypass cache and get directly from page file
 * 
 */
function returnPageField($page, $field, $raw = false, $cache = true)
{
    $pagesArray = getPagesXmlValues();
    if ($cache && isset($pagesArray[(string) $page]) && isset($pagesArray[(string) $page][$field])) {
        $ret = $raw ? $pagesArray[(string) $page][(string) $field] : strip_decode($pagesArray[(string) $page][(string) $field]);
    } else {
        $ret = returnPageFieldFromFile($page, $field, $raw);
    }
    // @todo this needs to come out of there, its dumb, special handling for special fields needs to be external
    if ($field == "content" && !$raw) {
        $ret = filterPageContent($page, $ret);
    }
    return $ret;
}
示例#2
0
/**
 * Return Page Field
 *
 * Retrieve the requested field from the given page cache, fallback to page file
 * If the field is "content" and not raw it will run it through content filter
 *
 * @since 3.1
 * @param $page  slug of the page to retrieve content
 * @param $field the Field to display
 * @param $raw   if true, prevent any processing of data, use with caution as result can vary if falls back to page file
 * @param $cache if false, bypass cache and get directly from page file
 * 
 */
function returnPageField($page, $field, $raw = false, $cache = true)
{
    $pagesArray = getPagesXmlValues();
    if ($cache && isset($pagesArray[(string) $page]) && isset($pagesArray[(string) $page][$field])) {
        $ret = $raw ? $pagesArray[(string) $page][(string) $field] : strip_decode($pagesArray[(string) $page][(string) $field]);
    } else {
        $ret = returnPageFieldFromFile($page, $field, $raw);
    }
    if ($field == "content" && !$raw) {
        $ret = filterPageContent($page, $ret);
    }
    return $ret;
}