From 2ccc8611b60872a33a43e1a87a2b0db6cf8a357d Mon Sep 17 00:00:00 2001 From: ThemeLexus Date: Mon, 30 Sep 2019 11:11:35 +0700 Subject: [PATCH] uapte --- inc/property/class-opalestate-shortcodes.php | 63 ++++++++++++++++--- .../opalestate-split-maps-search.php | 39 ++---------- templates/shortcodes/search-properties-v.php | 5 -- templates/shortcodes/search-split-maps.php | 31 +++++++++ 4 files changed, 93 insertions(+), 45 deletions(-) delete mode 100755 templates/shortcodes/search-properties-v.php create mode 100755 templates/shortcodes/search-split-maps.php diff --git a/inc/property/class-opalestate-shortcodes.php b/inc/property/class-opalestate-shortcodes.php index 7f9d88d2..97df9f04 100755 --- a/inc/property/class-opalestate-shortcodes.php +++ b/inc/property/class-opalestate-shortcodes.php @@ -23,6 +23,17 @@ if ( ! defined( 'ABSPATH' ) ) { */ class OpalEstate_Shortcodes { + /** + * Get instance of this object + */ + public static function get_instance(){ + static $_instance; + if( !$_instance ){ + $_instance = new OpalEstate_Shortcodes(); + } + return $_instance; + } + /** * Static $shortcodes */ @@ -39,7 +50,7 @@ class OpalEstate_Shortcodes { 'properties' => [ 'code' => 'properties', 'label' => esc_html__( 'Properties', 'opalestate-pro' ) ], 'search_properties_result' => [ 'code' => 'search_properties_result', 'label' => esc_html__( 'Search Properties Result', 'opalestate-pro' ) ], 'search_properties' => [ 'code' => 'search_properties', 'label' => esc_html__( 'Search Properties', 'opalestate-pro' ) ], - 'search_properties_v' => [ 'code' => 'search_properties_v', 'label' => esc_html__( 'Search Properties Vertical', 'opalestate-pro' ) ], + 'search_split_maps' => [ 'code' => 'search_split_maps', 'label' => esc_html__( 'Search Split Maps', 'opalestate-pro' ) ], 'search_map_properties' => [ 'code' => 'search_map_properties', 'label' => esc_html__( 'Search Map Properties', 'opalestate-pro' ) ], 'ajax_map_search' => [ 'code' => 'ajax_map_search', 'label' => esc_html__( 'Ajax Search Map Properties', 'opalestate-pro' ) ], @@ -58,6 +69,9 @@ class OpalEstate_Shortcodes { } + /** + * Display all properties follow user when logined + */ public function shortcode_button() { } @@ -114,8 +128,20 @@ class OpalEstate_Shortcodes { public function search_properties_result( $atts=[] ) { $atts = is_array( $atts ) ? $atts : []; + + $default = array( + 'style' => null, + 'style_list' => null, + 'column' => null, + ); - return opalestate_load_template_path( 'shortcodes/search-properties-result', $atts ); + $atts = array_merge( $default, $atts ); + + $html = '
'; + $html .= opalestate_load_template_path( 'shortcodes/ajax-map-search-result', $atts ); + $html .= '
'; + + return $html; } /** @@ -135,25 +161,46 @@ class OpalEstate_Shortcodes { /** * Render search property page with vertical form and map */ - public function search_properties_v() { - return opalestate_load_template_path( 'shortcodes/search-properties-v', [ 'loop' => '' ] ); + public function search_split_maps( $atts=[] ) { + + $atts = is_array( $atts ) ? $atts : []; + + $default = array( + 'search_form' => 'simple-city', + 'paged' => 1 + ); + + $atts = array_merge( $default, $atts ); + + return opalestate_load_template_path( 'shortcodes/search-split-maps', $atts ); } + /** + * Render search property page with vertical form and map + */ public function search_map_properties() { return opalestate_load_template_path( 'shortcodes/search-map-properties', [ 'loop' => '' ] ); } + /** + * Render search property page with vertical form and map + */ public function ajax_map_search() { wp_enqueue_script( 'sticky-kit', OPALESTATE_PLUGIN_URL . 'assets/js/jquery.sticky-kit.min.js' ); return opalestate_load_template_path( 'shortcodes/ajax-map-search', [ 'loop' => '' ] ); } + /** + * Render search property page with vertical form and map + */ public function ajax_map_quick_search() { return opalestate_load_template_path( 'shortcodes/ajax-map-quick-search', [ 'loop' => '' ] ); } - /* register form show up */ + /* + * Register form show up + */ public function register_form( $atts = [] ) { $atts = shortcode_atts( [ 'message' => '', @@ -164,7 +211,9 @@ class OpalEstate_Shortcodes { return opalestate_load_template_path( 'user/register-form', $atts ); } - /* sign in show up */ + /* + * sign in show up + */ public function login_form( $atts = [] ) { $atts = shortcode_atts( [ 'message' => '', @@ -177,4 +226,4 @@ class OpalEstate_Shortcodes { } -new OpalEstate_Shortcodes(); +OpalEstate_Shortcodes::get_instance(); \ No newline at end of file diff --git a/templates/elementor-templates/opalestate-split-maps-search.php b/templates/elementor-templates/opalestate-split-maps-search.php index 3e34fee7..ef74be28 100755 --- a/templates/elementor-templates/opalestate-split-maps-search.php +++ b/templates/elementor-templates/opalestate-split-maps-search.php @@ -1,37 +1,10 @@ 1, + 'search_form' => $settings['search_form'] +); ?> -
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
- true ] ); ?> -
- -
- 2 ] ); ?> -
-
-
-
-
-
+ \ No newline at end of file diff --git a/templates/shortcodes/search-properties-v.php b/templates/shortcodes/search-properties-v.php deleted file mode 100755 index eeca23af..00000000 --- a/templates/shortcodes/search-properties-v.php +++ /dev/null @@ -1,5 +0,0 @@ -
-
- -
-
diff --git a/templates/shortcodes/search-split-maps.php b/templates/shortcodes/search-split-maps.php new file mode 100755 index 00000000..d2ea7c8c --- /dev/null +++ b/templates/shortcodes/search-split-maps.php @@ -0,0 +1,31 @@ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true ] ); ?> +
+ +
+ 2 ] ); ?> +
+
+
+
+
+