GBPost::findByName PHP Method

findByName() static public method

static public findByName ( $name, $version = null, $applyBodyFilters = true )
    static function findByName($name, $version = null, $applyBodyFilters = true)
    {
        if (strpos($name, 'content/posts/') !== 0) {
            $name = 'content/posts/' . $name;
        }
        return self::find($name, $version, null, $applyBodyFilters);
    }

Usage Example

Example #1
0
function _add_posts_from_status($st, $prefixmatch, $stage, $stageflag)
{
    global $muxed_posts;
    if (isset($st[$stage])) {
        foreach ($st[$stage] as $name => $t) {
            if (substr($name, 0, strlen($prefixmatch)) !== $prefixmatch) {
                continue;
            }
            $status = is_array($t) ? $t['status'] : '';
            $post = GBPost::findByName($name, $status === 'deleted' ? null : 'work', false);
            if ($post) {
                if (!isset($muxed_posts[$post->name])) {
                    $muxed_posts[$post->name] = array();
                }
                $muxed_posts[$post->name][] = array($post, $stageflag . _mkflags($post, $status));
            }
        }
    }
}
All Usage Examples Of GBPost::findByName