Skip to content

Commit

Permalink
* Dummy data import does not support external images - FIXED
Browse files Browse the repository at this point in the history
  • Loading branch information
Stiofan committed May 9, 2024
1 parent ad2064f commit f48595a
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 21 deletions.
7 changes: 7 additions & 0 deletions includes/admin/class-geodir-admin-dummy-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,13 @@ public static function create_dummy_posts( $request ) {
$post_info['post_status'] = 'publish';
}

// Set all images except first one to be external for speed
if( !empty($post_info['post_images'] ) ){
for ($i = 1; $i < count($post_info['post_images']); $i++) {
$post_info['post_images'][$i] = '#' . $post_info['post_images'][$i];
}
}

wp_insert_post( $post_info, true ); // we hook into the save_post hook
}
}
Expand Down
5 changes: 5 additions & 0 deletions includes/class-geodir-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,11 @@ public static function insert_dummy_data(){
wp_die( -1 );
}

// defind doing import
if( ! defined( 'GEODIR_DOING_IMPORT' ) ){
define( 'GEODIR_DOING_IMPORT', true );
}

//Suspend cache additions
wp_suspend_cache_addition(true);

Expand Down
6 changes: 6 additions & 0 deletions includes/widgets/class-geodir-widget-listings.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ public function set_arguments() {
'advanced' => false,
'group' => __( 'Title', 'geodirectory' ),
);

if ( $design_style ) {
// title styles
$arguments = $arguments + geodir_get_sd_title_inputs();
}

$arguments['hide_if_empty'] = array(
'title' => __( 'Hide widget if no posts?', 'geodirectory' ),
'type' => 'checkbox',
Expand Down
2 changes: 2 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,9 @@ __WARNING: GDv2 is a significant update over GDv1 and may require manual work, s

= GeoDirectory v2.3.52 - TBD =
* AUI radio set should skip showing optgroup from option values - FIXED
* GD > Listings block missing title attribute settings - ADDED/FIXED
* PHP Warning: Undefined array key "heading_tag" - FIXED
* Dummy data import does not support external images - FIXED
* Add "id" as reserved field to prevent custom field with id key - CHANGED

= GeoDirectory v2.3.51 - 2024-05-02 =
Expand Down
2 changes: 1 addition & 1 deletion vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
add_action('after_setup_theme', function () {
global $ayecode_ui_version,$ayecode_ui_file_key;
$this_version = "0.2.13";
$this_version = "0.2.14";
if(empty($ayecode_ui_version) || version_compare($this_version , $ayecode_ui_version, '>')){
$ayecode_ui_version = $this_version ;
$ayecode_ui_file_key = wp_hash( __FILE__ );
Expand Down
3 changes: 2 additions & 1 deletion vendor/ayecode/wp-ayecode-ui/change-log.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
= 0.2.14 - TBD =
= 0.2.14 - 2024-05-09 =
* Label type top don't have margin to label - FIXED
* Improvements for aui_lightbox_embed() function - CHANGED

= 0.2.13 - 2024-05-02 =
* BS4 lightbox displays blurred image - FIXED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AyeCode_UI_Settings {
*
* @var string
*/
public $version = '0.2.13';
public $version = '0.2.14';

/**
* Class textdomain.
Expand Down
2 changes: 1 addition & 1 deletion vendor/ayecode/wp-ayecode-ui/includes/inc/bs4-js.php
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ function aui_lightbox_embed($link,ele){
// remove it first
jQuery('.aui-carousel-modal').remove();

var $modal = '<div class="modal fade aui-carousel-modal bsui" tabindex="-1" role="dialog" aria-labelledby="aui-modal-title" aria-hidden="true"><div class="modal-dialog modal-dialog-centered modal-xl mw-100"><div class="modal-content bg-transparent border-0"><div class="modal-header"><h5 class="modal-title" id="aui-modal-title"></h5></div><div class="modal-body text-center"><i class="fas fa-circle-notch fa-spin fa-3x"></i></div></div></div></div>';
var $modal = '<div class="modal fade aui-carousel-modal bsui" tabindex="-1" role="dialog" aria-labelledby="aui-modal-title" aria-hidden="true"><div class="modal-dialog modal-dialog-centered modal-xl mw-100"><div class="modal-content bg-transparent border-0 shadow-none"><div class="modal-header"><h5 class="modal-title" id="aui-modal-title"></h5></div><div class="modal-body text-center"><i class="fas fa-circle-notch fa-spin fa-3x"></i></div></div></div></div>';
jQuery('body').append($modal);

jQuery('.aui-carousel-modal').modal({
Expand Down
37 changes: 32 additions & 5 deletions vendor/ayecode/wp-ayecode-ui/includes/inc/bs5-js.php
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ function aui_lightbox_embed($link,ele){
// remove it first
jQuery('.aui-carousel-modal').remove();

var $modal = '<div class="modal fade aui-carousel-modal bsui" id="aui-carousel-modal" tabindex="-1" role="dialog" aria-labelledby="aui-modal-title" aria-hidden="true"><div class="modal-dialog modal-dialog-centered modal-xl mw-100"><div class="modal-content bg-transparent border-0"><div class="modal-header"><h5 class="modal-title" id="aui-modal-title"></h5></div><div class="modal-body text-center"><i class="fas fa-circle-notch fa-spin fa-3x"></i></div></div></div></div>';
var $modal = '<div class="modal fade aui-carousel-modal bsui" id="aui-carousel-modal" tabindex="-1" role="dialog" aria-labelledby="aui-modal-title" aria-hidden="true"><div class="modal-dialog modal-dialog-centered modal-xl mw-100"><div class="modal-content bg-transparent border-0 shadow-none"><div class="modal-header"><h5 class="modal-title" id="aui-modal-title"></h5></div><div class="modal-body text-center"><i class="fas fa-circle-notch fa-spin fa-3x"></i></div></div></div></div>';
jQuery('body').append($modal);

const ayeModal = new bootstrap.Modal('.aui-carousel-modal', {});
Expand Down Expand Up @@ -639,7 +639,7 @@ function aui_lightbox_embed($link,ele){

// items
$i = 0;
$carousel += '<div class="carousel-inner">';
$carousel += '<div class="carousel-inner d-flex align-items-center">';
$container.find('.aui-lightbox-image').each(function() {
var a = this;
var href = jQuery(a).attr('href');
Expand All @@ -649,13 +649,40 @@ function aui_lightbox_embed($link,ele){

// image
var css_height = window.innerWidth > window.innerHeight ? '90vh' : 'auto';
var img = href ? jQuery(a).find('img').clone().attr('src', href ).attr('sizes', '').removeClass().addClass('mx-auto d-block w-auto mw-100 rounded').css('max-height',css_height).get(0).outerHTML : jQuery(a).find('img').clone().removeClass().addClass('mx-auto d-block w-auto mw-100 rounded').css('max-height',css_height).get(0).outerHTML;
var srcset = jQuery(a).find('img').attr('srcset');
var sizes = '';
if (srcset) {
var sources = srcset.split(',')
.map(s => {
var parts = s.trim().split(' ');
return {
width: parseInt(parts[1].replace('w', '')),
descriptor: parts[1].replace('w', 'px') // Ensuring the descriptor is in pixels
};
})
.sort((a, b) => b.width - a.width); // Sort from largest to smallest for proper descending order

// Build the sizes string
sizes = sources.map((source, index, array) => {
// For the largest source, do not include max-width to serve as default for larger viewports
if (index === 0) {
return `${source.descriptor}`; // Using full descriptor for the largest image
} else {
// For other sources, specify max-width for one pixel less than the current width
return `(max-width: ${source.width - 1}px) ${array[index - 1].descriptor}`;
}
}).reverse().join(', '); // Reverse to start from smallest to largest for logical order

}


var img = href ? jQuery(a).find('img').clone().attr('src', href ).attr('sizes', sizes ).removeClass().addClass('mx-auto d-block w-auto mw-100 rounded').css('max-height',css_height).get(0).outerHTML : jQuery(a).find('img').clone().removeClass().addClass('mx-auto d-block w-auto mw-100 rounded').css('max-height',css_height).get(0).outerHTML;
$carousel += img;
// captions
if(jQuery(a).parent().find('.carousel-caption').length ){
$carousel += jQuery(a).parent().find('.carousel-caption').clone().removeClass('sr-only').get(0).outerHTML;
$carousel += jQuery(a).parent().find('.carousel-caption').clone().removeClass('sr-only visually-hidden').get(0).outerHTML;
}else if(jQuery(a).parent().find('.figure-caption').length ){
$carousel += jQuery(a).parent().find('.figure-caption').clone().removeClass('sr-only').addClass('carousel-caption').get(0).outerHTML;
$carousel += jQuery(a).parent().find('.figure-caption').clone().removeClass('sr-only visually-hidden').addClass('carousel-caption').get(0).outerHTML;
}
$carousel += '</div></div>';
$i++;
Expand Down
14 changes: 7 additions & 7 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,20 @@
},
{
"name": "ayecode/wp-ayecode-ui",
"version": "0.2.13",
"version_normalized": "0.2.13.0",
"version": "0.2.14",
"version_normalized": "0.2.14.0",
"source": {
"type": "git",
"url": "https://github.com/AyeCode/wp-ayecode-ui.git",
"reference": "45b6db6d436846578625cf852fcf9b98bf53f5f3"
"reference": "c9c391767426da6e7ebc023eb95f52cee644b8df"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/AyeCode/wp-ayecode-ui/zipball/45b6db6d436846578625cf852fcf9b98bf53f5f3",
"reference": "45b6db6d436846578625cf852fcf9b98bf53f5f3",
"url": "https://api.github.com/repos/AyeCode/wp-ayecode-ui/zipball/c9c391767426da6e7ebc023eb95f52cee644b8df",
"reference": "c9c391767426da6e7ebc023eb95f52cee644b8df",
"shasum": ""
},
"time": "2024-05-02T14:17:46+00:00",
"time": "2024-05-09T11:51:46+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
Expand Down Expand Up @@ -97,7 +97,7 @@
],
"support": {
"issues": "https://github.com/AyeCode/wp-ayecode-ui/issues",
"source": "https://github.com/AyeCode/wp-ayecode-ui/tree/0.2.13"
"source": "https://github.com/AyeCode/wp-ayecode-ui/tree/0.2.14"
},
"install-path": "../ayecode/wp-ayecode-ui"
},
Expand Down
10 changes: 5 additions & 5 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => 'ayecode/geodirectory',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'e27c6106d5ee33b08827f927f3daf73e82933a0c',
'reference' => 'ad2064f097572c4e645f7463d6e0e74ef853be2b',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand All @@ -22,16 +22,16 @@
'ayecode/geodirectory' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'e27c6106d5ee33b08827f927f3daf73e82933a0c',
'reference' => 'ad2064f097572c4e645f7463d6e0e74ef853be2b',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev_requirement' => false,
),
'ayecode/wp-ayecode-ui' => array(
'pretty_version' => '0.2.13',
'version' => '0.2.13.0',
'reference' => '45b6db6d436846578625cf852fcf9b98bf53f5f3',
'pretty_version' => '0.2.14',
'version' => '0.2.14.0',
'reference' => 'c9c391767426da6e7ebc023eb95f52cee644b8df',
'type' => 'library',
'install_path' => __DIR__ . '/../ayecode/wp-ayecode-ui',
'aliases' => array(),
Expand Down

0 comments on commit f48595a

Please sign in to comment.