src/lib/Post/Info.php
/**
     * Get post info, concatenated with a separator.
     */
Get post info, concatenated with a separator.
Get post info concatenated with a separator .
public function list(): string
    {
        if (!$this->types) {
            return '';
        }
        $meta = [];
        foreach ($this->types as $type) {
            if (0 === \stripos($type, 'avatar__')) {
                if ($this->post->author()->supported() &&
                    ($avatar = $this->post->thumbnail($type))
                ) {
                    $meta[] = $avatar;
                }
            } elseif (0 === \stripos($type, 'updated_ago')) {
                $meta[] = $this->updatedAgo(\preg_replace(
                    '/^updated\_ago(\_\_)?/i',
                    '',
                    $type
                ));
            } elseif (0 === \stripos($type, 'published_ago')) {
                $meta[] = $this->publishedAgo(\preg_replace(
                    '/^published\_ago(\_\_)?/i',
                    '',
                    $type
                ));
            } elseif (\is_callable([$this, ($call = "render_{$type}")])
                && ($return = $this->$call())
            ) {
                $meta[] = $return;
            } elseif ($filter = \apply_filters(
                $type,
                '',
                $this->post->get()->ID,
                $this->separator
            )) {
                $meta[] = $filter;
            } elseif ($post_meta = $this->post->meta($type, true)) {
                $meta[] = $post_meta;
            } elseif ($terms = $this->termList($type)) {
                $meta[] = $terms;
            }
        }
        if (!$meta) {
            return '';
        }
        return $this->before.\join(
            ' <span class="meta-sep">'.$this->separator.'</span> ',
            $meta
        ).$this->after;
    }
public function list ( ) : string { if ( ! $ this -> types ) { return '' ; } $ meta = [ ] ; foreach ( $ this -> types as $ type ) { if ( 0 === \ stripos ( $ type , 'avatar__' ) ) { if ( $ this -> post -> author ( ) -> supported ( ) && ( $ avatar = $ this -> post -> thumbnail ( $ type ) ) ) { $ meta [ ] = $ avatar ; } } elseif ( 0 === \ stripos ( $ type , 'updated_ago' ) ) { $ meta [ ] = $ this -> updatedAgo ( \ preg_replace ( '/^updated\_ago(\_\_)?/i' , '' , $ type ) ) ; } elseif ( 0 === \ stripos ( $ type , 'published_ago' ) ) { $ meta [ ] = $ this -> publishedAgo ( \ preg_replace ( '/^published\_ago(\_\_)?/i' , '' , $ type ) ) ; } elseif ( \ is_callable ( [ $ this , ( $ call = " render_ { $ type } " ) ] ) && ( $ return = $ this -> $ call ( ) ) ) { $ meta [ ] = $ return ; } elseif ( $ filter = \ apply_filters ( $ type , '' , $ this -> post -> get ( ) -> ID , $ this -> separator ) ) { $ meta [ ] = $ filter ; } elseif ( $ post_meta = $ this -> post -> meta ( $ type , true ) ) { $ meta [ ] = $ post_meta ; } elseif ( $ terms = $ this -> termList ( $ type ) ) { $ meta [ ] = $ terms ; } } if ( ! $ meta ) { return '' ; } return $ this -> before . \ join ( ' <span class="meta-sep">' . $ this -> separator . '</span> ' , $ meta ) . $ this -> after ; }
Get post info, concatenated with a separator.
Get post info concatenated with a separator .