Added: Clean Up settings
This commit is contained in:
parent
c6a75c3b49
commit
13bc6c7ea1
@ -1,3 +1,6 @@
|
||||
= 1.5.2 - 2020-06-04 =
|
||||
* Added - Clean Up setting.
|
||||
|
||||
= 1.5.1 - 2020-06-01 =
|
||||
* Added - Enable/Disable setting for each property.
|
||||
|
||||
|
@ -353,75 +353,6 @@ function opalestate_hook_callback( $args ) {
|
||||
do_action( 'opalestate_' . $args['id'] );
|
||||
}
|
||||
|
||||
register_activation_hook( __FILE__, 'opalestate_active_cron_jobs' );
|
||||
|
||||
function opalestate_active_cron_jobs() {
|
||||
if ( ! wp_next_scheduled( 'opalestate_cleanup' ) ) {
|
||||
wp_schedule_event( time(), 'daily', 'opalestate_cleanup' );
|
||||
}
|
||||
}
|
||||
|
||||
register_deactivation_hook( __FILE__, 'opalestate_deactive_cron_jobs' );
|
||||
|
||||
function opalestate_deactive_cron_jobs() {
|
||||
wp_clear_scheduled_hook( 'opalestate_cleanup' );
|
||||
}
|
||||
|
||||
function opalestate_cleanup() {
|
||||
$query = new WP_Query(
|
||||
[
|
||||
'post_type' => 'attachment',
|
||||
'post_status' => 'inherit',
|
||||
'date_query' => [
|
||||
'column' => 'post_date',
|
||||
'before' => date( 'Y-m-d', strtotime( '-1 days' ) ),
|
||||
],
|
||||
'meta_query' => [
|
||||
[
|
||||
'key' => '_pending_to_use_',
|
||||
'value' => 1,
|
||||
'compare' => '>=',
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
// clean up per day
|
||||
if ( $query->have_posts() ) {
|
||||
while ( $query->have_posts() ) {
|
||||
$query->the_post();
|
||||
wp_delete_attachment( get_the_ID() );
|
||||
}
|
||||
}
|
||||
wp_reset_postdata();
|
||||
|
||||
// Change status expired properties.
|
||||
$expired_query = new WP_Query( [
|
||||
'post_type' => 'opalestate_property',
|
||||
'post_status' => [ 'pending', 'publish' ],
|
||||
'meta_query' => [
|
||||
[
|
||||
'key' => OPALESTATE_PROPERTY_PREFIX . 'expired_time',
|
||||
'value' => time(),
|
||||
'compare' => '>=',
|
||||
'type' => 'NUMERIC',
|
||||
],
|
||||
],
|
||||
] );
|
||||
|
||||
if ( $expired_query->have_posts() ) {
|
||||
while ( $expired_query->have_posts() ) {
|
||||
$expired_query->the_post();
|
||||
|
||||
wp_update_post( [
|
||||
'ID' => get_the_ID(),
|
||||
'post_status' => 'expired',
|
||||
] );
|
||||
}
|
||||
}
|
||||
|
||||
wp_reset_postdata();
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches for users via ajax and returns a list of results
|
||||
*
|
||||
|
@ -25,6 +25,8 @@ class Opalestate_Admin_Property {
|
||||
|
||||
// add_action( 'transition_post_status', array( __CLASS__, 'save_post' ), 10, 3 );
|
||||
add_action( 'parse_query', [ $this, 'search_custom_fields' ] );
|
||||
|
||||
add_filter( 'display_post_states', [ $this, 'display_post_states' ], 10, 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -183,6 +185,20 @@ class Opalestate_Admin_Property {
|
||||
$wp->query_vars['post__in'] = array_merge( $post_ids, [ 0 ] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the default post display states used in the posts list table.
|
||||
*
|
||||
* @param string[] $post_states An array of post display states.
|
||||
* @param WP_Post $post The current post object.
|
||||
*/
|
||||
public function display_post_states( $post_states, $post ) {
|
||||
if ( 'expired' == $post->post_status ) {
|
||||
$post_states['expired'] = _x( 'Expired', 'post status', 'opalestate-pro' );
|
||||
}
|
||||
|
||||
return $post_states;
|
||||
}
|
||||
}
|
||||
|
||||
new Opalestate_Admin_Property();
|
||||
|
@ -37,7 +37,7 @@ class Opalestate_Settings_General_Tab extends Opalestate_Settings_Base_Tab {
|
||||
'name' => esc_html__( 'General Settings', 'opalestate-pro' ),
|
||||
|
||||
'type' => 'opalestate_title',
|
||||
'id' => 'opalestate_title_general_settings_1',
|
||||
'id' => 'opalestate_title_general_settings',
|
||||
'before_row' => '<hr>',
|
||||
'after_row' => '<hr>',
|
||||
],
|
||||
@ -62,36 +62,11 @@ class Opalestate_Settings_General_Tab extends Opalestate_Settings_Base_Tab {
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => esc_html__( 'Maximum Upload Image Size', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Set maximum volumn size having < x MB', 'opalestate-pro' ),
|
||||
|
||||
'id' => 'upload_image_max_size',
|
||||
'type' => 'text',
|
||||
'default' => '0.5',
|
||||
],
|
||||
[
|
||||
'name' => esc_html__( 'Maximum Upload Image Files', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Set maximum volumn size having < x MB', 'opalestate-pro' ),
|
||||
|
||||
'id' => 'upload_image_max_files',
|
||||
'type' => 'text',
|
||||
'default' => '10',
|
||||
],
|
||||
[
|
||||
'name' => esc_html__( 'Maximum Upload Other Size', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Set maximum volumn size having < x MB for upload docx, pdf...', 'opalestate-pro' ),
|
||||
|
||||
'id' => 'upload_other_max_size',
|
||||
'type' => 'text',
|
||||
'default' => '0.8',
|
||||
],
|
||||
[
|
||||
'name' => esc_html__( 'Maximum Upload Other Files', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Set maximum volumn size having < x MB for upload docx, pdf...', 'opalestate-pro' ),
|
||||
|
||||
'id' => 'upload_other_max_files',
|
||||
'type' => 'text',
|
||||
'default' => '10',
|
||||
'name' => esc_html__( 'Image Settings', 'opalestate-pro' ),
|
||||
'desc' => '',
|
||||
'type' => 'opalestate_title',
|
||||
'id' => 'opalestate_title_image_settings',
|
||||
'before_row' => '<hr>',
|
||||
'after_row' => '<hr>',
|
||||
],
|
||||
[
|
||||
@ -115,8 +90,6 @@ class Opalestate_Settings_General_Tab extends Opalestate_Settings_Base_Tab {
|
||||
'options' => opalestate_get_featured_image_sizes(),
|
||||
|
||||
],
|
||||
|
||||
|
||||
[
|
||||
'name' => esc_html__( 'Loop Image Size', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'The Loop Image is an image that is chosen as the representative image in grid and list.', 'opalestate-pro' ),
|
||||
@ -126,8 +99,6 @@ class Opalestate_Settings_General_Tab extends Opalestate_Settings_Base_Tab {
|
||||
'default' => 'large',
|
||||
'options' => opalestate_get_featured_image_sizes(),
|
||||
],
|
||||
|
||||
|
||||
[
|
||||
'name' => esc_html__( 'Featured Image Size', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'The Featured Image is an image that is chosen as the representative image in single page. .', 'opalestate-pro' ),
|
||||
@ -138,46 +109,18 @@ class Opalestate_Settings_General_Tab extends Opalestate_Settings_Base_Tab {
|
||||
'after_row' => '<em>' . __( 'To generate images with new image sizes, you can use this <a href="https://goo.gl/FuXFex" target="_blank">Force Regenerate Thumbnails</a>',
|
||||
'opalestate-pro' ) . '</em>',
|
||||
],
|
||||
[
|
||||
'name' => esc_html__( 'Minimum of Target Price For Agent', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Enter minimum of price for starting search agent by target', 'opalestate-pro' ),
|
||||
'id' => 'search_agent_min_price',
|
||||
'type' => 'text_medium',
|
||||
'attributes' => [
|
||||
'type' => 'number',
|
||||
],
|
||||
'default' => 0,
|
||||
],
|
||||
[
|
||||
'name' => esc_html__( 'Maximum of Target Price For Agent', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Enter maximum of price for starting search agent by target', 'opalestate-pro' ),
|
||||
'id' => 'search_agent_max_price',
|
||||
'type' => 'text_medium',
|
||||
'attributes' => [
|
||||
'type' => 'number',
|
||||
],
|
||||
'default' => 1000000,
|
||||
],
|
||||
[
|
||||
'name' => esc_html__( 'Single Layout Page', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Choose layout for single property.', 'opalestate-pro' ),
|
||||
'id' => 'layout',
|
||||
'type' => 'select',
|
||||
'options' => apply_filters( 'opalestate_single_layout_templates', [ '' => esc_html__( 'Inherit', 'opalestate-pro' ) ] ),
|
||||
],
|
||||
|
||||
|
||||
[
|
||||
'name' => esc_html__( 'Currency Settings', 'opalestate-pro' ),
|
||||
'desc' => '',
|
||||
'type' => 'opalestate_title',
|
||||
'id' => 'opalestate_title_general_settings_2',
|
||||
'id' => 'opalestate_title_currency_settings',
|
||||
'before_row' => '<hr>',
|
||||
'after_row' => '<hr>',
|
||||
],
|
||||
[
|
||||
'name' => esc_html__( 'Currency', 'opalestate-pro' ),
|
||||
'desc' => 'Choose your currency. Note that some payment gateways have currency restrictions.',
|
||||
'desc' => esc_html__( 'Choose your currency. Note that some payment gateways have currency restrictions.', 'opalestate-pro' ),
|
||||
'id' => 'currency',
|
||||
'type' => 'select',
|
||||
'options' => opalestate_get_currencies(),
|
||||
@ -234,6 +177,51 @@ class Opalestate_Settings_General_Tab extends Opalestate_Settings_Base_Tab {
|
||||
'options' => opalestate_get_time_formats(),
|
||||
'default' => '12_hour',
|
||||
],
|
||||
|
||||
[
|
||||
'name' => esc_html__( 'Others', 'opalestate-pro' ),
|
||||
'desc' => '',
|
||||
'type' => 'opalestate_title',
|
||||
'id' => 'opalestate_title_others_settings',
|
||||
'before_row' => '<hr>',
|
||||
'after_row' => '<hr>',
|
||||
],
|
||||
[
|
||||
'name' => esc_html__( 'Minimum of Target Price For Agent', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Enter minimum of price for starting search agent by target', 'opalestate-pro' ),
|
||||
'id' => 'search_agent_min_price',
|
||||
'type' => 'text_medium',
|
||||
'attributes' => [
|
||||
'type' => 'number',
|
||||
],
|
||||
'default' => 0,
|
||||
],
|
||||
[
|
||||
'name' => esc_html__( 'Maximum of Target Price For Agent', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Enter maximum of price for starting search agent by target', 'opalestate-pro' ),
|
||||
'id' => 'search_agent_max_price',
|
||||
'type' => 'text_medium',
|
||||
'attributes' => [
|
||||
'type' => 'number',
|
||||
],
|
||||
'default' => 1000000,
|
||||
],
|
||||
[
|
||||
'name' => esc_html__( 'Advanced', 'opalestate-pro' ),
|
||||
'desc' => '',
|
||||
'type' => 'opalestate_title',
|
||||
'id' => 'opalestate_title_advanced_settings',
|
||||
'before_row' => '<hr>',
|
||||
'after_row' => '<hr>',
|
||||
],
|
||||
[
|
||||
'name' => esc_html__( 'Clean Up Interval', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Set a schedule to automatically clean up expired properties and attachments.', 'opalestate-pro' ),
|
||||
'id' => 'schedule',
|
||||
'type' => 'select',
|
||||
'options' => opalestate_get_schedule_interval_options(),
|
||||
'default' => 0,
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -238,12 +238,11 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
|
||||
];
|
||||
|
||||
$fields[] = [
|
||||
'name' => esc_html__( 'Horizontal Search Fields', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Disable or enable fields appearing in search form', 'opalestate-pro' ),
|
||||
'name' => esc_html__( 'Search Fields', 'opalestate-pro' ),
|
||||
'type' => 'opalestate_title',
|
||||
'id' => 'opalestate_title_general_settings_1',
|
||||
'id' => 'opalestate_title_search_fields',
|
||||
'before_row' => '<hr>',
|
||||
'after_row' => '<hr>',
|
||||
'after_row' => '<em>' . __( 'Enable/Disable fields appearing in search properties form.', 'opalestate-pro' ) . '</em><hr>',
|
||||
];
|
||||
|
||||
$fields[] = [
|
||||
@ -280,12 +279,11 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
|
||||
}
|
||||
|
||||
$fields[] = [
|
||||
'name' => esc_html__( 'Setting type fields search', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Setting type fields search', 'opalestate-pro' ) . '<hr>',
|
||||
'name' => esc_html__( 'Search Fields type', 'opalestate-pro' ),
|
||||
'type' => 'opalestate_title',
|
||||
'id' => 'opalestate_title_general_settings_type_search',
|
||||
'before_row' => '<hr>',
|
||||
'after_row' => '<hr>',
|
||||
'after_row' => '<em>' . __( 'Input type for search fields.', 'opalestate-pro' ) . '</em>',
|
||||
];
|
||||
|
||||
$metas = Opalestate_Property_MetaBox::metaboxes_info_fields();
|
||||
@ -367,6 +365,14 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
|
||||
private function get_subtab_detail_fields() {
|
||||
$fields = [];
|
||||
|
||||
$fields[] = [
|
||||
'name' => esc_html__( 'Single Layout Page', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Choose layout for single property.', 'opalestate-pro' ),
|
||||
'id' => 'layout',
|
||||
'type' => 'select',
|
||||
'options' => apply_filters( 'opalestate_single_layout_templates', [ '' => esc_html__( 'Inherit', 'opalestate-pro' ) ] ),
|
||||
];
|
||||
|
||||
$fields[] = [
|
||||
'name' => esc_html__( 'Enable Request Viewing', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Enable Request Viewing feature in the single property page.', 'opalestate-pro' ),
|
||||
|
22
inc/class-opalestate-deactivator.php
Normal file
22
inc/class-opalestate-deactivator.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fired during plugin deactivation
|
||||
*
|
||||
* This class defines all code necessary to run during the plugin's deactivation.
|
||||
**/
|
||||
class Opalestate_Deactivator {
|
||||
|
||||
/**
|
||||
* Deactivate
|
||||
*/
|
||||
public static function deactivate() {
|
||||
$timestamp = wp_next_scheduled( 'opalestate_clean_update' );
|
||||
wp_unschedule_event( $timestamp, 'opalestate_clean_update' );
|
||||
}
|
||||
}
|
@ -4,6 +4,13 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
}
|
||||
|
||||
class Opalestate_Install {
|
||||
/**
|
||||
* Init.
|
||||
*/
|
||||
public static function init() {
|
||||
add_filter( 'cron_schedules', [ __CLASS__, 'cron_schedules' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Install Opalestate.
|
||||
*/
|
||||
@ -24,6 +31,7 @@ class Opalestate_Install {
|
||||
static::create_tables();
|
||||
static::create_roles();
|
||||
static::setup_environment();
|
||||
static::create_cron_jobs();
|
||||
static::update_opalestate_version();
|
||||
|
||||
if ( function_exists( 'opalmembership_install' ) ) {
|
||||
@ -227,6 +235,36 @@ class Opalestate_Install {
|
||||
private static function update_opalestate_version() {
|
||||
update_option( 'opalestate_version', OPALESTATE_VERSION );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add more cron schedules.
|
||||
*
|
||||
* @param array $schedules List of WP scheduled cron jobs.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function cron_schedules( $schedules ) {
|
||||
$interval = opalestate_get_option( 'schedule', 0 );
|
||||
|
||||
$schedules['opalestate_corn'] = [
|
||||
'display' => __( 'Opal Estate Pro Clean Up Interval', 'opalestate-pro' ),
|
||||
'interval' => $interval,
|
||||
];
|
||||
|
||||
return $schedules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create cron jobs (clear them first).
|
||||
*/
|
||||
public static function create_cron_jobs() {
|
||||
wp_clear_scheduled_hook( 'opalestate_corn' );
|
||||
wp_clear_scheduled_hook( 'opalestate_clean_update' );
|
||||
|
||||
if ( ! wp_next_scheduled ( 'opalestate_clean_update' ) ) {
|
||||
wp_schedule_event( time(), 'opalestate_corn', 'opalestate_clean_update' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
135
inc/hook-functions.php
Normal file
135
inc/hook-functions.php
Normal file
@ -0,0 +1,135 @@
|
||||
<?php
|
||||
/**
|
||||
* Hook functions.
|
||||
*
|
||||
* @package opalestate
|
||||
* @author Opal Team <info@wpopal.com >
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
/**
|
||||
* Register widget area.
|
||||
*
|
||||
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
|
||||
*/
|
||||
function opalestate_widgets_init() {
|
||||
register_sidebar( [
|
||||
'name' => esc_html__( 'Single Property Sidebar', 'opalestate-pro' ),
|
||||
'id' => 'opalestate-single-property',
|
||||
'description' => esc_html__( 'Add widgets here to appear in your single property sidebar area.', 'opalestate-pro' ),
|
||||
'before_widget' => '<div id="%1$s" class="widget opalestate-single-property-widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="widget-title">',
|
||||
'after_title' => '</h5>',
|
||||
] );
|
||||
}
|
||||
|
||||
add_action( 'widgets_init', 'opalestate_widgets_init' );
|
||||
|
||||
/**
|
||||
* Add hidden multilingual.
|
||||
*/
|
||||
function opalestate_add_hidden_multilingual() {
|
||||
if ( ! opalestate_running_on_multilanguage() ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<input type="hidden" name="lang" value="<?php echo opalestate_multilingual()->get_current_language(); ?>">
|
||||
<?php
|
||||
}
|
||||
|
||||
add_action( 'opalestate_after_search_properties_form', 'opalestate_add_hidden_multilingual' );
|
||||
|
||||
/**
|
||||
* Clean cron jobs when saving settings.
|
||||
*
|
||||
* @param $old_value
|
||||
* @param $value
|
||||
*/
|
||||
function opalestate_clean_cron_jobs( $old_value, $value ) {
|
||||
$update_schedule = isset( $value['schedule'] ) ? $value['schedule'] : 0;
|
||||
$old_schedule = isset( $old_value['schedule'] ) ? $old_value['schedule'] : 0;
|
||||
|
||||
if ( $update_schedule !== $old_schedule ) {
|
||||
wp_clear_scheduled_hook( 'opalestate_clean_update' );
|
||||
if ( $update_schedule ) {
|
||||
add_filter( 'cron_schedules', [ Opalestate_Install::class, 'cron_schedules' ] );
|
||||
|
||||
if ( ! wp_next_scheduled( 'opalestate_clean_update' ) ) {
|
||||
wp_schedule_event( time(), 'opalestate_corn', 'opalestate_clean_update' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'update_option_opalestate_settings', 'opalestate_clean_cron_jobs', 10, 2 );
|
||||
|
||||
/**
|
||||
* Clean update.
|
||||
*/
|
||||
function opalestate_clean_update() {
|
||||
try {
|
||||
$query = new WP_Query(
|
||||
[
|
||||
'post_type' => 'attachment',
|
||||
'post_status' => 'inherit',
|
||||
'date_query' => [
|
||||
'column' => 'post_date',
|
||||
'before' => date( 'Y-m-d', strtotime( '-1 days' ) ),
|
||||
],
|
||||
'meta_query' => [
|
||||
[
|
||||
'key' => '_pending_to_use_',
|
||||
'value' => 1,
|
||||
'compare' => '>=',
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
if ( $query->have_posts() ) {
|
||||
while ( $query->have_posts() ) {
|
||||
$query->the_post();
|
||||
wp_delete_attachment( get_the_ID() );
|
||||
}
|
||||
}
|
||||
wp_reset_postdata();
|
||||
|
||||
// Change status expired properties.
|
||||
$expired_query = new WP_Query( [
|
||||
'post_type' => 'opalestate_property',
|
||||
'post_status' => [ 'pending', 'publish' ],
|
||||
'meta_query' => [
|
||||
[
|
||||
'key' => OPALESTATE_PROPERTY_PREFIX . 'expired_time',
|
||||
'value' => time(),
|
||||
'compare' => '<',
|
||||
'type' => 'NUMERIC',
|
||||
],
|
||||
],
|
||||
] );
|
||||
|
||||
opalestate_write_log($expired_query->found_posts);
|
||||
|
||||
if ( $expired_query->have_posts() ) {
|
||||
while ( $expired_query->have_posts() ) {
|
||||
$expired_query->the_post();
|
||||
opalestate_write_log(get_the_ID());
|
||||
|
||||
wp_update_post( [
|
||||
'ID' => get_the_ID(),
|
||||
'post_status' => 'expired',
|
||||
] );
|
||||
}
|
||||
}
|
||||
|
||||
wp_reset_postdata();
|
||||
} catch ( Exception $e ) {
|
||||
opalestate_write_log( $e->getMessage() );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'opalestate_clean_update', 'opalestate_clean_update' );
|
@ -941,7 +941,6 @@ function opalestate_currency_symbol( $currency = '' ) {
|
||||
'LSL' => 'L',
|
||||
'LYD' => 'ل.د',
|
||||
'MAD' => 'د.م.',
|
||||
'MAD' => 'د.م.',
|
||||
'MDL' => 'L',
|
||||
'MGA' => 'Ar',
|
||||
'MKD' => 'ден',
|
||||
@ -1208,20 +1207,6 @@ function opalestate_running_on_multilanguage() {
|
||||
return apply_filters( 'opalestate_is_running_multilanguage', Opalestate_Multilingual::is_polylang() || Opalestate_Multilingual::is_wpml() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add hidden multilingual.
|
||||
*/
|
||||
function opalestate_add_hidden_multilingual() {
|
||||
if ( ! opalestate_running_on_multilanguage() ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<input type="hidden" name="lang" value="<?php echo opalestate_multilingual()->get_current_language(); ?>">
|
||||
<?php
|
||||
}
|
||||
|
||||
add_action( 'opalestate_after_search_properties_form', 'opalestate_add_hidden_multilingual' );
|
||||
|
||||
/**
|
||||
* Gets measurement units.
|
||||
*
|
||||
@ -1378,25 +1363,6 @@ function opalestate_unique_id( $prefix = '' ) {
|
||||
return $prefix . (string) ++$id_counter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register widget area.
|
||||
*
|
||||
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
|
||||
*/
|
||||
function opalestate_widgets_init() {
|
||||
register_sidebar( [
|
||||
'name' => esc_html__( 'Single Property Sidebar', 'opalestate-pro' ),
|
||||
'id' => 'opalestate-single-property',
|
||||
'description' => esc_html__( 'Add widgets here to appear in your single property sidebar area.', 'opalestate-pro' ),
|
||||
'before_widget' => '<div id="%1$s" class="widget opalestate-single-property-widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="widget-title">',
|
||||
'after_title' => '</h5>',
|
||||
] );
|
||||
}
|
||||
|
||||
add_action( 'widgets_init', 'opalestate_widgets_init' );
|
||||
|
||||
/**
|
||||
* Get email date format.
|
||||
*
|
||||
@ -1468,3 +1434,38 @@ function opalestate_search_property_by_term( $term ) {
|
||||
|
||||
return apply_filters( 'opalestate_search_property_results', $property_ids, $term, $search_fields );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Schedule Intervals
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function opalestate_get_schedule_interval_options() {
|
||||
return apply_filters( 'opalestate_schedule_interval_options', [
|
||||
'0' => esc_html__( 'Never', 'opalestate-pro' ),
|
||||
WEEK_IN_SECONDS => esc_html__( '1 Week', 'opalestate-pro' ),
|
||||
DAY_IN_SECONDS => esc_html__( '24 Hours', 'opalestate-pro' ),
|
||||
12 * HOUR_IN_SECONDS => esc_html__( '12 Hours', 'opalestate-pro' ),
|
||||
6 * HOUR_IN_SECONDS => esc_html__( '6 Hours', 'opalestate-pro' ),
|
||||
HOUR_IN_SECONDS => esc_html__( '1 Hours', 'opalestate-pro' ),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'opalestate_write_log' ) ) {
|
||||
|
||||
/**
|
||||
* Write log.
|
||||
*
|
||||
* @param $log
|
||||
*/
|
||||
function opalestate_write_log( $log ) {
|
||||
if ( true === WP_DEBUG ) {
|
||||
if ( is_array( $log ) || is_object( $log ) ) {
|
||||
error_log( print_r( $log, true ) );
|
||||
} else {
|
||||
error_log( $log );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -260,6 +260,46 @@ class OpalEstate_Submission {
|
||||
'type' => 'text',
|
||||
'default' => 'SKU-{property_id}',
|
||||
],
|
||||
[
|
||||
'name' => esc_html__( 'Upload Settings', 'opalestate-pro' ),
|
||||
'id' => 'opalestate_title_upload_settings',
|
||||
'type' => 'title',
|
||||
'before_row' => '<hr>',
|
||||
'after_row' => '<hr>',
|
||||
],
|
||||
[
|
||||
'name' => esc_html__( 'Maximum Upload Image Size', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Set maximum volumn size having < x MB', 'opalestate-pro' ),
|
||||
|
||||
'id' => 'upload_image_max_size',
|
||||
'type' => 'text',
|
||||
'default' => '0.5',
|
||||
],
|
||||
[
|
||||
'name' => esc_html__( 'Maximum Upload Image Files', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Set maximum volumn size having < x MB', 'opalestate-pro' ),
|
||||
|
||||
'id' => 'upload_image_max_files',
|
||||
'type' => 'text',
|
||||
'default' => '10',
|
||||
],
|
||||
[
|
||||
'name' => esc_html__( 'Maximum Upload Other Size', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Set maximum volumn size having < x MB for upload docx, pdf...', 'opalestate-pro' ),
|
||||
|
||||
'id' => 'upload_other_max_size',
|
||||
'type' => 'text',
|
||||
'default' => '0.8',
|
||||
],
|
||||
[
|
||||
'name' => esc_html__( 'Maximum Upload Other Files', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Set maximum volumn size having < x MB for upload docx, pdf...', 'opalestate-pro' ),
|
||||
|
||||
'id' => 'upload_other_max_files',
|
||||
'type' => 'text',
|
||||
'default' => '10',
|
||||
'after_row' => '<hr>',
|
||||
],
|
||||
]
|
||||
),
|
||||
];
|
||||
|
@ -77,7 +77,7 @@ class Opalestate_form_builder_Elementor_Widget extends Opalestate_Elementor_Widg
|
||||
$this->start_controls_section(
|
||||
'form_builder_head',
|
||||
[
|
||||
'label' => esc_html__( 'Agency/Agent Tab Form Search', 'opalestate-pro' ),
|
||||
'label' => esc_html__( 'Form Builder', 'opalestate-pro' ),
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.5.1
|
||||
* Version: 1.5.2
|
||||
* Author: WPOPAL
|
||||
* Author URI: http://www.wpopal.com
|
||||
* Requires at least: 4.9
|
||||
@ -123,6 +123,8 @@ if ( ! class_exists( 'OpalEstate' ) ) {
|
||||
self::$instance->setup_constants();
|
||||
|
||||
register_activation_hook( OPALESTATE_PLUGIN_FILE, [ 'Opalestate_Install', 'install' ] );
|
||||
register_deactivation_hook( OPALESTATE_PLUGIN_FILE, [ 'Opalestate_Deactivator', 'deactivate' ] );
|
||||
|
||||
add_action( 'plugins_loaded', [ self::$instance, 'load_textdomain' ] );
|
||||
self::$instance->setup();
|
||||
self::$instance->roles = new Opalestate_Roles();
|
||||
@ -130,6 +132,8 @@ if ( ! class_exists( 'OpalEstate' ) ) {
|
||||
self::$instance->api = new Opalestate_API();
|
||||
self::$instance->session = new Opalestate_Session();
|
||||
|
||||
Opalestate_Install::init();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ -150,7 +154,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.5.1' );
|
||||
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'opalestate-pro' ), '1.5.2' );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -159,7 +163,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
|
||||
public function setup_constants() {
|
||||
// Plugin version
|
||||
if ( ! defined( 'OPALESTATE_VERSION' ) ) {
|
||||
define( 'OPALESTATE_VERSION', '1.5.1' );
|
||||
define( 'OPALESTATE_VERSION', '1.5.2' );
|
||||
}
|
||||
|
||||
// Plugin Folder Path
|
||||
@ -236,6 +240,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
|
||||
'class-template-loader.php',
|
||||
'query-functions.php',
|
||||
'mixes-functions.php',
|
||||
'hook-functions.php',
|
||||
'class-opalestate-roles.php',
|
||||
'classes/class-opalestate-session.php',
|
||||
'classes/class-opalestate-abs-query.php',
|
||||
@ -360,6 +365,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
|
||||
);
|
||||
|
||||
require_once OPALESTATE_PLUGIN_DIR . 'inc/class-opalestate-install.php';
|
||||
require_once OPALESTATE_PLUGIN_DIR . 'inc/class-opalestate-deactivator.php';
|
||||
|
||||
require_once OPALESTATE_PLUGIN_DIR . 'inc/class-opalestate-html.php';
|
||||
require_once OPALESTATE_PLUGIN_DIR . 'inc/function-search-fields.php';
|
||||
|
@ -27,8 +27,6 @@ The plugin will not make you disappointed with ease of use, friendly & flexible
|
||||
2. *[ Latehome - Real Estate WordPress Theme](http://bit.ly/2p5HUn2 "Latehome - Real Estate WordPress Theme")*
|
||||
3. *[ Latehome Free - Real Estate Free WordPress Theme](http://demo2.themelexus.com/latehome_free/ "Latehome Free - Real Estate Free WordPress Theme"). You can download free [here](http://bit.ly/latehomefree "Latehome Free download").*
|
||||
|
||||
* Please keep contact us at help@wpopal.com to send us your website, we will publish it our showcase
|
||||
|
||||
= Add-ons for Opal Estate Pro =
|
||||
* Please visit and download [all add-ons](https://wordpress.org/plugins/tags/opalestate_addon/ "Opal Estate Pro add-ons") for Opal Estate Pro, they are free 100%*
|
||||
1. *[ Opal Membership](https://wordpress.org/plugins/opal-membership/ "Opal Membership")*: Manage membership packages, users.
|
||||
@ -152,6 +150,9 @@ This section describes how to install the plugin and get it working.
|
||||
* System tickets support 24/7 available : [free support](https://themelexus.ticksy.com/ "Visit the Plugin support Page")
|
||||
|
||||
== Changelog ==
|
||||
= 1.5.2 - 2020-06-04 =
|
||||
* Added - Clean Up setting.
|
||||
|
||||
= 1.5.1 - 2020-06-01 =
|
||||
* Added - Enable/Disable setting for each property.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user