Changeset 2783009
- Timestamp:
- 09/11/2022 06:36:06 PM (4 years ago)
- Location:
- bubuku-media-library
- Files:
-
- 20 edited
- 1 copied
-
tags/1.0.1 (copied) (copied from bubuku-media-library/trunk)
-
tags/1.0.1/assets/css/admin.css (modified) (3 diffs)
-
tags/1.0.1/bubuku-media-library.php (modified) (1 diff)
-
tags/1.0.1/readme.txt (modified) (1 diff)
-
tags/1.0.1/src/BML_assets.php (modified) (2 diffs)
-
tags/1.0.1/src/BML_common.php (modified) (2 diffs)
-
tags/1.0.1/src/BML_db.php (modified) (1 diff)
-
tags/1.0.1/src/BML_filter.php (modified) (1 diff)
-
tags/1.0.1/src/BML_plugin.php (modified) (1 diff)
-
tags/1.0.1/src/BML_restapi.php (modified) (2 diffs)
-
tags/1.0.1/src/BML_view.php (modified) (3 diffs)
-
trunk/assets/css/admin.css (modified) (3 diffs)
-
trunk/bubuku-media-library.php (modified) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/src/BML_assets.php (modified) (2 diffs)
-
trunk/src/BML_common.php (modified) (2 diffs)
-
trunk/src/BML_db.php (modified) (1 diff)
-
trunk/src/BML_filter.php (modified) (1 diff)
-
trunk/src/BML_plugin.php (modified) (1 diff)
-
trunk/src/BML_restapi.php (modified) (2 diffs)
-
trunk/src/BML_view.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bubuku-media-library/tags/1.0.1/assets/css/admin.css
r2782825 r2783009 9 9 .column-bk_file_size{ 10 10 width: 150px; 11 } 12 13 .bk_file_size_item small{ 14 line-height: 15px; 15 display: block; 16 margin: 2px 0 4px; 11 17 } 12 18 … … 35 41 .bk_file_size .bk_btn{ 36 42 width: 100%; 43 padding: 0; 37 44 border: none; 38 45 background: transparent; … … 44 51 height: 30px; 45 52 line-height: 30px; 46 border-radius: 50px;53 border-radius: 3px; 47 54 background: var(--bkml-bg-btn); 48 55 text-align: center; -
bubuku-media-library/tags/1.0.1/bubuku-media-library.php
r2782825 r2783009 5 5 * Requires at least: 5.2 6 6 * Requires PHP: 7.2 7 * Version: 1.0. 07 * Version: 1.0.1 8 8 * Author: Bubuku 9 9 * Author URI: https://www.bubuku.com/ -
bubuku-media-library/tags/1.0.1/readme.txt
r2782825 r2783009 33 33 == Changelog == 34 34 35 = 1.0.1 = 36 * Add calculate message to sort and filter. 37 * Add 'This media is not supported' message in the file size column. 38 35 39 = 1.0.0 = 36 40 * Initial release. -
bubuku-media-library/tags/1.0.1/src/BML_assets.php
r2782825 r2783009 6 6 * @author Luis Ruiz <lruiz@bubuku.com> 7 7 * @copyright 2022 Bubuku 8 * @version 1.0. 08 * @version 1.0.1 9 9 */ 10 10 … … 38 38 BBK_PLUGIN_ASSETS_URL . '/css/admin.css', 39 39 false, 40 '1.0. 0'40 '1.0.1' 41 41 ); 42 42 -
bubuku-media-library/tags/1.0.1/src/BML_common.php
r2782825 r2783009 6 6 * @author Luis Ruiz <lruiz@bubuku.com> 7 7 * @copyright 2022 Bubuku 8 * @version 1.0. 08 * @version 1.0.1 9 9 */ 10 10 … … 45 45 46 46 public function value_column_file_size( $column_name, $media_id ) { 47 global $wp_query;48 if ( 'bk_file_size' != $column_name || !wp_attachment_is_image( $media_id )) {47 48 if ( 'bk_file_size' != $column_name ) { 49 49 return; 50 50 } 51 52 $orderby = ( isset($wp_query->query['orderby']) ) ? $wp_query->query['orderby'] : ''; 53 $file_size = get_post_meta( $media_id, '_bkml_attachment_file_size', true ); 54 55 if ( empty($file_size) && 'bk_file_size' !== $orderby ) { 56 $file_size = filesize( get_attached_file( $media_id ) ); 51 52 if ( wp_attachment_is_image( $media_id ) ) { 53 54 echo $this->_view->show_file_size( $media_id ); 55 echo $this->_view->show_file_alt($media_id); 56 57 } else { 58 esc_html_e('This media is not supported.', 'bbkmedialibrary'); 57 59 } 58 59 60 if ( !empty( $file_size ) ) {61 62 echo $this->_view->show_file_size( $file_size );63 64 } else {65 echo '<p>66 <button type="button" class="bk_file_size bk_btn js-calculate" data-id="'. $media_id .'">67 <span class="bk_txt">'. esc_html__('Calculate', 'bbkmedialibrary') .'</span>68 <span class="bk_loader"></span>69 </button>70 </p>';71 }72 73 echo $this->_view->show_file_alt($media_id);74 60 75 61 } -
bubuku-media-library/tags/1.0.1/src/BML_db.php
r2782825 r2783009 6 6 * @author Luis Ruiz <lruiz@bubuku.com> 7 7 * @copyright 2022 Bubuku 8 * @version 1.0. 08 * @version 1.0.1 9 9 */ 10 10 -
bubuku-media-library/tags/1.0.1/src/BML_filter.php
r2782825 r2783009 6 6 * @author Luis Ruiz <lruiz@bubuku.com> 7 7 * @copyright 2022 Bubuku 8 * @version 1.0. 08 * @version 1.0.1 9 9 */ 10 10 -
bubuku-media-library/tags/1.0.1/src/BML_plugin.php
r2782825 r2783009 6 6 * @author Luis Ruiz <lruiz@bubuku.com> 7 7 * @copyright 2022 Bubuku 8 * @version 1.0. 08 * @version 1.0.1 9 9 */ 10 10 -
bubuku-media-library/tags/1.0.1/src/BML_restapi.php
r2782825 r2783009 6 6 * @author Luis Ruiz <lruiz@bubuku.com> 7 7 * @copyright 2022 Bubuku 8 * @version 1.0. 08 * @version 1.0.1 9 9 */ 10 10 … … 65 65 66 66 if ( $data ) { 67 $filesize = $this->_view->show_file_size($ data);67 $filesize = $this->_view->show_file_size($media_id); 68 68 wp_send_json_success(array('filesize' => $filesize)); 69 69 die(); -
bubuku-media-library/tags/1.0.1/src/BML_view.php
r2782825 r2783009 6 6 * @author Luis Ruiz <lruiz@bubuku.com> 7 7 * @copyright 2022 Bubuku 8 * @version 1.0. 08 * @version 1.0.1 9 9 */ 10 10 … … 29 29 * @return string 30 30 */ 31 public function show_file_size($file_size) { 31 public function show_file_size($media_id) { 32 global $wp_query; 33 34 $file_size = get_post_meta( $media_id, '_bkml_attachment_file_size', true ); 35 $is_calculate_filesize = true; 36 37 if ( empty($file_size) ) { 38 $is_calculate_filesize = false; 39 $file_size = filesize( get_attached_file( $media_id ) ); 40 } 32 41 33 42 if ( !empty( $file_size ) ) { … … 44 53 45 54 $file_size = size_format($file_size, 2); 46 return '<p><span class="bk_file_size '. esc_html( $file_size_style ) .'">'. esc_html( $file_size ) .'</span></p>'; 55 56 } 57 58 if ( $is_calculate_filesize ) { 59 return '<p class="bk_file_size_item"> 60 <span class="bk_file_size '. esc_html( $file_size_style ) .'">'. esc_html( $file_size ) .'</span> 61 </p>'; 62 } else { 63 64 $orderby = ( isset($wp_query->query['orderby']) ) ? $wp_query->query['orderby'] : ''; 65 $file_size_out = ''; 66 if ( 'bk_file_size' !== $orderby ) { 67 $file_size_out = '<span class="bk_file_size '. esc_html( $file_size_style ) .'">'. esc_html( $file_size ) .'</span>'; 68 } 69 70 return '<p class="bk_file_size_item"> 71 '. $file_size_out .' 72 <small>'. esc_html__('In order to sort or filter by size, you need to calculate', 'bbkmedialibrary') .'</small> 73 <button type="button" class="bk_btn js-calculate" data-id="'. $media_id .'"> 74 <span class="bk_txt">'. esc_html__('Calculate', 'bbkmedialibrary') .'</span> 75 <span class="bk_loader"></span> 76 </button> 77 </p>'; 47 78 } 48 79 -
bubuku-media-library/trunk/assets/css/admin.css
r2782825 r2783009 9 9 .column-bk_file_size{ 10 10 width: 150px; 11 } 12 13 .bk_file_size_item small{ 14 line-height: 15px; 15 display: block; 16 margin: 2px 0 4px; 11 17 } 12 18 … … 35 41 .bk_file_size .bk_btn{ 36 42 width: 100%; 43 padding: 0; 37 44 border: none; 38 45 background: transparent; … … 44 51 height: 30px; 45 52 line-height: 30px; 46 border-radius: 50px;53 border-radius: 3px; 47 54 background: var(--bkml-bg-btn); 48 55 text-align: center; -
bubuku-media-library/trunk/bubuku-media-library.php
r2782825 r2783009 5 5 * Requires at least: 5.2 6 6 * Requires PHP: 7.2 7 * Version: 1.0. 07 * Version: 1.0.1 8 8 * Author: Bubuku 9 9 * Author URI: https://www.bubuku.com/ -
bubuku-media-library/trunk/readme.txt
r2782825 r2783009 33 33 == Changelog == 34 34 35 = 1.0.1 = 36 * Add calculate message to sort and filter. 37 * Add 'This media is not supported' message in the file size column. 38 35 39 = 1.0.0 = 36 40 * Initial release. -
bubuku-media-library/trunk/src/BML_assets.php
r2782825 r2783009 6 6 * @author Luis Ruiz <lruiz@bubuku.com> 7 7 * @copyright 2022 Bubuku 8 * @version 1.0. 08 * @version 1.0.1 9 9 */ 10 10 … … 38 38 BBK_PLUGIN_ASSETS_URL . '/css/admin.css', 39 39 false, 40 '1.0. 0'40 '1.0.1' 41 41 ); 42 42 -
bubuku-media-library/trunk/src/BML_common.php
r2782825 r2783009 6 6 * @author Luis Ruiz <lruiz@bubuku.com> 7 7 * @copyright 2022 Bubuku 8 * @version 1.0. 08 * @version 1.0.1 9 9 */ 10 10 … … 45 45 46 46 public function value_column_file_size( $column_name, $media_id ) { 47 global $wp_query;48 if ( 'bk_file_size' != $column_name || !wp_attachment_is_image( $media_id )) {47 48 if ( 'bk_file_size' != $column_name ) { 49 49 return; 50 50 } 51 52 $orderby = ( isset($wp_query->query['orderby']) ) ? $wp_query->query['orderby'] : ''; 53 $file_size = get_post_meta( $media_id, '_bkml_attachment_file_size', true ); 54 55 if ( empty($file_size) && 'bk_file_size' !== $orderby ) { 56 $file_size = filesize( get_attached_file( $media_id ) ); 51 52 if ( wp_attachment_is_image( $media_id ) ) { 53 54 echo $this->_view->show_file_size( $media_id ); 55 echo $this->_view->show_file_alt($media_id); 56 57 } else { 58 esc_html_e('This media is not supported.', 'bbkmedialibrary'); 57 59 } 58 59 60 if ( !empty( $file_size ) ) {61 62 echo $this->_view->show_file_size( $file_size );63 64 } else {65 echo '<p>66 <button type="button" class="bk_file_size bk_btn js-calculate" data-id="'. $media_id .'">67 <span class="bk_txt">'. esc_html__('Calculate', 'bbkmedialibrary') .'</span>68 <span class="bk_loader"></span>69 </button>70 </p>';71 }72 73 echo $this->_view->show_file_alt($media_id);74 60 75 61 } -
bubuku-media-library/trunk/src/BML_db.php
r2782825 r2783009 6 6 * @author Luis Ruiz <lruiz@bubuku.com> 7 7 * @copyright 2022 Bubuku 8 * @version 1.0. 08 * @version 1.0.1 9 9 */ 10 10 -
bubuku-media-library/trunk/src/BML_filter.php
r2782825 r2783009 6 6 * @author Luis Ruiz <lruiz@bubuku.com> 7 7 * @copyright 2022 Bubuku 8 * @version 1.0. 08 * @version 1.0.1 9 9 */ 10 10 -
bubuku-media-library/trunk/src/BML_plugin.php
r2782825 r2783009 6 6 * @author Luis Ruiz <lruiz@bubuku.com> 7 7 * @copyright 2022 Bubuku 8 * @version 1.0. 08 * @version 1.0.1 9 9 */ 10 10 -
bubuku-media-library/trunk/src/BML_restapi.php
r2782825 r2783009 6 6 * @author Luis Ruiz <lruiz@bubuku.com> 7 7 * @copyright 2022 Bubuku 8 * @version 1.0. 08 * @version 1.0.1 9 9 */ 10 10 … … 65 65 66 66 if ( $data ) { 67 $filesize = $this->_view->show_file_size($ data);67 $filesize = $this->_view->show_file_size($media_id); 68 68 wp_send_json_success(array('filesize' => $filesize)); 69 69 die(); -
bubuku-media-library/trunk/src/BML_view.php
r2782825 r2783009 6 6 * @author Luis Ruiz <lruiz@bubuku.com> 7 7 * @copyright 2022 Bubuku 8 * @version 1.0. 08 * @version 1.0.1 9 9 */ 10 10 … … 29 29 * @return string 30 30 */ 31 public function show_file_size($file_size) { 31 public function show_file_size($media_id) { 32 global $wp_query; 33 34 $file_size = get_post_meta( $media_id, '_bkml_attachment_file_size', true ); 35 $is_calculate_filesize = true; 36 37 if ( empty($file_size) ) { 38 $is_calculate_filesize = false; 39 $file_size = filesize( get_attached_file( $media_id ) ); 40 } 32 41 33 42 if ( !empty( $file_size ) ) { … … 44 53 45 54 $file_size = size_format($file_size, 2); 46 return '<p><span class="bk_file_size '. esc_html( $file_size_style ) .'">'. esc_html( $file_size ) .'</span></p>'; 55 56 } 57 58 if ( $is_calculate_filesize ) { 59 return '<p class="bk_file_size_item"> 60 <span class="bk_file_size '. esc_html( $file_size_style ) .'">'. esc_html( $file_size ) .'</span> 61 </p>'; 62 } else { 63 64 $orderby = ( isset($wp_query->query['orderby']) ) ? $wp_query->query['orderby'] : ''; 65 $file_size_out = ''; 66 if ( 'bk_file_size' !== $orderby ) { 67 $file_size_out = '<span class="bk_file_size '. esc_html( $file_size_style ) .'">'. esc_html( $file_size ) .'</span>'; 68 } 69 70 return '<p class="bk_file_size_item"> 71 '. $file_size_out .' 72 <small>'. esc_html__('In order to sort or filter by size, you need to calculate', 'bbkmedialibrary') .'</small> 73 <button type="button" class="bk_btn js-calculate" data-id="'. $media_id .'"> 74 <span class="bk_txt">'. esc_html__('Calculate', 'bbkmedialibrary') .'</span> 75 <span class="bk_loader"></span> 76 </button> 77 </p>'; 47 78 } 48 79
Note: See TracChangeset
for help on using the changeset viewer.