Skip to content

Commit

Permalink
2.3.85
Browse files Browse the repository at this point in the history
  • Loading branch information
Stiofan committed Nov 12, 2024
1 parent 1acfd21 commit de30daa
Show file tree
Hide file tree
Showing 36 changed files with 2,142 additions and 1,443 deletions.
10 changes: 8 additions & 2 deletions geodirectory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Plugin Name: GeoDirectory
* Plugin URI: https://wpgeodirectory.com/
* Description: GeoDirectory - Business Directory Plugin for WordPress.
* Version: 2.3.84
* Version: 2.3.85
* Author: AyeCode - WP Business Directory Plugins
* Author URI: https://wpgeodirectory.com
* Text Domain: geodirectory
Expand All @@ -34,7 +34,7 @@ final class GeoDirectory {
*
* @var string
*/
public $version = '2.3.84';
public $version = '2.3.85';

/**
* GeoDirectory instance.
Expand Down Expand Up @@ -294,6 +294,12 @@ private function includes() {
GeoDir_Report_Post::init(); // Report Post
}

// BIG Data
if(!empty($this->settings['enable_big_data'])){
require_once( GEODIRECTORY_PLUGIN_DIR . 'includes/class-geodir-big-data.php' );
}


/**
* REST API.
*/
Expand Down
32 changes: 27 additions & 5 deletions includes/admin/class-geodir-admin-tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,15 @@ public function __construct() {
* @return array
*/
public function get_tools() {
global $geodir_count_attachments;
global $geodir_count_attachments, $geodirectory;

if ( empty( $geodir_count_attachments ) ) {
$geodir_count_attachments = GeoDir_Media::count_image_attachments();
}

$is_big_data_active = !empty($geodirectory->settings['enable_big_data']);
$big_data_status = $is_big_data_active ? __('(active)', 'geodirectory') : __('(not active)', 'geodirectory');

$tools = array(
'clear_version_numbers' => array(
'name' => __( 'Clear version numbers', 'geodirectory' ),
Expand Down Expand Up @@ -87,6 +90,11 @@ public function get_tools() {
'button' => __( 'Run', 'geodirectory' ),
'desc' => __( 'This tool will collect any texts stored in the DB and put them in the file db-language.php so they can then be used to translate them by translations tools.', 'geodirectory' ),
),
'clear_paging_cache' => array(
'name' => __( 'Clear paging cache', 'geodirectory' ),
'button' => __( 'Clear', 'geodirectory' ),
'desc' => __( 'This tool will delete pagign cache when the BIG Data option is enabled', 'geodirectory' ) . ' ' . esc_attr( $big_data_status ),
),
'search_replace_cf' => array(
'name' => __( 'Search & Replace Custom Field Value', 'geodirectory' ),
'button' => __( 'Replace', 'geodirectory' ),
Expand Down Expand Up @@ -144,7 +152,7 @@ public function execute_tool( $tool ) {
break;
case 'generate_keywords' :
$generated = (int) geodir_generate_title_keywords();

if ( $generated > 0 ) {
$message = wp_sprintf( _n( '%d keyword generated.', '%d keywords generated.', $generated, 'geodirectory' ), $generated );
} else {
Expand All @@ -163,6 +171,14 @@ public function execute_tool( $tool ) {
$ran = false;
}
break;
case 'clear_paging_cache' :
if ($this->clear_paging_cache()) {
$message = __( 'Cache successfully cleared', 'geodirectory' );
} else {
$message = __( 'There was a problem clearing the cache', 'geodirectory' );
$ran = false;
}
break;
case 'search_replace_cf' :
if ( $replaced = $this->search_replace_cf_value() ) {
$message = wp_sprintf( __( '%d items has been successfully updated.', 'geodirectory' ), $replaced );
Expand Down Expand Up @@ -204,7 +220,7 @@ public function execute_tool( $tool ) {

/**
* Clear version numbers so install/upgrade functions will run.
*
*
* @return string|void
*/
public function clear_version_numbers(){
Expand Down Expand Up @@ -263,6 +279,12 @@ public function check_reviews_location() {
return false;
}

public function clear_paging_cache()
{
delete_option('gd_found_posts_cache');
return true;
}

/**
* Load language strings in to file to translate via po editor
*
Expand Down Expand Up @@ -676,7 +698,7 @@ public function load_gd_options_text_translation($translation_texts = array()) {

/**
* Tool to remove unused GDv1 options.
*
*
* @since 2.1.0.12
*/
public function extra_debug_tools( $tools ) {
Expand All @@ -693,7 +715,7 @@ public function extra_debug_tools( $tools ) {

/**
* Remove unused GDv1 options.
*
*
* @since 2.1.0.12
*/
public function remove_unused_data() {
Expand Down
12 changes: 11 additions & 1 deletion includes/admin/settings/class-geodir-settings-cpt-cf.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,14 @@ public function left_panel_content() {

</div>

<?php
$listing_type = self::$post_type;

$cfs = self::fields_custom( $listing_type );

if ( ! empty( $cfs ) ) {
?>

<h3 class="h6 text-muted"><?php _e( 'Custom Fields', 'geodirectory' ); ?></h3>
<div class="inside">

Expand All @@ -219,6 +227,7 @@ public function left_panel_content() {

</div>
<?php
}

}

Expand All @@ -238,6 +247,7 @@ public function output_standard_fields() {
$listing_type = self::$post_type;

$cfs = self::fields_standard( self::$post_type );

?>
<ul class="row row-cols-1 px-2 mb-0">
<li class="gd-cf-tooltip-wrap col px-1">
Expand Down Expand Up @@ -321,7 +331,7 @@ public function output_custom_fields() {
}
echo '</ul>';
} else {
_e( 'There are no custom fields here yet.', 'geodirectory' );
//_e( 'There are no custom fields here yet.', 'geodirectory' );
}

}
Expand Down
8 changes: 8 additions & 0 deletions includes/admin/settings/class-geodir-settings-general.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,14 @@ public function get_settings( $current_section = '' ) {
'default' => '1',
),

array(
'name' => __( 'Enable BIG Data Optimizations', 'geodirectory' ),
'desc' => __( 'This will help with directories over 50k listings (can slow down smaller directories)', 'geodirectory' ),
'id' => 'enable_big_data',
'type' => 'checkbox',
// 'default' => '0',
),

// @todo to be move to own design section
array(
'id' => 'design_style',
Expand Down
8 changes: 4 additions & 4 deletions includes/admin/views/html-admin-page-status-report.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
$settings = $system_status->get_settings();
$pages = $system_status->get_pages();
?>
<div class="notice">
<div class="notice alert alert-primary">
<p><?php _e( 'Please copy and paste this information in your ticket when contacting support:', 'geodirectory' ); ?> </p>
<p class="submit"><a href="#" class="button-primary debug-report"><?php _e( 'Get system report', 'geodirectory' ); ?></a></p>
<p class="submit"><a href="#" class="button-primary debug-report btn btn-primary btn-sm text-white text-decoration-none"><?php _e( 'Get system report', 'geodirectory' ); ?></a></p>
<div id="debug-report">
<textarea readonly="readonly"></textarea>
<p class="submit"><button id="copy-for-support" class="button-primary" href="#" data-tip="<?php esc_attr_e( 'Copied!', 'geodirectory' ); ?>"><?php _e( 'Select all & copy for support', 'geodirectory' ); ?></button></p>
<p class="submit"><button id="copy-for-support" class="btn btn-primary btn-sm" href="#" data-tip="<?php esc_attr_e( 'Copied!', 'geodirectory' ); ?>"><?php _e( 'Select all & copy for support', 'geodirectory' ); ?></button></p>
<p class="copy-error gd-hidden"><?php _e( 'Copying to clipboard failed. Please press Ctrl/Cmd+C to copy.', 'geodirectory' ); ?></p>
</div>
</div>
Expand Down Expand Up @@ -647,7 +647,7 @@
</tr>
</thead>
<tbody>
<?php
<?php
if ( ! empty( $theme['overrides'] ) ) { ?>
<tr>
<td data-export-label="Overrides"><?php _e( 'Overrides', 'geodirectory' ); ?></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@
* @param string $field ->field_type Current field type.
*/
$cat_sort_heading_label = apply_filters( 'geodir_advance_custom_fields_heading', __( 'Posts sort options', 'geodirectory' ), $field->field_type );
$cat_sort_heading_label = apply_filters( 'geodir_advance_custom_fields_heading', __( 'Posts sort options', 'geodirectory' ), $field->field_type );
?>
<h3 class="border-bottom text-dark h4 pt-3 pb-2 mb-3 <?php echo geodir_advanced_toggle_class(); ?>" data-setting="cat_sort_heading"><?php echo $cat_sort_heading_label; ?></h3>
<?php
Expand Down
14 changes: 7 additions & 7 deletions includes/api/class-geodir-rest-fields-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function get_items( $request ) {

// Retrieve the list of registered collection query parameters.
$registered = $this->get_collection_params();

$args = array();

/*
Expand Down Expand Up @@ -138,7 +138,7 @@ public function get_items( $request ) {
}
}



if ( isset( $args['per_page'] ) ) {
$args['per_page'] = absint( $args['per_page'] );
Expand Down Expand Up @@ -172,9 +172,9 @@ public function get_items( $request ) {
*/
$args = apply_filters( "geodir_rest_fields_query", $args, $request );
$query_args = $this->prepare_items_query( $args, $request );

$query_args['count_total'] = true;

$results = $this->get_fields( $query_args );

$fields = array();
Expand Down Expand Up @@ -787,7 +787,7 @@ public function get_fields( $args ) {
}
$query_from = "FROM " . GEODIR_CUSTOM_FIELDS_TABLE;
$query_where = "WHERE 1=1";

// nicename
if ( ! empty( $args['htmlvar_name'] ) ) {
$query_where .= $wpdb->prepare( ' AND htmlvar_name = %s', $args['htmlvar_name'] );
Expand Down Expand Up @@ -823,7 +823,7 @@ public function get_fields( $args ) {
}
$orderby_array[] = 'frontend_title ASC';
$query_orderby = 'ORDER BY ' . implode( ', ', $orderby_array );

// limit
if ( isset( $args['per_page'] ) && $args['per_page'] > 0 ) {
if ( $args['offset'] ) {
Expand Down Expand Up @@ -867,7 +867,7 @@ public function get_fields( $args ) {
$sql = "SELECT $query_fields $query_from $query_where $query_orderby $query_limit";

$results = $wpdb->get_results( $sql );

$total_rows = 0;
if ( isset( $args['count_total'] ) && $args['count_total'] ) {
$total_rows = (int) $wpdb->get_var( 'SELECT FOUND_ROWS()' );
Expand Down
Loading

0 comments on commit de30daa

Please sign in to comment.