* Created on: 28/08/2018 * * @package Neve\Views */ namespace Neve\Views\Partials; use Neve\Views\Base_View; /** * Class Post_Meta * * @package Neve\Views */ class Post_Meta extends Base_View { /** * Function that is run after instantiation. * * @return void */ public function init() { add_action( 'neve_post_meta_archive', array( $this, 'render_meta_list' ) ); add_action( 'neve_post_meta_single', array( $this, 'render_meta_list' ) ); add_action( 'neve_do_tags', array( $this, 'render_tags_list' ) ); } /** * Render meta list. * * @param array $order the order array. Passed through the action parameter. */ public function render_meta_list( $order ) { if ( ! is_array( $order ) || empty( $order ) ) { return; } $order = $this->sanitize_order_array( $order ); $pid = get_the_ID(); $post_type = get_post_type( $pid ); $markup = ''; $markup .= '
'; echo neve_custom_kses_escape( $markup, array( 'time' => array( 'class' => true, 'datetime' => true, 'content' => true, ), ) ); // WPCS: XSS ok. } /** * Makes sure there's a valid meta order array. * * @param array $order meta order array. * * @return mixed */ private function sanitize_order_array( $order ) { $allowed_order_values = apply_filters( 'neve_meta_filter', array( 'author' => __( 'Author', 'neve' ), 'category' => __( 'Category', 'neve' ), 'date' => __( 'Date', 'neve' ), 'comments' => __( 'Comments', 'neve' ), ) ); foreach ( $order as $index => $value ) { if ( ! array_key_exists( $value, $allowed_order_values ) ) { unset( $order[ $index ] ); } } return $order; } /** * Get