WordPress.org

Plugin Directory

Changeset 1677886


Ignore:
Timestamp:
06/13/17 20:10:47 (5 months ago)
Author:
gitlost
Message:

v1.0.7

Location:
gs-only-pdf-preview
Files:
9 edited
10 copied

Legend:

Unmodified
Added
Removed
  • gs-only-pdf-preview/tags/1.0.7/gs-only-pdf-preview.php

    r1638573 r1677886  
    44 * Plugin URI: https://github.com/gitlost/gs-only-pdf-preview 
    55 * Description: Uses Ghostscript directly to generate PDF previews. 
    6  * Version: 1.0.6 
     6 * Version: 1.0.7 
    77 * Author: gitlost 
    88 * Author URI: https://profiles.wordpress.org/gitlost 
     
    1717 
    1818// These need to be synced with "readme.txt". 
    19 define( 'GOPP_PLUGIN_VERSION', '1.0.6' ); // Sync also "package.json" and "language/gs-only-pdf-preview.pot". 
     19define( 'GOPP_PLUGIN_VERSION', '1.0.7' ); // Sync also "package.json" and "language/gs-only-pdf-preview.pot". 
    2020define( 'GOPP_PLUGIN_WP_AT_LEAST_VERSION', '4.7.0' ); 
    21 define( 'GOPP_PLUGIN_WP_UP_TO_VERSION', '4.7.3' ); 
     21define( 'GOPP_PLUGIN_WP_UP_TO_VERSION', '4.8.0' ); 
    2222 
    2323define( 'GOPP_REGEN_PDF_PREVIEWS_SLUG', 'gopp-regen-pdf-previews' ); 
     
    522522                    ?> 
    523523                </p> 
    524                 <?php if ( ( defined( 'GOPP_PLUGIN_DEBUG' ) && GOPP_PLUGIN_DEBUG ) || ! self::check_have_gs() ) : ?> 
    525                     <?php require_once dirname( __FILE__ ) . '/includes/debug-gopp-image-editor-gs.php'; ?> 
    526                     <?php DEBUG_GOPP_Image_Editor_GS::dump(); ?> 
    527                 <?php endif; ?> 
     524                <?php if ( ( defined( 'GOPP_PLUGIN_DEBUG' ) && GOPP_PLUGIN_DEBUG ) || ! self::check_have_gs() ) : 
     525                    self::load_gopp_image_editor_gs(); 
     526                    require_once dirname( __FILE__ ) . '/includes/debug-gopp-image-editor-gs.php'; 
     527                    DEBUG_GOPP_Image_Editor_GS::dump(); 
     528                endif; ?> 
    528529            </form> 
    529530            <?php 
  • gs-only-pdf-preview/tags/1.0.7/includes/class-gopp-image-editor-gs.php

    r1638565 r1677886  
    181181            return new WP_Error( 'image_save_error', __( 'No Ghostscript.', 'gs-only-pdf-preview' ) ); 
    182182        } 
     183        $return_var = -1; 
     184        $output = array(); 
    183185        exec( $cmd, $output, $return_var ); 
    184186 
     
    321323     */ 
    322324    protected static function test_gs_cmd( $cmd ) { 
    323         // Note if exec() has been disabled by means not reflected in function_exists() it may barf here and throw warnings but we don't care that much. 
     325        // Note if exec() has been disabled by means not reflected in function_exists() it may barf here and throw warnings so initial vars. 
     326        $return_var = -1; 
     327        $output = array(); 
    324328        exec( self::escapeshellarg( $cmd ) . ' -dBATCH -dNOPAUSE -dNOPROMPT -dSAFER -v 2>&1', $output, $return_var ); 
    325329 
     
    363367        // Do one test query first to see if it works. 
    364368        $cmd = 'REG QUERY HKEY_LOCAL_MACHINE\\SOFTWARE 2>&1'; 
     369        $return_var = -1; 
    365370        $output = array(); 
    366371        exec( $cmd, $output, $return_var ); 
     
    813818            $filename = $dirname . '/' . wp_unique_filename( $dirname, 'gopp_size.jpg' ); 
    814819            if ( $cmd = self::gs_cmd( $this->get_gs_args( $filename ) ) ) { 
     820                $return_var = -1; 
     821                $output = array(); 
    815822                exec( $cmd, $output, $return_var ); 
    816823                if ( 0 === $return_var && ( $size = @ getimagesize( $filename ) ) ) { 
  • gs-only-pdf-preview/tags/1.0.7/includes/debug-gopp-image-editor-gs.php

    r1638565 r1677886  
    99class DEBUG_GOPP_Image_Editor_GS extends GOPP_Image_Editor_GS { 
    1010    static function get_test_output() { 
     11        if ( self::is_exec_disabled() ) { 
     12            return array( -1, array( __( 'Exec disabled!', 'gs-only-pdf-preview' ) ) ); 
     13        } 
    1114        if ( $cmd = self::gs_cmd( '-dBATCH -dNOPAUSE -dNOPROMPT -dSAFER -v' ) ) { 
    1215            exec( $cmd, $output, $return_var ); 
     
    2326    static function filter_gopp_image_gs_cmd_path() { return has_filter( 'gopp_image_gs_cmd_path' ); } 
    2427    static function apply_filters_gopp_image_gs_cmd_path() { return apply_filters( 'gopp_image_gs_cmd_path', self::$gs_cmd_path, self::is_win() ); } 
     28 
     29    static function is_exec_disabled() { 
     30        $ini_get = ini_get( 'disable_functions' ); 
     31        if ( $ini_get && in_array( 'exec', array_map( 'trim', explode( ',', strtolower( $ini_get ) ) ), true ) ) { 
     32            return true; 
     33        } 
     34        if ( extension_loaded( 'suhosin' ) || extension_loaded( 'suhosin7' ) || ( version_compare( PHP_VERSION, '5.3', '>=' ) && ini_get( 'enable_dl' ) && @ dl( 'suhosin' ) ) ) { 
     35            $ini_get = ini_get( 'suhosin.executor.func.whitelist' ); 
     36            if ( $ini_get && in_array( 'exec', array_map( 'trim', explode( ',', strtolower( $ini_get ) ) ), true ) ) { 
     37                return false; 
     38            } 
     39            $ini_get = ini_get( 'suhosin.executor.func.blacklist' ); 
     40            if ( $ini_get && in_array( 'exec', array_map( 'trim', explode( ',', strtolower( $ini_get ) ) ), true ) ) { 
     41                return true; 
     42            } 
     43        } 
     44        return false; 
     45    } 
    2546 
    2647    static function dump() { 
  • gs-only-pdf-preview/tags/1.0.7/js/gs-only-pdf-preview.js

    r1638565 r1677886  
    169169            attachment_details2_with = '$1 || ( \'application\' === data.type && data.sizes )$2', 
    170170            html_attachment_display_settings, 
    171             attachment_display_settings_re = /(<# if \( 'image' === data.type)( \) { #>\s+<label class="setting">)/, 
    172             attachment_display_settings_with = '$1 || ( \'application\' === data.type && data.sizes )$2', 
     171            attachment_display_settings_re = /(<# if \( 'image' === data.type)( \) { #>\s+<label class="setting)("| align")/, 
     172            attachment_display_settings_with = '$1 || ( \'application\' === data.type && data.sizes )$2$3', 
    173173            attachment_display_settings2_re = /(<# if \( data\.userSettings \) { #>\s+data-user-setting="imgsize"\s+<# } #>>)(\s+<#)/, 
    174174            attachment_display_settings2_with = '$1\n<# if ( \'application\' === data.type ) { #>\n<option value="">\n' + gopp_plugin_params.document_link_only + '\n</option>\n<# } #>\n$2', 
  • gs-only-pdf-preview/tags/1.0.7/js/gs-only-pdf-preview.min.js

    r1638573 r1677886  
    1 /*! gs-only-pdf-preview 1.0.6 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); 
     1/*! gs-only-pdf-preview 1.0.7 2017-06-13 */ 
     2var 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)("| align")/,"$1 || ( 'application' === data.type && data.sizes )$2$3"),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/tags/1.0.7/languages/gs-only-pdf-preview-fr_FR.po

    r1638573 r1677886  
    33msgid "" 
    44msgstr "" 
    5 "Project-Id-Version: GS Only PDF Preview 1.0.6\n" 
     5"Project-Id-Version: GS Only PDF Preview 1.0.7\n" 
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/gs-only-pdf-" 
    77"preview\n" 
    8 "POT-Creation-Date: 2017-04-16 16:03+0100\n" 
    9 "PO-Revision-Date: 2017-04-16 16:03+0100\n" 
     8"POT-Creation-Date: 2017-06-12 22:29+0100\n" 
     9"PO-Revision-Date: 2017-06-12 22:29+0100\n" 
    1010"Last-Translator: gitlost <gitlost@gitlostbonger.com>\n" 
    1111"Language-Team: \n" 
     
    1414"Content-Type: text/plain; charset=UTF-8\n" 
    1515"Content-Transfer-Encoding: 8bit\n" 
    16 "X-Generator: Poedit 1.8.9\n" 
     16"X-Generator: Poedit 2.0.1\n" 
    1717"X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;" 
    1818"_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;" 
     
    154154msgstr "Vous pouvez aller de nouveau ci-dessous si vous voulez." 
    155155 
    156 #: gs-only-pdf-preview.php:349 gs-only-pdf-preview.php:501 
    157 #: gs-only-pdf-preview.php:596 
     156#: gs-only-pdf-preview.php:349 gs-only-pdf-preview.php:504 
     157#: gs-only-pdf-preview.php:600 
    158158msgid "Regenerate PDF Previews" 
    159159msgstr "Régénérer les aperçus de miniature de PDF" 
     
    163163msgstr "Régén. aperçus PDF" 
    164164 
    165 #: gs-only-pdf-preview.php:363 gs-only-pdf-preview.php:465 
    166 #: gs-only-pdf-preview.php:664 
     165#: gs-only-pdf-preview.php:363 gs-only-pdf-preview.php:468 
     166#: gs-only-pdf-preview.php:668 
    167167msgid "Sorry, you are not allowed to access this page." 
    168168msgstr "" 
     
    170170"page. " 
    171171 
    172 #: gs-only-pdf-preview.php:472 
     172#: gs-only-pdf-preview.php:475 
    173173msgid "GS Only PDF Preview - Regenerate PDF Previews" 
    174174msgstr "GS Only PDF Preview -  Régénérer les aperçus de miniature de PDF." 
    175175 
    176 #: gs-only-pdf-preview.php:477 
     176#: gs-only-pdf-preview.php:480 
    177177msgid "" 
    178178"This tool is for regenerating the thumbnail previews of PDFs, but no PDFs " 
     
    182182"fichier PDF n&rsquo;a été téléchargé, donc il n&rsquo;a rien à faire." 
    183183 
    184 #: gs-only-pdf-preview.php:484 
     184#: gs-only-pdf-preview.php:487 
    185185msgid "" 
    186186"<strong>Warning: cannot set max execution time!</strong> The maximum time " 
     
    193193"donc éprouver l&rsquo;écran blanc de mort (WSOD) en essayant ceci." 
    194194 
    195 #: gs-only-pdf-preview.php:493 
     195#: gs-only-pdf-preview.php:496 
    196196msgid "Regenerate the thumbnail previews of PDFs uploaded to your system." 
    197197msgstr "" 
     
    200200 
    201201#. translators: %s: formatted number of PDFs found. 
    202 #: gs-only-pdf-preview.php:498 
     202#: gs-only-pdf-preview.php:501 
    203203msgid "<strong>%s</strong> PDF has been found." 
    204204msgid_plural "<strong>%s</strong> PDFs have been found." 
     
    207207 
    208208#. translators: %s: formatted number (greater than 10) of PDFs found. 
    209 #: gs-only-pdf-preview.php:506 
     209#: gs-only-pdf-preview.php:509 
    210210msgid "Regenerating %s PDF previews can take a long time." 
    211211msgstr "" 
     
    213213 
    214214#. translators: %s: url to the Media Library page in list mode. 
    215 #: gs-only-pdf-preview.php:518 
     215#: gs-only-pdf-preview.php:521 
    216216msgid "" 
    217217"Note that you can also regenerate PDF previews in batches or individually " 
     
    226226"<a href=\"%s\">mode de liste de la bibliothèque des médias</a>." 
    227227 
    228 #: gs-only-pdf-preview.php:558 
     228#: gs-only-pdf-preview.php:562 
    229229msgid "Please wait..." 
    230230msgstr "S&rsquo;il vous plaît attendre..." 
    231231 
    232 #: gs-only-pdf-preview.php:562 
     232#: gs-only-pdf-preview.php:566 
    233233msgid "No items selected!" 
    234234msgstr "Aucun élément sélectionné&nbsp;!" 
    235235 
    236 #: gs-only-pdf-preview.php:563 
     236#: gs-only-pdf-preview.php:567 
    237237msgid "Regenerate Preview ajax action not available!" 
    238238msgstr "" 
    239239"L&rsquo;action de régénérer l&rsquo;aperçu n&rsquo;est pas disponible&nbsp;!" 
    240240 
    241 #: gs-only-pdf-preview.php:567 
     241#: gs-only-pdf-preview.php:571 
    242242msgid "Document Link Only" 
    243243msgstr "Lien de document seulement" 
    244244 
    245245#. translators: %s: attachment title 
    246 #: gs-only-pdf-preview.php:649 
     246#: gs-only-pdf-preview.php:653 
    247247msgid "Regenerate the PDF preview for &#8220;%s&#8221;" 
    248248msgstr "Régénérer l&rsquo;aperçu de miniature de PDF pour &#8220;%s&#8221;" 
    249249 
    250 #: gs-only-pdf-preview.php:650 
     250#: gs-only-pdf-preview.php:654 
    251251msgid "Regenerate&nbsp;Preview" 
    252252msgstr "Régénérer&nbsp;l&rsquo;aperçu" 
    253253 
    254 #: gs-only-pdf-preview.php:669 
     254#: gs-only-pdf-preview.php:673 
    255255msgid "Invalid nonce." 
    256256msgstr "Nonce invalide." 
    257257 
    258 #: gs-only-pdf-preview.php:672 
     258#: gs-only-pdf-preview.php:676 
    259259msgid "Invalid ID." 
    260260msgstr "Identifiant invalide." 
    261261 
    262 #: gs-only-pdf-preview.php:678 
     262#: gs-only-pdf-preview.php:682 
    263263msgid "Failed to generate the PDF preview." 
    264264msgstr "Échec de générer l&rsquo;aperçu de miniature de PDF." 
    265265 
    266 #: gs-only-pdf-preview.php:683 
     266#: gs-only-pdf-preview.php:687 
    267267msgid "" 
    268268"Successfully regenerated the PDF preview. It's best to refresh your browser " 
     
    273273"jour correctement." 
    274274 
    275 #: gs-only-pdf-preview.php:685 
     275#: gs-only-pdf-preview.php:689 
    276276msgid "" 
    277277"Successfully regenerated the PDF preview. You will need to refresh your " 
     
    283283#. translators: %1$d: percentage of PDF previews completed; %2$d: completed 
    284284#. count. 
    285 #: gs-only-pdf-preview.php:714 
     285#: gs-only-pdf-preview.php:718 
    286286msgid "%d%% (%d)" 
    287287msgstr "%d%% (%d)" 
     
    299299msgstr "Pas de Ghostscript." 
    300300 
    301 #: includes/class-gopp-image-editor-gs.php:187 
     301#: includes/class-gopp-image-editor-gs.php:189 
    302302msgid "Image Editor Save Failed" 
    303303msgstr "L&rsquo;enregistrement de l&rsquo;éditeur d&rsquo;images a échoué." 
    304304 
    305 #: includes/class-gopp-image-editor-gs.php:192 
     305#: includes/class-gopp-image-editor-gs.php:194 
    306306msgid "Could not read image size." 
    307307msgstr "Impossible de lire la taille de l&rsquo;image." 
    308308 
    309 #: includes/class-gopp-image-editor-gs.php:230 
     309#: includes/class-gopp-image-editor-gs.php:232 
    310310msgid "Loading from URL not supported." 
    311311msgstr "Chargement à partir de l&rsquo;URL non pris en charge." 
    312312 
    313 #: includes/class-gopp-image-editor-gs.php:235 
    314 #: includes/class-gopp-image-editor-gs.php:241 
     313#: includes/class-gopp-image-editor-gs.php:237 
     314#: includes/class-gopp-image-editor-gs.php:243 
    315315msgid "Unsupported file name." 
    316316msgstr "Nom du fichier non supporté." 
    317317 
    318 #: includes/class-gopp-image-editor-gs.php:251 
     318#: includes/class-gopp-image-editor-gs.php:253 
    319319msgid "File doesn&#8217;t exist?" 
    320320msgstr "Le fichier n&rsquo;existe pas&nbsp;?" 
    321321 
    322 #: includes/class-gopp-image-editor-gs.php:258 
     322#: includes/class-gopp-image-editor-gs.php:260 
    323323msgid "File is not a PDF." 
    324324msgstr "Le fichier n&rsquo;est pas un PDF ." 
    325325 
    326 #: includes/class-gopp-image-editor-gs.php:642 
     326#: includes/class-gopp-image-editor-gs.php:647 
    327327msgid "Attempted to set PDF preview resolution to an invalid value." 
    328328msgstr "" 
     
    330330"valeur non valide." 
    331331 
    332 #: includes/class-gopp-image-editor-gs.php:697 
     332#: includes/class-gopp-image-editor-gs.php:702 
    333333msgid "Attempted to set PDF preview page to an invalid value." 
    334334msgstr "" 
     
    336336"non valide." 
    337337 
    338 #: 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 
     338#: includes/class-gopp-image-editor-gs.php:721 
     339#: includes/class-gopp-image-editor-gs.php:742 
     340#: includes/class-gopp-image-editor-gs.php:761 
     341#: includes/class-gopp-image-editor-gs.php:774 
     342#: includes/class-gopp-image-editor-gs.php:788 
     343#: includes/class-gopp-image-editor-gs.php:801 
    344344msgid "Unsupported operation." 
    345345msgstr "Opération non supportée." 
    346346 
    347 #: includes/debug-gopp-image-editor-gs.php:15 
     347#: includes/debug-gopp-image-editor-gs.php:12 
     348msgid "Exec disabled!" 
     349msgstr "Exec désactivé&nbsp;!" 
     350 
     351#: includes/debug-gopp-image-editor-gs.php:18 
    348352msgid "Ghostscript command not found!" 
    349353msgstr "Commande Ghostscript introuvable&nbsp;!" 
  • gs-only-pdf-preview/tags/1.0.7/languages/gs-only-pdf-preview.pot

    r1638573 r1677886  
    33msgid "" 
    44msgstr "" 
    5 "Project-Id-Version: GS Only PDF Preview 1.0.6\n" 
     5"Project-Id-Version: GS Only PDF Preview 1.0.7\n" 
    66"Report-Msgid-Bugs-To: " 
    77"https://wordpress.org/support/plugin/gs-only-pdf-preview\n" 
     
    132132 
    133133#: gs-only-pdf-preview.php:349 gs-only-pdf-preview.php:504 
    134 #: gs-only-pdf-preview.php:599 
     134#: gs-only-pdf-preview.php:600 
    135135msgid "Regenerate PDF Previews" 
    136136msgstr "" 
     
    141141 
    142142#: gs-only-pdf-preview.php:363 gs-only-pdf-preview.php:468 
    143 #: gs-only-pdf-preview.php:667 
     143#: gs-only-pdf-preview.php:668 
    144144msgid "Sorry, you are not allowed to access this page." 
    145145msgstr "" 
     
    187187msgstr "" 
    188188 
    189 #: gs-only-pdf-preview.php:561 
     189#: gs-only-pdf-preview.php:562 
    190190msgid "Please wait..." 
    191191msgstr "" 
    192192 
    193 #: gs-only-pdf-preview.php:565 
     193#: gs-only-pdf-preview.php:566 
    194194msgid "No items selected!" 
    195195msgstr "" 
    196196 
    197 #: gs-only-pdf-preview.php:566 
     197#: gs-only-pdf-preview.php:567 
    198198msgid "Regenerate Preview ajax action not available!" 
    199199msgstr "" 
    200200 
    201 #: gs-only-pdf-preview.php:570 
     201#: gs-only-pdf-preview.php:571 
    202202msgid "Document Link Only" 
    203203msgstr "" 
    204204 
    205 #: gs-only-pdf-preview.php:652 
     205#: gs-only-pdf-preview.php:653 
    206206#. translators: %s: attachment title 
    207207msgid "Regenerate the PDF preview for &#8220;%s&#8221;" 
    208208msgstr "" 
    209209 
    210 #: gs-only-pdf-preview.php:653 
     210#: gs-only-pdf-preview.php:654 
    211211msgid "Regenerate&nbsp;Preview" 
    212212msgstr "" 
    213213 
    214 #: gs-only-pdf-preview.php:672 
     214#: gs-only-pdf-preview.php:673 
    215215msgid "Invalid nonce." 
    216216msgstr "" 
    217217 
    218 #: gs-only-pdf-preview.php:675 
     218#: gs-only-pdf-preview.php:676 
    219219msgid "Invalid ID." 
    220220msgstr "" 
    221221 
    222 #: gs-only-pdf-preview.php:681 
     222#: gs-only-pdf-preview.php:682 
    223223msgid "Failed to generate the PDF preview." 
    224224msgstr "" 
    225225 
    226 #: gs-only-pdf-preview.php:686 
     226#: gs-only-pdf-preview.php:687 
    227227msgid "" 
    228228"Successfully regenerated the PDF preview. It's best to refresh your browser " 
     
    230230msgstr "" 
    231231 
    232 #: gs-only-pdf-preview.php:688 
     232#: gs-only-pdf-preview.php:689 
    233233msgid "" 
    234234"Successfully regenerated the PDF preview. You will need to refresh your " 
     
    236236msgstr "" 
    237237 
    238 #: gs-only-pdf-preview.php:717 
     238#: gs-only-pdf-preview.php:718 
    239239#. translators: %1$d: percentage of PDF previews completed; %2$d: completed 
    240240#. count. 
     
    254254msgstr "" 
    255255 
    256 #: includes/class-gopp-image-editor-gs.php:187 
     256#: includes/class-gopp-image-editor-gs.php:189 
    257257msgid "Image Editor Save Failed" 
    258258msgstr "" 
    259259 
    260 #: includes/class-gopp-image-editor-gs.php:192 
     260#: includes/class-gopp-image-editor-gs.php:194 
    261261msgid "Could not read image size." 
    262262msgstr "" 
    263263 
    264 #: includes/class-gopp-image-editor-gs.php:230 
     264#: includes/class-gopp-image-editor-gs.php:232 
    265265msgid "Loading from URL not supported." 
    266266msgstr "" 
    267267 
    268 #: includes/class-gopp-image-editor-gs.php:235 
    269 #: includes/class-gopp-image-editor-gs.php:241 
     268#: includes/class-gopp-image-editor-gs.php:237 
     269#: includes/class-gopp-image-editor-gs.php:243 
    270270msgid "Unsupported file name." 
    271271msgstr "" 
    272272 
    273 #: includes/class-gopp-image-editor-gs.php:251 
     273#: includes/class-gopp-image-editor-gs.php:253 
    274274msgid "File doesn&#8217;t exist?" 
    275275msgstr "" 
    276276 
    277 #: includes/class-gopp-image-editor-gs.php:258 
     277#: includes/class-gopp-image-editor-gs.php:260 
    278278msgid "File is not a PDF." 
    279279msgstr "" 
    280280 
    281 #: includes/class-gopp-image-editor-gs.php:642 
     281#: includes/class-gopp-image-editor-gs.php:647 
    282282msgid "Attempted to set PDF preview resolution to an invalid value." 
    283283msgstr "" 
    284284 
    285 #: includes/class-gopp-image-editor-gs.php:697 
     285#: includes/class-gopp-image-editor-gs.php:702 
    286286msgid "Attempted to set PDF preview page to an invalid value." 
    287287msgstr "" 
    288288 
    289 #: 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 
     289#: includes/class-gopp-image-editor-gs.php:721 
     290#: includes/class-gopp-image-editor-gs.php:742 
     291#: includes/class-gopp-image-editor-gs.php:761 
     292#: includes/class-gopp-image-editor-gs.php:774 
     293#: includes/class-gopp-image-editor-gs.php:788 
     294#: includes/class-gopp-image-editor-gs.php:801 
    295295msgid "Unsupported operation." 
    296296msgstr "" 
    297297 
    298 #: includes/debug-gopp-image-editor-gs.php:15 
     298#: includes/debug-gopp-image-editor-gs.php:12 
     299msgid "Exec disabled!" 
     300msgstr "" 
     301 
     302#: includes/debug-gopp-image-editor-gs.php:18 
    299303msgid "Ghostscript command not found!" 
    300304msgstr "" 
  • gs-only-pdf-preview/tags/1.0.7/readme.txt

    r1638573 r1677886  
    33Tags: Ghostscript, PDF, PDF Preview, Ghostscript Only 
    44Requires at least: 4.7.0 
    5 Tested up to: 4.7.3 
    6 Stable tag: 1.0.6 
     5Tested up to: 4.8.0 
     6Stable tag: 1.0.7 
    77License: GPLv2 or later 
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html 
     
    1212== Description == 
    1313 
    14 The plugin pre-empts the standard WordPress 4.7 PDF preview production process (which uses the PHP extension [`Imagick`](http://php.net/manual/en/book.imagick.php)) to call [Ghostscript](https://ghostscript.com/) directly to produce the preview. 
     14The plugin pre-empts the standard WordPress 4.7/4.8 PDF preview production process (which uses the PHP extension [`Imagick`](http://php.net/manual/en/book.imagick.php)) to call [Ghostscript](https://ghostscript.com/) directly to produce the preview. 
    1515 
    1616This means that only Ghostscript is required on the server. Neither the PHP module `Imagick` nor the server package [`ImageMagick`](https://www.imagemagick.org/script/index.php) is needed or used (though it's fine if they're installed anyway, and if they are they'll be used by WP (unless you override it) to produce the intermediate sizes of the preview). 
     
    2020The plugin was prompted by the `WP_Image_Editor_Imagick_External` demonstration class uploaded to the WP Trac ticket [#39262 Fall back to ImageMagick command line when the pecl imagic is not available on the server](https://core.trac.wordpress.org/ticket/39262) by [Hristo Pandjarov](https://profiles.wordpress.org/hristo-sg), and by the wish to solve the WP Trac ticket [#39216 PDFs with non-opaque alpha channels can result in previews with black backgrounds.](https://core.trac.wordpress.org/ticket/39216), which particularly affects PDFs with CMYK color spaces (common in the print world). 
    2121 
    22 The plugin by-passes (as far as PDF previews are concerned) #39216, and also by-passes the related issue [#39331 unsharpMaskImage in Imagick's thumbnail_image is not compatible with CMYK jpegs.](https://core.trac.wordpress.org/ticket/39331), as the preview jpegs produced directly by Ghostscript use sRGB color spaces. 
     22The plugin by-passes (as far as PDF previews are concerned) #39216, and also by-passes the related issue [#39331 unsharpMaskImage in Imagick's thumbnail_image is not compatible with CMYK JPEGs.](https://core.trac.wordpress.org/ticket/39331), as the preview JPEGs produced directly by Ghostscript use sRGB color spaces. 
    2323 
    2424= Limitations = 
     
    4040= Size = 
    4141 
    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": 
     42On 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": 
    4343 
    4444    function mytheme_wp_editor_set_quality( $quality, $mime_type ) { 
     
    5252= Quality = 
    5353 
    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. 
     54Eyeballing 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. 
    5555 
    5656= Tool = 
     
    6868A google-cheating schoolboy French translation is supplied. 
    6969 
    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. 
     70The plugin runs on WP 4.7.0 to 4.8.0, 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. 
    7171 
    7272The project is on [github](https://github.com/gitlost/gs-only-pdf-preview). 
     
    139139 
    140140== Changelog == 
     141 
     142= 1.0.7 (13 Jun 2017) = 
     143* Fix regex for patching "Align" select of Attachment Display Settings after core changeset [40640]. 
     144* Rejig tests. 
     145* WP 4.8.0 compatible. 
    141146 
    142147= 1.0.6 (16 Apr 2017) = 
     
    153158* Override get_size() to work if loaded. 
    154159* Enable "Alt Text" on Attachment Details. 
    155 * WP 4.7.3 compatible 
     160* WP 4.7.3 compatible. 
    156161 
    157162= 1.0.4 (13 Feb 2017) = 
     
    169174* Patch WP to allow preview image linking in Add Media (#39618). 
    170175* Patch WP to use thumbnail or medium sized thumbnails in Media Library (#39630). 
    171 * WP 4.7.2 compatible 
     176* WP 4.7.2 compatible. 
    172177 
    173178= 1.0.1 (20 Jan 2017) = 
     
    182187== Upgrade Notice == 
    183188 
     189= 1.0.7 = 
     190Tested with WordPress 4.8.0, with compatibility fix for patching "Align" select of Attachment Display Settings. 
     191 
    184192= 1.0.6 = 
    185193Keeps backward-compatibility for linked thumbnails. 
  • gs-only-pdf-preview/trunk/gs-only-pdf-preview.php

    r1638573 r1677886  
    44 * Plugin URI: https://github.com/gitlost/gs-only-pdf-preview 
    55 * Description: Uses Ghostscript directly to generate PDF previews. 
    6  * Version: 1.0.6 
     6 * Version: 1.0.7 
    77 * Author: gitlost 
    88 * Author URI: https://profiles.wordpress.org/gitlost 
     
    1717 
    1818// These need to be synced with "readme.txt". 
    19 define( 'GOPP_PLUGIN_VERSION', '1.0.6' ); // Sync also "package.json" and "language/gs-only-pdf-preview.pot". 
     19define( 'GOPP_PLUGIN_VERSION', '1.0.7' ); // Sync also "package.json" and "language/gs-only-pdf-preview.pot". 
    2020define( 'GOPP_PLUGIN_WP_AT_LEAST_VERSION', '4.7.0' ); 
    21 define( 'GOPP_PLUGIN_WP_UP_TO_VERSION', '4.7.3' ); 
     21define( 'GOPP_PLUGIN_WP_UP_TO_VERSION', '4.8.0' ); 
    2222 
    2323define( 'GOPP_REGEN_PDF_PREVIEWS_SLUG', 'gopp-regen-pdf-previews' ); 
     
    522522                    ?> 
    523523                </p> 
    524                 <?php if ( ( defined( 'GOPP_PLUGIN_DEBUG' ) && GOPP_PLUGIN_DEBUG ) || ! self::check_have_gs() ) : ?> 
    525                     <?php require_once dirname( __FILE__ ) . '/includes/debug-gopp-image-editor-gs.php'; ?> 
    526                     <?php DEBUG_GOPP_Image_Editor_GS::dump(); ?> 
    527                 <?php endif; ?> 
     524                <?php if ( ( defined( 'GOPP_PLUGIN_DEBUG' ) && GOPP_PLUGIN_DEBUG ) || ! self::check_have_gs() ) : 
     525                    self::load_gopp_image_editor_gs(); 
     526                    require_once dirname( __FILE__ ) . '/includes/debug-gopp-image-editor-gs.php'; 
     527                    DEBUG_GOPP_Image_Editor_GS::dump(); 
     528                endif; ?> 
    528529            </form> 
    529530            <?php 
  • gs-only-pdf-preview/trunk/includes/class-gopp-image-editor-gs.php

    r1638565 r1677886  
    181181            return new WP_Error( 'image_save_error', __( 'No Ghostscript.', 'gs-only-pdf-preview' ) ); 
    182182        } 
     183        $return_var = -1; 
     184        $output = array(); 
    183185        exec( $cmd, $output, $return_var ); 
    184186 
     
    321323     */ 
    322324    protected static function test_gs_cmd( $cmd ) { 
    323         // Note if exec() has been disabled by means not reflected in function_exists() it may barf here and throw warnings but we don't care that much. 
     325        // Note if exec() has been disabled by means not reflected in function_exists() it may barf here and throw warnings so initial vars. 
     326        $return_var = -1; 
     327        $output = array(); 
    324328        exec( self::escapeshellarg( $cmd ) . ' -dBATCH -dNOPAUSE -dNOPROMPT -dSAFER -v 2>&1', $output, $return_var ); 
    325329 
     
    363367        // Do one test query first to see if it works. 
    364368        $cmd = 'REG QUERY HKEY_LOCAL_MACHINE\\SOFTWARE 2>&1'; 
     369        $return_var = -1; 
    365370        $output = array(); 
    366371        exec( $cmd, $output, $return_var ); 
     
    813818            $filename = $dirname . '/' . wp_unique_filename( $dirname, 'gopp_size.jpg' ); 
    814819            if ( $cmd = self::gs_cmd( $this->get_gs_args( $filename ) ) ) { 
     820                $return_var = -1; 
     821                $output = array(); 
    815822                exec( $cmd, $output, $return_var ); 
    816823                if ( 0 === $return_var && ( $size = @ getimagesize( $filename ) ) ) { 
  • gs-only-pdf-preview/trunk/includes/debug-gopp-image-editor-gs.php

    r1638565 r1677886  
    99class DEBUG_GOPP_Image_Editor_GS extends GOPP_Image_Editor_GS { 
    1010    static function get_test_output() { 
     11        if ( self::is_exec_disabled() ) { 
     12            return array( -1, array( __( 'Exec disabled!', 'gs-only-pdf-preview' ) ) ); 
     13        } 
    1114        if ( $cmd = self::gs_cmd( '-dBATCH -dNOPAUSE -dNOPROMPT -dSAFER -v' ) ) { 
    1215            exec( $cmd, $output, $return_var ); 
     
    2326    static function filter_gopp_image_gs_cmd_path() { return has_filter( 'gopp_image_gs_cmd_path' ); } 
    2427    static function apply_filters_gopp_image_gs_cmd_path() { return apply_filters( 'gopp_image_gs_cmd_path', self::$gs_cmd_path, self::is_win() ); } 
     28 
     29    static function is_exec_disabled() { 
     30        $ini_get = ini_get( 'disable_functions' ); 
     31        if ( $ini_get && in_array( 'exec', array_map( 'trim', explode( ',', strtolower( $ini_get ) ) ), true ) ) { 
     32            return true; 
     33        } 
     34        if ( extension_loaded( 'suhosin' ) || extension_loaded( 'suhosin7' ) || ( version_compare( PHP_VERSION, '5.3', '>=' ) && ini_get( 'enable_dl' ) && @ dl( 'suhosin' ) ) ) { 
     35            $ini_get = ini_get( 'suhosin.executor.func.whitelist' ); 
     36            if ( $ini_get && in_array( 'exec', array_map( 'trim', explode( ',', strtolower( $ini_get ) ) ), true ) ) { 
     37                return false; 
     38            } 
     39            $ini_get = ini_get( 'suhosin.executor.func.blacklist' ); 
     40            if ( $ini_get && in_array( 'exec', array_map( 'trim', explode( ',', strtolower( $ini_get ) ) ), true ) ) { 
     41                return true; 
     42            } 
     43        } 
     44        return false; 
     45    } 
    2546 
    2647    static function dump() { 
  • gs-only-pdf-preview/trunk/js/gs-only-pdf-preview.js

    r1638565 r1677886  
    169169            attachment_details2_with = '$1 || ( \'application\' === data.type && data.sizes )$2', 
    170170            html_attachment_display_settings, 
    171             attachment_display_settings_re = /(<# if \( 'image' === data.type)( \) { #>\s+<label class="setting">)/, 
    172             attachment_display_settings_with = '$1 || ( \'application\' === data.type && data.sizes )$2', 
     171            attachment_display_settings_re = /(<# if \( 'image' === data.type)( \) { #>\s+<label class="setting)("| align")/, 
     172            attachment_display_settings_with = '$1 || ( \'application\' === data.type && data.sizes )$2$3', 
    173173            attachment_display_settings2_re = /(<# if \( data\.userSettings \) { #>\s+data-user-setting="imgsize"\s+<# } #>>)(\s+<#)/, 
    174174            attachment_display_settings2_with = '$1\n<# if ( \'application\' === data.type ) { #>\n<option value="">\n' + gopp_plugin_params.document_link_only + '\n</option>\n<# } #>\n$2', 
  • gs-only-pdf-preview/trunk/js/gs-only-pdf-preview.min.js

    r1638573 r1677886  
    1 /*! gs-only-pdf-preview 1.0.6 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); 
     1/*! gs-only-pdf-preview 1.0.7 2017-06-13 */ 
     2var 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)("| align")/,"$1 || ( 'application' === data.type && data.sizes )$2$3"),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

    r1638573 r1677886  
    33msgid "" 
    44msgstr "" 
    5 "Project-Id-Version: GS Only PDF Preview 1.0.6\n" 
     5"Project-Id-Version: GS Only PDF Preview 1.0.7\n" 
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/gs-only-pdf-" 
    77"preview\n" 
    8 "POT-Creation-Date: 2017-04-16 16:03+0100\n" 
    9 "PO-Revision-Date: 2017-04-16 16:03+0100\n" 
     8"POT-Creation-Date: 2017-06-12 22:29+0100\n" 
     9"PO-Revision-Date: 2017-06-12 22:29+0100\n" 
    1010"Last-Translator: gitlost <gitlost@gitlostbonger.com>\n" 
    1111"Language-Team: \n" 
     
    1414"Content-Type: text/plain; charset=UTF-8\n" 
    1515"Content-Transfer-Encoding: 8bit\n" 
    16 "X-Generator: Poedit 1.8.9\n" 
     16"X-Generator: Poedit 2.0.1\n" 
    1717"X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;" 
    1818"_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;" 
     
    154154msgstr "Vous pouvez aller de nouveau ci-dessous si vous voulez." 
    155155 
    156 #: gs-only-pdf-preview.php:349 gs-only-pdf-preview.php:501 
    157 #: gs-only-pdf-preview.php:596 
     156#: gs-only-pdf-preview.php:349 gs-only-pdf-preview.php:504 
     157#: gs-only-pdf-preview.php:600 
    158158msgid "Regenerate PDF Previews" 
    159159msgstr "Régénérer les aperçus de miniature de PDF" 
     
    163163msgstr "Régén. aperçus PDF" 
    164164 
    165 #: gs-only-pdf-preview.php:363 gs-only-pdf-preview.php:465 
    166 #: gs-only-pdf-preview.php:664 
     165#: gs-only-pdf-preview.php:363 gs-only-pdf-preview.php:468 
     166#: gs-only-pdf-preview.php:668 
    167167msgid "Sorry, you are not allowed to access this page." 
    168168msgstr "" 
     
    170170"page. " 
    171171 
    172 #: gs-only-pdf-preview.php:472 
     172#: gs-only-pdf-preview.php:475 
    173173msgid "GS Only PDF Preview - Regenerate PDF Previews" 
    174174msgstr "GS Only PDF Preview -  Régénérer les aperçus de miniature de PDF." 
    175175 
    176 #: gs-only-pdf-preview.php:477 
     176#: gs-only-pdf-preview.php:480 
    177177msgid "" 
    178178"This tool is for regenerating the thumbnail previews of PDFs, but no PDFs " 
     
    182182"fichier PDF n&rsquo;a été téléchargé, donc il n&rsquo;a rien à faire." 
    183183 
    184 #: gs-only-pdf-preview.php:484 
     184#: gs-only-pdf-preview.php:487 
    185185msgid "" 
    186186"<strong>Warning: cannot set max execution time!</strong> The maximum time " 
     
    193193"donc éprouver l&rsquo;écran blanc de mort (WSOD) en essayant ceci." 
    194194 
    195 #: gs-only-pdf-preview.php:493 
     195#: gs-only-pdf-preview.php:496 
    196196msgid "Regenerate the thumbnail previews of PDFs uploaded to your system." 
    197197msgstr "" 
     
    200200 
    201201#. translators: %s: formatted number of PDFs found. 
    202 #: gs-only-pdf-preview.php:498 
     202#: gs-only-pdf-preview.php:501 
    203203msgid "<strong>%s</strong> PDF has been found." 
    204204msgid_plural "<strong>%s</strong> PDFs have been found." 
     
    207207 
    208208#. translators: %s: formatted number (greater than 10) of PDFs found. 
    209 #: gs-only-pdf-preview.php:506 
     209#: gs-only-pdf-preview.php:509 
    210210msgid "Regenerating %s PDF previews can take a long time." 
    211211msgstr "" 
     
    213213 
    214214#. translators: %s: url to the Media Library page in list mode. 
    215 #: gs-only-pdf-preview.php:518 
     215#: gs-only-pdf-preview.php:521 
    216216msgid "" 
    217217"Note that you can also regenerate PDF previews in batches or individually " 
     
    226226"<a href=\"%s\">mode de liste de la bibliothèque des médias</a>." 
    227227 
    228 #: gs-only-pdf-preview.php:558 
     228#: gs-only-pdf-preview.php:562 
    229229msgid "Please wait..." 
    230230msgstr "S&rsquo;il vous plaît attendre..." 
    231231 
    232 #: gs-only-pdf-preview.php:562 
     232#: gs-only-pdf-preview.php:566 
    233233msgid "No items selected!" 
    234234msgstr "Aucun élément sélectionné&nbsp;!" 
    235235 
    236 #: gs-only-pdf-preview.php:563 
     236#: gs-only-pdf-preview.php:567 
    237237msgid "Regenerate Preview ajax action not available!" 
    238238msgstr "" 
    239239"L&rsquo;action de régénérer l&rsquo;aperçu n&rsquo;est pas disponible&nbsp;!" 
    240240 
    241 #: gs-only-pdf-preview.php:567 
     241#: gs-only-pdf-preview.php:571 
    242242msgid "Document Link Only" 
    243243msgstr "Lien de document seulement" 
    244244 
    245245#. translators: %s: attachment title 
    246 #: gs-only-pdf-preview.php:649 
     246#: gs-only-pdf-preview.php:653 
    247247msgid "Regenerate the PDF preview for &#8220;%s&#8221;" 
    248248msgstr "Régénérer l&rsquo;aperçu de miniature de PDF pour &#8220;%s&#8221;" 
    249249 
    250 #: gs-only-pdf-preview.php:650 
     250#: gs-only-pdf-preview.php:654 
    251251msgid "Regenerate&nbsp;Preview" 
    252252msgstr "Régénérer&nbsp;l&rsquo;aperçu" 
    253253 
    254 #: gs-only-pdf-preview.php:669 
     254#: gs-only-pdf-preview.php:673 
    255255msgid "Invalid nonce." 
    256256msgstr "Nonce invalide." 
    257257 
    258 #: gs-only-pdf-preview.php:672 
     258#: gs-only-pdf-preview.php:676 
    259259msgid "Invalid ID." 
    260260msgstr "Identifiant invalide." 
    261261 
    262 #: gs-only-pdf-preview.php:678 
     262#: gs-only-pdf-preview.php:682 
    263263msgid "Failed to generate the PDF preview." 
    264264msgstr "Échec de générer l&rsquo;aperçu de miniature de PDF." 
    265265 
    266 #: gs-only-pdf-preview.php:683 
     266#: gs-only-pdf-preview.php:687 
    267267msgid "" 
    268268"Successfully regenerated the PDF preview. It's best to refresh your browser " 
     
    273273"jour correctement." 
    274274 
    275 #: gs-only-pdf-preview.php:685 
     275#: gs-only-pdf-preview.php:689 
    276276msgid "" 
    277277"Successfully regenerated the PDF preview. You will need to refresh your " 
     
    283283#. translators: %1$d: percentage of PDF previews completed; %2$d: completed 
    284284#. count. 
    285 #: gs-only-pdf-preview.php:714 
     285#: gs-only-pdf-preview.php:718 
    286286msgid "%d%% (%d)" 
    287287msgstr "%d%% (%d)" 
     
    299299msgstr "Pas de Ghostscript." 
    300300 
    301 #: includes/class-gopp-image-editor-gs.php:187 
     301#: includes/class-gopp-image-editor-gs.php:189 
    302302msgid "Image Editor Save Failed" 
    303303msgstr "L&rsquo;enregistrement de l&rsquo;éditeur d&rsquo;images a échoué." 
    304304 
    305 #: includes/class-gopp-image-editor-gs.php:192 
     305#: includes/class-gopp-image-editor-gs.php:194 
    306306msgid "Could not read image size." 
    307307msgstr "Impossible de lire la taille de l&rsquo;image." 
    308308 
    309 #: includes/class-gopp-image-editor-gs.php:230 
     309#: includes/class-gopp-image-editor-gs.php:232 
    310310msgid "Loading from URL not supported." 
    311311msgstr "Chargement à partir de l&rsquo;URL non pris en charge." 
    312312 
    313 #: includes/class-gopp-image-editor-gs.php:235 
    314 #: includes/class-gopp-image-editor-gs.php:241 
     313#: includes/class-gopp-image-editor-gs.php:237 
     314#: includes/class-gopp-image-editor-gs.php:243 
    315315msgid "Unsupported file name." 
    316316msgstr "Nom du fichier non supporté." 
    317317 
    318 #: includes/class-gopp-image-editor-gs.php:251 
     318#: includes/class-gopp-image-editor-gs.php:253 
    319319msgid "File doesn&#8217;t exist?" 
    320320msgstr "Le fichier n&rsquo;existe pas&nbsp;?" 
    321321 
    322 #: includes/class-gopp-image-editor-gs.php:258 
     322#: includes/class-gopp-image-editor-gs.php:260 
    323323msgid "File is not a PDF." 
    324324msgstr "Le fichier n&rsquo;est pas un PDF ." 
    325325 
    326 #: includes/class-gopp-image-editor-gs.php:642 
     326#: includes/class-gopp-image-editor-gs.php:647 
    327327msgid "Attempted to set PDF preview resolution to an invalid value." 
    328328msgstr "" 
     
    330330"valeur non valide." 
    331331 
    332 #: includes/class-gopp-image-editor-gs.php:697 
     332#: includes/class-gopp-image-editor-gs.php:702 
    333333msgid "Attempted to set PDF preview page to an invalid value." 
    334334msgstr "" 
     
    336336"non valide." 
    337337 
    338 #: 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 
     338#: includes/class-gopp-image-editor-gs.php:721 
     339#: includes/class-gopp-image-editor-gs.php:742 
     340#: includes/class-gopp-image-editor-gs.php:761 
     341#: includes/class-gopp-image-editor-gs.php:774 
     342#: includes/class-gopp-image-editor-gs.php:788 
     343#: includes/class-gopp-image-editor-gs.php:801 
    344344msgid "Unsupported operation." 
    345345msgstr "Opération non supportée." 
    346346 
    347 #: includes/debug-gopp-image-editor-gs.php:15 
     347#: includes/debug-gopp-image-editor-gs.php:12 
     348msgid "Exec disabled!" 
     349msgstr "Exec désactivé&nbsp;!" 
     350 
     351#: includes/debug-gopp-image-editor-gs.php:18 
    348352msgid "Ghostscript command not found!" 
    349353msgstr "Commande Ghostscript introuvable&nbsp;!" 
  • gs-only-pdf-preview/trunk/languages/gs-only-pdf-preview.pot

    r1638573 r1677886  
    33msgid "" 
    44msgstr "" 
    5 "Project-Id-Version: GS Only PDF Preview 1.0.6\n" 
     5"Project-Id-Version: GS Only PDF Preview 1.0.7\n" 
    66"Report-Msgid-Bugs-To: " 
    77"https://wordpress.org/support/plugin/gs-only-pdf-preview\n" 
     
    132132 
    133133#: gs-only-pdf-preview.php:349 gs-only-pdf-preview.php:504 
    134 #: gs-only-pdf-preview.php:599 
     134#: gs-only-pdf-preview.php:600 
    135135msgid "Regenerate PDF Previews" 
    136136msgstr "" 
     
    141141 
    142142#: gs-only-pdf-preview.php:363 gs-only-pdf-preview.php:468 
    143 #: gs-only-pdf-preview.php:667 
     143#: gs-only-pdf-preview.php:668 
    144144msgid "Sorry, you are not allowed to access this page." 
    145145msgstr "" 
     
    187187msgstr "" 
    188188 
    189 #: gs-only-pdf-preview.php:561 
     189#: gs-only-pdf-preview.php:562 
    190190msgid "Please wait..." 
    191191msgstr "" 
    192192 
    193 #: gs-only-pdf-preview.php:565 
     193#: gs-only-pdf-preview.php:566 
    194194msgid "No items selected!" 
    195195msgstr "" 
    196196 
    197 #: gs-only-pdf-preview.php:566 
     197#: gs-only-pdf-preview.php:567 
    198198msgid "Regenerate Preview ajax action not available!" 
    199199msgstr "" 
    200200 
    201 #: gs-only-pdf-preview.php:570 
     201#: gs-only-pdf-preview.php:571 
    202202msgid "Document Link Only" 
    203203msgstr "" 
    204204 
    205 #: gs-only-pdf-preview.php:652 
     205#: gs-only-pdf-preview.php:653 
    206206#. translators: %s: attachment title 
    207207msgid "Regenerate the PDF preview for &#8220;%s&#8221;" 
    208208msgstr "" 
    209209 
    210 #: gs-only-pdf-preview.php:653 
     210#: gs-only-pdf-preview.php:654 
    211211msgid "Regenerate&nbsp;Preview" 
    212212msgstr "" 
    213213 
    214 #: gs-only-pdf-preview.php:672 
     214#: gs-only-pdf-preview.php:673 
    215215msgid "Invalid nonce." 
    216216msgstr "" 
    217217 
    218 #: gs-only-pdf-preview.php:675 
     218#: gs-only-pdf-preview.php:676 
    219219msgid "Invalid ID." 
    220220msgstr "" 
    221221 
    222 #: gs-only-pdf-preview.php:681 
     222#: gs-only-pdf-preview.php:682 
    223223msgid "Failed to generate the PDF preview." 
    224224msgstr "" 
    225225 
    226 #: gs-only-pdf-preview.php:686 
     226#: gs-only-pdf-preview.php:687 
    227227msgid "" 
    228228"Successfully regenerated the PDF preview. It's best to refresh your browser " 
     
    230230msgstr "" 
    231231 
    232 #: gs-only-pdf-preview.php:688 
     232#: gs-only-pdf-preview.php:689 
    233233msgid "" 
    234234"Successfully regenerated the PDF preview. You will need to refresh your " 
     
    236236msgstr "" 
    237237 
    238 #: gs-only-pdf-preview.php:717 
     238#: gs-only-pdf-preview.php:718 
    239239#. translators: %1$d: percentage of PDF previews completed; %2$d: completed 
    240240#. count. 
     
    254254msgstr "" 
    255255 
    256 #: includes/class-gopp-image-editor-gs.php:187 
     256#: includes/class-gopp-image-editor-gs.php:189 
    257257msgid "Image Editor Save Failed" 
    258258msgstr "" 
    259259 
    260 #: includes/class-gopp-image-editor-gs.php:192 
     260#: includes/class-gopp-image-editor-gs.php:194 
    261261msgid "Could not read image size." 
    262262msgstr "" 
    263263 
    264 #: includes/class-gopp-image-editor-gs.php:230 
     264#: includes/class-gopp-image-editor-gs.php:232 
    265265msgid "Loading from URL not supported." 
    266266msgstr "" 
    267267 
    268 #: includes/class-gopp-image-editor-gs.php:235 
    269 #: includes/class-gopp-image-editor-gs.php:241 
     268#: includes/class-gopp-image-editor-gs.php:237 
     269#: includes/class-gopp-image-editor-gs.php:243 
    270270msgid "Unsupported file name." 
    271271msgstr "" 
    272272 
    273 #: includes/class-gopp-image-editor-gs.php:251 
     273#: includes/class-gopp-image-editor-gs.php:253 
    274274msgid "File doesn&#8217;t exist?" 
    275275msgstr "" 
    276276 
    277 #: includes/class-gopp-image-editor-gs.php:258 
     277#: includes/class-gopp-image-editor-gs.php:260 
    278278msgid "File is not a PDF." 
    279279msgstr "" 
    280280 
    281 #: includes/class-gopp-image-editor-gs.php:642 
     281#: includes/class-gopp-image-editor-gs.php:647 
    282282msgid "Attempted to set PDF preview resolution to an invalid value." 
    283283msgstr "" 
    284284 
    285 #: includes/class-gopp-image-editor-gs.php:697 
     285#: includes/class-gopp-image-editor-gs.php:702 
    286286msgid "Attempted to set PDF preview page to an invalid value." 
    287287msgstr "" 
    288288 
    289 #: 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 
     289#: includes/class-gopp-image-editor-gs.php:721 
     290#: includes/class-gopp-image-editor-gs.php:742 
     291#: includes/class-gopp-image-editor-gs.php:761 
     292#: includes/class-gopp-image-editor-gs.php:774 
     293#: includes/class-gopp-image-editor-gs.php:788 
     294#: includes/class-gopp-image-editor-gs.php:801 
    295295msgid "Unsupported operation." 
    296296msgstr "" 
    297297 
    298 #: includes/debug-gopp-image-editor-gs.php:15 
     298#: includes/debug-gopp-image-editor-gs.php:12 
     299msgid "Exec disabled!" 
     300msgstr "" 
     301 
     302#: includes/debug-gopp-image-editor-gs.php:18 
    299303msgid "Ghostscript command not found!" 
    300304msgstr "" 
  • gs-only-pdf-preview/trunk/readme.txt

    r1638573 r1677886  
    33Tags: Ghostscript, PDF, PDF Preview, Ghostscript Only 
    44Requires at least: 4.7.0 
    5 Tested up to: 4.7.3 
    6 Stable tag: 1.0.6 
     5Tested up to: 4.8.0 
     6Stable tag: 1.0.7 
    77License: GPLv2 or later 
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html 
     
    1212== Description == 
    1313 
    14 The plugin pre-empts the standard WordPress 4.7 PDF preview production process (which uses the PHP extension [`Imagick`](http://php.net/manual/en/book.imagick.php)) to call [Ghostscript](https://ghostscript.com/) directly to produce the preview. 
     14The plugin pre-empts the standard WordPress 4.7/4.8 PDF preview production process (which uses the PHP extension [`Imagick`](http://php.net/manual/en/book.imagick.php)) to call [Ghostscript](https://ghostscript.com/) directly to produce the preview. 
    1515 
    1616This means that only Ghostscript is required on the server. Neither the PHP module `Imagick` nor the server package [`ImageMagick`](https://www.imagemagick.org/script/index.php) is needed or used (though it's fine if they're installed anyway, and if they are they'll be used by WP (unless you override it) to produce the intermediate sizes of the preview). 
     
    2020The plugin was prompted by the `WP_Image_Editor_Imagick_External` demonstration class uploaded to the WP Trac ticket [#39262 Fall back to ImageMagick command line when the pecl imagic is not available on the server](https://core.trac.wordpress.org/ticket/39262) by [Hristo Pandjarov](https://profiles.wordpress.org/hristo-sg), and by the wish to solve the WP Trac ticket [#39216 PDFs with non-opaque alpha channels can result in previews with black backgrounds.](https://core.trac.wordpress.org/ticket/39216), which particularly affects PDFs with CMYK color spaces (common in the print world). 
    2121 
    22 The plugin by-passes (as far as PDF previews are concerned) #39216, and also by-passes the related issue [#39331 unsharpMaskImage in Imagick's thumbnail_image is not compatible with CMYK jpegs.](https://core.trac.wordpress.org/ticket/39331), as the preview jpegs produced directly by Ghostscript use sRGB color spaces. 
     22The plugin by-passes (as far as PDF previews are concerned) #39216, and also by-passes the related issue [#39331 unsharpMaskImage in Imagick's thumbnail_image is not compatible with CMYK JPEGs.](https://core.trac.wordpress.org/ticket/39331), as the preview JPEGs produced directly by Ghostscript use sRGB color spaces. 
    2323 
    2424= Limitations = 
     
    4040= Size = 
    4141 
    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": 
     42On 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": 
    4343 
    4444    function mytheme_wp_editor_set_quality( $quality, $mime_type ) { 
     
    5252= Quality = 
    5353 
    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. 
     54Eyeballing 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. 
    5555 
    5656= Tool = 
     
    6868A google-cheating schoolboy French translation is supplied. 
    6969 
    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. 
     70The plugin runs on WP 4.7.0 to 4.8.0, 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. 
    7171 
    7272The project is on [github](https://github.com/gitlost/gs-only-pdf-preview). 
     
    139139 
    140140== Changelog == 
     141 
     142= 1.0.7 (13 Jun 2017) = 
     143* Fix regex for patching "Align" select of Attachment Display Settings after core changeset [40640]. 
     144* Rejig tests. 
     145* WP 4.8.0 compatible. 
    141146 
    142147= 1.0.6 (16 Apr 2017) = 
     
    153158* Override get_size() to work if loaded. 
    154159* Enable "Alt Text" on Attachment Details. 
    155 * WP 4.7.3 compatible 
     160* WP 4.7.3 compatible. 
    156161 
    157162= 1.0.4 (13 Feb 2017) = 
     
    169174* Patch WP to allow preview image linking in Add Media (#39618). 
    170175* Patch WP to use thumbnail or medium sized thumbnails in Media Library (#39630). 
    171 * WP 4.7.2 compatible 
     176* WP 4.7.2 compatible. 
    172177 
    173178= 1.0.1 (20 Jan 2017) = 
     
    182187== Upgrade Notice == 
    183188 
     189= 1.0.7 = 
     190Tested with WordPress 4.8.0, with compatibility fix for patching "Align" select of Attachment Display Settings. 
     191 
    184192= 1.0.6 = 
    185193Keeps backward-compatibility for linked thumbnails. 
Note: See TracChangeset for help on using the changeset viewer.