Skip to content

Commit

Permalink
Merge pull request #2567 from kprajapatii/master
Browse files Browse the repository at this point in the history
2.3.47
  • Loading branch information
kprajapatii authored Apr 4, 2024
2 parents 571e69f + 9329805 commit e8adcc2
Show file tree
Hide file tree
Showing 17 changed files with 282 additions and 226 deletions.
2 changes: 1 addition & 1 deletion assets/aui/js/geodirectory-plupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ function plu_show_thumbs(imgId) {

var file_display = '';
var file_display_class = '';
if (file_ext == 'jpg' || file_ext == 'jpe' || file_ext == 'jpeg' || file_ext == 'png' || file_ext == 'gif' || file_ext == 'bmp' || file_ext == 'ico' || file_ext == 'webp') {
if (file_ext == 'jpg' || file_ext == 'jpe' || file_ext == 'jpeg' || file_ext == 'png' || file_ext == 'gif' || file_ext == 'bmp' || file_ext == 'ico' || file_ext == 'webp' || file_ext == 'svg') {
file_display = '<img class="gd-file-info embed-responsive-item embed-item-cover-xy " data-id="' + image_id + '" data-title="' + image_title + '" data-caption="' + image_caption + '" data-src="' + image_url + '" src="' + image_url + '" alt="" />';
if(!!image_title.trim()){
image_title_html = '<span class="gd-title-preview badge badge-light ab-top-left text-truncate mw-100 h-auto text-dark w-auto" style="background: #ffffffc7">' + image_title + '</span>';
Expand Down
2 changes: 1 addition & 1 deletion assets/aui/js/geodirectory-plupload.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/geodirectory-plupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ function plu_show_thumbs(imgId) {

var file_display = '';
var file_display_class = '';
if (file_ext == 'jpg' || file_ext == 'jpe' || file_ext == 'jpeg' || file_ext == 'png' || file_ext == 'gif' || file_ext == 'bmp' || file_ext == 'ico' || file_ext == 'webp') {
if (file_ext == 'jpg' || file_ext == 'jpe' || file_ext == 'jpeg' || file_ext == 'png' || file_ext == 'gif' || file_ext == 'bmp' || file_ext == 'ico' || file_ext == 'webp' || file_ext == 'svg') {
file_display = '<img class="gd-file-info" data-id="' + image_id + '" data-title="' + image_title + '" data-caption="' + image_caption + '" data-src="' + image_url + '" src="' + image_url + '" alt="" />';
if(!!image_title.trim()){
image_title_html = '<span class="gd-title-preview">' + image_title + '</span>';
Expand Down
2 changes: 1 addition & 1 deletion assets/js/geodirectory-plupload.min.js

Large diffs are not rendered by default.

4 changes: 2 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.46
* Version: 2.3.47
* Author: AyeCode - WordPress 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.46';
public $version = '2.3.47';

/**
* GeoDirectory instance.
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/settings/class-geodir-settings-cpt-cf.php
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ public static function fields_predefined( $post_type ) {
'cat_sort' => false,
'cat_filter' => false,
'extra_fields' => array(
'gd_file_types' => array( 'jpg','jpe','jpeg','gif','png','bmp','ico','webp'),
'gd_file_types' => geodir_image_extensions(),
'file_limit' => 1,
),
'single_use' => true,
Expand Down
11 changes: 9 additions & 2 deletions includes/class-geodir-media.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,19 @@ public static function insert_attachment( $post_id, $type = 'file', $url = '', $
$file_type = $file_type_arr['type'];
} else {
$post_type = get_post_type( $post_id );

// Check for revisions
if ( $post_type == 'revision' ) {
$post_type = get_post_type( wp_get_post_parent_id( $post_id ) );
}
$allowed_file_types = self::get_file_fields( $post_type );
$allowed_file_types = isset( $allowed_file_types[ $type ] ) ? $allowed_file_types[ $type ] : array( 'jpg', 'jpe', 'jpeg', 'gif', 'png', 'bmp', 'ico', 'webp' );

$cf_file_types = self::get_file_fields( $post_type );

if ( ! empty( $cf_file_types ) && ! empty( $cf_file_types[ $type ] ) ) {
$allowed_file_types = $cf_file_types[ $type ];
} else {
$allowed_file_types = geodir_image_extensions();
}

if ( $order === 0 && $type == 'post_images' ) {
$attachment_id = media_sideload_image( $url, $post_id, $title, 'id' ); // Uses the post date for the upload time /2009/12/image.jpg
Expand Down
10 changes: 1 addition & 9 deletions includes/core-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,7 @@ function geodir_get_search_default_button_text() {
* @package GeoDirectory
*/
function geodir_params() {
/**
* Filter the allowed image type extensions for post images.
*
* @since 1.4.7.1
*
* @param string $allowed_img_types The image type extensions array.
*/
$allowed_img_types = apply_filters( 'geodir_allowed_post_image_exts', array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'webp' ) );

$allowed_img_types = geodir_image_extensions();
$default_marker_icon = GeoDir_Maps::default_marker_icon( true );
$default_marker_size = GeoDir_Maps::get_marker_size( $default_marker_icon, array( 'w' => 20, 'h' => 34 ) );
$default_marker_width = $default_marker_size['w'];
Expand Down
2 changes: 1 addition & 1 deletion includes/custom-fields/input-functions-aui.php
Original file line number Diff line number Diff line change
Expand Up @@ -2411,7 +2411,7 @@ function geodir_cfi_files( $html, $cf ) {
$extra_fields = maybe_unserialize( $cf['extra_fields'] );
$file_limit = ! empty( $extra_fields ) && ! empty( $extra_fields['file_limit'] ) ? absint( $extra_fields['file_limit'] ) : 0;
$file_limit = apply_filters( "geodir_custom_field_file_limit", $file_limit, $cf, $gd_post );
$file_types = isset( $extra_fields['gd_file_types'] ) ? maybe_unserialize( $extra_fields['gd_file_types'] ) : array( 'jpg','jpe','jpeg','gif','png','bmp','ico','webp');
$file_types = isset( $extra_fields['gd_file_types'] ) ? maybe_unserialize( $extra_fields['gd_file_types'] ) : geodir_image_extensions();

if ( ! empty( $file_types ) ) {
if ( is_scalar( $file_types ) ) {
Expand Down
2 changes: 1 addition & 1 deletion includes/custom-fields/input-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1915,7 +1915,7 @@ function geodir_cfi_files( $html, $cf ) {
$file_limit = ! empty( $extra_fields ) && ! empty( $extra_fields['file_limit'] ) ? absint( $extra_fields['file_limit'] ) : 0;
$file_limit = apply_filters( "geodir_custom_field_file_limit", $file_limit, $cf, $gd_post );

$allowed_file_types = isset( $extra_fields['gd_file_types'] ) ? maybe_unserialize( $extra_fields['gd_file_types'] ) : array( 'jpg','jpe','jpeg','gif','png','bmp','ico','webp');
$allowed_file_types = isset( $extra_fields['gd_file_types'] ) ? maybe_unserialize( $extra_fields['gd_file_types'] ) : geodir_image_extensions();
$display_file_types = $allowed_file_types != '' ? '.' . implode( ", .", $allowed_file_types ) : '';
if ( ! empty( $allowed_file_types ) ) {
$allowed_file_types = implode( ",", $allowed_file_types );
Expand Down
2 changes: 1 addition & 1 deletion includes/custom-fields/output-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1614,7 +1614,7 @@ function geodir_cf_file( $html, $location, $cf, $p = '', $output = '' ) {
}

//$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
$image_file_types = array( 'image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon', 'image/webp' );
$image_file_types = geodir_image_mime_types();
$audio_file_types = array( 'audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid' );

// If the uploaded file is image
Expand Down
53 changes: 53 additions & 0 deletions includes/general-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1769,6 +1769,59 @@ function geodir_allowed_mime_types() {
);
}

/**
* Retrieves the list of allowed image extensions.
*
* @since 2.3.47.
*
* @return array Array of image extensions.
*/
function geodir_image_extensions() {
$gd_mime_types = geodir_allowed_mime_types();

$image_exts = ! empty( $gd_mime_types['Image'] ) ? array_keys( $gd_mime_types['Image'] ) : array();

/**
* Filters the list of allowed image extensions.
*
* @since 2.3.47.
*
* @param array $image_exts Array of image extensions.
*/
return apply_filters( 'geodir_allowed_post_image_exts', $image_exts );
}

/**
* Retrieves the list of allowed image mime types.
*
* @since 2.3.47.
*
* @return array Array of image mime types.
*/
function geodir_image_mime_types() {
$gd_mime_types = geodir_allowed_mime_types();

$mime_types = ! empty( $gd_mime_types['Image'] ) ? array_values( $gd_mime_types['Image'] ) : array();

if ( in_array( 'image/jpeg', $mime_types ) ) {
$mime_types[] = 'image/jpe';
$mime_types[] = 'image/jpg';
}

if ( ! empty( $mime_types ) ) {
$mime_types = array_unique( $mime_types );
}

/**
* Filters the list of allowed image mime types.
*
* @since 2.3.47.
*
* @param array $mime_types Array of image mime types.
*/
return apply_filters( 'geodir_allowed_image_mime_types', $mime_types );
}

/**
* Retrieve list of user display name for user id.
*
Expand Down
18 changes: 9 additions & 9 deletions includes/helper-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1402,15 +1402,15 @@ function geodir_file_relative_url( $url, $full_path = false ) {
* @return bool
*/
function geodir_is_image_file( $url ) {
if ( !empty( $url ) ) {
$filetype = wp_check_filetype( $url );
if ( !empty( $filetype['ext'] ) && in_array( $filetype['ext'], array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico', 'webp' ) ) ) {
return true;
}
}
return false;
if ( ! empty( $url ) ) {
$filetype = wp_check_filetype( $url );

if ( !empty( $filetype['ext'] ) && in_array( $filetype['ext'], array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico', 'webp', 'svg' ) ) ) {
return true;
}
}

return false;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion includes/widgets/class-geodir-widget-post-images.php
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ public function output_images( $options ) {

$design_style = ! empty( $args['design_style'] ) ? esc_attr( $args['design_style'] ) : geodir_design_style();

if ( $this->is_preview() ) {
if ( $this->is_preview() || $options['type'] == 'masonry' ) {
$options['ajax_load'] = false;
}

Expand Down
Binary file modified languages/geodirectory-en_US.mo
Binary file not shown.
Loading

0 comments on commit e8adcc2

Please sign in to comment.