Changeset 2966661
- Timestamp:
- 09/13/2023 05:20:03 PM (11 months ago)
- Location:
- force-regenerate-thumbnails
- Files:
-
- 10 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
force-regenerate-thumbnails/tags/2.1.3/.travis.yml
r2850735 r2966661 15 15 16 16 php: 17 - 7. 218 - 7.417 - 7. 18 - 19 19 20 20 env: … … 25 25 - phpenv config-rm xdebug.ini 26 26 - composer global config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true 27 - composer global require wp-coding-standards/wpcs dealerdirect/phpcodesniffer-composer-installerphpcompatibility/phpcompatibility-wp27 - composer global require phpcompatibility/phpcompatibility-wp 28 28 29 29 script: -
force-regenerate-thumbnails/tags/2.1.3/changelog.txt
r2884433 r2966661 1 2 3 4 1 5 = 2.1.2 = 2 6 * changed: improved i18n for page headings and menu entries, props @alexclassroom -
force-regenerate-thumbnails/tags/2.1.3/class-forceregeneratethumbnails.php
r2884433 r2966661 33 33 34 34 /** 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 35 53 * Version of the plugin. 36 54 * … … 39 57 * @since 2.1.0 40 58 */ 41 const VERSION = 21 2;59 const VERSION = 21; 42 60 43 61 /** … … 47 65 * @since 1.0 48 66 */ 49 function __construct() {67 function __construct() { 50 68 51 69 add_action( 'admin_menu', array( &$this, 'add_admin_menu' ) ); … … 66 84 * @since 1.0 67 85 */ 68 function add_admin_menu() {86 function add_admin_menu() { 69 87 $this->menu_id = add_management_page( 70 88 _x( 'Force Regenerate Thumbnails', 'Admin menu page title tag', 'force-regenerate-thumbnails' ), … … 83 101 * @since 1.0 84 102 */ 85 function admin_enqueues( $hook_suffix ) {103 function admin_enqueues( $hook_suffix ) { 86 104 87 105 if ( $hook_suffix !== $this->menu_id ) { … … 160 178 * @global array $_wp_admin_css_colors An array of available admin color/theme objects. 161 179 */ 162 function get_admin_colors() {180 function get_admin_colors() { 163 181 if ( ! empty( $this->admin_color ) && preg_match( '/^\#([0-9a-fA-F]){3,6}$/', $this->admin_color ) ) { 164 182 return; … … 219 237 * @since 1.0 220 238 */ 221 function add_media_row_action( $actions, $post ) {239 function add_media_row_action( $actions, $post ) { 222 240 if ( 'application/pdf' === $post->post_mime_type && ! extension_loaded( 'imagick' ) ) { 223 241 return $actions; … … 256 274 * @since 1.0 257 275 */ 258 function add_bulk_actions( $actions ) {276 function add_bulk_actions( $actions ) { 259 277 260 278 $delete = false; … … 284 302 * @return string The URL to go back to when we are done handling the action. 285 303 */ 286 function bulk_action_handler( $redirect_to, $doaction, $post_ids ) {304 function bulk_action_handler( $redirect_to, $doaction, $post_ids ) { 287 305 if ( empty( $doaction ) || 'bulk_force_regenerate_thumbnails' !== $doaction ) { 288 306 return $redirect_to; … … 314 332 * @since 1.0 315 333 */ 316 function force_regenerate_interface() {334 function force_regenerate_interface() { 317 335 $retry_url = wp_nonce_url( 318 336 admin_url( 'tools.php?page=force-regenerate-thumbnails' ), … … 435 453 * @throws Exception Any time we find an image we can't handle: permissions, corruption, doesn't exist, etc. 436 454 */ 437 function ajax_process_image() {455 function ajax_process_image() { 438 456 if ( empty( $_REQUEST['id'] ) ) { 439 457 $this->ob_clean(); … … 604 622 } 605 623 if ( empty( $original_path ) || ! is_file( $original_path ) ) { 624 606 625 $original_path = $image_fullpath; 607 } 608 609 $metadata = wp_generate_attachment_metadata( $image->ID, $original_path ); 626 } elseif ( preg_match( '/e\d{10,}\./', $image_fullpath ) ) { 627 $regen_path = $image_fullpath; 628 } else { 629 $regen_path = $original_path; 630 } 631 $debug_1 = $regen_path; 632 633 $metadata = wp_generate_attachment_metadata( $image->ID, $regen_path ); 610 634 if ( is_wp_error( $metadata ) ) { 611 635 throw new Exception( esc_html( $metadata->get_error_message() ) ); … … 614 638 throw new Exception( esc_html__( 'Unknown failure.', 'force-regenerate-thumbnails' ) ); 615 639 } 640 641 642 616 643 wp_update_attachment_metadata( $image->ID, $metadata ); 617 do_action( 'regenerate_thumbs_post_update', $image->ID, $ original_path );644 do_action( 'regenerate_thumbs_post_update', $image->ID, $_path ); 618 645 619 646 /** … … 748 775 * @return string The full path to the image. 749 776 */ 750 function get_attachment_path( $id, $meta ) {777 function get_attachment_path( $id, $meta ) { 751 778 752 779 // Retrieve the location of the WordPress upload folder. … … 802 829 * @return bool True if a supported stream wrapper is found, false otherwise. 803 830 */ 804 function stream_wrapper_exists() {831 function stream_wrapper_exists() { 805 832 $wrappers = stream_get_wrappers(); 806 833 if ( ! is_iterable( $wrappers ) ) { … … 824 851 * @return bool True if a stream wrapper is found, false otherwise. 825 852 */ 826 function stream_wrapped( $filename ) {853 function stream_wrapped( $filename ) { 827 854 if ( false !== strpos( $filename, '://' ) ) { 828 855 if ( strpos( $filename, 's3' ) === 0 ) { … … 843 870 * @return string The haystack with needle removed from the end. 844 871 */ 845 function remove_from_end( $haystack, $needle ) {872 function remove_from_end( $haystack, $needle ) { 846 873 $needle_length = strlen( $needle ); 847 874 if ( substr( $haystack, -$needle_length ) === $needle ) { … … 854 881 * Checks if a function is disabled or does not exist. 855 882 * 856 * @param string $function The name of a function to test.883 * @param string $function The name of a function to test. 857 884 * @param bool $debug Whether to output debugging. 858 885 * @return bool True if the function is available, False if not. 859 886 */ 860 function function_exists( $function, $debug = false ) {887 , $debug = false ) { 861 888 if ( extension_loaded( 'suhosin' ) && function_exists( 'ini_get' ) ) { 862 889 // phpcs:ignore WordPress.PHP.NoSilencedErrors … … 866 893 $suhosin_disabled = array_map( 'trim', $suhosin_disabled ); 867 894 $suhosin_disabled = array_map( 'strtolower', $suhosin_disabled ); 868 if ( function_exists( $function ) && ! in_array( $function, $suhosin_disabled, true ) ) {895 if ( function_exists( $function, $suhosin_disabled, true ) ) { 869 896 return true; 870 897 } … … 872 899 } 873 900 } 874 return \function_exists( $function );901 return \function_exists( $function ); 875 902 } 876 903 … … 878 905 * Find out if set_time_limit() is allowed. 879 906 */ 880 function stl_check() {907 function stl_check() { 881 908 if ( defined( 'FTR_DISABLE_STL' ) && FTR_DISABLE_STL ) { 882 909 // set_time_limit() disabled by user. … … 893 920 * Clear output buffers without throwing a fit. 894 921 */ 895 function ob_clean() {922 function ob_clean() { 896 923 if ( ob_get_length() ) { 897 924 ob_end_clean(); … … 907 934 * @since 1.8 908 935 */ 909 function die_json_failure_msg( $id, $message ) {936 function die_json_failure_msg( $id, $message ) { 910 937 $this->ob_clean(); 911 938 die( -
force-regenerate-thumbnails/tags/2.1.3/force-regenerate-thumbnails.php
r2884433 r2966661 10 10 Plugin Name: Force Regenerate Thumbnails 11 11 Plugin URI: https://wordpress.org/plugins/force-regenerate-thumbnails/ 12 Description: Delete and REALLY force the regenerat e thumbnail.13 Version: 2.1. 214 Requires at least: 4.915 Requires PHP: 7. 212 Description: Delete and REALLY force the regenerat. 13 Version: 2.1. 14 Requires at least: 15 Requires PHP: 7. 16 16 Author: Exactly WWW 17 17 Author URI: http://ewww.io/about/ 18 18 License: GPLv2 19 */20 21 /*22 Debug URL23 wp-admin/admin-ajax.php?action=regeneratethumbnail&id=24 19 */ 25 20 … … 67 62 } 68 63 69 require_once ( trailingslashit( __DIR__ ) . 'class-forceregeneratethumbnails.php' );64 require_once; 70 65 71 66 /** -
force-regenerate-thumbnails/tags/2.1.3/readme.txt
r2884433 r2966661 1 1 === Force Regenerate Thumbnails === 2 2 Contributors: pedro-elsner, nosilver4u 3 Requires at least: 4.94 Tested up to: 6. 25 Requires PHP: 7. 26 Stable tag: 2.1. 23 Requires at least: 4 Tested up to: 6. 5 Requires PHP: 7. 6 Stable tag: 2.1. 7 7 License: GPLv2 8 8 Tags: force, regenerate thumbnails, thumbnail, thumbnails … … 17 17 18 18 Several filters exist for advanced usage. See more via [this gist](https://gist.github.com/nosilver4u/eb858df10521aece2044a3a15ccdd17b). 19 20 19 21 20 22 == Installation == … … 32 34 33 35 == ChangeLog == 36 37 38 39 34 40 35 41 = 2.1.2 = -
force-regenerate-thumbnails/trunk/.travis.yml
r2850735 r2966661 15 15 16 16 php: 17 - 7. 218 - 7.417 - 7. 18 - 19 19 20 20 env: … … 25 25 - phpenv config-rm xdebug.ini 26 26 - composer global config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true 27 - composer global require wp-coding-standards/wpcs dealerdirect/phpcodesniffer-composer-installerphpcompatibility/phpcompatibility-wp27 - composer global require phpcompatibility/phpcompatibility-wp 28 28 29 29 script: -
force-regenerate-thumbnails/trunk/changelog.txt
r2884433 r2966661 1 2 3 4 1 5 = 2.1.2 = 2 6 * changed: improved i18n for page headings and menu entries, props @alexclassroom -
force-regenerate-thumbnails/trunk/class-forceregeneratethumbnails.php
r2884433 r2966661 33 33 34 34 /** 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 35 53 * Version of the plugin. 36 54 * … … 39 57 * @since 2.1.0 40 58 */ 41 const VERSION = 21 2;59 const VERSION = 21; 42 60 43 61 /** … … 47 65 * @since 1.0 48 66 */ 49 function __construct() {67 function __construct() { 50 68 51 69 add_action( 'admin_menu', array( &$this, 'add_admin_menu' ) ); … … 66 84 * @since 1.0 67 85 */ 68 function add_admin_menu() {86 function add_admin_menu() { 69 87 $this->menu_id = add_management_page( 70 88 _x( 'Force Regenerate Thumbnails', 'Admin menu page title tag', 'force-regenerate-thumbnails' ), … … 83 101 * @since 1.0 84 102 */ 85 function admin_enqueues( $hook_suffix ) {103 function admin_enqueues( $hook_suffix ) { 86 104 87 105 if ( $hook_suffix !== $this->menu_id ) { … … 160 178 * @global array $_wp_admin_css_colors An array of available admin color/theme objects. 161 179 */ 162 function get_admin_colors() {180 function get_admin_colors() { 163 181 if ( ! empty( $this->admin_color ) && preg_match( '/^\#([0-9a-fA-F]){3,6}$/', $this->admin_color ) ) { 164 182 return; … … 219 237 * @since 1.0 220 238 */ 221 function add_media_row_action( $actions, $post ) {239 function add_media_row_action( $actions, $post ) { 222 240 if ( 'application/pdf' === $post->post_mime_type && ! extension_loaded( 'imagick' ) ) { 223 241 return $actions; … … 256 274 * @since 1.0 257 275 */ 258 function add_bulk_actions( $actions ) {276 function add_bulk_actions( $actions ) { 259 277 260 278 $delete = false; … … 284 302 * @return string The URL to go back to when we are done handling the action. 285 303 */ 286 function bulk_action_handler( $redirect_to, $doaction, $post_ids ) {304 function bulk_action_handler( $redirect_to, $doaction, $post_ids ) { 287 305 if ( empty( $doaction ) || 'bulk_force_regenerate_thumbnails' !== $doaction ) { 288 306 return $redirect_to; … … 314 332 * @since 1.0 315 333 */ 316 function force_regenerate_interface() {334 function force_regenerate_interface() { 317 335 $retry_url = wp_nonce_url( 318 336 admin_url( 'tools.php?page=force-regenerate-thumbnails' ), … … 435 453 * @throws Exception Any time we find an image we can't handle: permissions, corruption, doesn't exist, etc. 436 454 */ 437 function ajax_process_image() {455 function ajax_process_image() { 438 456 if ( empty( $_REQUEST['id'] ) ) { 439 457 $this->ob_clean(); … … 604 622 } 605 623 if ( empty( $original_path ) || ! is_file( $original_path ) ) { 624 606 625 $original_path = $image_fullpath; 607 } 608 609 $metadata = wp_generate_attachment_metadata( $image->ID, $original_path ); 626 } elseif ( preg_match( '/e\d{10,}\./', $image_fullpath ) ) { 627 $regen_path = $image_fullpath; 628 } else { 629 $regen_path = $original_path; 630 } 631 $debug_1 = $regen_path; 632 633 $metadata = wp_generate_attachment_metadata( $image->ID, $regen_path ); 610 634 if ( is_wp_error( $metadata ) ) { 611 635 throw new Exception( esc_html( $metadata->get_error_message() ) ); … … 614 638 throw new Exception( esc_html__( 'Unknown failure.', 'force-regenerate-thumbnails' ) ); 615 639 } 640 641 642 616 643 wp_update_attachment_metadata( $image->ID, $metadata ); 617 do_action( 'regenerate_thumbs_post_update', $image->ID, $ original_path );644 do_action( 'regenerate_thumbs_post_update', $image->ID, $_path ); 618 645 619 646 /** … … 748 775 * @return string The full path to the image. 749 776 */ 750 function get_attachment_path( $id, $meta ) {777 function get_attachment_path( $id, $meta ) { 751 778 752 779 // Retrieve the location of the WordPress upload folder. … … 802 829 * @return bool True if a supported stream wrapper is found, false otherwise. 803 830 */ 804 function stream_wrapper_exists() {831 function stream_wrapper_exists() { 805 832 $wrappers = stream_get_wrappers(); 806 833 if ( ! is_iterable( $wrappers ) ) { … … 824 851 * @return bool True if a stream wrapper is found, false otherwise. 825 852 */ 826 function stream_wrapped( $filename ) {853 function stream_wrapped( $filename ) { 827 854 if ( false !== strpos( $filename, '://' ) ) { 828 855 if ( strpos( $filename, 's3' ) === 0 ) { … … 843 870 * @return string The haystack with needle removed from the end. 844 871 */ 845 function remove_from_end( $haystack, $needle ) {872 function remove_from_end( $haystack, $needle ) { 846 873 $needle_length = strlen( $needle ); 847 874 if ( substr( $haystack, -$needle_length ) === $needle ) { … … 854 881 * Checks if a function is disabled or does not exist. 855 882 * 856 * @param string $function The name of a function to test.883 * @param string $function The name of a function to test. 857 884 * @param bool $debug Whether to output debugging. 858 885 * @return bool True if the function is available, False if not. 859 886 */ 860 function function_exists( $function, $debug = false ) {887 , $debug = false ) { 861 888 if ( extension_loaded( 'suhosin' ) && function_exists( 'ini_get' ) ) { 862 889 // phpcs:ignore WordPress.PHP.NoSilencedErrors … … 866 893 $suhosin_disabled = array_map( 'trim', $suhosin_disabled ); 867 894 $suhosin_disabled = array_map( 'strtolower', $suhosin_disabled ); 868 if ( function_exists( $function ) && ! in_array( $function, $suhosin_disabled, true ) ) {895 if ( function_exists( $function, $suhosin_disabled, true ) ) { 869 896 return true; 870 897 } … … 872 899 } 873 900 } 874 return \function_exists( $function );901 return \function_exists( $function ); 875 902 } 876 903 … … 878 905 * Find out if set_time_limit() is allowed. 879 906 */ 880 function stl_check() {907 function stl_check() { 881 908 if ( defined( 'FTR_DISABLE_STL' ) && FTR_DISABLE_STL ) { 882 909 // set_time_limit() disabled by user. … … 893 920 * Clear output buffers without throwing a fit. 894 921 */ 895 function ob_clean() {922 function ob_clean() { 896 923 if ( ob_get_length() ) { 897 924 ob_end_clean(); … … 907 934 * @since 1.8 908 935 */ 909 function die_json_failure_msg( $id, $message ) {936 function die_json_failure_msg( $id, $message ) { 910 937 $this->ob_clean(); 911 938 die( -
force-regenerate-thumbnails/trunk/force-regenerate-thumbnails.php
r2884433 r2966661 10 10 Plugin Name: Force Regenerate Thumbnails 11 11 Plugin URI: https://wordpress.org/plugins/force-regenerate-thumbnails/ 12 Description: Delete and REALLY force the regenerat e thumbnail.13 Version: 2.1. 214 Requires at least: 4.915 Requires PHP: 7. 212 Description: Delete and REALLY force the regenerat. 13 Version: 2.1. 14 Requires at least: 15 Requires PHP: 7. 16 16 Author: Exactly WWW 17 17 Author URI: http://ewww.io/about/ 18 18 License: GPLv2 19 */20 21 /*22 Debug URL23 wp-admin/admin-ajax.php?action=regeneratethumbnail&id=24 19 */ 25 20 … … 67 62 } 68 63 69 require_once ( trailingslashit( __DIR__ ) . 'class-forceregeneratethumbnails.php' );64 require_once; 70 65 71 66 /** -
force-regenerate-thumbnails/trunk/readme.txt
r2884433 r2966661 1 1 === Force Regenerate Thumbnails === 2 2 Contributors: pedro-elsner, nosilver4u 3 Requires at least: 4.94 Tested up to: 6. 25 Requires PHP: 7. 26 Stable tag: 2.1. 23 Requires at least: 4 Tested up to: 6. 5 Requires PHP: 7. 6 Stable tag: 2.1. 7 7 License: GPLv2 8 8 Tags: force, regenerate thumbnails, thumbnail, thumbnails … … 17 17 18 18 Several filters exist for advanced usage. See more via [this gist](https://gist.github.com/nosilver4u/eb858df10521aece2044a3a15ccdd17b). 19 20 19 21 20 22 == Installation == … … 32 34 33 35 == ChangeLog == 36 37 38 39 34 40 35 41 = 2.1.2 =
Note: See TracChangeset
for help on using the changeset viewer.