Sindbad~EG File Manager

Current Path : /home/x/i/e/xiedrke/entrepot/wp-content/plugins/realpress/app/Shortcodes/
Upload File :
Current File : /home/x/i/e/xiedrke/entrepot/wp-content/plugins/realpress/app/Shortcodes/PropertyMap.php

<?php

namespace RealPress\Shortcodes;

use RealPress\Helpers\Template;
use RealPress\Helpers\Settings;
use RealPress\Models\PropertyModel;
use WP_Query;

/**
 * Class PropertyMap
 * @package RealPress\Shortcodes
 */
class PropertyMap extends AbstractShortcode {
	protected $shortcode_name = 'realpress_property_map';

	/**
	 * PropertyMap constructor.
	 */
	public function __construct() {
		parent::__construct();
	}

	/**
	 * @param $attrs
	 *
	 * @return string
	 */
	public function render( $attrs ): string {
		$args = array(
			'post_type'      => REALPRESS_PROPERTY_CPT,
			'posts_per_page' => $attrs['limit'] ?? Settings::get_setting_detail( 'group:property:fields:property_per_page' ),
			'paged'          => $attrs['page'] ?? 1,
			'meta_query'     => array(
				array(
					'key'     => 'realpress_group:map:section:enable_map:fields:enable',
					'value'   => 'on',
					'type'    => 'CHAR',
					'compare' => '=',
				),
				array(
					'key'     => 'realpress_group:map:section:map:fields:lat',
					'value'   => '',
					'type'    => 'CHAR',
					'compare' => '!=',
				),
				array(
					'key'     => 'realpress_group:map:section:map:fields:lng',
					'value'   => '',
					'type'    => 'CHAR',
					'compare' => '!=',
				),
				'realation' => 'AND',
			),
		);

		if ( isset( $attrs['ids'] ) ) {
			$args['post__in'] = $attrs['ids'];
		}

		$properties = array();
		$query      = new WP_Query( $args );

		if ( $query->have_posts() ) {
			while ( $query->have_posts() ) {
				$query->the_post();
				$properties[] = PropertyModel::get_property_list_item_data( get_the_ID() );
			}
			wp_reset_postdata();
		}
		$data = array(
			'properties' => $properties,
		);

		ob_start();
		Template::instance( true )->get_frontend_template_type_classic( 'shortcodes/property-map.php', compact( 'data' ) );

		return ob_get_clean();
	}

	/**
	 * @return void
	 */
	public function enqueue_scripts() {
	}
}

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists