Changeset 1638565
- Timestamp:
- 04/16/2017 02:27:44 PM (9 years ago)
- Location:
- gs-only-pdf-preview/trunk
- Files:
-
- 9 edited
-
gs-only-pdf-preview.php (modified) (25 diffs)
-
includes/class-gopp-image-editor-gs.php (modified) (9 diffs)
-
includes/debug-gopp-image-editor-gs.php (modified) (3 diffs)
-
js/gs-only-pdf-preview.js (modified) (12 diffs)
-
js/gs-only-pdf-preview.min.js (modified) (1 diff)
-
languages/gs-only-pdf-preview-fr_FR.mo (modified) (previous)
-
languages/gs-only-pdf-preview-fr_FR.po (modified) (24 diffs)
-
languages/gs-only-pdf-preview.pot (modified) (19 diffs)
-
readme.txt (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
gs-only-pdf-preview/trunk/gs-only-pdf-preview.php
r1594582 r1638565 4 4 * Plugin URI: https://github.com/gitlost/gs-only-pdf-preview 5 5 * Description: Uses Ghostscript directly to generate PDF previews. 6 * Version: 1.0. 46 * Version: 1.0.5 7 7 * Author: gitlost 8 8 * Author URI: https://profiles.wordpress.org/gitlost … … 17 17 18 18 // These need to be synced with "readme.txt". 19 define( 'GOPP_PLUGIN_VERSION', '1.0. 4' ); // Sync also "package.json" and "language/gs-only-pdf-preview.pot".19 define( 'GOPP_PLUGIN_VERSION', '1.0.5' ); // Sync also "package.json" and "language/gs-only-pdf-preview.pot". 20 20 define( 'GOPP_PLUGIN_WP_AT_LEAST_VERSION', '4.7.0' ); 21 define( 'GOPP_PLUGIN_WP_UP_TO_VERSION', '4.7. 2' );21 define( 'GOPP_PLUGIN_WP_UP_TO_VERSION', '4.7.3' ); 22 22 23 23 define( 'GOPP_REGEN_PDF_PREVIEWS_SLUG', 'gopp-regen-pdf-previews' ); … … 44 44 45 45 if ( is_admin() ) { 46 if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX) {46 if ( ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { 47 47 add_action( 'admin_init', array( __CLASS__, 'admin_init' ) ); 48 add_action( 'admin_menu', array( __CLASS__, 'admin_menu' ) );49 48 add_action( 'admin_enqueue_scripts', array( __CLASS__, 'admin_enqueue_scripts' ) ); 50 49 51 add_filter( 'bulk_actions-upload', array( __CLASS__, 'bulk_actions_upload' ) ); 52 add_filter( 'handle_bulk_actions-upload', array( __CLASS__, 'handle_bulk_actions_upload' ), 10, 3 ); 53 add_filter( 'removable_query_args', array( __CLASS__, 'removable_query_args' ) ); 54 55 add_action( 'current_screen', array( __CLASS__, 'current_screen' ) ); 56 add_action( 'media_row_actions', array( __CLASS__, 'media_row_actions' ), 100, 3 ); // Add after (most) others due to spinner. 50 if ( current_user_can( self::$cap ) ) { 51 add_action( 'admin_menu', array( __CLASS__, 'admin_menu' ) ); 52 add_filter( 'bulk_actions-upload', array( __CLASS__, 'bulk_actions_upload' ) ); 53 add_filter( 'handle_bulk_actions-upload', array( __CLASS__, 'handle_bulk_actions_upload' ), 10, 3 ); 54 add_filter( 'removable_query_args', array( __CLASS__, 'removable_query_args' ) ); 55 add_action( 'current_screen', array( __CLASS__, 'current_screen' ) ); 56 add_filter( 'media_row_actions', array( __CLASS__, 'media_row_actions' ), 100, 3 ); // Add after (most) others due to spinner. 57 } 57 58 } else { 58 59 add_filter( 'media_send_to_editor', array( __CLASS__, 'media_send_to_editor' ), 10, 3 ); 59 } 60 add_action( 'wp_ajax_gopp_media_row_action', array( __CLASS__, 'gopp_media_row_action' ) ); 61 add_action( 'wp_ajax_gopp_poll_regen_pdf_previews', array( __CLASS__, 'gopp_poll_regen_pdf_previews' ) ); 60 61 if ( current_user_can( self::$cap ) ) { 62 add_action( 'wp_ajax_gopp_media_row_action', array( __CLASS__, 'gopp_media_row_action' ) ); 63 add_action( 'wp_ajax_gopp_poll_regen_pdf_previews', array( __CLASS__, 'gopp_poll_regen_pdf_previews' ) ); 64 } 65 } 62 66 } 63 67 } … … 88 92 if ( ! function_exists( 'exec' ) ) { 89 93 deactivate_plugins( $plugin_basename ); 90 if ( in_array( 'exec', array_map( 'trim', explode( ',', strtolower( ini_get( 'disable_functions' ) ) ) ), true ) ) { 94 $ini_get = ini_get( 'disable_functions' ); 95 if ( $ini_get && in_array( 'exec', array_map( 'trim', explode( ',', strtolower( $ini_get ) ) ), true ) ) { 91 96 $msg = sprintf( 92 97 /* translators: %s: url to admin plugins page. */ … … 94 99 esc_url( self_admin_url( 'plugins.php' ) ) 95 100 ); 101 } elseif ( $suhosin_disabled_msg = self::suhosin_disabled_msg() ) { 102 $msg = $suhosin_disabled_msg; 96 103 } else { 97 104 $msg = sprintf( … … 104 111 } 105 112 106 // If the (somewhat outdated) suhosin extension is loaded, then need to check its function blacklist also, as it doesn't reflect in function_exists(). 107 // Theoretically should first check whether the function whitelist exists and whether exec() is not in it, as it overrides the blacklist, but it's unlikely to be used. 108 if ( extension_loaded( 'suhosin' ) && in_array( 'exec', array_map( 'trim', explode( ',', strtolower( ini_get( 'suhosin.executor.func.blacklist' ) ) ) ), true ) ) { 113 // Apparently if the suhosin extension is installed, disabled functions may not be reflected in function_exists(). 114 if ( $suhosin_disabled_msg = self::suhosin_disabled_msg() ) { 109 115 deactivate_plugins( $plugin_basename ); 110 $msg = sprintf( 111 /* translators: %s: url to admin plugins page. */ 112 __( 'The plugin "GS Only PDF Preview" cannot be activated as it relies on the PHP function <code>exec</code>, which has been disabled on your system via the suhosin extension directive <code>suhosin.executor.func.blacklist</code>. <a href="%s">Return to Plugins page.</a>', 'gs-only-pdf-preview' ), 113 esc_url( self_admin_url( 'plugins.php' ) ) 114 ); 115 wp_die( $msg ); 116 wp_die( $suhosin_disabled_msg ); 116 117 } 117 118 … … 128 129 129 130 global $wp_version; 130 $stripped_wp_version = substr( $wp_version, 0, strspn( $wp_version, '0123456789.' ) ); // Remove any trailing datestuff.131 $stripped_wp_version = substr( $wp_version, 0, strspn( $wp_version, '0123456789.' ) ); // Remove any trailing stuff. 131 132 if ( preg_match( '/^[0-9]+\.[0-9]+$/', $stripped_wp_version ) ) { 132 133 $stripped_wp_version .= '.0'; // Make WP version x.y.z compat. … … 161 162 GOPP_Image_Editor_GS::clear(); 162 163 163 // Check if Ghostscript available. 164 if ( ! GOPP_Image_Editor_GS::test( array() ) ) { 165 $admin_notices[] = array( 'warning', __( '<strong>Warning: no Ghostscript!</strong> The plugin "GS Only PDF Preview" cannot determine the server location of your Ghostscript executable.', 'gs-only-pdf-preview' ) ); 166 } 167 168 if ( $admin_notices ) { 169 set_transient( 'gopp_plugin_admin_notices', $admin_notices, 5 * MINUTE_IN_SECONDS ); 170 } 164 // Warn if Ghostscript not available. 165 self::warn_if_no_gs( $admin_notices ); 166 } 167 168 /** 169 * Helper to check if suhosin extension has disabled exec(). 170 */ 171 static function suhosin_disabled_msg() { 172 if ( extension_loaded( 'suhosin' ) || extension_loaded( 'suhosin7' ) ) { 173 // Whitelist overrides blacklist according to doc https://suhosin.org/stories/configuration.html#suhosin.executor.func.whitelist 174 $directive = 'suhosin.executor.func.whitelist'; 175 $ini_get = ini_get( $directive ); 176 if ( $ini_get ) { 177 // Good luck getting WP to work if you use this! 178 if ( in_array( 'exec', array_map( 'trim', explode( ',', strtolower( $ini_get ) ) ), true ) ) { 179 return false; 180 } 181 $msg = sprintf( 182 /* translators: %1$s: name of suhosin extension directive; %2$s: url to admin plugins page. */ 183 __( 'The plugin "GS Only PDF Preview" cannot be activated as it relies on the PHP function <code>exec</code>, which has been disabled on your system via the suhosin extension directive <code>%1$s</code>. <a href="%2$s">Return to Plugins page.</a>', 'gs-only-pdf-preview' ), 184 $directive, esc_url( self_admin_url( 'plugins.php' ) ) 185 ); 186 return $msg; 187 } 188 $directive = 'suhosin.executor.func.blacklist'; 189 $ini_get = ini_get( $directive ); 190 if ( $ini_get && in_array( 'exec', array_map( 'trim', explode( ',', strtolower( $ini_get ) ) ), true ) ) { 191 $msg = sprintf( 192 /* translators: %1$s: name of suhosin extension directive; %2$s: url to admin plugins page. */ 193 __( 'The plugin "GS Only PDF Preview" cannot be activated as it relies on the PHP function <code>exec</code>, which has been disabled on your system via the suhosin extension directive <code>%1$s</code>. <a href="%2$s">Return to Plugins page.</a>', 'gs-only-pdf-preview' ), 194 $directive, esc_url( self_admin_url( 'plugins.php' ) ) 195 ); 196 return $msg; 197 } 198 } 199 return false; 171 200 } 172 201 … … 180 209 } 181 210 require dirname( __FILE__ ) . '/includes/class-gopp-image-editor-gs.php'; 211 } 212 } 213 214 /** 215 * Helper to check if Ghostscript available. 216 */ 217 static function check_have_gs( $path = null ) { 218 $args = array( 'mime_type' => 'application/pdf' ); 219 if ( null !== $path ) { 220 $args['path'] = $path; 221 } 222 self::load_gopp_image_editor_gs(); 223 return GOPP_Image_Editor_GS::test( $args ); 224 } 225 226 /** 227 * Helper to add warning admin notice if Ghostscript not available. 228 */ 229 static function warn_if_no_gs( $admin_notices = array() ) { 230 if ( ! self::check_have_gs() ) { 231 $admin_notices[] = array( 'warning', __( '<strong>Warning: no Ghostscript!</strong> The plugin "GS Only PDF Preview" cannot determine the server location of your Ghostscript executable.', 'gs-only-pdf-preview' ) ); 232 } 233 if ( $admin_notices ) { 234 set_transient( 'gopp_plugin_admin_notices', $admin_notices, 5 * MINUTE_IN_SECONDS ); 182 235 } 183 236 } … … 289 342 290 343 /** 291 * Called on 'admin_menu' action .344 * Called on 'admin_menu' action for users with cap. 292 345 * Adds the "Regen. PDF Previews" administration tool. 293 346 */ … … 307 360 */ 308 361 static function load_regen_pdf_previews() { 309 if ( ! current_user_can( self::$cap ) ) { 310 wp_die( __( 'Sorry, you are not allowed to access this page.', 'gs-only-pdf-preview' ) ); 311 } 312 313 if ( ! empty( $_REQUEST[GOPP_REGEN_PDF_PREVIEWS_SLUG] ) ) { 362 if ( ! current_user_can( self::$cap ) ) { // Double-check cap. 363 wp_die( __( 'Sorry, you are not allowed to access this page.', 'gs-only-pdf-preview' ), '', array( 'response' => 403 ) ); 364 } 365 366 if ( empty( $_REQUEST[GOPP_REGEN_PDF_PREVIEWS_SLUG] ) ) { 367 // Warn if Ghostscript not available. 368 self::warn_if_no_gs(); 369 } else { 314 370 315 371 check_admin_referer( GOPP_REGEN_PDF_PREVIEWS_SLUG ); … … 334 390 */ 335 391 static function do_regen_pdf_previews( $ids, $check_mime_type = false, $do_transient = true ) { 336 static $upload_dir = null, $basedir = null;337 392 338 393 $cnt = $num_updates = $num_fails = $time = 0; … … 360 415 // Remove old intermediate thumbnails if any. 361 416 if ( $old_value && ! empty( $old_value[0]['sizes'] ) && is_array( $old_value[0]['sizes'] ) ) { 362 if ( null === $upload_dir ) {363 $upload_dir = wp_get_upload_dir();364 $basedir = $upload_dir['basedir'];365 }366 417 $dirname = dirname( $file ) . '/'; 367 418 foreach ( $old_value[0]['sizes'] as $sizeinfo ) { 368 $intermediate_file = $dirname . $sizeinfo['file']; 369 @ unlink( path_join( $basedir, $intermediate_file ) ); 419 @ unlink( $dirname . $sizeinfo['file'] ); 370 420 } 371 421 } … … 412 462 */ 413 463 static function regen_pdf_previews() { 414 if ( ! current_user_can( self::$cap ) ) { 415 wp_die( __( 'Sorry, you are not allowed to access this page.', 'gs-only-pdf-preview' ) ); 416 } 464 if ( ! current_user_can( self::$cap ) ) { // Double-check cap. 465 wp_die( __( 'Sorry, you are not allowed to access this page.', 'gs-only-pdf-preview' ), '', array( 'response' => 403 ) ); 466 } 467 417 468 global $wpdb; 418 469 $cnt = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = %s AND post_mime_type = %s", 'attachment', 'application/pdf' ) ); … … 468 519 ?> 469 520 </p> 470 <?php if ( defined( 'GOPP_PLUGIN_DEBUG' ) && GOPP_PLUGIN_DEBUG) : ?>521 <?php if ( ( defined( 'GOPP_PLUGIN_DEBUG' ) && GOPP_PLUGIN_DEBUG ) || ! self::check_have_gs() ) : ?> 471 522 <?php require_once dirname( __FILE__ ) . '/includes/debug-gopp-image-editor-gs.php'; ?> 472 523 <?php DEBUG_GOPP_Image_Editor_GS::dump(); ?> … … 501 552 'is_upload' => $is_upload, 502 553 'is_post' => $is_post, 554 'current_user_can_cap' => current_user_can( self::$cap ), 503 555 ), 504 556 ); … … 537 589 538 590 /** 539 * Called on 'bulk_actions-upload' filter .591 * Called on 'bulk_actions-upload' filter for users with cap. 540 592 * Adds "Regenerate PDF Previews" to the bulk action dropdown in the list mode of the Media Library. 541 593 */ 542 594 static function bulk_actions_upload( $actions ) { 543 if ( current_user_can( self::$cap) ) {595 if ( self::check_have_gs() ) { 544 596 $actions['gopp_regen_pdf_previews'] = __( 'Regenerate PDF Previews', 'gs-only-pdf-preview' ); 545 597 } … … 548 600 549 601 /** 550 * Called on 'handle_bulk_actions-upload' filter .602 * Called on 'handle_bulk_actions-upload' filter for users with cap. 551 603 * Does the work of the "Regenerate PDF Previews" bulk action. 552 604 */ 553 605 static function handle_bulk_actions_upload( $location, $doaction, $post_ids ) { 554 606 555 if ( 'gopp_regen_pdf_previews' === $doaction && current_user_can( self::$cap ) ) { 607 if ( 'gopp_regen_pdf_previews' === $doaction && current_user_can( self::$cap ) ) { // Double-check cap. 556 608 // Note nonce has already been checked in "wp-admin/upload.php". 557 609 // But $post_ids hasn't (and triggers a PHP Warning if nothing selected in "wp-admin/upload.php:168" as of WP 4.7.2). … … 566 618 567 619 /** 568 * Called on 'removable_query_args' filter .620 * Called on 'removable_query_args' filter for users with cap. 569 621 * Signals that our query arg should be removed from the URL. 570 622 */ … … 575 627 576 628 /** 577 * Called on 'current_screen' action .629 * Called on 'current_screen' action for users with cap. 578 630 * Removes our query arg from the URL. 579 631 */ … … 585 637 586 638 /** 587 * Called on 'media_row_actions' filter .639 * Called on 'media_row_actions' filter for users with cap. 588 640 * Adds the "Regenerate Preview" link to PDF rows in the list mode of the Media Library. 589 641 */ 590 642 static function media_row_actions( $actions, $post, $detached ) { 591 if ( 'application/pdf' === $post->post_mime_type && current_user_can( self::$cap ) ) { 592 self::load_gopp_image_editor_gs(); 593 if ( GOPP_Image_Editor_GS::test( array( 'path' => get_attached_file( $post->ID ) ) ) ) { 594 $actions['gopp_regen_pdf_preview'] = sprintf( 595 '<a href="#the-list" onclick="return gopp_plugin.media_row_action( event, %d, %s );" class="hide-if-no-js aria-button-if-js" aria-label="%s">%s</a>' . self::spinner( -3 ), 596 $post->ID, 597 esc_attr( json_encode( wp_create_nonce( 'gopp_media_row_action_' . $post->ID ) ) ), 598 /* translators: %s: attachment title */ 599 esc_attr( sprintf( __( 'Regenerate the PDF preview for “%s”', 'gs-only-pdf-preview' ), _draft_or_post_title() ) ), 600 esc_attr( __( 'Regenerate Preview', 'gs-only-pdf-preview' ) ) 601 ); 602 } 643 if ( 'application/pdf' === $post->post_mime_type && self::check_have_gs( get_attached_file( $post->ID ) ) ) { 644 $actions['gopp_regen_pdf_preview'] = sprintf( 645 '<a href="#the-list" onclick="return gopp_plugin.media_row_action( event, %d, %s );" class="hide-if-no-js aria-button-if-js" aria-label="%s">%s</a>' . self::spinner( -3 ), 646 $post->ID, 647 esc_attr( json_encode( wp_create_nonce( 'gopp_media_row_action_' . $post->ID ) ) ), 648 /* translators: %s: attachment title */ 649 esc_attr( sprintf( __( 'Regenerate the PDF preview for “%s”', 'gs-only-pdf-preview' ), _draft_or_post_title() ) ), 650 esc_attr( __( 'Regenerate Preview', 'gs-only-pdf-preview' ) ) 651 ); 603 652 } 604 653 return $actions; … … 612 661 $ret = array( 'msg' => '', 'error' => false, 'img' => '' ); 613 662 614 if ( ! current_user_can( self::$cap ) ) { 663 if ( ! current_user_can( self::$cap ) ) { // Double-check cap. 615 664 $ret['error'] = __( 'Sorry, you are not allowed to access this page.', 'gs-only-pdf-preview' ); 616 665 } else { … … 653 702 $ret = array( 'msg' => '' ); 654 703 655 if ( current_user_can( self::$cap ) ) { 704 if ( current_user_can( self::$cap ) ) { // Double-check cap. 656 705 $cnt = isset( $_REQUEST['cnt'] ) && is_string( $_REQUEST['cnt'] ) ? intval( $_REQUEST['cnt'] ) : 0; 657 706 … … 676 725 /** 677 726 * Called on 'media_send_to_editor' filter. 727 * Patch to allow PDF thumbnail insertion (see #39618). 678 728 */ 679 729 static function media_send_to_editor( $html, $id, $attachment ) { … … 687 737 $align = isset( $attachment['align'] ) ? $attachment['align'] : 'none'; 688 738 $size = $attachment['image-size']; 689 $alt = isset( $attachment['image_alt'] ) ? $attachment['image_alt'] : ''; 739 // Not sure what sets 'image_alt' - may be legacy stuff. 740 $alt = isset( $attachment['image_alt'] ) ? $attachment['image_alt'] : ( isset( $attachment['alt'] ) ? $attachment['alt'] : '' ); 690 741 691 742 // No whitespace-only captions. -
gs-only-pdf-preview/trunk/includes/class-gopp-image-editor-gs.php
r1594582 r1638565 78 78 */ 79 79 public static function test( $args = array() ) { 80 // Ensure given 'mime_type' arg, as if not _wp_image_editor_choose() won't call supports_mime_type() subsequently 81 // and will return this as a supporting implementation, which is probably not what callers expect. 82 if ( ! isset( $args['mime_type'] ) ) { 83 return false; 84 } 85 80 86 // Check that exec() is (probably) available and we're not in safe_mode. 81 87 if ( ! function_exists( 'exec' ) || ini_get( 'safe_mode' ) ) { … … 128 134 */ 129 135 public function load() { 130 $result = self::gs_valid( $this->file ); 131 if ( true !== $result ) { 136 if ( true !== ( $result = self::gs_valid( $this->file ) ) ) { 132 137 return new WP_Error( 'invalid_image', $result, $this->file ); 133 138 } … … 137 142 138 143 // Allow chance for gopp_editor_set_resolution filter to fire by calling set_resolution() with null arg (mimicking set_quality() behavior). 139 $this->set_resolution(); 144 if ( is_wp_error( $result = $this->set_resolution() ) ) { 145 return $result; 146 } 140 147 141 148 // Similarly for page to render. 142 $this->set_page(); 149 if ( is_wp_error( $result = $this->set_page() ) ) { 150 return $result; 151 } 143 152 144 153 return $this->set_quality(); … … 166 175 } 167 176 168 // Make sure not to overwrite existing JPEG with same name. 177 // Make sure not to overwrite existing JPEG with same name. Redundant now for WP 4.7.3+ after #39875, but keep for BC. 169 178 $filename = $dirname . '/' . wp_unique_filename( $dirname, wp_basename( $filename ) ); 170 179 … … 179 188 } 180 189 181 // As this editor is immediately thrown away just do dummy size. Saves some cycles. 182 $size = array( 1088, 1408 ); // US Letter size at 128 DPI. Makes it pass the unit test Tests_Image_Functions::test_wp_generate_attachment_metadata_pdf(). 183 //$size = @ getimagesize( $filename ); 190 $size = @ getimagesize( $filename ); 184 191 if ( ! $size ) { 185 return new WP_Error( 'image_save_error', __( 'Could not read image size.', 'gs-only-pdf-preview' ) ); // @codeCoverageIgnore192 return new WP_Error( 'image_save_error', __( 'Could not read image size.', 'gs-only-pdf-preview' ) ); 186 193 } 187 194 … … 382 389 if ( self::test_gs_cmd( $possible_path ) ) { 383 390 $best_match = $possible_path; 391 $highest_ver = $ver; 384 392 } 385 393 } … … 396 404 if ( ! $win_path ) { 397 405 // Try GSC environment variable. TODO: Is this still used? 398 $gsc = getenv( 'GSC' ); 399 if ( $gsc && is_string( $gsc ) && self::test_gs_cmd( $gsc ) ) { 400 $win_path = $gsc; 406 if ( ! empty( $_SERVER['GSC'] ) && is_string( $_SERVER['GSC'] ) && self::test_gs_cmd( $_SERVER['GSC'] ) ) { 407 $win_path = $_SERVER['GSC']; 401 408 } 402 409 } … … 431 438 if ( @ is_executable( $gs_entry . '\\bin\\gswin64c.exe' ) && self::test_gs_cmd( $gs_entry . '\\bin\\gswin64c.exe' ) ) { 432 439 $best_match = $gs_entry . '\\bin\\gswin64c.exe'; 440 $highest_ver = $ver; 433 441 } elseif ( @ is_executable( $gs_entry . '\\bin\\gswin32c.exe' ) && self::test_gs_cmd( $gs_entry . '\\bin\\gswin32c.exe' ) ) { 434 442 $best_match = $gs_entry . '\\bin\\gswin32c.exe'; 443 $highest_ver = $ver; 435 444 } 436 445 } … … 787 796 return new WP_Error( 'image_stream_error', __( 'Unsupported operation.', 'gs-only-pdf-preview' ) ); 788 797 } 798 799 /** 800 * Gets dimensions of image. 801 * 802 * @since 3.5.0 803 * @access public 804 * 805 * @return array {'width'=>int, 'height'=>int} 806 */ 807 public function get_size() { 808 // If size hasn't been set yet and have loaded. 809 if ( null === $this->size && $this->mime_type ) { 810 $this->update_size( 0, 0 ); 811 // Do a temporary full preview to get size of image. 812 $dirname = untrailingslashit( get_temp_dir() ); 813 $filename = $dirname . '/' . wp_unique_filename( $dirname, 'gopp_size.jpg' ); 814 if ( $cmd = self::gs_cmd( $this->get_gs_args( $filename ) ) ) { 815 exec( $cmd, $output, $return_var ); 816 if ( 0 === $return_var && ( $size = @ getimagesize( $filename ) ) ) { 817 $this->update_size( $size[0], $size[1] ); 818 } 819 @ unlink( $filename ); 820 } 821 } 822 return $this->size; 823 } 789 824 } -
gs-only-pdf-preview/trunk/includes/debug-gopp-image-editor-gs.php
r1578349 r1638565 9 9 class DEBUG_GOPP_Image_Editor_GS extends GOPP_Image_Editor_GS { 10 10 static function get_test_output() { 11 $cmd = self::gs_cmd( '-dBATCH -dNOPAUSE -dNOPROMPT -dSAFER -v' ); 12 exec( $cmd, $output, $return_var ); 13 return array( $return_var, $output ); 11 if ( $cmd = self::gs_cmd( '-dBATCH -dNOPAUSE -dNOPROMPT -dSAFER -v' ) ) { 12 exec( $cmd, $output, $return_var ); 13 return array( $return_var, $output ); 14 } 15 return array( -1, array( __( 'Ghostscript command not found!', 'gs-only-pdf-preview' ) ) ); 14 16 } 15 17 … … 23 25 24 26 static function dump() { 27 $args = array( 'mime_type' => 'application/pdf' ); 25 28 list( $return_var, $output ) = self::get_test_output(); 26 29 ?> … … 31 34 <tr><td valign="top">Output</td><td><strong><?php echo implode( '<br />', $output ); ?></strong></td></tr> 32 35 <tr><td>gs_cmd_path</td><td><strong><?php echo self::gs_cmd_path(); ?></strong> </td></tr> 33 <tr><td>test</td><td><strong><?php echo self::test( ) ? 'true' : 'false'; ?></strong> </td></tr>36 <tr><td>test</td><td><strong><?php echo self::test( $args ) ? 'true' : 'false'; ?></strong> </td></tr> 34 37 <tr><td>is_win</td><td><strong><?php echo self::is_win() ? 'true' : 'false'; ?></strong> </td></tr> 35 38 <tr><td>Transient <em>gopp_image_gs_cmd_path</em></td><td><strong><?php echo self::transient_gopp_image_gs_cmd_path(); ?></strong> </td></tr> -
gs-only-pdf-preview/trunk/js/gs-only-pdf-preview.js
r1594582 r1638565 58 58 * Regenerate Preview row action. 59 59 */ 60 gopp_plugin.media_row_action = function ( e, id, nonce ) {61 var $target = $( e.target ), $row_action_div = $target.parents( '.row-actions' ).first(), $ spinner = $target.next();62 $( '.gopp_response', $row_action_ div.parent()).remove();60 gopp_plugin.media_row_action = function ( e, id, nonce, test ) { 61 var $target = $( e.target ), $row_action_div = $target.parents( '.row-actions' ).first(), $row_action_parent = $row_action_div.parent(), $spinner = $target.next(), post_ret; 62 $( '.gopp_response', $row_action_parent ).remove(); 63 63 $spinner.addClass( 'is-active' ); 64 $.post( {64 post_ret = $.post( { 65 65 url: ajaxurl, 66 66 data: { … … 78 78 success: function( data ) { 79 79 $spinner.removeClass( 'is-active' ); 80 $( '.gopp_response', $row_action_ div.parent()).remove();80 $( '.gopp_response', $row_action_parent ).remove(); 81 81 if ( data ) { 82 82 if ( data.error ) { … … 86 86 } 87 87 if ( data.img ) { 88 $( '.has-media-icon .media-icon', $row_action_ div.parent()).html( data.img );88 $( '.has-media-icon .media-icon', $row_action_parent ).html( data.img ); 89 89 } 90 90 } else { … … 95 95 } ); 96 96 97 post_ret.fail( function () { 98 $spinner.removeClass( 'is-active' ); 99 } ); 100 101 if ( test ) { 102 test.post_ret = post_ret; 103 } 97 104 return false; 98 105 }; … … 104 111 $( '#doaction, #doaction2' ).click( function ( e ) { 105 112 $( 'select[name^="action"]' ).each( function () { 106 var $target, checkeds;113 var $target, $parent, checkeds; 107 114 if ( 'gopp_regen_pdf_previews' === $( this ).val() ) { 108 115 $target = $( e.target ); 116 $parent = $target.parent(); 117 $( '.gopp_none', $parent ).remove(); 118 $( '.spinner', $parent ).remove(); 109 119 // See if anything selected. 110 120 checkeds = $.makeArray( $( '#the-list input[name="media[]"]:checked' ).map( function () { … … 113 123 if ( ! checkeds.length ) { 114 124 e.preventDefault(); 115 $( '.gopp_none', $target.parent() ).remove();116 125 $( gopp_plugin_params.no_items_selected_msg ).insertAfter( $target ).fadeOut( 1000, function() { $( this ).remove(); } ); 117 126 } else { 118 $( '.spinner', $target.parent() ).remove();119 127 $( gopp_plugin_params.spinner ).insertAfter( $target ); // Like above, as in submit, doesn't work for Safari. 120 128 } … … 125 133 126 134 /** 135 * Patches Attachment Details template. 136 */ 137 gopp_plugin.upload_patch = function () { 138 var $tmpl_attachment_details_two_column, html_before, 139 html_attachment_details_two_column, 140 attachment_details_two_column_re = /(<# if \( 'image' === data.type)( \) { #>\s+<label class="setting" data-setting="alt">)/, 141 attachment_details_two_column_with = '$1 || data.sizes$2'; 142 143 $tmpl_attachment_details_two_column = $( '#tmpl-attachment-details-two-column' ); 144 if ( $tmpl_attachment_details_two_column.length ) { 145 146 // Enable "Alt Text" in Attachment Details Two Column. 147 html_before = $tmpl_attachment_details_two_column.html(); 148 html_attachment_details_two_column = html_before.replace( attachment_details_two_column_re, attachment_details_two_column_with ); 149 if ( html_before === html_attachment_details_two_column ) { 150 return false; 151 } 152 153 $tmpl_attachment_details_two_column.html( html_attachment_details_two_column ); 154 155 return true; 156 } 157 return false; 158 }; 159 160 /** 127 161 * Patches templates and wp.media.editor.send.attachment to allow PDF thumbnail insertion (see #39618). 128 * Also addresses #39630 by using either thumbnail or medium sized thumbnails in Media Library, favouring thumbnail size. 129 */ 130 gopp_plugin.post = function () { 162 */ 163 gopp_plugin.post_patch = function () { 131 164 var $tmpl_attachment_details, $tmpl_attachment_display_settings, $tmpl_image_details, html_before, 132 165 html_attachment_details, 133 166 attachment_details_re = /(<# } else if \( 'image' === data\.type && data\.sizes \) { #>\s+<img src="{{ data\.size\.url }}" draggable="false" alt="" \/>)(\s+<# } else { #>)/, 134 attachment_details_with = '$1\n<# } else if ( data.sizes && data.sizes.thumbnail ) { #>\n<img src="{{ data.sizes.thumbnail.url }}" draggable="false" alt="" />\n$2', 167 attachment_details_with = '$1\n<# } else if ( data.sizes && ( data.sizes.thumbnail || data.sizes.full ) ) { #>\n<img src="{{ ( data.sizes.thumbnail || data.sizes.full ).url }}" draggable="false" alt="" />\n$2', 168 attachment_details2_re = /(<# if \( 'image' === data.type)( \) { #>\s+<label class="setting" data-setting="alt")/, 169 attachment_details2_with = '$1 || ( \'application\' === data.type && data.sizes )$2', 135 170 html_attachment_display_settings, 136 171 attachment_display_settings_re = /(<# if \( 'image' === data.type)( \) { #>\s+<label class="setting">)/, … … 157 192 } 158 193 194 // Enables "Alt Text" input in Attachment Details. 195 html_before = html_attachment_details; 196 html_attachment_details = html_before.replace( attachment_details2_re, attachment_details2_with ); 197 if ( html_before === html_attachment_details ) { 198 return false; 199 } 200 159 201 // #39618 Enables "Align" select of Attachment Display Settings. 160 202 html_before = $tmpl_attachment_display_settings.html(); … … 174 216 html_image_details = html_before.replace( image_details_re, image_details_with ); 175 217 if ( html_before === html_image_details ) { 176 return false;177 }178 179 // #39630 Use either thumbnail or medium sized thumbnails in Media Library.180 if ( false === gopp_plugin.patch_39630() ) {181 218 return false; 182 219 } … … 244 281 options.post_title = props.title; 245 282 // gitlost begin. 246 if ( 'application' === attachment.type && 'pdf' === attachment.subtype ) { 283 if ( attachment.sizes ) { 284 // Not picked into props for non-images in wp.media.string.props(). 285 if ( attachment.alt ) { 286 options.alt = attachment.alt; 287 } 247 288 _.each({ 248 289 align: 'align', 249 size: 'image-size' 290 size: 'image-size', 291 alt: 'image_alt' 250 292 }, function( option, prop ) { 251 293 if ( props[ prop ] ) … … 265 307 266 308 /** 267 * Patches 'tmpl-attachmentin "wp-includes/media-templates.php" to use either thumbnail or medium sized thumbnails in Media Library, favouring thumbnail size.309 * Addresses #39630 by patching 'tmpl-attachment' in "wp-includes/media-templates.php" to use either thumbnail or medium sized thumbnails in Media Library, favouring thumbnail size. 268 310 */ 269 311 gopp_plugin.patch_39630 = function () { 270 312 var $tmpl_attachment = $( '#tmpl-attachment' ), html_before, html_attachment, 271 313 attachment_re = /(<# } else if \( data\.sizes && )data\.sizes\.medium( \) { #>\s+<img src="{{ )data\.sizes\.medium(\.url }}" class="thumbnail" draggable="false" alt="" \/>\s+<# } else { #>)/, 272 attachment_with = '$1( data.sizes.thumbnail || data.sizes.medium )$2( data.sizes.thumbnail || data.sizes.medium)$3';314 attachment_with = '$1( data.sizes.thumbnail || data.sizes.medium || data.sizes.full )$2( data.sizes.thumbnail || data.sizes.medium || data.sizes.full )$3'; 273 315 274 316 if ( $tmpl_attachment.length ) { … … 290 332 if ( gopp_plugin_params && gopp_plugin_params.val ) { 291 333 if ( gopp_plugin_params.val.is_regen_pdf_preview ) { 292 gopp_plugin.regen_pdf_preview(); 334 if ( gopp_plugin_params.val.current_user_can_cap ) { 335 gopp_plugin.regen_pdf_preview(); 336 } 293 337 } else if ( gopp_plugin_params.val.is_upload ) { 294 gopp_plugin.upload(); 338 if ( gopp_plugin_params.val.current_user_can_cap ) { 339 gopp_plugin.upload(); 340 } 341 // Always try the patches. 342 gopp_plugin.upload_patch(); 295 343 gopp_plugin.patch_39630(); 296 344 } else if ( gopp_plugin_params.val.is_post ) { 297 gopp_plugin.post(); 345 // Always try the patches. 346 gopp_plugin.post_patch(); 347 gopp_plugin.patch_39630(); 298 348 } 299 349 } -
gs-only-pdf-preview/trunk/js/gs-only-pdf-preview.min.js
r1594582 r1638565 1 /*! gs-only-pdf-preview 1.0. 4 2017-02-13*/2 var gopp_plugin=gopp_plugin||{};!function(a){"use strict";gopp_plugin.regen_pdf_preview=function(){var b=a("#gopp_regen_pdf_previews"),c=a(".gopp_regen_pdf_previews_form",b);b.length&&a('input[type="submit"]',c).click(function(d){var e,f,g=a(this),h=a(".notice, .updated",b),i=a(gopp_plugin_params.please_wait_msg),j=parseInt(a("#poll_cnt",c).val(),10),k=a("#poll_nonce",c).val();g.hide(),a(".gopp_regen_pdf_previews_form_hide",b).hide(),h.hide(),a("h1",b).first().after(i),e=a("#gopp_progress",b),f=function(){a.post(ajaxurl,{action:"gopp_poll_regen_pdf_previews",cnt:j,poll_nonce:k},function(a){a&&a.msg&&e.html(a.msg),setTimeout(f,1e3*gopp_plugin_params.val.poll_interval)},"json")},a.browser&&a.browser.safari?(d.preventDefault(),a(".spinner",i).removeClass("is-active"),g.unbind("click"),setTimeout(function(){g.click()},0)):setTimeout(f,1e3*gopp_plugin_params.val.poll_interval)})},gopp_plugin.media_row_action=function(b,c,d ){var e=a(b.target),f=e.parents(".row-actions").first(),g=e.next();return a(".gopp_response",f.parent()).remove(),g.addClass("is-active"),a.post({url:ajaxurl,data:{action:"gopp_media_row_action",id:c,nonce:d},dataType:"json",error:function(b,c,d){var e;g.removeClass("is-active"),e='<div class="notice error gopp_response"><p>'+gopp_plugin_params.action_not_available+" ("+d+")</p></div>",f.after(a(e))},success:function(b){g.removeClass("is-active"),a(".gopp_response",f.parent()).remove(),b?(b.error?f.after(a('<div class="notice error gopp_response"><p>'+b.error+"</p></div>")):b.msg&&f.after(a('<div class="notice updated gopp_response"><p>'+b.msg+"</p></div>")),b.img&&a(".has-media-icon .media-icon",f.parent()).html(b.img)):f.after(a('<div class="notice error gopp_response"><p>'+gopp_plugin_params.action_not_available+"</p></div>"))},timeout:1e3*gopp_plugin_params.val.min_time_limit}),!1},gopp_plugin.upload=function(){a("#doaction, #doaction2").click(function(b){a('select[name^="action"]').each(function(){var c,d;"gopp_regen_pdf_previews"===a(this).val()&&(c=a(b.target),d=a.makeArray(a('#the-list input[name="media[]"]:checked').map(function(){return this.value})),d.length?(a(".spinner",c.parent()).remove(),a(gopp_plugin_params.spinner).insertAfter(c)):(b.preventDefault(),a(".gopp_none",c.parent()).remove(),a(gopp_plugin_params.no_items_selected_msg).insertAfter(c).fadeOut(1e3,function(){a(this).remove()})))})})},gopp_plugin.post=function(){var b,c,d,e,f,g,h,i=/(<# } else if \( 'image' === data\.type && data\.sizes \) { #>\s+<img src="{{ data\.size\.url }}" draggable="false" alt="" \/>)(\s+<# } else { #>)/,j='$1\n<# } else if ( data.sizes && data.sizes.thumbnail ) { #>\n<img src="{{ data.sizes.thumbnail.url }}" draggable="false" alt="" />\n$2',k=/(<# if \( 'image' === data.type)( \) { #>\s+<label class="setting">)/,l="$1 || ( 'application' === data.type && data.sizes )$2",m=/(<# if \( data\.userSettings \) { #>\s+data-user-setting="imgsize"\s+<# } #>>)(\s+<#)/,n="$1\n<# if ( 'application' === data.type ) { #>\n<option value=\"\">\n"+gopp_plugin_params.document_link_only+"\n</option>\n<# } #>\n$2",o=/(<# if \( data\.attachment && window\.imageEdit)( \) { #>)/,p="$1 && 'image' === data.type $2";return wp.media&&wp.media.editor&&wp.media.editor.send&&"function"==typeof wp.media.editor.send.attachment&&(b=a("#tmpl-attachment-details"),c=a("#tmpl-attachment-display-settings"),d=a("#tmpl-image-details"),b.length&&c.length&&d.length)?(e=b.html(),f=e.replace(i,j),e===f?!1:(e=c.html(),g=e.replace(k,l),e===g?!1:(e=g,g=e.replace(m,n),e===g?!1:(e=d.html(),h=e.replace(o,p),e===h?!1:!1===gopp_plugin.patch_39630()?!1:(b.html(f),c.html(g),d.html(h),wp.media.editor.send.attachment=gopp_plugin.media_editor_send_attachment,!0))))):!1},gopp_plugin.media_editor_send_attachment=function(a,b){var c,d,e=b.caption;return wp.media.view.settings.captions||delete b.caption,a=wp.media.string.props(a,b),c={id:b.id,post_content:b.description,post_excerpt:e},a.linkUrl&&(c.url=a.linkUrl),a.link&&(c.link_to=a.link),"image"===b.type?(d=wp.media.string.image(a),_.each({align:"align",size:"image-size",alt:"image_alt"},function(b,d){a[d]&&(c[b]=a[d])})):"video"===b.type?d=wp.media.string.video(a,b):"audio"===b.type?d=wp.media.string.audio(a,b):(d=wp.media.string.link(a),c.post_title=a.title,"application"===b.type&&"pdf"===b.subtype&&_.each({align:"align",size:"image-size"},function(b,d){a[d]&&(c[b]=a[d])})),wp.media.post("send-attachment-to-editor",{nonce:wp.media.view.settings.nonce.sendToEditor,attachment:c,html:d,post_id:wp.media.view.settings.post.id})},gopp_plugin.patch_39630=function(){var b,c,d=a("#tmpl-attachment"),e=/(<# } else if \( data\.sizes && )data\.sizes\.medium( \) { #>\s+<img src="{{ )data\.sizes\.medium(\.url }}" class="thumbnail" draggable="false" alt="" \/>\s+<# } else { #>)/,f="$1( data.sizes.thumbnail || data.sizes.medium )$2( data.sizes.thumbnail || data.sizes.medium )$3";return d.length?(b=d.html(),c=b.replace(e,f),b===c?!1:(d.html(c),!0)):!1},a(function(){gopp_plugin_params&&gopp_plugin_params.val&&(gopp_plugin_params.val.is_regen_pdf_preview?gopp_plugin.regen_pdf_preview():gopp_plugin_params.val.is_upload?(gopp_plugin.upload(),gopp_plugin.patch_39630()):gopp_plugin_params.val.is_post&&gopp_plugin.post())})}(jQuery);1 /*! gs-only-pdf-preview 1.0.5 2017-04-16 */ 2 var gopp_plugin=gopp_plugin||{};!function(a){"use strict";gopp_plugin.regen_pdf_preview=function(){var b=a("#gopp_regen_pdf_previews"),c=a(".gopp_regen_pdf_previews_form",b);b.length&&a('input[type="submit"]',c).click(function(d){var e,f,g=a(this),h=a(".notice, .updated",b),i=a(gopp_plugin_params.please_wait_msg),j=parseInt(a("#poll_cnt",c).val(),10),k=a("#poll_nonce",c).val();g.hide(),a(".gopp_regen_pdf_previews_form_hide",b).hide(),h.hide(),a("h1",b).first().after(i),e=a("#gopp_progress",b),f=function(){a.post(ajaxurl,{action:"gopp_poll_regen_pdf_previews",cnt:j,poll_nonce:k},function(a){a&&a.msg&&e.html(a.msg),setTimeout(f,1e3*gopp_plugin_params.val.poll_interval)},"json")},a.browser&&a.browser.safari?(d.preventDefault(),a(".spinner",i).removeClass("is-active"),g.unbind("click"),setTimeout(function(){g.click()},0)):setTimeout(f,1e3*gopp_plugin_params.val.poll_interval)})},gopp_plugin.media_row_action=function(b,c,d,e){var f,g=a(b.target),h=g.parents(".row-actions").first(),i=h.parent(),j=g.next();return a(".gopp_response",i).remove(),j.addClass("is-active"),f=a.post({url:ajaxurl,data:{action:"gopp_media_row_action",id:c,nonce:d},dataType:"json",error:function(b,c,d){var e;j.removeClass("is-active"),e='<div class="notice error gopp_response"><p>'+gopp_plugin_params.action_not_available+" ("+d+")</p></div>",h.after(a(e))},success:function(b){j.removeClass("is-active"),a(".gopp_response",i).remove(),b?(b.error?h.after(a('<div class="notice error gopp_response"><p>'+b.error+"</p></div>")):b.msg&&h.after(a('<div class="notice updated gopp_response"><p>'+b.msg+"</p></div>")),b.img&&a(".has-media-icon .media-icon",i).html(b.img)):h.after(a('<div class="notice error gopp_response"><p>'+gopp_plugin_params.action_not_available+"</p></div>"))},timeout:1e3*gopp_plugin_params.val.min_time_limit}),f.fail(function(){j.removeClass("is-active")}),e&&(e.post_ret=f),!1},gopp_plugin.upload=function(){a("#doaction, #doaction2").click(function(b){a('select[name^="action"]').each(function(){var c,d,e;"gopp_regen_pdf_previews"===a(this).val()&&(c=a(b.target),d=c.parent(),a(".gopp_none",d).remove(),a(".spinner",d).remove(),e=a.makeArray(a('#the-list input[name="media[]"]:checked').map(function(){return this.value})),e.length?a(gopp_plugin_params.spinner).insertAfter(c):(b.preventDefault(),a(gopp_plugin_params.no_items_selected_msg).insertAfter(c).fadeOut(1e3,function(){a(this).remove()})))})})},gopp_plugin.upload_patch=function(){var b,c,d;return b=a("#tmpl-attachment-details-two-column"),!!b.length&&(c=b.html(),d=c.replace(/(<# if \( 'image' === data.type)( \) { #>\s+<label class="setting" data-setting="alt">)/,"$1 || data.sizes$2"),c!==d&&(b.html(d),!0))},gopp_plugin.post_patch=function(){var b,c,d,e,f,g,h,i="$1\n<# if ( 'application' === data.type ) { #>\n<option value=\"\">\n"+gopp_plugin_params.document_link_only+"\n</option>\n<# } #>\n$2";return!!(wp.media&&wp.media.editor&&wp.media.editor.send&&"function"==typeof wp.media.editor.send.attachment&&(b=a("#tmpl-attachment-details"),c=a("#tmpl-attachment-display-settings"),d=a("#tmpl-image-details"),b.length&&c.length&&d.length))&&(e=b.html(),f=e.replace(/(<# } else if \( 'image' === data\.type && data\.sizes \) { #>\s+<img src="{{ data\.size\.url }}" draggable="false" alt="" \/>)(\s+<# } else { #>)/,'$1\n<# } else if ( data.sizes && ( data.sizes.thumbnail || data.sizes.full ) ) { #>\n<img src="{{ ( data.sizes.thumbnail || data.sizes.full ).url }}" draggable="false" alt="" />\n$2'),e!==f&&(e=f,f=e.replace(/(<# if \( 'image' === data.type)( \) { #>\s+<label class="setting" data-setting="alt")/,"$1 || ( 'application' === data.type && data.sizes )$2"),e!==f&&(e=c.html(),g=e.replace(/(<# if \( 'image' === data.type)( \) { #>\s+<label class="setting">)/,"$1 || ( 'application' === data.type && data.sizes )$2"),e!==g&&(e=g,g=e.replace(/(<# if \( data\.userSettings \) { #>\s+data-user-setting="imgsize"\s+<# } #>>)(\s+<#)/,i),e!==g&&(e=d.html(),h=e.replace(/(<# if \( data\.attachment && window\.imageEdit)( \) { #>)/,"$1 && 'image' === data.type $2"),e!==h&&(b.html(f),c.html(g),d.html(h),wp.media.editor.send.attachment=gopp_plugin.media_editor_send_attachment,!0))))))},gopp_plugin.media_editor_send_attachment=function(a,b){var c,d,e=b.caption;return wp.media.view.settings.captions||delete b.caption,a=wp.media.string.props(a,b),c={id:b.id,post_content:b.description,post_excerpt:e},a.linkUrl&&(c.url=a.linkUrl),a.link&&(c.link_to=a.link),"image"===b.type?(d=wp.media.string.image(a),_.each({align:"align",size:"image-size",alt:"image_alt"},function(b,d){a[d]&&(c[b]=a[d])})):"video"===b.type?d=wp.media.string.video(a,b):"audio"===b.type?d=wp.media.string.audio(a,b):(d=wp.media.string.link(a),c.post_title=a.title,b.sizes&&(b.alt&&(c.alt=b.alt),_.each({align:"align",size:"image-size",alt:"image_alt"},function(b,d){a[d]&&(c[b]=a[d])}))),wp.media.post("send-attachment-to-editor",{nonce:wp.media.view.settings.nonce.sendToEditor,attachment:c,html:d,post_id:wp.media.view.settings.post.id})},gopp_plugin.patch_39630=function(){var b,c,d=a("#tmpl-attachment");return!!d.length&&(b=d.html(),c=b.replace(/(<# } else if \( data\.sizes && )data\.sizes\.medium( \) { #>\s+<img src="{{ )data\.sizes\.medium(\.url }}" class="thumbnail" draggable="false" alt="" \/>\s+<# } else { #>)/,"$1( data.sizes.thumbnail || data.sizes.medium || data.sizes.full )$2( data.sizes.thumbnail || data.sizes.medium || data.sizes.full )$3"),b!==c&&(d.html(c),!0))},a(function(){gopp_plugin_params&&gopp_plugin_params.val&&(gopp_plugin_params.val.is_regen_pdf_preview?gopp_plugin_params.val.current_user_can_cap&&gopp_plugin.regen_pdf_preview():gopp_plugin_params.val.is_upload?(gopp_plugin_params.val.current_user_can_cap&&gopp_plugin.upload(),gopp_plugin.upload_patch(),gopp_plugin.patch_39630()):gopp_plugin_params.val.is_post&&(gopp_plugin.post_patch(),gopp_plugin.patch_39630()))})}(jQuery); -
gs-only-pdf-preview/trunk/languages/gs-only-pdf-preview-fr_FR.po
r1594582 r1638565 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: GS Only PDF Preview 1.0. 4\n"5 "Project-Id-Version: GS Only PDF Preview 1.0.5\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/gs-only-pdf-" 7 7 "preview\n" 8 "POT-Creation-Date: 2017-0 2-13 03:13+0000\n"9 "PO-Revision-Date: 2017-0 2-13 03:13+0000\n"8 "POT-Creation-Date: 2017-04-16 14:40+0100\n" 9 "PO-Revision-Date: 2017-04-16 14:40+0100\n" 10 10 "Last-Translator: gitlost <gitlost@gitlostbonger.com>\n" 11 11 "Language-Team: \n" … … 25 25 26 26 #. translators: %s: url to admin plugins page. 27 #: gs-only-pdf-preview.php:9 327 #: gs-only-pdf-preview.php:98 28 28 msgid "" 29 29 "The plugin \"GS Only PDF Preview\" cannot be activated as it relies on the " … … 39 39 40 40 #. translators: %s: url to admin plugins page. 41 #: gs-only-pdf-preview.php: 9941 #: gs-only-pdf-preview.php:106 42 42 msgid "" 43 43 "The plugin \"GS Only PDF Preview\" cannot be activated as it relies on the " … … 51 51 52 52 #. translators: %s: url to admin plugins page. 53 #: gs-only-pdf-preview.php:112 54 msgid "" 55 "The plugin \"GS Only PDF Preview\" cannot be activated as it relies on the " 56 "PHP function <code>exec</code>, which has been disabled on your system via " 57 "the suhosin extension directive <code>suhosin.executor.func.blacklist</" 58 "code>. <a href=\"%s\">Return to Plugins page.</a>" 59 msgstr "" 60 "L’extension « GS Only PDF Preview » ne peut pas " 61 "être activée parce qu’elle dépend de la fonction de PHP <code>exec</" 62 "code>, qui est désactivée sur votre système via la directive d’" 63 "extension de suhosin <code>suhosin.executor.func.blacklist</code>. <a href=" 64 "\"%s\">Retournez sur la page des extensions.</a>" 65 66 #. translators: %s: url to admin plugins page. 67 #: gs-only-pdf-preview.php:124 53 #: gs-only-pdf-preview.php:125 68 54 msgid "" 69 55 "The plugin \"GS Only PDF Preview\" cannot be activated as it is incompatible " … … 78 64 #. translators: %1$s: lowest compatible WordPress version; %2$s: user's current 79 65 #. WordPress version; %3$s: url to admin plugins page. 80 #: gs-only-pdf-preview.php:14 066 #: gs-only-pdf-preview.php:141 81 67 msgid "" 82 68 "The plugin \"GS Only PDF Preview\" cannot be activated as it requires " … … 90 76 #. translators: %1$s: highest WordPress version tested; %2$s: user's current 91 77 #. WordPress version. 92 #: gs-only-pdf-preview.php:15 378 #: gs-only-pdf-preview.php:154 93 79 msgid "" 94 80 "<strong>Warning: untested!</strong> The plugin \"GS Only PDF Preview\" has " … … 99 85 "versions de WordPress justqu’à %1$s. Vous avez WordPress version %2$s." 100 86 101 #: gs-only-pdf-preview.php:165 87 #. translators: %1$s: name of suhosin extension directive; %2$s: url to admin 88 #. plugins page. 89 #: gs-only-pdf-preview.php:183 gs-only-pdf-preview.php:193 90 msgid "" 91 "The plugin \"GS Only PDF Preview\" cannot be activated as it relies on the " 92 "PHP function <code>exec</code>, which has been disabled on your system via " 93 "the suhosin extension directive <code>%1$s</code>. <a href=\"%2$s\">Return " 94 "to Plugins page.</a>" 95 msgstr "" 96 "L’extension « GS Only PDF Preview » ne peut pas " 97 "être activée parce qu’elle dépend de la fonction de PHP <code>exec</" 98 "code>, qui est désactivée sur votre système via la directive d’" 99 "extension de suhosin <code>%1$s</code>. <a href=\"%2$s\">Retournez sur la " 100 "page des extensions.</a>" 101 102 #: gs-only-pdf-preview.php:231 102 103 msgid "" 103 104 "<strong>Warning: no Ghostscript!</strong> The plugin \"GS Only PDF Preview\" " … … 108 109 "déterminer l’emplacement du serveur de votre exécutable Ghostscript." 109 110 110 #: gs-only-pdf-preview.php:2 18111 #: gs-only-pdf-preview.php:271 111 112 msgid "Invalid arguments!" 112 113 msgstr "Paramètres invalides !" 113 114 114 #: gs-only-pdf-preview.php:2 23115 #: gs-only-pdf-preview.php:276 115 116 msgid "No PDFs found!" 116 117 msgstr "Aucun fichier PDF trouvé !" … … 118 119 #. translators: %1$s: formatted number of PDF previews regenerated; %2$s: 119 120 #. formatted number of seconds to one decimal place it took. 120 #: gs-only-pdf-preview.php:2 29121 #: gs-only-pdf-preview.php:282 121 122 msgid "%1$s PDF preview regenerated in %2$s seconds." 122 123 msgid_plural "%1$s PDF previews regenerated in %2$s seconds." … … 125 126 126 127 #. translators: %s: formatted number of non-PDFs ignored. 127 #: gs-only-pdf-preview.php:2 36128 #: gs-only-pdf-preview.php:289 128 129 msgid "%s non-PDF ignored." 129 130 msgid_plural "%s non-PDFs ignored." … … 131 132 msgstr[1] "%s non PDFs ignorés." 132 133 133 #: gs-only-pdf-preview.php:2 41134 #: gs-only-pdf-preview.php:294 134 135 msgid "Nothing updated!" 135 136 msgstr "Rien mis à jour !" 136 137 137 138 #. translators: %s: formatted number of non-PDFs ignored. 138 #: gs-only-pdf-preview.php:2 45139 #: gs-only-pdf-preview.php:298 139 140 msgid "Nothing updateable! %s non-PDF ignored." 140 141 msgid_plural "Nothing updateable! %s non-PDFs ignored." … … 143 144 144 145 #. translators: %s: formatted number of PDF previews that failed to regenerate. 145 #: gs-only-pdf-preview.php: 252146 #: gs-only-pdf-preview.php:305 146 147 msgid "%s PDF preview not regenerated." 147 148 msgid_plural "%s PDF previews not regenerated." … … 149 150 msgstr[1] "%s aperçus de miniature de PDF non régénérés." 150 151 151 #: gs-only-pdf-preview.php: 258152 #: gs-only-pdf-preview.php:311 152 153 msgid "You can go again below if you want." 153 154 msgstr "Vous pouvez aller de nouveau ci-dessous si vous voulez." 154 155 155 #: gs-only-pdf-preview.php: 296 gs-only-pdf-preview.php:450156 #: gs-only-pdf-preview.php:5 44156 #: gs-only-pdf-preview.php:349 gs-only-pdf-preview.php:501 157 #: gs-only-pdf-preview.php:596 157 158 msgid "Regenerate PDF Previews" 158 159 msgstr "Régénérer les aperçus de miniature de PDF" 159 160 160 #: gs-only-pdf-preview.php: 296161 #: gs-only-pdf-preview.php:349 161 162 msgid "Regen. PDF Previews" 162 163 msgstr "Régén. aperçus PDF" 163 164 164 #: gs-only-pdf-preview.php:3 10 gs-only-pdf-preview.php:415165 #: gs-only-pdf-preview.php:6 15165 #: gs-only-pdf-preview.php:363 gs-only-pdf-preview.php:465 166 #: gs-only-pdf-preview.php:664 166 167 msgid "Sorry, you are not allowed to access this page." 167 168 msgstr "" … … 169 170 "page. " 170 171 171 #: gs-only-pdf-preview.php:4 21172 #: gs-only-pdf-preview.php:472 172 173 msgid "GS Only PDF Preview - Regenerate PDF Previews" 173 174 msgstr "GS Only PDF Preview - Régénérer les aperçus de miniature de PDF." 174 175 175 #: gs-only-pdf-preview.php:4 26176 #: gs-only-pdf-preview.php:477 176 177 msgid "" 177 178 "This tool is for regenerating the thumbnail previews of PDFs, but no PDFs " … … 181 182 "fichier PDF n’a été téléchargé, donc il n’a rien à faire." 182 183 183 #: gs-only-pdf-preview.php:4 33184 #: gs-only-pdf-preview.php:484 184 185 msgid "" 185 186 "<strong>Warning: cannot set max execution time!</strong> The maximum time " … … 192 193 "donc éprouver l’écran blanc de mort (WSOD) en essayant ceci." 193 194 194 #: gs-only-pdf-preview.php:4 42195 #: gs-only-pdf-preview.php:493 195 196 msgid "Regenerate the thumbnail previews of PDFs uploaded to your system." 196 197 msgstr "" … … 199 200 200 201 #. translators: %s: formatted number of PDFs found. 201 #: gs-only-pdf-preview.php:4 47202 #: gs-only-pdf-preview.php:498 202 203 msgid "<strong>%s</strong> PDF has been found." 203 204 msgid_plural "<strong>%s</strong> PDFs have been found." … … 206 207 207 208 #. translators: %s: formatted number (greater than 10) of PDFs found. 208 #: gs-only-pdf-preview.php: 455209 #: gs-only-pdf-preview.php:506 209 210 msgid "Regenerating %s PDF previews can take a long time." 210 211 msgstr "" … … 212 213 213 214 #. translators: %s: url to the Media Library page in list mode. 214 #: gs-only-pdf-preview.php: 467215 #: gs-only-pdf-preview.php:518 215 216 msgid "" 216 217 "Note that you can also regenerate PDF previews in batches or individually " … … 225 226 "<a href=\"%s\">mode de liste de la bibliothèque des médias</a>." 226 227 227 #: gs-only-pdf-preview.php:5 06228 #: gs-only-pdf-preview.php:558 228 229 msgid "Please wait..." 229 230 msgstr "S’il vous plaît attendre..." 230 231 231 #: gs-only-pdf-preview.php:5 10232 #: gs-only-pdf-preview.php:562 232 233 msgid "No items selected!" 233 234 msgstr "Aucun élément sélectionné !" 234 235 235 #: gs-only-pdf-preview.php:5 11236 #: gs-only-pdf-preview.php:563 236 237 msgid "Regenerate Preview ajax action not available!" 237 238 msgstr "" 238 239 "L’action de régénérer l’aperçu n’est pas disponible !" 239 240 240 #: gs-only-pdf-preview.php:5 15241 #: gs-only-pdf-preview.php:567 241 242 msgid "Document Link Only" 242 243 msgstr "Lien de document seulement" 243 244 244 245 #. translators: %s: attachment title 245 #: gs-only-pdf-preview.php: 599246 #: gs-only-pdf-preview.php:649 246 247 msgid "Regenerate the PDF preview for “%s”" 247 248 msgstr "Régénérer l’aperçu de miniature de PDF pour “%s”" 248 249 249 #: gs-only-pdf-preview.php:6 00250 #: gs-only-pdf-preview.php:650 250 251 msgid "Regenerate Preview" 251 252 msgstr "Régénérer l’aperçu" 252 253 253 #: gs-only-pdf-preview.php:6 20254 #: gs-only-pdf-preview.php:669 254 255 msgid "Invalid nonce." 255 256 msgstr "Nonce invalide." 256 257 257 #: gs-only-pdf-preview.php:6 23258 #: gs-only-pdf-preview.php:672 258 259 msgid "Invalid ID." 259 260 msgstr "Identifiant invalide." 260 261 261 #: gs-only-pdf-preview.php:6 29262 #: gs-only-pdf-preview.php:678 262 263 msgid "Failed to generate the PDF preview." 263 264 msgstr "Échec de générer l’aperçu de miniature de PDF." 264 265 265 #: gs-only-pdf-preview.php:6 34266 #: gs-only-pdf-preview.php:683 266 267 msgid "" 267 268 "Successfully regenerated the PDF preview. It's best to refresh your browser " … … 272 273 "jour correctement." 273 274 274 #: gs-only-pdf-preview.php:6 36275 #: gs-only-pdf-preview.php:685 275 276 msgid "" 276 277 "Successfully regenerated the PDF preview. You will need to refresh your " … … 282 283 #. translators: %1$d: percentage of PDF previews completed; %2$d: completed 283 284 #. count. 284 #: gs-only-pdf-preview.php: 665285 #: gs-only-pdf-preview.php:714 285 286 msgid "%d%% (%d)" 286 287 msgstr "%d%% (%d)" 287 288 288 #: includes/class-gopp-image-editor-gs.php:1 61289 #: includes/class-gopp-image-editor-gs.php:170 289 290 msgid "Unsupported MIME type." 290 291 msgstr "Type MIME non supporté." 291 292 292 #: includes/class-gopp-image-editor-gs.php:1 65293 #: includes/class-gopp-image-editor-gs.php:174 293 294 msgid "Unsupported destination." 294 295 msgstr "Destination non supportée." 295 296 296 #: includes/class-gopp-image-editor-gs.php:1 72297 #: includes/class-gopp-image-editor-gs.php:181 297 298 msgid "No Ghostscript." 298 299 msgstr "Pas de Ghostscript." 299 300 300 #: includes/class-gopp-image-editor-gs.php:1 78301 #: includes/class-gopp-image-editor-gs.php:187 301 302 msgid "Image Editor Save Failed" 302 303 msgstr "L’enregistrement de l’éditeur d’images a échoué." 303 304 304 #: includes/class-gopp-image-editor-gs.php:1 85305 #: includes/class-gopp-image-editor-gs.php:192 305 306 msgid "Could not read image size." 306 307 msgstr "Impossible de lire la taille de l’image." 307 308 308 #: includes/class-gopp-image-editor-gs.php:2 23309 #: includes/class-gopp-image-editor-gs.php:230 309 310 msgid "Loading from URL not supported." 310 311 msgstr "Chargement à partir de l’URL non pris en charge." 311 312 312 #: includes/class-gopp-image-editor-gs.php:2 28313 #: includes/class-gopp-image-editor-gs.php:2 34313 #: includes/class-gopp-image-editor-gs.php:235 314 #: includes/class-gopp-image-editor-gs.php:241 314 315 msgid "Unsupported file name." 315 316 msgstr "Nom du fichier non supporté." 316 317 317 #: includes/class-gopp-image-editor-gs.php:2 44318 #: includes/class-gopp-image-editor-gs.php:251 318 319 msgid "File doesn’t exist?" 319 320 msgstr "Le fichier n’existe pas ?" 320 321 321 #: includes/class-gopp-image-editor-gs.php:25 1322 #: includes/class-gopp-image-editor-gs.php:258 322 323 msgid "File is not a PDF." 323 324 msgstr "Le fichier n’est pas un PDF ." 324 325 325 #: includes/class-gopp-image-editor-gs.php:6 33326 #: includes/class-gopp-image-editor-gs.php:642 326 327 msgid "Attempted to set PDF preview resolution to an invalid value." 327 328 msgstr "" … … 329 330 "valeur non valide." 330 331 331 #: includes/class-gopp-image-editor-gs.php:6 88332 #: includes/class-gopp-image-editor-gs.php:697 332 333 msgid "Attempted to set PDF preview page to an invalid value." 333 334 msgstr "" … … 335 336 "non valide." 336 337 337 #: includes/class-gopp-image-editor-gs.php:7 07338 #: includes/class-gopp-image-editor-gs.php:7 28339 #: includes/class-gopp-image-editor-gs.php:7 47340 #: includes/class-gopp-image-editor-gs.php:76 0341 #: includes/class-gopp-image-editor-gs.php:7 74342 #: includes/class-gopp-image-editor-gs.php:7 87338 #: includes/class-gopp-image-editor-gs.php:716 339 #: includes/class-gopp-image-editor-gs.php:737 340 #: includes/class-gopp-image-editor-gs.php:756 341 #: includes/class-gopp-image-editor-gs.php:769 342 #: includes/class-gopp-image-editor-gs.php:783 343 #: includes/class-gopp-image-editor-gs.php:796 343 344 msgid "Unsupported operation." 344 345 msgstr "Opération non supportée." 346 347 #: includes/debug-gopp-image-editor-gs.php:15 348 msgid "Ghostscript command not found!" 349 msgstr "Commande Ghostscript introuvable !" 345 350 346 351 #. Plugin Name of the plugin/theme -
gs-only-pdf-preview/trunk/languages/gs-only-pdf-preview.pot
r1594582 r1638565 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: GS Only PDF Preview 1.0. 4\n"5 "Project-Id-Version: GS Only PDF Preview 1.0.5\n" 6 6 "Report-Msgid-Bugs-To: " 7 7 "https://wordpress.org/support/plugin/gs-only-pdf-preview\n" … … 26 26 "X-Textdomain-Support: yes\n" 27 27 28 #: gs-only-pdf-preview.php:9 328 #: gs-only-pdf-preview.php:98 29 29 #. translators: %s: url to admin plugins page. 30 30 msgid "" … … 35 35 msgstr "" 36 36 37 #: gs-only-pdf-preview.php: 9937 #: gs-only-pdf-preview.php:106 38 38 #. translators: %s: url to admin plugins page. 39 39 msgid "" … … 43 43 msgstr "" 44 44 45 #: gs-only-pdf-preview.php:112 46 #. translators: %s: url to admin plugins page. 47 msgid "" 48 "The plugin \"GS Only PDF Preview\" cannot be activated as it relies on the " 49 "PHP function <code>exec</code>, which has been disabled on your system via " 50 "the suhosin extension directive " 51 "<code>suhosin.executor.func.blacklist</code>. <a href=\"%s\">Return to " 52 "Plugins page.</a>" 53 msgstr "" 54 55 #: gs-only-pdf-preview.php:124 45 #: gs-only-pdf-preview.php:125 56 46 #. translators: %s: url to admin plugins page. 57 47 msgid "" … … 62 52 msgstr "" 63 53 64 #: gs-only-pdf-preview.php:14 054 #: gs-only-pdf-preview.php:141 65 55 #. translators: %1$s: lowest compatible WordPress version; %2$s: user's current 66 56 #. WordPress version; %3$s: url to admin plugins page. … … 71 61 msgstr "" 72 62 73 #: gs-only-pdf-preview.php:15 363 #: gs-only-pdf-preview.php:154 74 64 #. translators: %1$s: highest WordPress version tested; %2$s: user's current 75 65 #. WordPress version. … … 79 69 msgstr "" 80 70 81 #: gs-only-pdf-preview.php:165 71 #: gs-only-pdf-preview.php:183 gs-only-pdf-preview.php:193 72 #. translators: %1$s: name of suhosin extension directive; %2$s: url to admin 73 #. plugins page. 74 msgid "" 75 "The plugin \"GS Only PDF Preview\" cannot be activated as it relies on the " 76 "PHP function <code>exec</code>, which has been disabled on your system via " 77 "the suhosin extension directive <code>%1$s</code>. <a href=\"%2$s\">Return " 78 "to Plugins page.</a>" 79 msgstr "" 80 81 #: gs-only-pdf-preview.php:231 82 82 msgid "" 83 83 "<strong>Warning: no Ghostscript!</strong> The plugin \"GS Only PDF " … … 86 86 msgstr "" 87 87 88 #: gs-only-pdf-preview.php:2 1888 #: gs-only-pdf-preview.php:271 89 89 msgid "Invalid arguments!" 90 90 msgstr "" 91 91 92 #: gs-only-pdf-preview.php:2 2392 #: gs-only-pdf-preview.php:276 93 93 msgid "No PDFs found!" 94 94 msgstr "" 95 95 96 #: gs-only-pdf-preview.php:2 2996 #: gs-only-pdf-preview.php:282 97 97 #. translators: %1$s: formatted number of PDF previews regenerated; %2$s: 98 98 #. formatted number of seconds to one decimal place it took. … … 102 102 msgstr[1] "" 103 103 104 #: gs-only-pdf-preview.php:2 36104 #: gs-only-pdf-preview.php:289 105 105 #. translators: %s: formatted number of non-PDFs ignored. 106 106 msgid "%s non-PDF ignored." … … 109 109 msgstr[1] "" 110 110 111 #: gs-only-pdf-preview.php:2 41111 #: gs-only-pdf-preview.php:294 112 112 msgid "Nothing updated!" 113 113 msgstr "" 114 114 115 #: gs-only-pdf-preview.php:2 45115 #: gs-only-pdf-preview.php:298 116 116 #. translators: %s: formatted number of non-PDFs ignored. 117 117 msgid "Nothing updateable! %s non-PDF ignored." … … 120 120 msgstr[1] "" 121 121 122 #: gs-only-pdf-preview.php: 252122 #: gs-only-pdf-preview.php:305 123 123 #. translators: %s: formatted number of PDF previews that failed to regenerate. 124 124 msgid "%s PDF preview not regenerated." … … 127 127 msgstr[1] "" 128 128 129 #: gs-only-pdf-preview.php: 258129 #: gs-only-pdf-preview.php:311 130 130 msgid "You can go again below if you want." 131 131 msgstr "" 132 132 133 #: gs-only-pdf-preview.php: 296 gs-only-pdf-preview.php:450134 #: gs-only-pdf-preview.php:5 44133 #: gs-only-pdf-preview.php:349 gs-only-pdf-preview.php:501 134 #: gs-only-pdf-preview.php:596 135 135 msgid "Regenerate PDF Previews" 136 136 msgstr "" 137 137 138 #: gs-only-pdf-preview.php: 296138 #: gs-only-pdf-preview.php:349 139 139 msgid "Regen. PDF Previews" 140 140 msgstr "" 141 141 142 #: gs-only-pdf-preview.php:3 10 gs-only-pdf-preview.php:415143 #: gs-only-pdf-preview.php:6 15142 #: gs-only-pdf-preview.php:363 gs-only-pdf-preview.php:465 143 #: gs-only-pdf-preview.php:664 144 144 msgid "Sorry, you are not allowed to access this page." 145 145 msgstr "" 146 146 147 #: gs-only-pdf-preview.php:4 21147 #: gs-only-pdf-preview.php:472 148 148 msgid "GS Only PDF Preview - Regenerate PDF Previews" 149 149 msgstr "" 150 150 151 #: gs-only-pdf-preview.php:4 26151 #: gs-only-pdf-preview.php:477 152 152 msgid "" 153 153 "This tool is for regenerating the thumbnail previews of PDFs, but no PDFs " … … 155 155 msgstr "" 156 156 157 #: gs-only-pdf-preview.php:4 33157 #: gs-only-pdf-preview.php:484 158 158 msgid "" 159 159 "<strong>Warning: cannot set max execution time!</strong> The maximum time " … … 162 162 msgstr "" 163 163 164 #: gs-only-pdf-preview.php:4 42164 #: gs-only-pdf-preview.php:493 165 165 msgid "Regenerate the thumbnail previews of PDFs uploaded to your system." 166 166 msgstr "" 167 167 168 #: gs-only-pdf-preview.php:4 47168 #: gs-only-pdf-preview.php:498 169 169 #. translators: %s: formatted number of PDFs found. 170 170 msgid "<strong>%s</strong> PDF has been found." … … 173 173 msgstr[1] "" 174 174 175 #: gs-only-pdf-preview.php: 455175 #: gs-only-pdf-preview.php:506 176 176 #. translators: %s: formatted number (greater than 10) of PDFs found. 177 177 msgid "Regenerating %s PDF previews can take a long time." 178 178 msgstr "" 179 179 180 #: gs-only-pdf-preview.php: 467180 #: gs-only-pdf-preview.php:518 181 181 #. translators: %s: url to the Media Library page in list mode. 182 182 msgid "" … … 187 187 msgstr "" 188 188 189 #: gs-only-pdf-preview.php:5 06189 #: gs-only-pdf-preview.php:558 190 190 msgid "Please wait..." 191 191 msgstr "" 192 192 193 #: gs-only-pdf-preview.php:5 10193 #: gs-only-pdf-preview.php:562 194 194 msgid "No items selected!" 195 195 msgstr "" 196 196 197 #: gs-only-pdf-preview.php:5 11197 #: gs-only-pdf-preview.php:563 198 198 msgid "Regenerate Preview ajax action not available!" 199 199 msgstr "" 200 200 201 #: gs-only-pdf-preview.php:5 15201 #: gs-only-pdf-preview.php:567 202 202 msgid "Document Link Only" 203 203 msgstr "" 204 204 205 #: gs-only-pdf-preview.php: 599205 #: gs-only-pdf-preview.php:649 206 206 #. translators: %s: attachment title 207 207 msgid "Regenerate the PDF preview for “%s”" 208 208 msgstr "" 209 209 210 #: gs-only-pdf-preview.php:6 00210 #: gs-only-pdf-preview.php:650 211 211 msgid "Regenerate Preview" 212 212 msgstr "" 213 213 214 #: gs-only-pdf-preview.php:6 20214 #: gs-only-pdf-preview.php:669 215 215 msgid "Invalid nonce." 216 216 msgstr "" 217 217 218 #: gs-only-pdf-preview.php:6 23218 #: gs-only-pdf-preview.php:672 219 219 msgid "Invalid ID." 220 220 msgstr "" 221 221 222 #: gs-only-pdf-preview.php:6 29222 #: gs-only-pdf-preview.php:678 223 223 msgid "Failed to generate the PDF preview." 224 224 msgstr "" 225 225 226 #: gs-only-pdf-preview.php:6 34226 #: gs-only-pdf-preview.php:683 227 227 msgid "" 228 228 "Successfully regenerated the PDF preview. It's best to refresh your browser " … … 230 230 msgstr "" 231 231 232 #: gs-only-pdf-preview.php:6 36232 #: gs-only-pdf-preview.php:685 233 233 msgid "" 234 234 "Successfully regenerated the PDF preview. You will need to refresh your " … … 236 236 msgstr "" 237 237 238 #: gs-only-pdf-preview.php: 665238 #: gs-only-pdf-preview.php:714 239 239 #. translators: %1$d: percentage of PDF previews completed; %2$d: completed 240 240 #. count. … … 242 242 msgstr "" 243 243 244 #: includes/class-gopp-image-editor-gs.php:1 61244 #: includes/class-gopp-image-editor-gs.php:170 245 245 msgid "Unsupported MIME type." 246 246 msgstr "" 247 247 248 #: includes/class-gopp-image-editor-gs.php:1 65248 #: includes/class-gopp-image-editor-gs.php:174 249 249 msgid "Unsupported destination." 250 250 msgstr "" 251 251 252 #: includes/class-gopp-image-editor-gs.php:1 72252 #: includes/class-gopp-image-editor-gs.php:181 253 253 msgid "No Ghostscript." 254 254 msgstr "" 255 255 256 #: includes/class-gopp-image-editor-gs.php:1 78256 #: includes/class-gopp-image-editor-gs.php:187 257 257 msgid "Image Editor Save Failed" 258 258 msgstr "" 259 259 260 #: includes/class-gopp-image-editor-gs.php:1 85260 #: includes/class-gopp-image-editor-gs.php:192 261 261 msgid "Could not read image size." 262 262 msgstr "" 263 263 264 #: includes/class-gopp-image-editor-gs.php:2 23264 #: includes/class-gopp-image-editor-gs.php:230 265 265 msgid "Loading from URL not supported." 266 266 msgstr "" 267 267 268 #: includes/class-gopp-image-editor-gs.php:2 28269 #: includes/class-gopp-image-editor-gs.php:2 34268 #: includes/class-gopp-image-editor-gs.php:235 269 #: includes/class-gopp-image-editor-gs.php:241 270 270 msgid "Unsupported file name." 271 271 msgstr "" 272 272 273 #: includes/class-gopp-image-editor-gs.php:2 44273 #: includes/class-gopp-image-editor-gs.php:251 274 274 msgid "File doesn’t exist?" 275 275 msgstr "" 276 276 277 #: includes/class-gopp-image-editor-gs.php:25 1277 #: includes/class-gopp-image-editor-gs.php:258 278 278 msgid "File is not a PDF." 279 279 msgstr "" 280 280 281 #: includes/class-gopp-image-editor-gs.php:6 33281 #: includes/class-gopp-image-editor-gs.php:642 282 282 msgid "Attempted to set PDF preview resolution to an invalid value." 283 283 msgstr "" 284 284 285 #: includes/class-gopp-image-editor-gs.php:6 88285 #: includes/class-gopp-image-editor-gs.php:697 286 286 msgid "Attempted to set PDF preview page to an invalid value." 287 287 msgstr "" 288 288 289 #: includes/class-gopp-image-editor-gs.php:7 07290 #: includes/class-gopp-image-editor-gs.php:7 28291 #: includes/class-gopp-image-editor-gs.php:7 47292 #: includes/class-gopp-image-editor-gs.php:76 0293 #: includes/class-gopp-image-editor-gs.php:7 74294 #: includes/class-gopp-image-editor-gs.php:7 87289 #: includes/class-gopp-image-editor-gs.php:716 290 #: includes/class-gopp-image-editor-gs.php:737 291 #: includes/class-gopp-image-editor-gs.php:756 292 #: includes/class-gopp-image-editor-gs.php:769 293 #: includes/class-gopp-image-editor-gs.php:783 294 #: includes/class-gopp-image-editor-gs.php:796 295 295 msgid "Unsupported operation." 296 msgstr "" 297 298 #: includes/debug-gopp-image-editor-gs.php:15 299 msgid "Ghostscript command not found!" 296 300 msgstr "" 297 301 -
gs-only-pdf-preview/trunk/readme.txt
r1594582 r1638565 3 3 Tags: Ghostscript, PDF, PDF Preview, Ghostscript Only 4 4 Requires at least: 4.7.0 5 Tested up to: 4.7. 26 Stable tag: 1.0. 45 Tested up to: 4.7.3 6 Stable tag: 1.0.5 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 24 24 = Limitations = 25 25 26 The plugin requires the PHP function [`exec`](http://php.net/manual/en/function.exec.php) to be enabled on your system. So if the PHP ini setting [`disable_functions`](http://php.net/manual/en/ini.core.php#ini.disable-functions) includes `exec`, the plugin won't work. Neither will it work if the (somewhat outdated) [`suhosin` security extension](https://suhosin.org/stories/index.html) is installed and `exec`is [blacklisted](https://suhosin.org/stories/configuration.html#suhosin-executor-func-blacklist).26 The plugin requires the PHP function [`exec`](http://php.net/manual/en/function.exec.php) to be enabled on your system. So if the PHP ini setting [`disable_functions`](http://php.net/manual/en/ini.core.php#ini.disable-functions) includes `exec`, the plugin won't work. Neither will it work if the [`suhosin` security extension](https://suhosin.org/stories/index.html) is installed and `exec` is either not [whitelisted](https://suhosin.org/stories/configuration.html#suhosin-executor-func-whitelist) or is [blacklisted](https://suhosin.org/stories/configuration.html#suhosin-executor-func-blacklist). 27 27 28 28 Also, the plugin is incompatible with the PHP ini setting [`safe_mode`](http://php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode), an old (and misnamed) setting that was deprecated in PHP 5.3.0 and removed in PHP 5.4.0. … … 38 38 Unsurprisingly it's faster. Crude benchmarking (see the script [`perf_vs_imagick.php`](https://github.com/gitlost/gs-only-pdf-preview/blob/master/perf/perf_vs_imagick.php)) suggests it's around 35-40% faster. However the production of the preview is only a part of the overhead of uploading a PDF (and doesn't include producing the intermediate thumbnail sizes for instance) so any speed-up may not be that noticeable. 39 39 40 On jpeg thumbnail size it appears to be comparable, maybe a bit larger on average. To mitigate this the default jpeg quality for the PDF preview has been lowered to 70 (from 82), which results in some extra "ringing" (speckles around letters) but the previews tested remain very readable. Note that this only affects the "full" PDF thumbnail - the intermediate-sized thumbnails as produced by `Imagick` or `GD` and any other non-PDF images remain at the standard jpeg quality of 82. Use the WP filter [`wp_editor_set_quality`](https://developer.wordpress.org/reference/hooks/wp_editor_set_quality/) to override this, for instance to restore the quality to 82 you could add to your theme's "functions.php": 40 = Size = 41 42 On jpeg thumbnail size it appears to be comparable (though it depends on the PDF), maybe a bit larger on average. To mitigate this the default jpeg quality for the PDF preview has been lowered to 70 (from 82), which results in some extra "ringing" (speckles around letters) but the previews tested remain very readable. Note that this only affects the "full" PDF thumbnail - the intermediate-sized thumbnails as produced by `Imagick` or `GD` and any other non-PDF images remain at the standard jpeg quality of 82. You can use the WP filter [`wp_editor_set_quality`](https://developer.wordpress.org/reference/hooks/wp_editor_set_quality/) to override this, for instance to restore the quality to 82 add to your theme's "functions.php": 41 43 42 44 function mytheme_wp_editor_set_quality( $quality, $mime_type ) { … … 47 49 } 48 50 add_filter( 'wp_editor_set_quality', 'mytheme_wp_editor_set_quality', 10, 2 ); 51 52 = Quality = 53 54 Eyeballing based on very limited data, ie anecdotally, the previews seem to be of superior definition with less artifacts (even with the jpeg quality reduced to 70), and more faithful to the original colours. 49 55 50 56 = Tool = … … 62 68 A google-cheating schoolboy French translation is supplied. 63 69 64 The plugin runs on WP 4.7.0 to 4.7. 2, and requires Ghostscript to be installed on the server. The plugin should run on PHP 5.2.17 to 7.1, and on both Unix and Windows servers.70 The plugin runs on WP 4.7.0 to 4.7.3, and requires Ghostscript to be installed on the server. The plugin should run on PHP 5.2.17 to 7.1, and on both Unix and Windows servers. 65 71 66 72 The project is on [github](https://github.com/gitlost/gs-only-pdf-preview). … … 118 124 add_filter( 'init', 'mytheme_gopp_init' ); 119 125 126 or for [WP-CLI](https://wp-cli.org/) users: 127 128 wp transient delete gopp_image_gs_cmd_path 129 120 130 == Screenshots == 121 131 … … 129 139 130 140 == Changelog == 141 142 = 1.0.5 (16 Apr 2017) = 143 * Fix Windows cmd path highest version/best match. 144 * Set real size not dummy for preview. 145 * Fix test to be preview name agnostic. 146 * Remove unnecessary upload_dir calc re old preview thumbnails. 147 * Insist on mime_type arg in test() to avoid reporting bogus supported implementation. 148 * Only add actions/filters if have cap. 149 * Add qunit tests. 150 * Override get_size() to work if loaded. 151 * Enable "Alt Text" on Attachment Details. 152 * WP 4.7.3 compatible 131 153 132 154 = 1.0.4 (13 Feb 2017) = … … 157 179 == Upgrade Notice == 158 180 181 = 1.0.5 = 182 Determines Windows command path better. 183 159 184 = 1.0.4 = 160 185 Allows file names containing "+".
Note: See TracChangeset
for help on using the changeset viewer.