Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code refactoring with utility #1605

Merged
merged 56 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
4987a33
updated composer lock
obiPlabon Jul 27, 2022
6f4f103
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Aug 1, 2022
77b8884
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Aug 2, 2022
4f0d495
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Aug 2, 2022
d020772
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Aug 2, 2022
8fcd90b
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Aug 3, 2022
86ba70a
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Aug 8, 2022
d6e792c
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Aug 18, 2022
4c2bb68
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Aug 22, 2022
040527b
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Aug 24, 2022
884ec5c
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Aug 28, 2022
0364bef
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Aug 30, 2022
9d271ca
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Sep 1, 2022
7b3e07b
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Sep 4, 2022
13b3545
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Oct 9, 2022
04648c1
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Nov 20, 2022
1483140
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Feb 8, 2023
9aef859
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Feb 19, 2023
40969d3
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Feb 22, 2023
5fcca17
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Feb 26, 2023
8d3ada0
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Mar 1, 2023
aad382d
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Mar 23, 2023
ab01506
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Mar 31, 2023
88112ca
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Apr 4, 2023
960ed08
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Apr 11, 2023
1af49d1
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Apr 12, 2023
19cefc5
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Apr 13, 2023
2c5b296
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon May 25, 2023
a4280f7
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Jun 7, 2023
261bfb3
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Jun 15, 2023
d14358c
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Jun 26, 2023
0724b94
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Jul 27, 2023
0951cf7
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Jul 27, 2023
78389ed
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Aug 2, 2023
87ef739
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Aug 6, 2023
e9fd9fb
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Aug 6, 2023
b284029
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Aug 20, 2023
ad0c37d
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Aug 24, 2023
4098ca6
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Sep 11, 2023
ef54569
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Sep 20, 2023
810f3f0
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Sep 25, 2023
725c4c0
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Sep 26, 2023
ff302eb
Refactored all multi directory enable check with utility
obiPlabon Sep 26, 2023
6a94e69
Refactored all guest listing submission check
obiPlabon Sep 26, 2023
8c23ab4
Refactored all featured listing check with utility
obiPlabon Sep 26, 2023
38adbbc
Refactored all monetization enable check with utility
obiPlabon Sep 26, 2023
c89f081
Refactored core functions to separate file
obiPlabon Sep 26, 2023
9bba874
Refactored all curreny get option call with utility
obiPlabon Sep 26, 2023
574ee9c
Refactored all get option currency position call with utility
obiPlabon Sep 26, 2023
b08c84a
Refactored multi directory check calls
obiPlabon Sep 26, 2023
e71452b
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Oct 5, 2023
48c015f
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Oct 5, 2023
bbfaf60
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Oct 10, 2023
5f0ee04
Merge branch 'alpha' of github.com:sovware/directorist into alpha
obiPlabon Oct 12, 2023
00d7906
Resolved conflict
obiPlabon Oct 12, 2023
ddea01d
Merge branch 'alpha' into code-refactoring-with-utility
vairafiq Dec 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion directorist-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@ private function includes()
$this->autoload( ATBDP_INC_DIR . 'widgets/' );

self::require_files([
ATBDP_INC_DIR . 'directorist-core-functions',
ATBDP_INC_DIR . 'directorist-directory-functions',
ATBDP_INC_DIR . 'class-helper',
ATBDP_INC_DIR . 'helper-functions',
ATBDP_INC_DIR . 'template-functions',
Expand All @@ -461,7 +463,6 @@ private function includes()
ATBDP_INC_DIR . 'gutenberg/init',
ATBDP_INC_DIR . 'review/init',
ATBDP_INC_DIR . 'rest-api/init',
ATBDP_INC_DIR . 'directorist-directory-functions',
ATBDP_INC_DIR . 'fields/init',
ATBDP_INC_DIR . 'modules/multi-directory-setup/class-builder-data',
ATBDP_INC_DIR . 'modules/multi-directory-setup/trait-multi-directory-helper',
Expand Down
7 changes: 3 additions & 4 deletions includes/checkout/class-checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function display_checkout_content()
if (!atbdp_is_user_logged_in()) return null;

ob_start();
$enable_monetization = apply_filters('atbdp_enable_monetization_checkout',get_directorist_option('enable_monetization'));
$enable_monetization = apply_filters('atbdp_enable_monetization_checkout', directorist_is_monetization_enabled() );
// vail if monetization is not active.
if (!$enable_monetization) {
return __('Monetization is not active on this site. if you are an admin, you can enable it from the settings panel.', 'directorist');
Expand All @@ -81,7 +81,7 @@ public function display_checkout_content()
// Checkout form is not submitted, so show the content of the checkout items here
$form_data = apply_filters('atbdp_checkout_form_data', array(), $listing_id); // this is the hook that an extension can hook to, to add new items on checkout page.eg. plan
// let's add featured listing data
$featured_active = apply_filters('atbdp_featured_active_checkout',get_directorist_option('enable_featured_listing'));
$featured_active = apply_filters('atbdp_featured_active_checkout', directorist_is_featured_listing_enabled() );
if ($featured_active && !is_fee_manager_active()) {
$title = get_directorist_option('featured_listing_title', __('Featured', 'directorist'));
$desc = get_directorist_option('featured_listing_desc');
Expand Down Expand Up @@ -177,8 +177,7 @@ public function payment_receipt()
// we need to provide payment receipt shortcode with the order details array as we passed in the order checkout form page.
$order_items = apply_filters('atbdp_order_items', array(), $order_id, $listing_id, $data); // this is the hook that an extension can hook to, to add new items on checkout page.eg. plan
// let's add featured listing data if the order has featured listing in it
$featured_active = get_directorist_option('enable_featured_listing');
if ($featured_active && !empty($meta['_featured'])) {
if ( directorist_is_featured_listing_enabled() && !empty($meta['_featured'])) {
$title = get_directorist_option('featured_listing_title', __('Featured', 'directorist'));
$desc = get_directorist_option('featured_listing_desc');
$price = get_directorist_option('featured_listing_price');
Expand Down
10 changes: 5 additions & 5 deletions includes/class-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public static function price_template( $listing_id ) {

public static function price_range_template( $listing_id ) {
$price_range = get_post_meta( $listing_id, '_price_range', true );
$currency = get_directorist_option( 'g_currency', 'USD' );
$currency = directorist_get_currency();
$currency = atbdp_currency_symbol( $currency );

switch ( $price_range ) {
Expand Down Expand Up @@ -312,8 +312,8 @@ public static function price_range_template( $listing_id ) {

public static function formatted_price( $price ) {
$allow_decimal = get_directorist_option('allow_decimal', 1);
$c_position = get_directorist_option('g_currency_position');
$currency = get_directorist_option('g_currency', 'USD');
$c_position = directorist_get_currency_position();
$currency = directorist_get_currency();
$symbol = atbdp_currency_symbol($currency);
$before = '';
$after = '';
Expand Down Expand Up @@ -494,11 +494,11 @@ public static function is_new( $listing_id ) {
}

public static function multi_directory_enabled() {
return get_directorist_option( 'enable_multi_directory', false );
return directorist_is_multi_directory_enabled();
}

public static function default_preview_image_src( $type ) {
if ( self::multi_directory_enabled() ) {
if ( directorist_is_multi_directory_enabled() ) {
$type_general = get_term_meta( $type, 'general_config', true );

if ( ! empty( $type_general['preview_image'] ) ) {
Expand Down
5 changes: 1 addition & 4 deletions includes/classes/class-add-listing.php
Original file line number Diff line number Diff line change
Expand Up @@ -933,10 +933,7 @@ private function renew_listing( $listing_id ) {
update_post_meta( $listing_id, '_featured', 0 ); // delete featured

// for listing package extensions...
$active_monetization = get_directorist_option( 'enable_monetization' );
$enable_featured_listing = get_directorist_option( 'enable_featured_listing' );

if ( $active_monetization && $enable_featured_listing ) {
if ( directorist_is_monetization_enabled() && directorist_is_featured_listing_enabled() ) {
// if paid submission enabled/triggered by an extension, redirect to the checkout page and let that handle it, and vail out.
update_post_meta( $listing_id, '_refresh_renewal_token', 1 );
wp_safe_redirect( ATBDP_Permalink::get_checkout_page_link( $listing_id ) );
Expand Down
8 changes: 3 additions & 5 deletions includes/classes/class-cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public function __construct() {

// update_atbdp_schedule_tasks
function update_atbdp_schedule_tasks( $post_id, $post ) {

if ( ! is_admin() || ATBDP_POST_TYPE !== get_post_type( $post_id ) ) {
return;
return;
}

$this->atbdp_schedule_tasks();
Expand Down Expand Up @@ -94,9 +94,7 @@ public function atbdp_custom_schedule_cron() {
*/

private function featured_listing_followup() {
$monitization = get_directorist_option( 'enable_monetization' );
$featured_enable = get_directorist_option( 'enable_featured_listing' );
if ( $monitization && $featured_enable ) {
if ( directorist_is_monetization_enabled() && directorist_is_featured_listing_enabled() ) {
$featured_days = get_directorist_option( 'featured_listing_time', 30 );
// Define the query
$args = array(
Expand Down
7 changes: 2 additions & 5 deletions includes/classes/class-custom-post.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,20 +297,17 @@ protected function register_post_type() {
}

public function add_new_listing_columns( $columns ) {
$featured_active = get_directorist_option( 'enable_featured_listing' );
$enable_multi_directory = get_directorist_option( 'enable_multi_directory', false );

$columns = array();
$columns['cb'] = '<input type="checkbox" />';
$columns['title'] = __( 'Name', 'directorist' );
if ( atbdp_is_truthy( $enable_multi_directory ) ) {
if ( directorist_is_multi_directory_enabled() ) {
$columns['directory_type'] = __( 'Directory', 'directorist' );
}
$columns['atbdp_location'] = __( 'Location', 'directorist' );
$columns['atbdp_category'] = __( 'Categories', 'directorist' );
$columns['atbdp_author'] = __( 'Author', 'directorist' );
$columns['atbdp_status'] = __( 'Status', 'directorist' );
if ( $featured_active || is_fee_manager_active() ) {
if ( directorist_is_featured_listing_enabled() || is_fee_manager_active() ) {
$columns['atbdp_featured'] = __( 'Featured', 'directorist' );
}
$subscribed_package_id = get_user_meta( get_current_user_id(), '_subscribed_users_plan_id', true );
Expand Down
12 changes: 5 additions & 7 deletions includes/classes/class-custom-taxonomy.php
Original file line number Diff line number Diff line change
Expand Up @@ -633,12 +633,11 @@ protected function register_tag() {
public function category_columns( $original_columns ) {
$new_columns = $original_columns;
array_splice( $new_columns, 1 ); // in this way we could place our columns on the first place after the first checkbox.
$enable_multi_directory = get_directorist_option( 'enable_multi_directory' );

$new_columns['ID'] = __( 'ID', 'directorist' );

$new_columns['atbdp_category_icon'] = __( 'Icon', 'directorist' );
if ( ! empty( $enable_multi_directory ) ) {

if ( directorist_is_multi_directory_enabled() ) {
$new_columns['atbdp_category_directory_type'] = __( 'Directory Type', 'directorist' );
}

Expand All @@ -648,8 +647,8 @@ public function category_columns( $original_columns ) {
public function location_columns( $original_columns ) {
$new_columns = $original_columns;
array_splice( $new_columns, 2 ); // in this way we could place our columns on the first place after the first checkbox.
$enable_multi_directory = get_directorist_option( 'enable_multi_directory' );
if ( ! empty( $enable_multi_directory ) ) {

if ( directorist_is_multi_directory_enabled() ) {
$new_columns['atbdp_location_directory_type'] = __( 'Directory Type', 'directorist' );
}

Expand Down Expand Up @@ -871,8 +870,7 @@ public function get_current_listing_type() {
}

public function default_listing_type() {
$enable_multi_directory = get_directorist_option( 'enable_multi_directory' );
if ( empty( $enable_multi_directory ) || ( 1 == count( $this->get_listing_types() ) ) ) {
if ( ! directorist_is_multi_directory_enabled() || ( 1 == count( $this->get_listing_types() ) ) ) {
return $this->get_current_listing_type();
}
}
Expand Down
15 changes: 9 additions & 6 deletions includes/classes/class-listing.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,11 @@ public function atbdp_listings_filter( ) {
if (isset($_GET['post_type'])) {
$type = ! empty( $_GET['post_type'] ) ? directorist_clean( wp_unslash( $_GET['post_type'] ) ) : '';
}
$enable_multi_directory = get_directorist_option( 'enable_multi_directory', false );

//only add filter to post type you want
if ( ( 'at_biz_dir' == $type ) && ( atbdp_is_truthy( $enable_multi_directory ) ) ) { ?>
if ( ( 'at_biz_dir' == $type ) && directorist_is_multi_directory_enabled() ) { ?>
<select name="directory_type">
<option value=""><?php esc_html_e('Filter by directory ', 'directorist'); ?></option>
<option value=""><?php esc_html_e( 'Filter by directory ', 'directorist' ); ?></option>
<?php
$current_v = ! empty( $_GET['directory_type'] ) ? directorist_clean( wp_unslash( $_GET['directory_type'] ) ) : '';

Expand Down Expand Up @@ -152,11 +151,15 @@ public function manage_listings_status() {

// update_listing_status
public function update_listing_status( $order_id, $listing_id ) {
$featured_enabled = get_directorist_option('enable_featured_listing');
$pricing_plan_enabled = is_fee_manager_active();

if ( $pricing_plan_enabled ) { return; };
if ( ! $featured_enabled ) { return; };
if ( $pricing_plan_enabled ) {
return;
};

if ( ! directorist_is_featured_listing_enabled() ) {
return;
};

$directory_type = get_post_meta( $listing_id, '_directory_type', true );
$post_status = get_term_meta( $directory_type, 'new_listing_status', true );
Expand Down
8 changes: 3 additions & 5 deletions includes/classes/class-metabox.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public function render_expire_date( $listing_id, $term_id )
$directory_type = isset( $term_id ) ? $term_id : default_directory_type();
$expiration = get_term_meta( $directory_type, 'default_expiration', true );
$expire_in_days = ! empty( $expiration ) ? $expiration : '90';
$f_active = get_directorist_option('enable_featured_listing');
$f_active = directorist_is_featured_listing_enabled();
$never_expire = get_post_meta( $listing_id, '_never_expire', true );
$never_expire = !empty( $never_expire ) ? (int) $never_expire : '';

Expand Down Expand Up @@ -227,10 +227,8 @@ public function listing_form_info_meta( $post ) {
$current_type = get_post_meta( $post->ID, '_directory_type', true );
$value = $current_type ? $current_type : $default;
wp_nonce_field( 'listing_info_action', 'listing_info_nonce' );
$multi_directory = get_directorist_option( 'enable_multi_directory', false );


$show_directory_type_nav = ! empty ( $multi_directory ) && ( count( $all_types ) > 1 );
$show_directory_type_nav = directorist_is_multi_directory_enabled() && ( count( $all_types ) > 1 );
$show_directory_type_nav = apply_filters( 'directorist_show_admin_edit_listing_directory_type_nav', $show_directory_type_nav, $post->ID );

if ( $show_directory_type_nav ) { ?>
Expand Down Expand Up @@ -307,7 +305,7 @@ public function post_submitbox_meta($post)
$directory_type = default_directory_type();
$expiration = get_term_meta( $directory_type, 'default_expiration', true );
$expire_in_days = ! empty( $expiration ) ? $expiration : '90';
$f_active = get_directorist_option('enable_featured_listing');
$f_active = directorist_is_featured_listing_enabled();
$never_expire = get_post_meta($post->ID, '_never_expire', true);
$never_expire = !empty($never_expire) ? (int) $never_expire : '';

Expand Down
2 changes: 1 addition & 1 deletion includes/classes/class-permalink.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public static function get_user_profile_page_link( $author_id , $directory_type
$author = get_user_by( 'id', $author_id );
$author_id = ( $author ) ? $author->user_login : $author_id;

if( ! empty( $directory_type ) && Directorist\Helper::multi_directory_enabled() ) {
if( ! empty( $directory_type ) && directorist_is_multi_directory_enabled() ) {
$slug = $author_id . '/directory/' . $directory_type;
$link = Helper::join_slug_to_url( $link, $slug );
} else {
Expand Down
4 changes: 2 additions & 2 deletions includes/classes/class-settings-panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function register_setting_fields( $fields = [] ) {
$fields['single_listing_slug_with_directory_type'] = [
'type' => 'toggle',
'label' => __('Listing Slug with Directory Type', 'directorist'),
'value' => get_directorist_option( 'enable_multi_directory' ),
'value' => directorist_is_multi_directory_enabled(),
'show-if' => [
'where' => "enable_multi_directory",
'conditions' => [
Expand Down Expand Up @@ -117,7 +117,7 @@ public function register_setting_fields( $fields = [] ) {
'label' => __( 'Start Building Directory', 'directorist' ),
'type' => 'success',
'url' => admin_url( 'edit.php?post_type=at_biz_dir&page=atbdp-directory-types' ),
'show' => get_directorist_option( 'enable_multi_directory', false ),
'show' => directorist_is_multi_directory_enabled(),
]
]
];
Expand Down
35 changes: 35 additions & 0 deletions includes/directorist-core-functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* Directorist Core Functions
*
* @package Directorist\Functions
* @version 8.0.0
*/

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

function directorist_is_multi_directory_enabled() {
return (bool) get_directorist_option( 'enable_multi_directory', false );
}

function directorist_is_guest_submission_enabled() {
return (bool) get_directorist_option( 'guest_listings', false );
}

function directorist_is_featured_listing_enabled() {
return (bool) get_directorist_option( 'enable_featured_listing' );
}

function directorist_is_monetization_enabled() {
return (bool) get_directorist_option( 'enable_monetization' );
}

function directorist_get_currency() {
return get_directorist_option( 'g_currency', 'USD' );
}

function directorist_get_currency_position() {
return get_directorist_option( 'g_currency_position' );
}
16 changes: 0 additions & 16 deletions includes/directorist-directory-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,6 @@ function directorist_listing_form_has_category_field( int $directory_id ) {
return ! empty( $category_field );
}

function directorist_is_multi_directory_enabled() {
return (bool) get_directorist_option( 'enable_multi_directory', false );
}

function directorist_is_guest_submission_enabled() {
return (bool) get_directorist_option( 'guest_listings', 0 );
}

function directorist_is_featured_listing_enabled() {
return (bool) get_directorist_option( 'enable_featured_listing' );
}

function directorist_is_monetization_enabled() {
return (bool) get_directorist_option( 'enable_monetization' );
}

function directorist_is_terms_and_condition_enabled( int $directory_id ) {
return (bool) directorist_get_directory_meta( $directory_id, 'listing_terms_condition' );
}
Expand Down
6 changes: 3 additions & 3 deletions includes/elementor/add-listing.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ public function az_fields(){
'type' => Controls_Manager::HEADING,
'id' => 'sec_heading',
'label' => __( 'This widget works only in Add Listing page. It has no additional elementor settings.', 'directorist' ),
'condition' => !Helper::multi_directory_enabled() ? '' : ['nocondition' => true],
'condition' => ! directorist_is_multi_directory_enabled() ? '' : ['nocondition' => true],
),
array(
'type' => Controls_Manager::SELECT2,
'id' => 'type',
'label' => __( 'Directory Types', 'directorist' ),
'multiple' => true,
'options' => $this->az_listing_types(),
'condition' => Helper::multi_directory_enabled() ? '' : ['nocondition' => true],
'condition' => directorist_is_multi_directory_enabled() ? '' : ['nocondition' => true],
),
array(
'mode' => 'section_end',
Expand All @@ -61,7 +61,7 @@ protected function render() {

$atts = [];

if ( Helper::multi_directory_enabled() ) {
if ( directorist_is_multi_directory_enabled() ) {
if ( $settings['type'] ) {
$atts['directory_type'] = implode( ',', $settings['type'] );
}
Expand Down
6 changes: 3 additions & 3 deletions includes/elementor/all-categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ public function az_fields(){
'label' => __( 'Directory Types', 'directorist' ),
'multiple' => true,
'options' => $this->az_listing_types(),
'condition' => Helper::multi_directory_enabled() ? '' : ['nocondition' => true],
'condition' => directorist_is_multi_directory_enabled() ? '' : ['nocondition' => true],
),
array(
'type' => Controls_Manager::SELECT2,
'id' => 'default_type',
'label' => __( 'Default Directory Types', 'directorist' ),
'options' => $this->az_listing_types(),
'condition' => Helper::multi_directory_enabled() ? '' : ['nocondition' => true],
'condition' => directorist_is_multi_directory_enabled() ? '' : ['nocondition' => true],
),
array(
'type' => Controls_Manager::SELECT,
Expand Down Expand Up @@ -148,7 +148,7 @@ protected function render() {
'slug' => $settings['slug'] ? implode( ',', $settings['slug'] ) : '',
);

if ( Helper::multi_directory_enabled() ) {
if ( directorist_is_multi_directory_enabled() ) {
if ( $settings['type'] ) {
$atts['directory_type'] = implode( ',', $settings['type'] );
}
Expand Down
Loading