Headline
CVE-2023-4239: shortcodes.class.php in real-estate-manager/tags/6.7.1/classes – WordPress Plugin Repository
The Real Estate Manager plugin for WordPress is vulnerable to privilege escalation in versions up to, and including, 6.7.1 due to insufficient restriction on the ‘rem_save_profile_front’ function. This makes it possible for authenticated attackers, with minimal permissions such as a subscriber, to modify their user role by supplying the ‘wp_capabilities’ parameter during a profile update.
1<?php2/**3* Real Estate Management - Shortcodes Class4*/5class REM_Shortcodes6{7 8 function __construct(){910 /***********************************************************************************************/11 /* Add Shortcodes */12 /***********************************************************************************************/1314 add_shortcode( 'rem_register_agent’, array($this, ‘register_agent’) );15 add_shortcode( 'rem_search_property’, array($this, ‘search_property’) );16 add_shortcode( 'rem_simple_search’, array($this, ‘simple_search_property’) );17 add_shortcode( 'rem_agent_login’, array($this, ‘login_agent’) );18 add_shortcode( 'rem_create_property’, array($this, ‘create_property’) );19 add_shortcode( 'rem_edit_property’, array($this, ‘edit_property’) );20 add_shortcode( 'rem_my_properties’, array($this, ‘my_properties’) );21 add_shortcode( 'rem_manage_properties’, array($this, ‘manage_properties’) );22 add_shortcode( 'rem_list_properties’, array($this, ‘list_properties’) );23 add_shortcode( 'rem_search_results’, array($this, ‘display_search_results’) );24 add_shortcode( 'rem_carousel’, array($this, ‘display_carousel’) );25 add_shortcode( 'rem_maps’, array($this, ‘display_maps’) );26 add_shortcode( 'rem_agent_profile’, array($this, ‘display_agent’) );27 add_shortcode( 'rem_my_profile’, array($this, ‘my_profile’) );28 add_shortcode( 'rem_agent_edit’, array($this, ‘edit_agent’) );29 add_shortcode( 'rem_property’, array($this, ‘single_property’) );30 add_shortcode( 'rem_list_agents’, array($this, ‘list_agents’) );31 add_shortcode( 'rem_agent_logout’, array($this, ‘logout_button’) );3233 /***********************************************************************************************/34 /* WP Bakery Page Builder and Divi Modules Support */35 /***********************************************************************************************/36 add_action( 'vc_before_init’, array($this, ‘rem_vc_addons_setup’ ) );37 add_action('et_builder_ready’, array($this, ‘rem_divi_modules_setup’ ));3839 /***********************************************************************************************/40 /* Shortcodes button in the tiny mce editor */41 /***********************************************************************************************/4243 add_action('admin_init’, array($this, ‘shortcode_button’));4445 /***********************************************************************************************/46 /* AJAX Callbacks */47 /***********************************************************************************************/4849 // Agent Login50 add_action( 'wp_ajax_rem_user_login’, array($this, ‘rem_user_login_check’ ) );51 add_action( 'wp_ajax_nopriv_rem_user_login’, array($this, ‘rem_user_login_check’ ) );5253 // Create Property Frontend54 add_action( 'wp_ajax_rem_create_pro_ajax’, array($this, ‘create_property_frontend’ ) );55 add_action( 'wp_ajax_rem_manage_my_properties’, array($this, ‘manage_my_properties’ ) );56 57 // Saving Agent Profile Frontend58 add_action( 'wp_ajax_rem_save_profile_front’, array($this, ‘rem_save_profile_front’ ) );59 60 // Search Property Frontend61 add_action( 'wp_ajax_rem_search_property’, array($this, ‘search_results’ ) );62 add_action( 'wp_ajax_nopriv_rem_search_property’, array($this, ‘search_results’ ) );6364 // Register New Agent65 add_action( 'wp_ajax_nopriv_rem_agent_register’, array($this, ‘rem_register_agent’ ) );6667 // Delete Property68 add_action( 'wp_ajax_rem_delete_property’, array($this, ‘delete_property’) );69 }7071 function register_agent($attrs, $content = ‘’){72 if (!is_user_logged_in()) {7374 extract( shortcode_atts( array(75 ‘redirect’ => '’,76 ), $attrs ) );7778 rem_load_bs_and_fa();79 rem_load_basic_styles();80 wp_enqueue_style( 'rem-register-css’, REM_URL . ‘/assets/front/css/register-agent.css’ );81 wp_enqueue_script( 'rem-register-agent-js’, REM_URL . '/assets/front/js/register-agent.js’, array(‘jquery’));82 83 ob_start();84 $in_theme = get_stylesheet_directory().’/rem/shortcodes/register-agent.php’;85 if (file_exists($in_theme)) {86 include $in_theme;87 } else {88 include REM_PATH. '/shortcodes/register-agent.php’;89 }90 return ob_get_clean();91 } else {92 return apply_filters( 'the_content’, $content );93 }94 }9596 function search_property($attrs, $content = ‘’){9798 extract( shortcode_atts( array(99 ‘fields_to_show’ => 'property_address,search,property_type,property_country,property_purpose,property_price’,100 ‘columns’ => '6’,101 ‘search_btn_text’ => __( 'Search’, ‘real-estate-manager’ ),102 ‘filters_btn_text’ => __( 'More Filters’, ‘real-estate-manager’ ),103 ‘reset_btn_text’ => '’,104 ‘fixed_fields’ => '’,105 ‘results_page’ => '’,106 ‘results_selector’ => '’,107 ‘disable_eq_height’ => '’,108 ‘more_filters_column_class’ => 'col-xs-6 col-sm-4 col-md-3’,109 ‘agent_id’ => '’,110 ‘order’ => 'ASC’,111 ‘orderby’ => '’,112 ‘scroll_results’ => 'enable’,113 ), $attrs ) );114 115 rem_load_bs_and_fa();116 rem_load_basic_styles();117 wp_enqueue_style( 'rem-archive-property-css’, REM_URL . ‘/assets/front/css/archive-property.css’ );118 119 wp_enqueue_style( 'rem-nouislider-css’, REM_URL . ‘/assets/front/lib/nouislider.min.css’ );120 wp_enqueue_style( 'rem-easydropdown-css’, REM_URL . ‘/assets/front/lib/easydropdown.css’ );121 wp_enqueue_style( 'rem-labelauty-css’, REM_URL . ‘/assets/front/lib/labelauty.css’ );122 wp_enqueue_script( 'rem-labelauty’, REM_URL . '/assets/front/lib/labelauty.min.js’, array(‘jquery’));123 wp_enqueue_script( 'rem-easy-drop’, REM_URL . '/assets/front/lib/jquery.easydropdown.min.js’, array(‘jquery’));124 wp_enqueue_script( 'rem-nouislider-drop’, REM_URL . '/assets/front/lib/nouislider.all.min.js’, array(‘jquery’));125 wp_enqueue_script( 'rem-match-height’, REM_URL . '/assets/front/lib/jquery.matchheight-min.js’, array(‘jquery’));126127 wp_enqueue_script( 'rem-imagefill-js’, REM_URL . '/assets/front/lib/imagefill.min.js’, array(‘jquery’)); 128 wp_enqueue_script( 'rem-imagesloaded-js’, REM_URL . '/assets/front/lib/imagesloaded.min.js’, array(‘jquery’));129 130 wp_enqueue_style( 'rem-search-css’, REM_URL . ‘/assets/front/css/search-property.css’ );131132 $script_settings = array(133 ‘price_min’ => rem_get_option('minimum_price’, ‘350’),134 ‘price_max’ => rem_get_option('maximum_price’, ‘45000’), 135 ‘price_min_default’ => rem_get_option('default_minimum_price’, ‘7000’), 136 ‘price_max_default’ => rem_get_option('default_maximum_price’, ‘38500’), 137 ‘price_step’ => rem_get_option('price_step’, ‘10’),138 ‘currency_symbol’ => rem_get_currency_symbol(),139 'thousand_separator’=> rem_get_option('thousand_separator’, ‘’),140 ‘decimal_separator’ => rem_get_option('decimal_separator’, ‘’),141 ‘decimal_points’ => rem_get_option('decimal_points’, ‘0’),142 );143 wp_enqueue_script( 'rem-search-script’, REM_URL . '/assets/front/js/search-property.js’, array('jquery’, ‘jquery-masonry’));144 wp_localize_script( 'rem-search-script’, 'rem_ob’, $script_settings );145146 ob_start();147 $in_theme = get_stylesheet_directory().’/rem/shortcodes/search-property.php’;148 if (file_exists($in_theme)) {149 include $in_theme;150 } else {151 include REM_PATH. '/shortcodes/search-property.php’;152 }153 return ob_get_clean();154 }155156 function simple_search_property($attrs, $content = ‘’){157 extract( shortcode_atts( array(158 ‘placeholder’ => 'Type to Search…’,159 ‘width’ => '450px’,160 ‘border_color’ => '#E4E4E4’,161 ‘results_page’ => '#’,162 ‘search_icon’ => '<i class="glyphicon glyphicon-search"></i>’,163 ), $attrs ) );164 rem_load_bs_and_fa();165 rem_load_basic_styles();166 ob_start();167 $in_theme = get_stylesheet_directory().’/rem/shortcodes/simple-search.php’;168 if (file_exists($in_theme)) {169 include $in_theme;170 } else {171 include REM_PATH. '/shortcodes/simple-search.php’;172 } 173 return ob_get_clean();174 }175176 function login_agent($attrs = array(), $content = ‘’){177 if (is_user_logged_in()) {178 return apply_filters( 'the_content’, $content );179 } else {180181 rem_load_bs_and_fa();182 rem_load_basic_styles();183 wp_enqueue_style( 'rem-login-css’, REM_URL . ‘/assets/front/css/login-agent.css’ );184 wp_enqueue_style( 'rem-labelauty-css’, REM_URL . ‘/assets/front/lib/labelauty.css’ );185 wp_enqueue_script( 'rem-labelauty’, REM_URL . '/assets/front/lib/labelauty.min.js’, array(‘jquery’));186 wp_enqueue_script( 'rem-login-agent’, REM_URL . '/assets/front/js/login.js’, array(‘jquery’));187188 extract( shortcode_atts( array(189 ‘heading’ => 'Login Here’,190 ‘redirect’ => '’,191 ), $attrs ) );192 ob_start();193 $in_theme = get_stylesheet_directory().’/rem/shortcodes/login.php’;194 if (file_exists($in_theme)) {195 include $in_theme;196 } else {197 include REM_PATH. '/shortcodes/login.php’;198 } 199 return ob_get_clean();200 }201 }202203 function create_property($attrs, $content = ‘Please Login to create properties’){204 if (is_user_logged_in()) {205 extract( shortcode_atts( array(206 ‘style’ => '’,207 ), $attrs ) );208209 global $rem_ob;210 wp_enqueue_media();211 rem_load_bs_and_fa();212 rem_load_basic_styles();213 wp_enqueue_style( 'rem-admin-css’, REM_URL . ‘/assets/admin/css/admin.css’ );214215 wp_enqueue_style( 'rem-easydropdown-css’, REM_URL . ‘/assets/front/lib/easydropdown.css’ );216 wp_enqueue_style( 'rem-labelauty-css’, REM_URL . ‘/assets/front/lib/labelauty.css’ );217 wp_enqueue_script( 'rem-labelauty’, REM_URL . '/assets/front/lib/labelauty.min.js’, array(‘jquery’));218 wp_enqueue_script( 'rem-easy-drop’, REM_URL . '/assets/front/lib/jquery.easydropdown.min.js’, array(‘jquery’));219 wp_enqueue_script( 'rem-match-height’, REM_URL . '/assets/front/lib/jquery.matchheight-min.js’, array(‘jquery’));220221 // If Map is enabled222 if (rem_get_option('single_property_map’, ‘enable’) == ‘enable’) {223224 $def_lat = rem_get_option(‘default_map_lat’, '-33.890542’); 225 $def_long = rem_get_option('default_map_long’, ‘151.274856’);226 $zoom_level = rem_get_option('maps_zoom_level’, ‘18’);227 $map_type = rem_get_option( 'maps_type’, ‘roadmap’);228 $maps_api = apply_filters( 'rem_maps_api’, ‘AIzaSyBbpbij9IIXGftKhFLMHOuTpAbFoTU_8ZQ’);229 $drag_icon = apply_filters( ‘rem_maps_drag_icon’, REM_URL.’/assets/images/pin-drag.png’ );230 if (rem_get_option('use_map_from’, ‘leaflet’) == ‘leaflet’) {231 wp_enqueue_style( 'rem-leaflet-css’, REM_URL . ‘/assets/front/leaflet/leaflet.css’);232 wp_enqueue_script( 'rem-leaflet-js’, REM_URL . '/assets/front/leaflet/leaflet.js’, array(‘jquery’));233 wp_enqueue_style( 'rem-leaflet-geo-css’, ‘https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.css’);234 wp_enqueue_script( 'rem-leaflet-geo-js’, ‘https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.js’);235 } else {236 if (is_ssl()) {237 wp_enqueue_script( 'rem-edit-property-map’, ‘https://maps.googleapis.com/maps/api/js?key=’.$maps_api.’&libraries=places’);238 } else {239 wp_enqueue_script( 'rem-edit-property-map’, ‘http://maps.googleapis.com/maps/api/js?key=’.$maps_api.’&libraries=places’);240 }241 }242 $localize_vars = array(243 ‘use_map_from’ => rem_get_option('use_map_from’, ‘leaflet’),244 ‘def_lat’ => $def_lat,245 ‘def_long’ => $def_long,246 ‘zoom_level’ => $zoom_level,247 ‘map_type’ => $map_type,248 ‘maps_api’ => $maps_api,249 ‘drag_icon’ => $drag_icon,250 ‘maps_styles’ => stripcslashes(rem_get_option(‘maps_styles’)),251 );252 }253254 wp_enqueue_script( 'rem-create-pro’, REM_URL . '/assets/front/js/create-property.js’, array('jquery’, ‘jquery-ui-sortable’));255256 if (isset($localize_vars)) {257 wp_localize_script( 'rem-create-pro’, 'rem_edit_property_map’, $localize_vars );258 } else {259 $localize_vars = array(260 ‘def_lat’ => 'disable’,261 ); 262 wp_localize_script( 'rem-create-pro’, 'rem_edit_property_map’, $localize_vars );263 }264265 ob_start(); ?>266 <?php267 $property_individual_cbs = $rem_ob->get_all_property_features();268 $in_theme = get_stylesheet_directory().’/rem/shortcodes/create-property.php’;269 if (file_exists($in_theme)) {270 include $in_theme;271 } else {272 include REM_PATH. '/shortcodes/create-property.php’;273 } 274 return ob_get_clean();275 } else {276 return apply_filters( 'the_content’, $content );277 } 278 }279280 function edit_property($attrs, $content = ‘’){281 $current_user_data = wp_get_current_user();282 if (is_user_logged_in() && isset($_GET[‘property_id’]) && get_post_field( 'post_author’, $_REQUEST[‘property_id’] ) == $current_user_data->ID) {283 extract( shortcode_atts( array(284 ‘style’ => '’,285 ), $attrs ) );286287 global $rem_ob;288 wp_enqueue_media();289 rem_load_bs_and_fa();290 rem_load_basic_styles();291 wp_enqueue_style( 'rem-admin-css’, REM_URL . ‘/assets/admin/css/admin.css’ );292293 wp_enqueue_style( 'rem-easydropdown-css’, REM_URL . ‘/assets/front/lib/easydropdown.css’ );294 wp_enqueue_style( 'rem-labelauty-css’, REM_URL . ‘/assets/front/lib/labelauty.css’ );295 wp_enqueue_script( 'rem-labelauty’, REM_URL . '/assets/front/lib/labelauty.min.js’, array(‘jquery’));296 wp_enqueue_script( 'rem-easy-drop’, REM_URL . '/assets/front/lib/jquery.easydropdown.min.js’, array(‘jquery’));297 wp_enqueue_script( 'rem-match-height’, REM_URL . '/assets/front/lib/jquery.matchheight-min.js’, array(‘jquery’));298299 // If Map is enabled300 if (rem_get_option('single_property_map’, ‘enable’) == ‘enable’) {301302 $def_lat = rem_get_option(‘default_map_lat’, '-33.890542’); 303 $def_long = rem_get_option('default_map_long’, ‘151.274856’);304 $zoom_level = rem_get_option('maps_zoom_level’, ‘18’);305 $map_type = rem_get_option( 'maps_type’, ‘roadmap’);306 $maps_api = apply_filters( 'rem_maps_api’, ‘AIzaSyBbpbij9IIXGftKhFLMHOuTpAbFoTU_8ZQ’);307 $drag_icon = apply_filters( ‘rem_maps_drag_icon’, REM_URL.’/assets/images/pin-drag.png’ );308 if (get_post_meta( $_GET[‘property_id’], 'rem_property_latitude’, true ) != ‘’) {309 $def_lat = get_post_meta( $_GET[‘property_id’], 'rem_property_latitude’, true );310 }311312 if (get_post_meta( $_GET[‘property_id’], 'rem_property_longitude’, true ) != ‘’) {313 $def_long = get_post_meta( $_GET[‘property_id’], 'rem_property_longitude’, true );314 }315316 if (rem_get_option('use_map_from’, ‘leaflet’) == ‘leaflet’) {317 wp_enqueue_style( 'rem-leaflet-css’, REM_URL . ‘/assets/front/leaflet/leaflet.css’);318 wp_enqueue_script( 'rem-leaflet-js’, REM_URL . '/assets/front/leaflet/leaflet.js’, array(‘jquery’));319 wp_enqueue_style( 'rem-leaflet-geo-css’, ‘https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.css’);320 wp_enqueue_script( 'rem-leaflet-geo-js’, ‘https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.js’); 321 } else {322 if (is_ssl()) {323 wp_enqueue_script( 'rem-edit-property-map’, ‘https://maps.googleapis.com/maps/api/js?key=’.$maps_api.’&libraries=places’);324 } else {325 wp_enqueue_script( 'rem-edit-property-map’, ‘http://maps.googleapis.com/maps/api/js?key=’.$maps_api.’&libraries=places’);326 }327 } 328 $localize_vars = array(329 ‘use_map_from’ => rem_get_option('use_map_from’, ‘leaflet’),330 ‘def_lat’ => $def_lat,331 ‘def_long’ => $def_long,332 ‘zoom_level’ => $zoom_level,333 ‘map_type’ => $map_type,334 ‘maps_api’ => $maps_api,335 ‘drag_icon’ => $drag_icon,336 ‘maps_styles’ => stripcslashes(rem_get_option(‘maps_styles’)),337 );338 }339340 wp_enqueue_script( 'rem-create-pro’, REM_URL . '/assets/front/js/create-property.js’, array(‘jquery’));341 if (isset($localize_vars)) {342 wp_localize_script( 'rem-create-pro’, 'rem_edit_property_map’, $localize_vars );343 } else {344 $localize_vars = array(345 ‘def_lat’ => 'disable’,346 ); 347 wp_localize_script( 'rem-create-pro’, 'rem_edit_property_map’, $localize_vars );348 }349350 ob_start(); ?>351 <?php352 $property_individual_cbs = $rem_ob->get_all_property_features();353 $in_theme = get_stylesheet_directory().’/rem/shortcodes/edit-property.php’;354 if (file_exists($in_theme)) {355 include $in_theme;356 } else {357 include REM_PATH. '/shortcodes/edit-property.php’;358 }359 return ob_get_clean();360 } else {361 return apply_filters( 'the_content’, $content );362 } 363 }364365 function my_properties($attrs, $content = ‘’){366 if (is_user_logged_in()) {367 extract( shortcode_atts( array(368 ‘style’ => '’,369 ), $attrs ) );370371 rem_load_bs_and_fa();372 rem_load_basic_styles();373 wp_enqueue_script( 'sweet-alerts’, REM_URL . ‘/assets/admin/js/sweetalert.min.js’ , array(‘jquery’));374 wp_enqueue_style( 'rem-myproperties-css’, REM_URL . ‘/assets/front/css/my-properties.css’ );375 wp_enqueue_script( 'rem-my-pro’, REM_URL . '/assets/front/js/my-properties.js’, array(‘jquery’));376 $localize_vars = array(377 ‘ajaxurl’ => admin_url( ‘admin-ajax.php’ ),378 ‘confirm’ => __( 'Are you sure to delete this property?’, ‘real-estate-manager’ ),379 ‘yes_txt’ => __( 'Yes’, ‘real-estate-manager’ ),380 ‘no_txt’ => __( 'No’, ‘real-estate-manager’ ),381 ‘done_txt’ => __( 'Done’, ‘real-estate-manager’ ),382 );383 wp_localize_script( 'rem-my-pro’, 'rem_vars’, $localize_vars );384385 ob_start();386 387 $in_theme = get_stylesheet_directory().’/rem/shortcodes/my-properties.php’;388 if (file_exists($in_theme)) {389 include $in_theme;390 } else {391 include REM_PATH. '/shortcodes/my-properties.php’;392 }393 return ob_get_clean();394 } else {395 return apply_filters( 'the_content’, $content );396 } 397 }398399 function manage_properties($attrs){400 if (is_user_logged_in()) {401 extract( shortcode_atts( array(402 ‘role’ => 'administrator’,403 ), $attrs ) );404405 rem_load_bs_and_fa();406 rem_load_basic_styles();407 wp_enqueue_script( 'sweet-alerts’, REM_URL . ‘/assets/admin/js/sweetalert.min.js’ , array(‘jquery’));408 wp_enqueue_script( 'rem-my-pro’, REM_URL . '/assets/front/js/manage-properties.js’, array(‘jquery’));409 wp_enqueue_style( 'rem-myproperties-css’, REM_URL . ‘/assets/front/css/my-properties.css’ );410 $localize_vars = array(411 ‘ajaxurl’ => admin_url( ‘admin-ajax.php’ ),412 ‘confirm’ => __( 'Are you sure to delete this property?’, ‘real-estate-manager’ ),413 ‘yes_txt’ => __( 'Yes’, ‘real-estate-manager’ ),414 ‘no_txt’ => __( 'No’, ‘real-estate-manager’ ),415 ‘done_txt’ => __( 'Done’, ‘real-estate-manager’ ),416 );417 wp_localize_script( 'rem-my-pro’, 'rem_vars’, $localize_vars ); 418419 ob_start();420 421 $in_theme = get_stylesheet_directory().’/rem/shortcodes/manage-properties.php’;422 if (file_exists($in_theme)) {423 include $in_theme;424 } else {425 include REM_PATH. '/shortcodes/manage-properties.php’;426 }427 return ob_get_clean();428 } else {429 return apply_filters( 'the_content’, $content );430 }431 }432433 function list_properties($attrs, $content = ‘’){434 extract( shortcode_atts( array(435 ‘order’ => 'ASC’,436 ‘orderby’ => 'date’,437 ‘style’ => '1’,438 ‘posts’ => 10,439 ‘class’ => 'col-sm-12’,440 ‘purpose’ => '’,441 ‘status’ => '’,442 ‘author’ => '’,443 ‘type’ => '’,444 ‘tags’ => '’,445 ‘pagination’ => 'enable’,446 ‘meta’ => '’,447 ‘masonry’ => '’,448 ‘orderby_custom’ => '’,449 ‘top_bar’ => 'disable’,450 ‘not_available’ => 'enable’,451 ‘default_grid_style’ => '3’,452 ‘nearest_porperties’ => 'disable’,453 ‘features’ => '’,454 ), $attrs ) );455456 if (isset($_GET[‘list_style’]) && $_GET[‘list_style’] == ‘list’) {457 $style = '1’;458 }459460 if (isset($_GET[‘list_style’]) && $_GET[‘list_style’] == ‘grid’) {461 $style = $default_grid_style;462 }463464 if($style == ‘1’){465 $class = ‘col-sm-12 m-item’;466 } else {467 $class = $class.’ m-item’;468 }469470 rem_load_bs_and_fa();471 rem_load_basic_styles();472 if ($masonry == ‘enable’) {473 wp_enqueue_script( ‘jquery-masonry’ );474 }475 // Imagesfill and Loaded476 wp_enqueue_script( 'rem-imagefill-js’, REM_URL . '/assets/front/lib/imagefill.min.js’, array(‘jquery’)); 477 wp_enqueue_script( 'rem-imagesloaded-js’, REM_URL . '/assets/front/lib/imagesloaded.min.js’, array(‘jquery’));478 479 // Page Specific480 wp_enqueue_style( 'rem-archive-property-css’, REM_URL . ‘/assets/front/css/archive-property.css’ );481 wp_enqueue_script( 'rem-archive-property-js’, REM_URL . '/assets/front/js/archive-property.js’, array(‘jquery’));482483 $args = array(484 ‘order’ => $order,485 ‘orderby’ => $orderby, 486 ‘post_type’ => 'rem_property’,487 ‘posts_per_page’ => $posts,488 );489490 if ($orderby == ‘price’) {491 $args[‘orderby’] = 'meta_value_num’;492 $args[‘meta_key’] = 'rem_property_price’;493 }494495 if ($orderby_custom != ‘’) {496 $args[‘orderby’] = 'meta_value’;497 $args[‘meta_key’] = 'rem_’.$orderby_custom;498 }499500 if (isset($_GET[‘sort_by’]) && $_GET[‘sort_by’] != ‘’) {501 $sort_op = explode("-“, $_GET[‘sort_by’]);502 $args[‘order’] = strtoupper($sort_op[1]);503 $args[‘orderby’] = $sort_op[0];504 if ($sort_op[0] == ‘price’) {505 $args[‘orderby’] = 'meta_value_num’;506 $args[‘meta_key’] = 'rem_property_price’;507 }508 }509510 if ($author != ‘’) {511 if ($author == ‘current’ && is_user_logged_in()) {512 $current_user = wp_get_current_user();513 $args[‘author’] = $current_user->ID;514 } else {515 $args[‘author’] = $author;516 }517 }518519 if ($purpose != ‘’) {520 $args[‘meta_query’][] = array(521 array(522 ‘key’ => 'rem_property_purpose’,523 ‘value’ => $purpose,524 ‘compare’ => 'IN’,525 ),526 );527 }528 if ($status != ‘’) {529 $args[‘meta_query’][] = array(530 array(531 ‘key’ => 'rem_property_status’,532 ‘value’ => $status,533 ‘compare’ => 'IN’,534 ),535 );536 }537 if ($type != ‘’) {538 $args[‘meta_query’][] = array(539 array(540 ‘key’ => 'rem_property_type’,541 ‘value’ => $type,542 ‘compare’ => 'IN’,543 ),544 );545 }546 if ($features != ‘’) {547 $features = explode(“,", $features);548 foreach ($features as $feature) {549 $args[‘meta_query’][] = array(550 array(551 ‘key’ => 'rem_property_detail_cbs’,552 ‘value’ => $feature,553 ‘compare’ => 'LIKE’,554 ),555 );556 }557 }558 if ($tags != ‘’) {559 $p_tags = array_map('trim’, explode(',’, $tags));560 $args[‘tax_query’] = array(561 array(562 ‘taxonomy’ => 'rem_property_tag’,563 ‘field’ => 'name’,564 ‘terms’ => $p_tags,565 ),566 );567 }568 if ($meta != ‘’) {569 $meta_data = explode(“,", $meta);570 foreach ($meta_data as $single_meta) {571 $m_k_v = explode(“|", $single_meta);572 if (isset($m_k_v[1]) && $m_k_v[1] != ‘’ && strpos($m_k_v[1], ‘*’) == false) {573 $args[‘meta_query’][] = array(574 array(575 ‘key’ => 'rem_’.trim($m_k_v[0]),576 ‘value’ => trim($m_k_v[1]),577 ‘compare’ => 'LIKE’,578 ),579 );580 }581 if (isset($m_k_v[1]) && $m_k_v[1] != ‘’ && strpos($m_k_v[1], ‘*’) != false) {582 $m_k_v_and = explode(“*", $m_k_v[1]);583584 $meta_query_arr = array();585586 foreach ($m_k_v_and as $meta_value) {587 $meta_query_arr[] = array(588 ‘key’ => 'rem_’.trim($m_k_v[0]),589 ‘value’ => trim($meta_value),590 ‘compare’ => 'LIKE’,591 );592 }593 $meta_query_arr[‘relation’] = 'OR’;594 $args[‘meta_query’][] = $meta_query_arr;595 }596 597 }598 }599 if ($not_available == ‘disable’) {600 $args[‘meta_query’][] = array(601 array(602 ‘key’ => 'rem_property_status’,603 ‘value’ => 'Not Available’,604 ‘compare’ => 'NOT LIKE’,605 ),606 );607 }608609 $args = apply_filters( 'rem_list_porperties_args_before_render’, $args );610 611 if ($pagination == ‘enable’) {612 if (is_front_page()) {613 $paged = ( get_query_var(‘page’) ) ? get_query_var(‘page’) : 1;614 } else {615 $paged = ( get_query_var(‘paged’) ) ? get_query_var(‘paged’) : 1;616 }617 $args[‘paged’] = $paged;618 }619 ob_start();620621 if($nearest_porperties == ‘enable’){622 ?>623 <script>624 if (navigator.geolocation) {625 navigator.geolocation.getCurrentPosition(wcpSetPosition);626 }627 function wcpSetPosition(position) {628 var href = window.location.href;629 if (href.indexOf(‘lat’) == -1) {630 window.location.href = href += '/?lat=’+position.coords.latitude+’&long=’+position.coords.longitude;631 }632 } 633 </script>634 <?php635 }636 if ($nearest_porperties == ‘enable’ && isset($_GET[‘lat’]) && isset($_GET[‘long’])) {637 $args[‘posts_per_page’] = -1;638 $the_query = new WP_Query( $args );639 $in_theme = get_stylesheet_directory().’/rem/shortcodes/list/nearby.php’;640 if (file_exists($in_theme)) {641 include $in_theme;642 } else {643 include REM_PATH. '/shortcodes/list/nearby.php’;644 }645 } else {646 $the_query = new WP_Query( $args );647 $in_theme = get_stylesheet_directory().’/rem/shortcodes/list/list.php’;648 if (file_exists($in_theme)) {649 include $in_theme;650 } else {651 include REM_PATH. '/shortcodes/list/list.php’;652 }653 }654655 656 return ob_get_clean();657 }658659 function display_carousel($attrs, $content = ‘’){660 extract( shortcode_atts( array(661 ‘order’ => 'ASC’,662 ‘orderby’ => 'date’,663 ‘style’ => '1’,664 ‘slidestoshow’ => '1’,665 ‘slidestoscroll’ => '1’,666 ‘speed’ => '2000’,667 ‘autoplay’ => 'disable’,668 ‘autoplayspeed’ => '2000’,669 ‘arrows’ => 'disable’,670 ‘dots’ => 'disable’,671 ‘ids’ => '’,672 ‘meta’ => '’,673 ‘author’ => '’,674 ‘tags’ => '’,675 ‘not_available’ => 'disable’,676 ‘total_properties’ => '10’,677 ‘nearest_porperties’ => 'disable’,678 ), $attrs ) );679 if($style == ‘1’){680 $attrs[‘slidestoshow’] = '1’;681 }682 $data_attr = '’;683 if(is_array($attrs)){684 foreach ($attrs as $p_name => $p_val) {685 if ($p_val != ‘’) {686 $data_attr .= ' data-‘.$p_name.’ = '.$p_val;687 }688 }689 }690691 rem_load_bs_and_fa();692 rem_load_basic_styles();693694 // Imagesfill and Loaded695 wp_enqueue_script( 'rem-imagefill-js’, REM_URL . '/assets/front/lib/imagefill.min.js’, array(‘jquery’)); 696 wp_enqueue_script( 'rem-imagesloaded-js’, REM_URL . '/assets/front/lib/imagesloaded.min.js’, array(‘jquery’)); 697 698 // Carousel699 wp_enqueue_style( 'rem-carousel-css’, REM_URL . ‘/assets/front/lib/slick.css’ );700 wp_enqueue_script( 'rem-carousel-js’, REM_URL . '/assets/front/lib/slick.min.js’, array(‘jquery’));701702 // Page Specific703 wp_enqueue_style( 'rem-archive-property-css’, REM_URL . ‘/assets/front/css/archive-property.css’ );704 wp_enqueue_script( 'rem-custom-carousel-js’, REM_URL . '/assets/front/js/carousel.js’, array(‘jquery’));705706 $args = array(707 ‘order’ => $order,708 ‘orderby’ => $orderby, 709 ‘post_type’ => 'rem_property’,710 ‘posts_per_page’ => $total_properties,711 );712 if ($author != ‘’) {713 if ($author == ‘current’ && is_user_logged_in()) {714 $current_user = wp_get_current_user();715 $args[‘author’] = $current_user->ID;716 } else {717 $args[‘author’] = $author;718 }719 }720 if ($meta != ‘’) {721 $meta_data = explode(“,", $meta);722 foreach ($meta_data as $single_meta) {723 $m_k_v = explode(“|", $single_meta);724 if (isset($m_k_v[1]) && $m_k_v[1] != ‘’) {725 $args[‘meta_query’][] = array(726 array(727 ‘key’ => 'rem_’.trim($m_k_v[0]),728 ‘value’ => trim($m_k_v[1]),729 ‘compare’ => 'LIKE’,730 ),731 );732 }733 734 }735 }736 if ($not_available == ‘disable’) {737 $args[‘meta_query’][] = array(738 array(739 ‘key’ => 'rem_property_status’,740 ‘value’ => 'Not Available’,741 ‘compare’ => 'NOT LIKE’,742 ),743 );744 } 745 if ($tags != ‘’) {746 $p_tags = array_map('trim’, explode(',’, $tags));747 $args[‘tax_query’] = array(748 array(749 ‘taxonomy’ => 'rem_property_tag’,750 ‘field’ => 'name’,751 ‘terms’ => $p_tags,752 ),753 );754 }755 756 if ($ids != ‘’) {757 $args[‘post__in’] = explode(',’, $ids);758 }759760 ob_start();761762 if($nearest_porperties == ‘enable’){763 ?>764 <script>765 if (navigator.geolocation) {766 navigator.geolocation.getCurrentPosition(wcpSetPosition);767 }768 function wcpSetPosition(position) {769 var href = window.location.href;770 if (href.indexOf(‘lat’) == -1) {771 window.location.href = href += '/?lat=’+position.coords.latitude+’&long=’+position.coords.longitude;772 }773 } 774 </script>775 <?php776 }777 if ($nearest_porperties == ‘enable’ && isset($_GET[‘lat’]) && isset($_GET[‘long’])) {778 $args[‘posts_per_page’] = -1;779 $the_query = new WP_Query( $args );780 $in_theme = get_stylesheet_directory().’/rem/shortcodes/carousel/nearby.php’;781 if (file_exists($in_theme)) {782 include $in_theme;783 } else {784 include REM_PATH. '/shortcodes/carousel/nearby.php’;785 }786 } else {787 // The Loop788 $the_query = new WP_Query( $args );789 $in_theme = get_stylesheet_directory().’/rem/shortcodes/carousel/carousel.php’;790 if (file_exists($in_theme)) {791 include $in_theme;792 } else {793 include REM_PATH. '/shortcodes/carousel/carousel.php’;794 }795 }796797 return ob_get_clean();798 }799800 /**801 * Create a shortcode button for tinymce802 *803 * @return [type] [description]804 */805 public function shortcode_button(){806 if (isset($_GET[‘post’]) && get_post_type($_GET[‘post’]) != ‘rem_property’) {807 if( current_user_can(‘edit_posts’) && current_user_can(‘edit_pages’) ){808 add_filter( 'mce_external_plugins’, array($this, ‘add_buttons’ ));809 add_filter( 'mce_buttons’, array($this, ‘register_buttons’ ));810 }811 }812 }813814 /**815 * Add new Javascript to the plugin scrippt array816 *817 * @param Array $plugin_array - Array of scripts818 *819 * @return Array820 */821 public function add_buttons( $plugin_array )822 {823 $plugin_array[‘rem_shortcodes’] = REM_URL . '/assets/admin/js/shortcode.js’;824825 return $plugin_array;826 }827828 /**829 * Add new button to tinymce830 *831 * @param Array $buttons - Array of buttons832 *833 * @return Array834 */835 public function register_buttons( $buttons )836 {837 array_push( $buttons, 'separator’, ‘rem_shortcodes’ );838 return $buttons;839 }840841 /**842 * It displays search results from widgets843 */844 function display_search_results($attrs, $content = ‘’){845 extract( shortcode_atts( array(846 ‘order’ => 'ASC’,847 ‘orderby’ => 'date’,848 ), $attrs ) );849 850 rem_load_bs_and_fa();851 rem_load_basic_styles();852 wp_enqueue_style( 'rem-archive-property-css’, REM_URL . ‘/assets/front/css/archive-property.css’ );853854 wp_enqueue_script( 'rem-imagefill-js’, REM_URL . '/assets/front/lib/imagefill.min.js’, array(‘jquery’)); 855 wp_enqueue_script( 'rem-imagesloaded-js’, REM_URL . '/assets/front/lib/imagesloaded.min.js’, array(‘jquery’));856857 wp_enqueue_script( 'rem-search-results’, REM_URL . '/assets/front/js/search-results.js’, array(‘jquery’));858859 ob_start();860 if (isset($_GET[‘simple_search’])) {861 $in_theme = get_stylesheet_directory().’/rem/shortcodes/search-results-simple.php’;862 if (file_exists($in_theme)) {863 include $in_theme;864 } else {865 include REM_PATH. '/shortcodes/search-results-simple.php’;866 }867 } else {868 $in_theme = get_stylesheet_directory().’/rem/shortcodes/search-results.php’;869 if (file_exists($in_theme)) {870 include $in_theme;871 } else {872 include REM_PATH. '/shortcodes/search-results.php’;873 }874 }875 return ob_get_clean();876 }877878 function display_maps($attrs){879 $default_icon = rem_get_option('maps_property_image’, REM_URL . ‘/assets/images/maps/cottage-pin.png’);880 $default_icon_h = rem_get_option('maps_property_image_hover’, REM_URL . ‘/assets/images/maps/cottage-hover-pin.png’);881 extract( shortcode_atts( array(882 ‘load_heading’ => 'Loading Maps’,883 ‘load_desc’ => 'Please Wait…’,884 ‘ids’ => '’,885 ‘total_properties’ => '10’,886 ‘order’ => 'ASC’,887 ‘orderby’ => 'date’, 888 ‘meta’ => '’, 889 ‘tags’ => '’, 890 ‘agent’ => '’, 891 ‘btn_bg_color’ => '’,892 ‘btn_text_color’ => '’,893 ‘btn_bg_color_hover’ => '’,894 ‘btn_text_color_hover’ => '’,895 ‘loader_color’ => '’,896 ‘type_bar_bg_color’ => '’,897 ‘water_color’ => '’,898 ‘fill_color’ => '’,899 ‘poi_color’ => '’,900 ‘poi_color_hue’ => '’,901 ‘roads_lightness’ => '’,902 ‘lines_lightness’ => '’,903 'nearest_porperties’=> 'disable’,904 'map_height’=> '’,905 906 ‘type_filtering’ => 'disable’,907 ‘filter_by_key’ => 'property_type’,908 ‘filter_options’ => '’,909 ‘bottom_btn_bg_color’ => '’,910 ‘bottom_btn_text_color’ => '’,911 ‘bottom_btn_bg_color_hover’ => '’,912 ‘bottom_btn_text_color_hover’ => '’,913 ‘bottom_btn_bg_color_active’ => '’,914915 ‘use_map_from’ => '’,916 ‘def_lat’ => '’,917 ‘def_long’ => '’,918 ‘map_zoom’ => '’,919 ‘map_id’ => 'leafletmaps’,920 ‘leaflet_styles’ => '’,921 922 ‘icons_by_meta’ => 'property_purpose’,923 ‘icons_data’ => 'sell|’.$default_icon.’|’.$default_icon_h.’,rent|’.$default_icon.’|’.$default_icon_h,924 ‘my_location_icon’ => rem_get_option('maps_my_location_image’, REM_URL. ‘/assets/images/maps/you-are-here.png’),925 ‘circle_icon’ => rem_get_option('maps_circle_image’, REM_URL. ‘/assets/images/maps/m1.png’),926 ), $attrs ) );927928 if ($use_map_from == ‘’) {929 $use_map_from = rem_get_option('use_map_from’, ‘leaflet’);930 }931932 if ($leaflet_styles == ‘’) {933 $leaflet_styles = rem_get_leaflet_provider(rem_get_option(‘leaflet_style’));934 }935936 $icons_array = explode(“,", $icons_data);937 $map_icons = array();938939 foreach ($icons_array as $icon_meta) {940 $icon_meta_arr = explode(“|", $icon_meta);941 $map_icons[trim($icon_meta_arr[0])] = array(942 ‘static’ => trim($icon_meta_arr[1]),943 ‘hover’ => trim($icon_meta_arr[2]),944 );945 }946947 // Fetching Properties and creating array948 $all_properties = array();949950 $args = array(951 ‘order’ => $order,952 ‘orderby’ => $orderby, 953 ‘post_type’ => 'rem_property’,954 ‘posts_per_page’ => -1,955 );956957 if ($agent != ‘’) {958 if ($agent == ‘current’ && is_user_logged_in()) {959 $current_user = wp_get_current_user();960 $args[‘author’] = $current_user->ID;961 } else {962 $args[‘author’] = $agent;963 }964 }965966 if ($meta != ‘’) {967 $meta_data = explode(“,", $meta);968 foreach ($meta_data as $single_meta) {969 $m_k_v = explode(“|", $single_meta);970 if (isset($m_k_v[1]) && $m_k_v[1] != ‘’) {971 $args[‘meta_query’][] = array(972 array(973 ‘key’ => 'rem_’.trim($m_k_v[0]),974 ‘value’ => trim($m_k_v[1]),975 ‘compare’ => 'IN’,976 ),977 );978 }979 980 }981 }982 if ($tags != ‘’) {983 $p_tags = array_map('trim’, explode(',’, $tags));984 $args[‘tax_query’] = array(985 array(986 ‘taxonomy’ => 'rem_property_tag’,987 ‘field’ => 'name’,988 ‘terms’ => $p_tags,989 ),990 );991 }992 if ($ids != ‘’) {993 $args[‘post__in’] = explode(',’, $ids);994 }995996 ob_start();997998 if($nearest_porperties == ‘enable’){999 ?>1000 <script>1001 if (navigator.geolocation) {1002 navigator.geolocation.getCurrentPosition(wcpSetPosition);1003 }1004 function wcpSetPosition(position) {1005 var href = window.location.href;1006 if (href.indexOf(‘lat’) == -1) {1007 window.location.href = href += '/?lat=’+position.coords.latitude+’&long=’+position.coords.longitude;1008 }1009 } 1010 </script>1011 <?php1012 }1013 if ($nearest_porperties == ‘enable’ && isset($_GET[‘lat’]) && isset($_GET[‘long’])) {1014 $args[‘posts_per_page’] = -1;1015 $the_query = new WP_Query( $args );1016 $in_theme = get_stylesheet_directory().’/rem/shortcodes/map/nearby.php’;1017 if (file_exists($in_theme)) {1018 include $in_theme;1019 } else {1020 include REM_PATH. '/shortcodes/map/nearby.php’;1021 }1022 } else {1023 // The Loop1024 $the_query = new WP_Query( $args );1025 $in_theme = get_stylesheet_directory().’/rem/shortcodes/map/map.php’;1026 if (file_exists($in_theme)) {1027 include $in_theme;1028 } else {1029 include REM_PATH. '/shortcodes/map/map.php’;1030 }1031 }10321033 return ob_get_clean();1034 }10351036 function list_agents($attrs){1037 extract( shortcode_atts( array(1038 ‘ids’ => '’,1039 ‘columns’ => 'col-sm-12’,1040 ‘orderby’ => 'login’,1041 ‘order’ => 'ASC’,1042 ‘meta_key’ => '’,1043 ‘meta_value’ => '’,1044 ‘total’ => '10’,1045 ‘masonry’ => 'enable’,1046 ), $attrs ) );10471048 $args = array(1049 ‘role’ => 'rem_property_agent’,1050 ‘orderby’ => $orderby,1051 ‘order’ => $order,1052 ‘meta_key’ => $meta_key,1053 ‘meta_value’ => $meta_value,1054 ‘masonry’ => $masonry,1055 ‘number’ => $total,1056 );1057 if ($ids != ‘’) {1058 $args[‘include’] = explode(“,", $ids);1059 }1060 $agents = get_users( $args );1061 rem_load_bs_and_fa();1062 rem_load_basic_styles();1063 wp_enqueue_script( 'rem-imagesloaded-js’, REM_URL . '/assets/front/lib/imagesloaded.min.js’, array(‘jquery’));1064 wp_enqueue_script( 'rem-agents-list-js’, REM_URL . '/assets/front/js/list-agents.js’, array('jquery’, ‘jquery-masonry’));1065 ob_start();1066 $the_query = new WP_Query( $args );1067 $in_theme = get_stylesheet_directory().’/rem/shortcodes/agents.php’;1068 if (file_exists($in_theme)) {1069 include $in_theme;1070 } else {1071 include REM_PATH. '/shortcodes/agents.php’;1072 }10731074 return ob_get_clean();1075 }10761077 function logout_button($attrs){1078 extract( shortcode_atts( array(1079 ‘redirect’ => wp_logout_url(home_url()),1080 ‘button_classes’ => 'btn btn-default’,1081 ‘label’ => __( 'Logout’, ‘real-estate-manager’ ),1082 ), $attrs ) ); 1083 ob_start(); ?>1084 <span class="ich-settings-main-wrap">1085 <?php if (is_user_logged_in()) { ?>1086 <a href="<?php echo esc_url( $redirect ); ?>” class="<?php echo $button_classes; ?>"><?php echo $label; ?></a>1087 <?php } ?>1088 </span>1089 <?php return ob_get_clean();1090 }10911092 function rem_vc_addons_setup(){1093 if (rem_get_option('wpbakery_addons’, ‘enable’) == ‘enable’) {1094 include REM_PATH. '/shortcodes/page-builders/all-setting-fields.php’;1095 include REM_PATH. '/shortcodes/page-builders/vc-settings.php’;10961097 foreach ($shortcodes as $sc) {1098 vc_map($sc);1099 }1100 }1101 }11021103 function rem_divi_modules_setup(){1104 if ( rem_get_option('divi_modules’, ‘enable’) == ‘enable’ && class_exists(‘ET_Builder_Module’) ) {1105 include REM_PATH. '/shortcodes/page-builders/all-setting-fields.php’;1106 include_once REM_PATH. '/shortcodes/page-builders/divi-settings.php’;1107 }1108 }11091110 function display_agent($attrs, $content = ‘’){1111 extract( shortcode_atts( array(1112 ‘author_id’ => '1’,1113 ), $attrs ) );1114 global $rem_ob;11151116 rem_load_bs_and_fa();1117 rem_load_basic_styles();1118 wp_enqueue_style( 'rem-skillbars-css’, REM_URL . ‘/assets/front/lib/skill-bars.css’ );11191120 // Imagesfill and Loaded1121 wp_enqueue_script( 'rem-imagefill-js’, REM_URL . '/assets/front/lib/imagefill.min.js’, array(‘jquery’)); 1122 wp_enqueue_script( 'rem-imagesloaded-js’, REM_URL . '/assets/front/lib/imagesloaded.min.js’, array(‘jquery’)); 1123 1124 // Carousel1125 wp_enqueue_style( 'rem-carousel-css’, REM_URL . ‘/assets/front/lib/slick.css’ );1126 wp_enqueue_script( 'rem-carousel-js’, REM_URL . '/assets/front/lib/slick.min.js’, array(‘jquery’));11271128 // Page Specific1129 wp_enqueue_style( 'rem-archive-property-css’, REM_URL . ‘/assets/front/css/archive-property.css’ );1130 wp_enqueue_style( 'rem-profile-agent-css’, REM_URL . ‘/assets/front/css/profile-agent.css’ );1131 wp_enqueue_script( 'rem-profile-agent-js’, REM_URL . '/assets/front/js/profile-agent.js’, array(‘jquery’));11321133 ob_start();1134 $in_theme = get_stylesheet_directory().’/rem/shortcodes/agent-profile.php’;1135 if (file_exists($in_theme)) {1136 include $in_theme;1137 } else {1138 include REM_PATH. '/shortcodes/agent-profile.php’;1139 }1140 return ob_get_clean();1141 }11421143 function my_profile($attrs, $content = ‘’){1144 if (is_user_logged_in()) {1145 global $rem_ob;11461147 $current_user = wp_get_current_user();1148 $author_id = $current_user->ID;11491150 rem_load_bs_and_fa();1151 rem_load_basic_styles();1152 wp_enqueue_style( 'rem-skillbars-css’, REM_URL . ‘/assets/front/lib/skill-bars.css’ );11531154 // Imagesfill and Loaded1155 wp_enqueue_script( 'rem-imagefill-js’, REM_URL . '/assets/front/lib/imagefill.min.js’, array(‘jquery’)); 1156 wp_enqueue_script( 'rem-imagesloaded-js’, REM_URL . '/assets/front/lib/imagesloaded.min.js’, array(‘jquery’)); 1157 1158 // Carousel1159 wp_enqueue_style( 'rem-carousel-css’, REM_URL . ‘/assets/front/lib/slick.css’ );1160 wp_enqueue_script( 'rem-carousel-js’, REM_URL . '/assets/front/lib/slick.min.js’, array(‘jquery’));11611162 // Page Specific1163 wp_enqueue_style( 'rem-archive-property-css’, REM_URL . ‘/assets/front/css/archive-property.css’ );1164 wp_enqueue_style( 'rem-profile-agent-css’, REM_URL . ‘/assets/front/css/profile-agent.css’ );1165 wp_enqueue_script( 'rem-profile-agent-js’, REM_URL . '/assets/front/js/profile-agent.js’, array(‘jquery’));11661167 ob_start();1168 $in_theme = get_stylesheet_directory().’/rem/shortcodes/agent-profile.php’;1169 if (file_exists($in_theme)) {1170 include $in_theme;1171 } else {1172 include REM_PATH. '/shortcodes/agent-profile.php’;1173 }1174 return ob_get_clean();1175 } else {1176 if ($content != ‘’) {1177 return apply_filters( 'the_content’, $content );1178 } else {1179 return $this->login_agent();1180 }1181 }11821183 }11841185 function edit_agent($attrs, $content = ‘’){1186 if (is_user_logged_in()) {11871188 rem_load_bs_and_fa();1189 rem_load_basic_styles();1190 wp_enqueue_media();1191 wp_enqueue_style( 'rem-register-css’, REM_URL . ‘/assets/front/css/register-agent.css’ );1192 wp_enqueue_script( 'rem-register-agent-js’, REM_URL . '/assets/front/js/edit-agent.js’, array(‘jquery’));11931194 ob_start();1195 $in_theme = get_stylesheet_directory().’/rem/shortcodes/edit-agent.php’;1196 if (file_exists($in_theme)) {1197 include $in_theme;1198 } else {1199 include REM_PATH. '/shortcodes/edit-agent.php’;1200 }1201 return ob_get_clean();1202 } else {1203 return apply_filters( 'the_content’, $content );1204 }1205 }12061207 function single_property($attrs, $content = ‘’){1208 if (isset($attrs[‘id’])) {12091210 rem_load_bs_and_fa();12111212 rem_load_basic_styles();12131214 // Photorama1215 wp_enqueue_style( 'rem-fotorama-css’, REM_URL . ‘/assets/front/lib/fotorama.min.css’ );1216 wp_enqueue_script( 'rem-photorama-js’, REM_URL . '/assets/front/lib/fotorama.min.js’, array(‘jquery’));12171218 // Imagesfill and Loaded1219 wp_enqueue_script( 'rem-imagefill-js’, REM_URL . '/assets/front/lib/imagefill.min.js’, array(‘jquery’)); 1220 wp_enqueue_script( 'rem-imagesloaded-js’, REM_URL . '/assets/front/lib/imagesloaded.min.js’, array(‘jquery’)); 1221 1222 // Page Specific1223 wp_enqueue_style( 'rem-single-property-css’, REM_URL . ‘/assets/front/css/single-property.css’ );1224 wp_enqueue_script( 'rem-single-property-js’, REM_URL . '/assets/front/js/single-property.js’, array(‘jquery’));12251226 // If Map is enabled1227 if (rem_get_option('single_property_map’, ‘enable’) == ‘enable’) {1228 global $post;1229 $property_id = (isset($post->ID)) ? $post->ID : '’;1230 $latitude = get_post_meta($property_id, 'rem_property_latitude’, true);1231 $longitude = get_post_meta($property_id, 'rem_property_longitude’, true);1232 $address = get_post_meta($property_id, 'rem_property_address’, true);1233 $zoom = rem_get_option( 'maps_zoom_level’, 10);1234 $map_type = rem_get_option( 'maps_type’, ‘roadmap’);1235 $maps_api = apply_filters( 'rem_maps_api’, ‘AIzaSyBbpbij9IIXGftKhFLMHOuTpAbFoTU_8ZQ’);1236 $maps_icon_url = apply_filters( 'rem_maps_location_icon’, REM_URL . '/assets/images/pin-maps.png’, $property_id );1237 $load_map_from = ($latitude == ‘’ || $longitude == ‘’) ? ‘address’ : ‘coords’ ;1238 if (rem_get_option('use_map_from’, ‘leaflet’) == ‘leaflet’) {1239 wp_enqueue_style( 'rem-leaflet-css’, REM_URL . ‘/assets/front/leaflet/leaflet.css’);1240 wp_enqueue_script( 'rem-leaflet-js’, REM_URL . '/assets/front/leaflet/leaflet.js’, array(‘jquery’));1241 } else {1242 if (is_ssl()) {1243 wp_enqueue_script( 'rem-single-property-map’, 'https://maps.googleapis.com/maps/api/js?key=’.$maps_api);1244 } else {1245 wp_enqueue_script( 'rem-single-property-map’, 'http://maps.googleapis.com/maps/api/js?key=’.$maps_api);1246 }1247 }1248 $localize_vars = array(1249 ‘use_map_from’ => rem_get_option('use_map_from’, ‘leaflet’),1250 ‘latitude’ => $latitude,1251 ‘longitude’ => $longitude,1252 ‘zoom’ => $zoom,1253 ‘map_type’ => $map_type,1254 ‘leaflet_styles’ => rem_get_leaflet_provider(rem_get_option(‘leaflet_style’)),1255 ‘address’ => $address,1256 ‘load_map_from’ => $load_map_from,1257 ‘maps_icon_url’ => $maps_icon_url,1258 ‘maps_styles’ => stripcslashes(rem_get_option(‘maps_styles’)),1259 );1260 }12611262 wp_enqueue_script( 'rem-single-property-js’, REM_URL . '/assets/front/js/single-property.js’, array(‘jquery’));12631264 if (isset($localize_vars)) {1265 wp_localize_script( 'rem-single-property-js’, 'rem_property_map’, $localize_vars );1266 } else {1267 $localize_vars = array(1268 ‘latitude’ => 'disable’,1269 ); 1270 wp_localize_script( 'rem-single-property-js’, 'rem_property_map’, $localize_vars );1271 } 12721273 ob_start(); ?>1274 <section id="property-content” class="ich-settings-main-wrap">1275 <?php do_action( 'rem_single_property_slider’, $attrs[‘id’] ); ?>1276 <?php do_action( 'rem_single_property_contents’, $attrs[‘id’] ); ?>1277 </section>1278 <?php return ob_get_clean();1279 }1280 }12811282 function rem_user_login_check(){1283 if (isset($_REQUEST)) {1284 extract($_REQUEST);1285 global $user;1286 $creds = array();1287 $creds[‘user_login’] = $rem_username;1288 $creds[‘user_password’] = $rem_userpass;1289 $creds[‘remember’] = (isset($rememberme)) ? true : false;1290 $user = wp_signon( $creds, true );12911292 if ( is_wp_error($user) ) {1293 $resp = array(1294 ‘status’ => 'failed’,1295 ‘message’ => $user->get_error_message(),1296 );1297 echo json_encode($resp);1298 }1299 if ( !is_wp_error($user) ) {1300 $resp = array(1301 ‘status’ => 'success’,1302 ‘message’ => '’,1303 );1304 wp_set_auth_cookie( $user->ID, true, false );1305 echo json_encode($resp);1306 }13071308 die(0);1309 }1310 }13111312 function create_property_frontend(){1313 if (isset($_REQUEST) && $_REQUEST != ‘’) {1314 extract($_REQUEST);1315 $current_user_data = wp_get_current_user();13161317 // Create post object1318 $my_post = array(1319 ‘post_title’ => wp_strip_all_tags( $title ),1320 ‘post_content’ => $content,1321 ‘post_author’ => $current_user_data->ID,1322 ‘post_type’ => 'rem_property’,1323 );13241325 // If Editing Property1326 1327 if (isset($_REQUEST[‘property_id’]) && get_post_field( 'post_author’, $_REQUEST[‘property_id’] ) == $current_user_data->ID) {1328 $my_post[‘ID’] = $_REQUEST[‘property_id’];13291330 if (isset($_REQUEST[‘accessibility’]) && $_REQUEST[‘accessibility’] != ‘’) {1331 if (rem_get_option(‘property_submission_mode’) == ‘approve’ && get_post_status($_REQUEST[‘property_id’]) == ‘pending’) {1332 $p_status = 'pending’;1333 } else {1334 $p_status = $_REQUEST[‘accessibility’];1335 }1336 } else {1337 $p_status = get_post_status($_REQUEST[‘property_id’]);1338 }1339 $my_post[‘post_status’] = $p_status;1340 } else {1341 if (rem_get_option(‘property_submission_mode’) == ‘approve’) {1342 $my_post[‘post_status’] = 'pending’;1343 do_action( 'rem_new_property_submitted’, ‘’ );1344 } else {1345 $my_post[‘post_status’] = 'publish’;1346 }1347 }1348 // just for previewing prop1349 if (isset($_REQUEST[‘preview_property’])) {1350 $my_post[‘post_status’] = 'draft’;1351 }1352 if ( isset($_REQUEST[‘property_preview_id’]) && $_REQUEST[‘property_preview_id’] != ‘’ ) {1353 $my_post[‘ID’] = $_REQUEST[‘property_preview_id’];1354 }13551356 $status = apply_filters( 'rem_property_publish_status’, $my_post[‘post_status’], $current_user_data->ID );13571358 $my_post[‘post_status’] = $status;13591360 // Insert the post into the database1361 $property_id = wp_insert_post( $my_post );13621363 foreach ($_REQUEST as $key => $data) {1364 if ($key != ‘title’ || $key != ‘content’ || $key != ‘rem_property_data’ || $key != ‘tags’) {1365 update_post_meta( $property_id, 'rem_’.$key, $data );1366 }136713681369 if ($key == ‘rem_property_data’) {1370 update_post_meta( $property_id, 'rem_property_images’, $data[‘property_images’] );1371 $img_ids = 0;1372 foreach ($data[‘property_images’] as $imgID => $id) {1373 if ($img_ids == 0) {1374 set_post_thumbnail( $property_id, $imgID );1375 }1376 $img_ids++;1377 }1378 }13791380 if ($key == ‘tags’) {1381 wp_set_post_terms( $property_id, $data, ‘rem_property_tag’ );1382 }1383 }13841385 if (!isset($_REQUEST[‘property_detail_cbs’])) {1386 update_post_meta( $property_id, 'rem_property_detail_cbs’, ‘’ );1387 }1388 if (!isset($_REQUEST[‘rem_property_data’][‘property_images’])) {1389 update_post_meta( $property_id, 'rem_property_images’, ‘’ );1390 }13911392 // Property id edited1393 if (isset($_REQUEST[‘property_id’]) && get_post_field( 'post_author’, $_REQUEST[‘property_id’] ) == $current_user_data->ID) {1394 echo apply_filters( 'rem_redirect_after_property_edit’, get_permalink( $property_id ), $_REQUEST );1395 exit;1396 }1397 // just for previewing prop1398 if (isset($_REQUEST[‘preview_property’])) {1399 $resp = array(1400 ‘property_id’ => $property_id,1401 ‘preview_link’ => get_preview_post_link($property_id),1402 );1403 wp_send_json($resp);1404 }1405 echo apply_filters( 'rem_redirect_after_property_submit’, get_permalink( $property_id ), $_REQUEST );1406 }14071408 die();1409 }14101411 function manage_my_properties(){14121413 $current_user = wp_get_current_user();1414 $agent_id = $current_user->ID;14151416 if (isset($_REQUEST[‘p_ids’])) {1417 foreach ($_REQUEST[‘p_ids’] as $p_id) {14181419 $post_author_id = get_post_field( 'post_author’, $p_id );14201421 // check if admin of author of current property1422 if (current_user_can( ‘manage_options’) || $agent_id == $post_author_id) {1423 if ($_REQUEST[‘status’] == ‘publish’) {1424 wp_update_post( array(‘ID’ => $p_id, ‘post_status’ => ‘publish’) );1425 }1426 if ($_REQUEST[‘status’] == ‘draft’) {1427 wp_update_post( array(‘ID’ => $p_id, ‘post_status’ => ‘draft’) );1428 }1429 }14301431 }1432 }14331434 echo __( 'Done’, ‘real-estate-manager’ );14351436 die(0);1437 } 14381439 function rem_save_profile_front(){1440 $current_user = wp_get_current_user();1441 $agent_id = $current_user->ID;1442 if ($agent_id == $_REQUEST[‘agent_id’]) {1443 foreach ($_REQUEST as $key => $value) {1444 if ($key == ‘useremail’) {1445 wp_update_user( array(1446 ‘ID’ => $agent_id,1447 ‘user_email’ => $value,1448 ));1449 } elseif ($key == ‘action’) {1450 1451 } elseif ($key == ‘agent_id’) {1452 1453 } else {1454 update_user_meta( $agent_id, $key, $value );1455 }1456 }1457 }14581459 echo '<p class="alert alert-success">’.__( “Changes Saved!", ‘real-estate-manager’ ).’</p>’;14601461 die(0);1462 }14631464 1465 function get_distance( $latitude1, $longitude1, $latitude2, $longitude2 ) { 1466 $earth_radius = 6371;14671468 $dLat = deg2rad( $latitude2 - $latitude1 );1469 $dLon = deg2rad( $longitude2 - $longitude1 );14701471 $a = sin($dLat/2) * sin($dLat/2) + cos(deg2rad($latitude1)) * cos(deg2rad($latitude2)) * sin($dLon/2) * sin($dLon/2); 1472 $c = 2 * asin(sqrt($a)); 1473 $d = $earth_radius * $c; 14741475 return $d;1476 }14771478 function search_results(){1479 if(isset($_REQUEST)){1480 extract($_REQUEST);1481 include REM_PATH . '/inc/ajax/search-property-ajax.php’;1482 }14831484 die(0);1485 }14861487 function rem_register_agent(){14881489 if (isset($_REQUEST)) {1490 $resp = array();14911492 // Checking for Spams1493 if (isset($_REQUEST[‘g-recaptcha-response’])) {1494 if (!$_REQUEST[‘g-recaptcha-response’]) {1495 $resp = array(‘status’ => 'already’, ‘msg’ => __( 'Please check the captcha form.’, ‘real-estate-manager’ ));1496 echo json_encode($resp); exit;1497 } else {1498 $captcha = $_REQUEST[‘g-recaptcha-response’];1499 $secretKey = rem_get_option('captcha_secret_key’, ‘6LcDhUQUAAAAAGKQ7gd1GsGAkEGooVISGEl3s7ZH’);1500 $ip = $_SERVER[‘REMOTE_ADDR’];1501 $response = wp_remote_post(“https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&response=".$captcha."&remoteip=".$ip);1502 $responseKeys = json_decode($response[‘body’], true);1503 if(intval($responseKeys[“success”]) !== 1) {1504 $resp = array(‘status’ => 'error’, ‘msg’ => __( 'There was an error. Please try again after reloading page.’, ‘real-estate-manager’ ));1505 echo json_encode($resp); exit;1506 }1507 }1508 }15091510 // Lets Check if username already exists1511 if (username_exists( $_REQUEST[‘username’] ) || email_exists( $_REQUEST[‘useremail’] )) {1512 $resp = array(‘status’ => 'already’, ‘msg’ => __( 'Username or Email already exists’, ‘real-estate-manager’ ));1513 } else {15141515 if (rem_get_option('agents_approval’, ‘manual’) == ‘auto’) {1516 extract($_REQUEST);1517 $agent_id = wp_create_user( $username, $password, $useremail );1518 if ($agent_id) {1519 do_action( 'rem_new_agent_register’, $_REQUEST );1520 $resp = array(‘status’ => 'success’, ‘msg’ => __( 'Registered Successfully, please wait until admin approves.’, ‘real-estate-manager’ ));1521 } else {1522 $resp = array(‘status’ => 'error’, ‘msg’ => __( 'Error, please try later’, ‘real-estate-manager’ ));1523 } 15241525 do_action( 'rem_new_agent_approved’, $_REQUEST );15261527 if ($agent_id != ‘’) {1528 wp_update_user( array( ‘ID’ => $agent_id, ‘role’ => ‘rem_property_agent’ ) );1529 }15301531 global $rem_ob;1532 $agent_fields = $rem_ob->get_agent_fields();15331534 foreach ($agent_fields as $field) {1535 if (isset($_REQUEST[$field[‘key’]])) {1536 update_user_meta( $agent_id, $field[‘key’], $_REQUEST[$field[‘key’]]);1537 }1538 } 1539 1540 } else {1541 $_REQUEST[‘time’] = current_time( ‘mysql’ );15421543 $previous_users = get_option( ‘rem_pending_users’ );15441545 if ( $previous_users != ‘’ && is_array($previous_users)) {1546 foreach ($previous_users as $single_user) {1547 if ($single_user[‘username’] == $_REQUEST[‘username’] || $single_user[‘useremail’] == $_REQUEST[‘useremail’]) {1548 $resp = array(‘status’ => 'already’, ‘msg’ => __( 'Username or Email already exists’, ‘real-estate-manager’ ));1549 echo json_encode($resp);1550 exit;1551 }1552 }1553 $previous_users[] = $_REQUEST;1554 } else {1555 $previous_users = array($_REQUEST);1556 }15571558 // var_dump($_REQUEST); exit;1559 if (update_option( 'rem_pending_users’, $previous_users )) {1560 do_action( 'rem_new_agent_register’, $_REQUEST );1561 $resp = array(‘status’ => 'success’, ‘msg’ => __( 'Registered Successfully, please wait until admin approves.’, ‘real-estate-manager’ ));1562 } else {1563 $resp = array(‘status’ => 'error’, ‘msg’ => __( 'Error, please try later’, ‘real-estate-manager’ ));1564 }1565 }1566 }15671568 echo json_encode($resp);1569 die(0);1570 }1571 }15721573 function delete_property(){1574 if (isset($_REQUEST[‘p_id’]) && current_user_can('delete_post’, $_REQUEST[‘p_id’])) {1575 wp_delete_post( $_REQUEST[‘p_id’] );1576 echo __( 'Deleted’, ‘real-estate-manager’ );1577 }1578 die(0);1579 }15801581 function render_registration_field($field){1582 ?>1583 <li>1584 <span><?php echo $field[‘title’]; ?></span>1585 <?php switch ($field[‘type’]) {15861587 case 'text’: ?>1588 <input type="text” class="form-control” name="<?php echo $field[‘key’]; ?>” <?php echo (isset($field[‘required’]) && $field[‘required’] == ‘true’) ? ‘required’ : ‘’ ; ?> />1589 <?php break;15901591 case 'email’: ?>1592 <input type="email” class="form-control” name="<?php echo $field[‘key’]; ?>” <?php echo (isset($field[‘required’]) && $field[‘required’] == ‘true’) ? ‘required’ : ‘’ ; ?> />1593 <?php break;15941595 case 'checkbox’: ?>1596 <input type="checkbox” name="<?php echo $field[‘key’]; ?>” <?php echo (isset($field[‘required’]) && $field[‘required’] == ‘true’) ? ‘required’ : ‘’ ; ?> />1597 <?php break;15981599 case 'password’: ?>1600 <input type="password” class="form-control” name="<?php echo $field[‘key’]; ?>” <?php echo (isset($field[‘required’]) && $field[‘required’] == ‘true’) ? ‘required’ : ‘’ ; ?> />1601 <?php break;16021603 case 'textarea’: ?>1604 <textarea name="<?php echo $field[‘key’]; ?>” <?php echo (isset($field[‘required’]) && $field[‘required’] == ‘true’) ? ‘required’ : ‘’ ; ?> class="form-control"></textarea>1605 <br>1606 <p><?php echo $field[‘help’]; ?></p>1607 <?php break;1608 1609 default:1610 break;1611 } ?>1612 </li>1613 <?php1614 }16151616 function render_agent_edit_field($field, $agent_id){1617 ?>1618 <li style="padding-right: 7px;">1619 <span><?php echo $field[‘title’]; ?></span>1620 <?php switch ($field[‘type’]) {1621 case 'text’: ?>1622 <input type="text" value="<?php echo get_user_meta( $agent_id, $field[‘key’], true ); ?>" name="<?php echo $field[‘key’]; ?>" <?php echo (isset($field[‘required’]) && $field[‘required’] == ‘true’) ? ‘required’ : ‘’ ; ?> />1623 <i class="icon fas fa-pencil-alt"></i>1624 <?php break;1625 case 'number’: ?>1626 <input type="number" value="<?php echo get_user_meta( $agent_id, $field[‘key’], true ); ?>" name="<?php echo $field[‘key’]; ?>" <?php echo (isset($field[‘required’]) && $field[‘required’] == ‘true’) ? ‘required’ : ‘’ ; ?> />1627 <i class="icon fas fa-pencil-alt"></i>1628 <?php break;1629 case 'email’:1630 $user_info = get_userdata( $agent_id ); ?>1631 <input type="email" value="<?php echo $user_info->user_email; ?>" name="<?php echo $field[‘key’]; ?>" <?php echo (isset($field[‘required’]) && $field[‘required’] == ‘true’) ? ‘required’ : ‘’ ; ?> />1632 <i class="icon fas fa-pencil-alt"></i>1633 <?php break;1634 case 'image’: ?>1635 <input class="img-url" type="text" value="<?php echo get_user_meta( $agent_id, $field[‘key’], true ); ?>" name="<?php echo $field[‘key’]; ?>" <?php echo (isset($field[‘required’]) && $field[‘required’] == ‘true’) ? ‘required’ : ‘’ ; ?> />1636 <i data-title="<?php _e( 'Choose Picture’, ‘real-estate-manager’ ); ?>" data-btntext="<?php _e( 'Add’, ‘real-estate-manager’ ); ?>" class="upload_image_agent icon fa fa-upload"></i>1637 <?php break;1638 case 'textarea’: ?>1639 <textarea rows="4" name="<?php echo $field[‘key’]; ?>" <?php echo (isset($field[‘required’]) && $field[‘required’] == ‘true’) ? ‘required’ : ‘’ ; ?>><?php echo get_user_meta( $agent_id, $field[‘key’] , true ); ?></textarea>1640 <p><?php echo $field[‘help’]; ?></p>1641 <?php break;1642 1643 default:1644 1645 break;1646 } ?>1647 </li>1648 <?php1649 }16501651 function render_property_field($field, $value = ‘’){1652 $default_val = ($value != ‘’) ? $value : $field[‘default’];1653 $columns = apply_filters( 'rem_property_fields_cols’, 'col-sm-4 col-xs-12’, $field );1654 1655 $show_condition = isset($field[‘show_condition’]) ? $field[‘show_condition’] : ‘true’ ; 1656 $conditions = isset($field[‘condition’]) ? $field[‘condition’] : array() ;1657 $required = (isset($field[‘required’]) && $field[‘required’] == ‘true’ ) ? ‘required’ : ‘’ ;1658 $help_text = (rem_get_option(‘property_fields_help_text’) == ‘enable’) ? ‘<span title="’.wp_strip_all_tags($field[‘help’]).’" class="glyphicon glyphicon-question-sign"></span>’ : ‘’ ;1659 $help_text = apply_filters( 'property_fields_help_text’, $help_text, $field, $value );1660 ?>1661 1662 <div class="<?php echo $columns; ?> space-form wrap-<?php echo $field[‘key’]; ?>" data-condition_status="<?php echo $show_condition; ?>" data-condition_bound="<?php echo isset($field[‘condition_bound’]) ? $field[‘condition_bound’] : ‘all’ ?>" data-condition=’<?php echo json_encode($conditions); ?>’>1663 <?php switch ($field[‘type’]) {1664 case 'text’:1665 case 'number’:1666 case 'date’: ?>1667 <label for="<?php echo $field[‘key’]; ?>" class="label-p-title"><?php echo $field[‘title’]; ?> <?php echo $help_text; ?></label>1668 <input id="<?php echo $field[‘key’]; ?>" <?php echo $required; ?> class="form-control" value="<?php echo $default_val; ?>" type="<?php echo $field[‘type’]; ?>" title="<?php echo $field[‘help’]; ?>" name="<?php echo $field[‘key’]; ?>">1669 <?php break;1670 case 'checkbox’: ?>1671 <?php $chkd = (isset($default_val[$field[‘key’]])) ? ‘checked’ : ‘’ ; ?>1672 <input <?php echo $chkd; ?> class="labelauty" type="checkbox" name="property_detail_cbs[<?php echo $field[‘key’]; ?>]" data-labelauty="<?php echo $field[‘title’]; ?>">1673 <?php break;1674 case 'upload’: ?>1675 <div class="input-group">1676 <textarea <?php echo $required; ?> id="<?php echo $field[‘key’]; ?>" name="<?php echo $field[‘key’]; ?>" class="form-control custom-control place-attachment" rows="2" style="resize:none;"><?php echo stripcslashes($value); ?></textarea> 1677 <span data-title="<?php _e( 'Select attachments for property’, ‘real-estate-manager’ ); ?>" data-btntext="<?php _e( 'Add’, ‘real-estate-manager’ ); ?>" class="upload-attachment input-group-addon btn btn-info"><?php _e( 'Upload’, ‘real-estate-manager’ ); ?></span>1678 </div>1679 <?php break;1680 case 'textarea’: ?>1681 <label class="label-p-title"><?php echo $field[‘title’]; ?> <?php echo $help_text; ?></label>1682 <textarea <?php echo $required; ?> id="<?php echo $field[‘key’]; ?>" name="<?php echo $field[‘key’]; ?>" class="form-control" rows="2"><?php echo stripcslashes($value); ?></textarea>1683 <?php break;16841685 case ‘select’: ?>1686 <label class="label-p-title"><?php echo $field[‘title’]; ?> <?php echo $help_text; ?></label>1687 <select <?php echo $required; ?> class="dropdown" data-settings=’{"cutOff": 5}’ name="<?php echo $field[‘key’]; ?>">1688 <?php if($field[‘key’] != ‘property_featured’){ ?>1689 <option value="">-- <?php echo __( ‘Any’, ‘real-estate-manager’ ).’ '.$field[‘title’]; ?> --</option>1690 <?php } ?>1691 <?php1692 if (is_array($field[‘options’])) {1693 $options = $field[‘options’];1694 } else {1695 $options = explode(“\n",$field[‘options’]);1696 }1697 foreach ($options as $title) {1698 $title = stripcslashes($title);1699 $selected = ($default_val == $title) ? ‘selected’ : ‘’ ;1700 echo '<option value="’.$title.’” '.$selected.’>’.$title.’</option>’;1701 }1702 ?>1703 </select>1704 <?php break;1705 1706 default:1707 1708 break;1709 } ?>1710 </div>1711 <?php1712 }17131714 function map_box($property_id){1715 ob_start();17161717 $url = get_permalink($property_id);1718 $img = get_the_post_thumbnail_url($property_id, ‘full’);1719 $title = get_the_title( $property_id );1720 $price = rem_display_property_price($property_id);17211722 $in_theme = get_stylesheet_directory().’/rem/map-box.php’;17231724 if (file_exists($in_theme)) {1725 $file_path = $in_theme;1726 } else {1727 $file_path = REM_PATH . '/templates/map-box.php’;1728 }17291730 if (file_exists($file_path)) {1731 include $file_path;1732 }17331734 return ob_get_clean();1735 }17361737 function lists_sorting_options(){1738 $options = array(1739 array(1740 ‘title’ => __( 'Sort By Date’, ‘real-estate-manager’ ),1741 ‘value’ => 'date-desc’,1742 ),1743 array(1744 ‘title’ => __( 'Sort By Title’, ‘real-estate-manager’ ),1745 ‘value’ => 'title-asc’,1746 ),1747 array(1748 ‘title’ => __( 'Sort By Price : High to Low’, ‘real-estate-manager’ ),1749 ‘value’ => 'price-desc’,1750 ),1751 array(1752 ‘title’ => __( 'Sort By Price : Low to High’, ‘real-estate-manager’ ),1753 ‘value’ => 'price-asc’,1754 ),1755 );17561757 return apply_filters( 'rem_lists_sorting_options’, $options );1758 }1759}1760?>