Skip to content

Commit

Permalink
= 4.2.7.4 =
Browse files Browse the repository at this point in the history
~ Tweak meta-box type file.
  • Loading branch information
tungnxt89 committed Dec 10, 2024
1 parent ab1956f commit 2abcf2b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 30 deletions.
17 changes: 4 additions & 13 deletions assets/src/js/admin/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,10 @@ import { AdminUtilsFunctions, Api, Utils } from './utils-admin.js';
attachmentIds = attachmentIds ? attachmentIds + ',' + attachment.id : attachment.id;
}

if ( attachment.type === 'image' ) {
const attachmentImage = attachment.sizes && attachment.sizes.thumbnail ? attachment.sizes.thumbnail.url : attachment.url;

listImages.append(
'<li class="lp-meta-box__file_list-item image" data-attachment_id="' + attachment.id + '"><img src="' + attachmentImage +
'" /><ul class="actions"><li><a href="#" class="delete"></a></li></ul></li>'
);
} else {
listImages.append(
'<li class="lp-meta-box__file_list-item image" data-attachment_id="' + attachment.id + '"><img class="is_file" src="' + attachment.icon +
'" /><span>' + attachment.filename + '</span><ul class="actions"><li><a href="#" class="delete"></a></li></ul></li>'
);
}
listImages.append(
'<li class="lp-meta-box__file_list-item image" data-attachment_id="' + attachment.id + '"><img class="is_file" src="' + attachment.icon +
'" /><span>' + attachment.filename + '</span><ul class="actions"><li><a href="#" class="delete"></a></li></ul></li>'
);
}
} );

Expand Down
20 changes: 14 additions & 6 deletions inc/admin/class-lp-admin-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ public function localize_data_global(): array {
],
'current_screen' => $screen ? $screen->id : '',
'show_search_author_field' => empty( $html_search_author_field ) ? 0 : $html_search_author_field,
'toast' => [
'gravity' => 'bottom',
'position' => 'center',
'duration' => 3000,
'close' => 1,
'stopOnFocus' => 1,
'classPrefix' => 'lp-toast',
],
]
);
}
Expand Down Expand Up @@ -469,12 +477,12 @@ public function get_course_data_for_editor_vue() {
global $post, $pagenow;

if ( empty( $post ) || ( get_post_type() !== LP_COURSE_CPT ) || ! in_array(
$pagenow,
array(
'post.php',
'post-new.php',
)
) ) {
$pagenow,
array(
'post.php',
'post-new.php',
)
) ) {
return [];
}

Expand Down
15 changes: 5 additions & 10 deletions inc/admin/views/meta-boxes/fields/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ public function output( $thepostid ) {
<label for="' . esc_attr( $field['id'] ) . '">' . wp_kses_post( $field['label'] ) . '</label>';

echo '<div id="' . esc_attr( $field['id'] ) . '" class="lp-meta-box__file ' . esc_attr( $field['class'] ) . '" data-mime="' . $field['mime_type'] . '" data-multil="' . $field['multil'] . '" style="' . esc_attr( $field['style'] ) . '" ' . implode(
' ',
$custom_attributes
) . '>';
' ',
$custom_attributes
) . '>';
echo '<ul class="lp-meta-box__file_list">';

$value = (array) $field['value'];
Expand All @@ -71,13 +71,8 @@ public function output( $thepostid ) {
$check_file = wp_check_filetype( $url );

echo '<li class="lp-meta-box__file_list-item image" data-attachment_id="' . $attachment_id . '">';

if ( in_array( $check_file['ext'], array( 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'tif' ), true ) ) {
echo wp_get_attachment_image( $attachment_id, 'thumbnail' );
} else {
echo '<img class="is_file" src="' . wp_mime_type_icon( $check_file['type'] ) . '" />';
echo '<span>' . wp_basename( get_attached_file( $attachment_id ) ) . '</span>';
}
echo sprintf( '<img class="is_file" src="%s" />', wp_mime_type_icon( $check_file['type'] ) );
echo sprintf( '<span>%s</span>', wp_basename( get_attached_file( $attachment_id ) ) );
echo '<ul class="actions"><li><a href="#" class="delete"></a></li></ul>';
echo '</li>';
}
Expand Down
2 changes: 1 addition & 1 deletion inc/class-lp-request-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public static function do_ajax( $action ) {
define( 'LP_DOING_AJAX', true );
}

LP_Gateways::instance()->get_available_payment_gateways();
//LP_Gateways::instance()->get_available_payment_gateways();

if ( has_filter( 'learn-press/ajax/verify-none/' . $action ) ) {
if ( ! self::verify_nonce( $action ) ) {
Expand Down

0 comments on commit 2abcf2b

Please sign in to comment.