From 685803792e5247b172e5f8e5128f8ddcc3a97fec Mon Sep 17 00:00:00 2001 From: Hoang Huu Date: Wed, 4 Dec 2019 14:03:31 +0700 Subject: [PATCH 1/4] Fix empty map. --- inc/template-functions.php | 4 ++++ templates/single-property/nearby.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/inc/template-functions.php b/inc/template-functions.php index a43d73e8..58813378 100755 --- a/inc/template-functions.php +++ b/inc/template-functions.php @@ -741,6 +741,10 @@ function opalestate_get_property_walkscore_results( $property ) { $map = $property->get_map(); + if ( ! $map || ! is_array( $map ) || ! isset( $map['latitude'] ) || ! isset( $map['longitude'] ) ) { + return false; + } + $latitude = $map['latitude']; $longitude = $map['longitude']; diff --git a/templates/single-property/nearby.php b/templates/single-property/nearby.php index c7872bff..09d52c85 100755 --- a/templates/single-property/nearby.php +++ b/templates/single-property/nearby.php @@ -16,6 +16,10 @@ if ( ! $categories ) { $map = $property->get_map(); +if ( ! $map || ! is_array( $map ) || ! isset( $map['latitude'] ) || ! isset( $map['longitude'] ) ) { + return; +} + $latitude = $map['latitude']; $longitude = $map['longitude']; if ( ! $latitude || ! $longitude ) { From 40f1928b69483661c4f9d7103e3c8db8f18fc6ba Mon Sep 17 00:00:00 2001 From: Hoang Huu Date: Wed, 4 Dec 2019 15:13:37 +0700 Subject: [PATCH 2/4] Add On/Off email settings. --- inc/class-opalestate-email.php | 86 +++++++++++++++++++++----------- inc/class-opalestate-install.php | 4 ++ 2 files changed, 61 insertions(+), 29 deletions(-) diff --git a/inc/class-opalestate-email.php b/inc/class-opalestate-email.php index 348b94bc..e35259bb 100755 --- a/inc/class-opalestate-email.php +++ b/inc/class-opalestate-email.php @@ -29,17 +29,20 @@ class Opalestate_Emails { public static function init() { self::load(); - add_action( 'opalestate_processed_new_submission', [ __CLASS__, 'new_submission_email' ], 10, 2 ); - add_action( 'opalestate_processed_new_submission', [ __CLASS__, 'admin_new_submission_email' ], 15, 2 ); - //add_action( 'opalestate_processed_edit_submission' , array( __CLASS__ , 'new_submission_email'), 10, 2 ); if ( is_admin() ) { add_filter( 'opalestate_settings_tabs', [ __CLASS__, 'setting_email_tab' ], 1 ); add_filter( 'opalestate_registered_emails_settings', [ __CLASS__, 'setting_email_fields' ], 10, 1 ); } - $enable_approve_property_email = opalestate_get_option( 'enable_approve_property_email' ); + if ( 'on' === opalestate_get_option( 'enable_customer_new_submission', 'on' ) ) { + add_action( 'opalestate_processed_new_submission', [ __CLASS__, 'new_submission_email' ], 10, 2 ); + } - if ( $enable_approve_property_email == 'on' ) { + if ( 'on' === opalestate_get_option( 'enable_admin_new_submission', 'on' ) ) { + add_action( 'opalestate_processed_new_submission', [ __CLASS__, 'admin_new_submission_email' ], 15, 2 ); + } + + if ( 'on' === opalestate_get_option( 'enable_approve_property_email', 'on' ) ) { add_action( 'transition_post_status', [ __CLASS__, 'send_email_when_publish_property' ], 10, 3 ); add_action( 'opalestate_processed_approve_publish_property', [ __CLASS__, 'approve_publish_property_email' ], 10, 1 ); } @@ -342,11 +345,22 @@ class Opalestate_Emails { //------------------------------------------ [ - 'name' => esc_html__( 'Notification For New Property Submission (Customer)', 'opalestate-pro' ), + 'name' => esc_html__( 'New Property Submission (Customer)', 'opalestate-pro' ), 'desc' => '
', 'id' => 'opalestate_title_email_settings_3', 'type' => 'title', ], + [ + 'name' => esc_html__( 'Enable', 'opalestate-pro' ), + 'desc' => esc_html__( 'Enable email for customers when they have a submission.', 'opalestate-pro' ), + 'id' => 'enable_customer_new_submission', + 'type' => 'switch', + 'options' => [ + 'on' => esc_html__( 'Enable', 'opalestate-pro' ), + 'off' => esc_html__( 'Disable', 'opalestate-pro' ), + ], + 'default' => 'on', + ], [ 'id' => 'newproperty_email_subject', 'name' => esc_html__( 'Email Subject', 'opalestate-pro' ), @@ -368,10 +382,22 @@ class Opalestate_Emails { //------------------------------------------ [ - 'name' => esc_html__( 'Notification For New Property Submission (Admin)', 'opalestate-pro' ), - 'desc' => '
', - 'id' => 'opalestate_title_email_settings_admin', - 'type' => 'title', + 'name' => esc_html__( 'New Property Submission (Admin)', 'opalestate-pro' ), + 'desc' => '
', + 'id' => 'opalestate_title_email_settings_admin', + 'type' => 'title', + 'before_row' => '
', + ], + [ + 'name' => esc_html__( 'Enable', 'opalestate-pro' ), + 'desc' => esc_html__( 'Enable email for admin when a property is submitted.', 'opalestate-pro' ), + 'id' => 'enable_admin_new_submission', + 'type' => 'switch', + 'options' => [ + 'on' => esc_html__( 'Enable', 'opalestate-pro' ), + 'off' => esc_html__( 'Disable', 'opalestate-pro' ), + ], + 'default' => 'on', ], [ 'id' => 'admin_newproperty_email_subject', @@ -394,12 +420,12 @@ class Opalestate_Emails { //------------------------------------------ [ - 'name' => esc_html__( 'Approve property for publish', 'opalestate-pro' ), - 'desc' => '
', - 'id' => 'opalestate_title_email_settings_4', - 'type' => 'title', + 'name' => esc_html__( 'Approved property for publish (Customer)', 'opalestate-pro' ), + 'desc' => '
', + 'id' => 'opalestate_title_email_settings_4', + 'type' => 'title', + 'before_row' => '
', ], - [ 'name' => esc_html__( 'Enable approve property email', 'opalestate-pro' ), 'desc' => esc_html__( 'Enable approve property email.', 'opalestate-pro' ), @@ -409,9 +435,8 @@ class Opalestate_Emails { 'on' => esc_html__( 'Enable', 'opalestate-pro' ), 'off' => esc_html__( 'Disable', 'opalestate-pro' ), ], - 'default' => 'off', + 'default' => 'on', ], - [ 'id' => 'approve_email_subject', 'name' => esc_html__( 'Email Subject', 'opalestate-pro' ), @@ -434,10 +459,11 @@ class Opalestate_Emails { ], /// enquire contact template //// [ - 'name' => esc_html__( 'Email Enquiry Contact Templates (Template Tags)', 'opalestate-pro' ), - 'desc' => $contact_list_tags . '

', - 'id' => 'opalestate_title_email_settings_6_1', - 'type' => 'title', + 'name' => esc_html__( 'Email Enquiry Contact Templates (Template Tags)', 'opalestate-pro' ), + 'desc' => $contact_list_tags . '

', + 'id' => 'opalestate_title_email_settings_6_1', + 'type' => 'title', + 'before_row' => '
', ], [ 'id' => 'enquiry_email_subject', @@ -460,10 +486,11 @@ class Opalestate_Emails { ], /// email contact template //// [ - 'name' => esc_html__( 'Email Contact Templates (Template Tags)', 'opalestate-pro' ), - 'desc' => $contact_list_tags . '

', - 'id' => 'opalestate_title_email_settings_6', - 'type' => 'title', + 'name' => esc_html__( 'Email Contact Templates (Template Tags)', 'opalestate-pro' ), + 'desc' => $contact_list_tags . '

', + 'id' => 'opalestate_title_email_settings_6', + 'type' => 'title', + 'before_row' => '
', ], [ 'id' => 'contact_email_subject', @@ -486,10 +513,11 @@ class Opalestate_Emails { ], /// Email Request Review /// [ - 'name' => esc_html__( 'Email Request Review Templates (Template Tags)', 'opalestate-pro' ), - 'desc' => $review_list_tags . '

', - 'id' => 'opalestate_title_email_settings_7', - 'type' => 'title', + 'name' => esc_html__( 'Email Request Review Templates (Template Tags)', 'opalestate-pro' ), + 'desc' => $review_list_tags . '

', + 'id' => 'opalestate_title_email_settings_7', + 'type' => 'title', + 'before_row' => '
', ], [ 'id' => 'request_review_email_subject', diff --git a/inc/class-opalestate-install.php b/inc/class-opalestate-install.php index bed36653..27f73ac9 100755 --- a/inc/class-opalestate-install.php +++ b/inc/class-opalestate-install.php @@ -128,6 +128,10 @@ class Opalestate_Install { $options['enable_agency_reviews'] = 'on'; $options['enable_agent_reviews'] = 'on'; + $options['enable_customer_new_submission'] = 'on'; + $options['enable_admin_new_submission'] = 'on'; + $options['enable_approve_property_email'] = 'on'; + $options['admin_approve'] = 'on'; $options['enable_submission_tab_media'] = 'on'; $options['enable_submission_tab_location'] = 'on'; From a0d9b9f0c7087b3c0c5990248fed4283b76e00ff Mon Sep 17 00:00:00 2001 From: Hoang Huu Date: Wed, 4 Dec 2019 17:12:08 +0700 Subject: [PATCH 3/4] Fix login ajax. --- assets/js/opalestate.js | 15 ++++----------- assets/opalestate.css | 4 ++++ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/assets/js/opalestate.js b/assets/js/opalestate.js index 2b0a7761..7ed5b370 100755 --- a/assets/js/opalestate.js +++ b/assets/js/opalestate.js @@ -1,8 +1,4 @@ jQuery( document ).ready( function ( $ ) { - - /** - * - */ $( '#show-user-sidebar-btn' ).click( function () { $( 'body' ).toggleClass( 'active' ); } ); @@ -313,8 +309,7 @@ jQuery( document ).ready( function ( $ ) { /** * Login form **/ - $( 'body' ).delegate( '.opalestate-mfp-popup form.opalestate-login-form', 'submit', function () { - + $( 'form.opalestate-login-form' ).on( 'submit', function () { var $form = $( this ); $.ajax( { type: 'POST', @@ -331,17 +326,15 @@ jQuery( document ).ready( function ( $ ) { $form.find( '.opalestate-notice' ).remove(); $form.prepend( data.message ); } - } } ); return false; } ); /** - * Login form + * Register form **/ - $( 'body' ).delegate( '.opalestate-mfp-popup form.opalestate-register-form', 'submit', function () { - + $( 'form.opalestate-register-form' ).on( 'submit', function () { var $form = $( this ); $.ajax( { type: 'POST', @@ -358,11 +351,11 @@ jQuery( document ).ready( function ( $ ) { $form.find( '.opalestate-notice' ).remove(); $form.prepend( data.message ); } - } } ); return false; } ); + /** * AJAX ACTION */ diff --git a/assets/opalestate.css b/assets/opalestate.css index 2e837ee8..73b7aaad 100755 --- a/assets/opalestate.css +++ b/assets/opalestate.css @@ -3997,3 +3997,7 @@ header#masthead { background: #2f73e9; position: absolute; top: 0; } + + .opalestate-notice { + padding: 10px; + } From 68482b2432296d34521bd3ab43461c70cba3ec0e Mon Sep 17 00:00:00 2001 From: Hoang Huu Date: Wed, 4 Dec 2019 17:13:41 +0700 Subject: [PATCH 4/4] Tag 1.2 --- opal-estate-pro.php | 8 ++++---- readme.txt | 8 ++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/opal-estate-pro.php b/opal-estate-pro.php index bc7d06e2..9fed86a9 100755 --- a/opal-estate-pro.php +++ b/opal-estate-pro.php @@ -3,11 +3,11 @@ * Plugin Name: Opal Estate Pro * Plugin URI: https://wpdocs.gitbook.io/opal-estate/ * Description: Opal Real Estate Plugin is an ideal solution and brilliant choice for you to set up a professional estate website. - * Version: 1.1.9.3 + * Version: 1.2 * Author: WPOPAL * Author URI: http://www.wpopal.com * Requires at least: 4.6 - * Tested up to: 5.2.3 + * Tested up to: 5.3 * Text Domain: opalestate-pro * Domain Path: languages/ * @@ -151,7 +151,7 @@ if ( ! class_exists( 'OpalEstate' ) ) { */ public function __clone() { // Cloning instances of the class is forbidden - _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'opalestate-pro' ), '1.1.9.3' ); + _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'opalestate-pro' ), '1.2' ); } /** @@ -160,7 +160,7 @@ if ( ! class_exists( 'OpalEstate' ) ) { public function setup_constants() { // Plugin version if ( ! defined( 'OPALESTATE_VERSION' ) ) { - define( 'OPALESTATE_VERSION', '1.1.9.3' ); + define( 'OPALESTATE_VERSION', '1.2' ); } // Plugin Folder Path diff --git a/readme.txt b/readme.txt index bf44ff1e..7f2f0d15 100755 --- a/readme.txt +++ b/readme.txt @@ -3,8 +3,8 @@ Contributors: wpopal Donate link: https://wpdocs.gitbook.io/opal-estate/ Tags: estate, property, opalestate, house for rent, agency for lease, estate submission, agents estate property, property marketplace Requires at least: 4.6 -Tested up to: 5.2.3 -Stable tag: 1.1.9.3 +Tested up to: 5.3 +Stable tag: 1.2 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -156,6 +156,10 @@ This section describes how to install the plugin and get it working. * System tickets support 24/7 available : [free support](https://wpopal.ticksy.com/ "Visit the Plugin support Page") == Changelog == += 1.2 - 2019-12-04 = +* Fixes - Login ajax. +* Added - Enable email settings. + = 1.1.9.3 - 2019-11-27 = * Fixes - Measurement Unit translation.