Skip to content

Commit

Permalink
* Several SQL Query optimizations reducing some query times even furt…
Browse files Browse the repository at this point in the history
…her - ADDED

* GD > Single Next Prev not filtering by same location - FIXED
* Add listing zip and region discovery improvements - ADDED
* Setup Wizard fields not showing tooltips with BS5 styles - FIXED
  • Loading branch information
stiofan committed Feb 22, 2024
1 parent b48ce7d commit 6153f6f
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 44 deletions.
31 changes: 12 additions & 19 deletions includes/admin/class-geodir-admin-addons.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Addons Page
*
*
*
* @author AyeCode
* @category Admin
Expand Down Expand Up @@ -33,7 +33,7 @@ public static function get_tabs(){
'membership' => __("Membership", "geodirectory"),
);



return $tabs;
}
Expand Down Expand Up @@ -449,7 +449,7 @@ public static function output_button( $addon ) {
}
}


// filter the button arguments
$button_args = apply_filters('edd_api_button_args',$button_args);

Expand Down Expand Up @@ -525,7 +525,7 @@ public static function get_recommend_wp_plugins(){
'slug' => 'ayecode-connect',
'name' => 'AyeCode Connect',
'file' => 'ayecode-connect/ayecode-connect.php',
'desc' => __( 'Allows you to install any purchased AyeCode Ltd product add-ons without a zip file. It also installs and activates licences automatically, so there is no need to copy/paste licenses.', 'geodirectory' ),
'desc' => __( 'Support & documentation right from your dashboard, easily install any purchased add-ons without a zip file or license key.', 'geodirectory' ),
),
'ninja-forms' => array(
'url' => 'https://wordpress.org/plugins/ninja-forms/',
Expand All @@ -541,22 +541,15 @@ public static function get_recommend_wp_plugins(){
'file' => 'userswp/userswp.php',
'desc' => __('Allow frontend user login and registration as well as have slick profile pages.','geodirectory'),
),
// just testing script for below plugins
// 'ewww-image-optimizer' => array(
// 'url' => 'https://wordpress.org/plugins/ewww-image-optimizer/',
// 'slug' => 'ewww-image-optimizer',
// 'name' => 'EWWW Image Optimizer',
// 'desc' => __('testing','geodirectory'),
// ),
// 'hide-admin-bar' => array(
// 'url' => 'https://wordpress.org/plugins/hide-admin-bar/',
// 'slug' => 'hide-admin-bar',
// 'name' => 'Hide admin bar',
// 'desc' => __('testing','geodirectory'),
// ),
);

return $plugins;

/**
* A collection of WP plugins to recommend.
*
* @var array $plugins An array containing all the plugins.
*/
return apply_filters('geodir_recommend_wp_plugins', $plugins );
}

/**
Expand Down Expand Up @@ -585,7 +578,7 @@ public static function get_recommend_wp_plugins_edd_formatted(){

public static function get_wizard_paid_addons(){
$addons = self::get_section_data( 'addons' );

return $addons;
}
}
44 changes: 29 additions & 15 deletions includes/admin/class-geodir-admin-dummy-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class GeoDir_Admin_Dummy_Data {
public function __construct() {

}

public static function create_sort_fields(){

}

/**
Expand Down Expand Up @@ -342,7 +342,7 @@ public static function create_dummy_posts( $request ) {

$total_count = 0;
$dummy_post_index = $item_index;

$dummy_categories = array();
$dummy_custom_fields = array();
$dummy_sort_fields = array();
Expand Down Expand Up @@ -409,13 +409,13 @@ public static function create_dummy_posts( $request ) {

/**
* Fires action before each dummy data item.
*
*
* @since 2.0.0
*
*
*/
do_action( 'geodir_insert_dummy_data_loop', $post_type, $data_type, $item_index );
}

// Do the data insert
if($dummy_post_index === 0){

Expand Down Expand Up @@ -509,6 +509,7 @@ public static function set_page_templates($post_type,$page_templates){
* @param string $post_type The post type.
*/
public static function dummy_data_ui() {
global $aui_bs5;
wp_enqueue_script( 'jquery-ui-progressbar' );
global $wpdb, $plugin_prefix,$geodirectory;

Expand All @@ -531,12 +532,18 @@ public static function dummy_data_ui() {

$nonce = wp_create_nonce( 'geodir_dummy_data' );


$bs_select_class = $aui_bs5 ? 'form-select form-select-sm' : ' form-control form-control-sm';
$data_tooltip = $aui_bs5 ? 'data-bs-toggle="tooltip"' : 'data-toggle="tooltip"';

foreach ( $cpts as $post_type => $cpt ) {

$data_types = self::dummy_data_types( $post_type );

$set_dt = geodir_get_option( $post_type . '_dummy_data_type' );

$set_dt = apply_filters( 'geodir_default_dummy_data_type', $set_dt, $post_type );

$count = 30;

if(geodir_column_exist($plugin_prefix . $post_type . "_detail", "post_dummy")){
Expand All @@ -552,7 +559,7 @@ public static function dummy_data_ui() {

$select_disabled = $post_counts > 0 ? 'disabled' : '';
echo "<td class='d-flex flex-row mb-0'>";
echo "<select title='".__( "Select the data type", "geodirectory" )."' data-toggle=\"tooltip\" id='" . $post_type . "_data_type' onchange='geodir_dummy_set_count(this,\"$post_type\");' $select_disabled class='flex-fill form-control form-control-sm' style='min-width:180px'>";
echo "<select title='".__( "Select the data type", "geodirectory" )."' $data_tooltip id='" . $post_type . "_data_type' onchange='geodir_dummy_set_count(this,\"$post_type\");' $select_disabled class='flex-fill $bs_select_class' style='min-width:180px'>";

$c = 0;
foreach ( $data_types as $key => $val ) {
Expand All @@ -566,25 +573,29 @@ public static function dummy_data_ui() {
echo "</select>";

$select_display = $post_counts > 0 ? 'display:none;' : '';
echo "<span title='".__( "Set the number of listings", "geodirectory" )."' data-toggle=\"tooltip\" class='gd-data-type-count flex-shrink-1 flex-fill ml-1 ms-1' style='$select_display'><select id='" . $post_type . "_data_type_count' style='min-width:65px;' class='form-control form-control-sm '>";
$select_display_bs5 = $aui_bs5 && $select_display ? 'display:none;' : '';
$select_count_class_bs5 = $aui_bs5 ? 'mx-1' : '';
echo $aui_bs5 ? '' : "<span title='".__( "Set the number of listings", "geodirectory" )."' data-toggle=\"tooltip\" class='gd-data-type-count flex-shrink-1 flex-fill ml-1 ms-1' style='$select_display'>";
echo "<select id='" . $post_type . "_data_type_count' style='min-width:65px;$select_display_bs5 ' class='$bs_select_class gd-data-type-count $select_count_class_bs5' data-bs-toggle=\"tooltip\" data-bs-title='".__( "Set the number of listings", "geodirectory" )."'>";
$x = 1;
while ( $x <= $count ) {
$selected = ( $x == $count ) ? "selected='selected'" : '';
echo "<option $selected value='$x'>" . $x . "</option>";
$x ++;
}
echo "</select></span>";
echo "</select>";
echo $aui_bs5 ? '' : "</span>";

// Page templates styles
echo "<span title='".__( "Overwrite the template designs to suit the data type", "geodirectory" )."' data-toggle=\"tooltip\" class='gd-data-type-templates ml-1 ms-1 flex-fill' style='$select_display'>";
echo "<label>";
echo $aui_bs5 ? '' : "<span title='".__( "Overwrite the template designs to suit the data type", "geodirectory" )."' data-toggle=\"tooltip\" class='gd-data-type-templates ml-1 ms-1 flex-fill' style='$select_display'>";
//echo "<label>";
// echo "<input value='1' style='width: auto;height: 16px;' id='" . $post_type . "_data_type_templates' type='checkbox' name='gd-data-templates' checked />".__("(Update page templates)","geodirectory");
echo "<select style='' id='" . $post_type . "_data_type_templates' name='gd-data-templates' class='form-control form-control-sm'>";
echo "<select style='$select_display_bs5' id='" . $post_type . "_data_type_templates' name='gd-data-templates' class='$bs_select_class gd-data-type-templates' data-bs-toggle=\"tooltip\" data-bs-title='".__( "Overwrite the template designs to suit the data type", "geodirectory" )."'>";
echo "<option value='1'>".__("Update page templates","geodirectory")."</option>";
echo "<option value='0'>".__("Do not update page templates","geodirectory")."</option>";
echo "</select>";
echo "</label>";
echo "</span>";
//echo "</label>";
echo $aui_bs5 ? '' : "</span>";

echo "</td>";

Expand Down Expand Up @@ -729,6 +740,8 @@ function (data) {
jQuery(obj).removeClass('gd-remove-data btn-danger').addClass('btn-primary');
jQuery(obj).val('<?php esc_attr_e( 'Insert posts', 'geodirectory' );?>');
jQuery(obj).prop('disabled', false);
jQuery('#' + posttype + '_data_type_count.gd-data-type-count').show();
jQuery('#' + posttype + '_data_type_templates.gd-data-type-templates').show();
jQuery('#' + posttype + '_data_type_count').closest('.gd-data-type-count').show();
jQuery('#' + posttype + '_data_type_templates').closest('.gd-data-type-templates').show();
jQuery('#' + posttype + '_data_type_count').prop('disabled', false);
Expand All @@ -752,6 +765,7 @@ function gdInstallDummyData(obj, nonce, posttype, insertedCount) {
jQuery(obj).prop('disabled', true);
jQuery('#' + posttype + '_data_type').prop('disabled', true);
jQuery('#' + posttype + '_data_type_count').prop('disabled', true);
jQuery('#' + posttype + '_data_type_count.gd-data-type-count').hide();
jQuery('#' + posttype + '_data_type_count').closest('.gd-data-type-count').hide();
jQuery('#' + posttype + '_data_type_templates').closest('.gd-data-type-templates').hide();

Expand Down Expand Up @@ -1418,4 +1432,4 @@ public static function setup_menu($menu_id = '',$menu_location = ''){
}

}
}
}
39 changes: 29 additions & 10 deletions includes/admin/class-geodir-admin-setup-wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -537,17 +537,18 @@ public function setup_features() {

$recommend_wp_plugins = GeoDir_Admin_Addons::get_recommend_wp_plugins();
$paid_types = GeoDir_Admin_Addons::get_wizard_paid_addons();

$installed_text = "<i class=\"fas fa-check-circle\" aria-hidden=\"true\"></i> " . __( 'Installed', 'geodirectory' );
echo "<input type='hidden' id='gd-installing-text' value='<i class=\"fas fa-sync fa-spin\" aria-hidden=\"true\"></i> " . __( 'Installing', 'geodirectory' ) . "' >";
echo "<input type='hidden' id='gd-installed-text' value='$installed_text' >";
?>
<div class="text-center mb-4">
<div class="text-center mb-5">
<h1 class="h3"><?php _e("What Directory features do you need?","geodirectory");?></h1>
<small class="text-muted"><?php _e("Select any that apply","geodirectory");?></small>
</div>

<div class="list-group mb-5" >
<?php
$installed_text = "<i class=\"fas fa-check-circle\" aria-hidden=\"true\"></i> " . __( 'Installed', 'geodirectory' );
echo "<input type='hidden' id='gd-installing-text' value='<i class=\"fas fa-sync fa-spin\" aria-hidden=\"true\"></i> " . __( 'Installing', 'geodirectory' ) . "' >";
echo "<input type='hidden' id='gd-installed-text' value='$installed_text' >";


// recommended
foreach ( $recommend_wp_plugins as $product ) {
Expand Down Expand Up @@ -587,10 +588,20 @@ public function setup_features() {
</div>
<small class="">
<span class="badge <?php echo ( $aui_bs5 ? 'rounded-pill bg-secondary' : 'badge-pill badge-secondary' ); ?> gd-plugin-status d-none"><?php _e( "Installing", "geodirectory" ); ?></span>
<?php echo $active_badge;?>
<?php
echo $active_badge;

if ( ! empty( $product['required'] ) ) {
?>
<span class="badge <?php echo ( $aui_bs5 ? 'rounded-pill bg-warning' : 'badge-pill badge-warning' ); ?>"><?php _e("Required","geodirectory");?></span>
<?php
}

?>
<span class="badge <?php echo ( $aui_bs5 ? 'rounded-pill bg-success' : 'badge-pill badge-success' ); ?>"><?php _e("Free","geodirectory");?></span>
</small>
</div>
<small class="text-muted"><?php echo !empty( $product['desc'] ) ? esc_attr($product['desc']) : ''; ?></small>
</div>
<?php } ?>
</div>
Expand Down Expand Up @@ -1261,6 +1272,12 @@ public function setup_content() {
'menus' => __( "Menus", "geodirectory" ),
);

// If a block theme remove some parts that don't apply
if ( function_exists( 'wp_is_block_theme' ) && wp_is_block_theme() ) {
unset( $wizard_content['sidebars'] );
unset( $wizard_content['menus'] );
}

$wizard_content = apply_filters( 'geodir_wizard_content', $wizard_content );

$page_counts = wp_count_posts( 'page' );
Expand Down Expand Up @@ -1687,6 +1704,7 @@ public static function content_dummy_data() {
public static function content_sidebars() {
global $aui_bs5;

$bs_select_class = $aui_bs5 ? 'form-select form-select-sm' : ' form-control form-control-sm';
$gd_sidebar_top = get_theme_support( 'geodirectory-sidebar-top' );
if ( isset( $gd_sidebar_top[0] ) ) {
?>
Expand All @@ -1695,7 +1713,7 @@ public static function content_sidebars() {
<div class="pb-1 flex-fill">
<div class="<?php echo ( $aui_bs5 ? 'mb-3' : 'form-group' ); ?>">
<label for="geodir-wizard-widgets-top"><?php _e( "Select the theme top sidebar", "geodirectory" ); ?></label>
<select id='geodir-wizard-widgets-top' class="geodir-select form-control form-control-sm w-100 mw-100 ">
<select id='geodir-wizard-widgets-top' class="geodir-select <?php echo $bs_select_class; ?> w-100 mw-100 ">
<?php
$is_sidebar = '';
$maybe_sidebar = '';
Expand Down Expand Up @@ -1771,7 +1789,7 @@ class="btn btn-primary btn-sm geodir_dummy_button d-block"
<div class="pb-1 flex-fill">
<div class="<?php echo ( $aui_bs5 ? 'mb-3' : 'form-group' ); ?>">
<label for="geodir-wizard-widgets"><?php _e( "Select the theme sidebar", "geodirectory" ); ?></label>
<select id='geodir-wizard-widgets' class="geodir-select form-control form-control-sm w-100 mw-100">
<select id='geodir-wizard-widgets' class="geodir-select <?php echo $bs_select_class; ?> w-100 mw-100">
<?php
$is_sidebar = '';
$maybe_sidebar = '';
Expand Down Expand Up @@ -1843,6 +1861,7 @@ class="btn btn-primary btn-sm geodir_dummy_button d-block"
*/
public static function content_menus() {
global $aui_bs5;
$bs_select_class = $aui_bs5 ? 'form-select form-select-sm' : ' form-control form-control-sm';
?>
<div class="form-table gd-dummy-table gd-dummy-widgets gd-dummy-posts">
<div class="d-flex justify-content-between">
Expand All @@ -1858,7 +1877,7 @@ public static function content_menus() {

if ( ! empty( $set_menus ) ) {
//echo '##1';
echo "<select id='geodir-wizard-menu-id' data-type='add' class='geodir-select form-control form-control-sm w-100 mw-100' >";
echo "<select id='geodir-wizard-menu-id' data-type='add' class='geodir-select $bs_select_class w-100 mw-100' >";

foreach ( $set_menus as $menu_location => $menu_id ) {
$selected = '';
Expand Down Expand Up @@ -1890,7 +1909,7 @@ public static function content_menus() {
//print_r($menus );

if ( ! empty( $menus ) ) {
echo "<select id='geodir-wizard-menu-location' data-type='create' class='geodir-select form-control form-control-sm w-100 mw-100' >";
echo "<select id='geodir-wizard-menu-location' data-type='create' class='geodir-select $bs_select_class w-100 mw-100' >";

foreach ( $menus as $menu_slug => $menu_name ) {
$selected = '';
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ __WARNING: GDv2 is a significant update over GDv1 and may require manual work, s
* Several SQL Query optimizations reducing some query times even further - ADDED
* GD > Single Next Prev not filtering by same location - FIXED
* Add listing zip and region discovery improvements - ADDED
* Setup Wizard fields not showing tooltips with BS5 styles - FIXED

= GeoDirectory v2.3.40 - 2024-02-15 =
* Custom single post map is not loading on non GD pages - FIXED
Expand Down

0 comments on commit 6153f6f

Please sign in to comment.