Plugin Directory

Changeset 1066688


Ignore:
Timestamp:
01/13/2015 05:44:20 AM (11 years ago)
Author:
sewpafly
Message:

2.4.3

Location:
post-thumbnail-editor
Files:
10 edited
9 copied

Legend:

Unmodified
Added
Removed
  • post-thumbnail-editor/tags/2.4.3/README.txt

    r1001040 r1066688  
    33Donate link: http://sewpafly.github.io/post-thumbnail-editor/#toc_donations
    44Tags: post-thumbnail, post thumbnail, featured image, featured, editor, image, awesome, crop
    5 Requires at least: 3.5
    6 Tested up to: 4.0.x
     5Requires at least: 4.1
     6Tested up to: 4.1.x
    77Stable tag: trunk
    88License: GPLv2
     
    7575
    7676== Changelog ==
     77
     78= 2.4.3 =
     79* Debug mode was broken
     80* Update the generated .gz javascript file
     81* modify the media library to have a fallback url
     82* check that option `pte_jpeg_compression` exists before trying to access it
    7783
    7884= 2.4.2 =
  • post-thumbnail-editor/tags/2.4.3/html/pte.php

    r1001040 r1066688  
    284284<?php
    285285
    286                function evaluate_attributes( $array ) {
    287                    foreach ( $array as $key => $value ) {
    288                        $attributes[] = "$key=\"$value\"";
    289                    }
    290                    return $attributes;
    291                }
    292 
    293                $script_tag = "<script %s></script>";
    294                $options = pte_get_options();
    295                if ( $options['pte_debug'] ) {
    296                    $script_attributes = evaluate_attributes( array(
    297                        'src' => PTE_PLUGINURL . "apps/requirejs/require.js",
    298                        'data-main' => PTE_PLUGINURL . 'js/main'
    299                    ) );
    300                }
    301                else {
    302                    $script_attributes = evaluate_attributes( array(
    303                        'src' => PTE_PLUGINURL . "js-build/main.js"
    304                    ) );
    305                }
    306 
    307 
    308                echo sprintf( $script_tag, join( $script_attributes, " " ) );
     286function enqueue_script_filter($tag, $handle) {
     287    if ('pte-require' !== $handle)
     288        return $tag;
     289    return str_replace(' src', ' data-main="' . PTE_PLUGINURL . 'js/main" src', $tag);
     290}
     291
     292$options = pte_get_options();
     293
     294if ( $options['pte_debug'] ) {
     295    wp_enqueue_script(
     296        'pte-require',
     297        PTE_PLUGINURL . "apps/requirejs/require.js",
     298        null,
     299        PTE_VERSION,
     300        true
     301    );
     302    add_filter('script_loader_tag', 'enqueue_script_filter', 10, 2);
     303}
     304else {
     305    wp_enqueue_script(
     306        'pte-min-js',
     307        PTE_PLUGINURL . "js-build/main.js",
     308        null,
     309        PTE_VERSION,
     310        true
     311    );
     312}
  • post-thumbnail-editor/tags/2.4.3/js/snippets/pte_enable_media.js

    r982619 r1066688  
    1414     // Change the attachment-details html
    1515     injectTemplate = _.template("<a class=\"pte\" href=\"" +
    16                                  pteL10n.url.replace(/&TB_iframe=true/,'') +
     16                                 pteL10n.fallbackUrl.replace(/&TB_iframe=true/,'') +
    1717                                 "\">\n   " +
    1818                                 pteL10n.PTE +
     
    2525     template = $("#tmpl-attachment-details-two-column").text();
    2626     template = template.replace(/(<div class="actions">)([\s\S]*?)(<\/div>)/m,
    27                                  "$1$2" + injectTemplate + "$3");
     27                                 "$1$2| " + injectTemplate + "$3");
    2828     $("#tmpl-attachment-details-two-column").text(template);
    2929   });
     
    5151      loadPteEditor: function(evt) {
    5252         evt.preventDefault();
     53         evt.stopImmediatePropagation();
     54
    5355         var state = this.controller.state().id;
    5456         var me = this;
  • post-thumbnail-editor/tags/2.4.3/php/functions.php

    r1001040 r1066688  
    251251        "\nWORDPRESS:   " . $GLOBALS['wp_version'] );
    252252
    253     $script_url = PTE_PLUGINURL . 'php/load-scripts.php?load=jquery,imgareaselect,jquery-json,pte';
    254     $style_url = PTE_PLUGINURL . 'php/load-styles.php?load=imgareaselect,pte';
    255     if ( $options['pte_debug'] ){
    256         $style_url .= "&d=1";
    257         $script_url .= "&d=1";
    258     }
    259 
    260253    // Generate an image and put into the ptetmp directory
    261254    if (false === $editor_image = pte_generate_working_image($id)) {
  • post-thumbnail-editor/tags/2.4.3/php/options.php

    r982619 r1066688  
    108108    foreach ( $sizes as $size ){
    109109        // Hidden
    110         if ( is_array( $input['pte_hidden_sizes'] )
    111             and in_array( $size, $input['pte_hidden_sizes'] ) ){
     110        if ( isset($input['pte_hidden_sizes']) && is_array( $input['pte_hidden_sizes'] )
     111            && in_array( $size, $input['pte_hidden_sizes'] ) ){
    112112                $pte_hidden_sizes[] = $size;
    113113            }
     
    117117
    118118    // Check the JPEG Compression value
    119     if ( $input['pte_jpeg_compression'] != "" ){
     119    if ( isset($input['pte_jpeg_compression']) && $input['pte_jpeg_compression'] != "" ){
    120120        $tmp_jpeg_compression = (int) preg_replace( "/[\D]/", "", $input['pte_jpeg_compression'] );
    121121        if ( ! is_int( $tmp_jpeg_compression )
  • post-thumbnail-editor/tags/2.4.3/post-thumbnail-editor.php

    r1001040 r1066688  
    55Author: sewpafly
    66Author URI: http://sewpafly.github.io/post-thumbnail-editor/
    7 Version: 2.4.2
     7Version: 2.4.3
    88Description: Individually manage your post thumbnails
    99
     
    3535define( 'PTE_PLUGINPATH', dirname(__FILE__) . "/");
    3636define( 'PTE_DOMAIN', "post-thumbnail-editor");
    37 define( 'PTE_VERSION', "2.4.2");
     37define( 'PTE_VERSION', "2.4.3");
    3838
    3939// TODO:
     
    211211        , array('PTE' => __('Post Thumbnail Editor', PTE_DOMAIN)
    212212            , 'url' => pte_url( "<%= id %>", true )
     213            , 'fallbackUrl' => pte_url( "<%= id %>" )
    213214        )
    214215    );
     
    339340        , array('PTE' => __('Post Thumbnail Editor', PTE_DOMAIN)
    340341            , 'url' => pte_url( "<%= id %>", true )
     342            , 'fallbackUrl' => pte_url( "<%= id %>" )
    341343        )
    342344    );
     
    443445
    444446    include_once( PTE_PLUGINPATH . "php/functions.php" );
    445     $pte_body = pte_body( $post->ID );
    446447
    447448    // Add the scripts and styles
     
    451452    wp_enqueue_style( 'colors' );
    452453    wp_enqueue_style( 'wp-jquery-ui-dialog' );
     454
     455    $pte_body = pte_body( $post->ID );
    453456}
    454457
  • post-thumbnail-editor/trunk/README.txt

    r1001040 r1066688  
    33Donate link: http://sewpafly.github.io/post-thumbnail-editor/#toc_donations
    44Tags: post-thumbnail, post thumbnail, featured image, featured, editor, image, awesome, crop
    5 Requires at least: 3.5
    6 Tested up to: 4.0.x
     5Requires at least: 4.1
     6Tested up to: 4.1.x
    77Stable tag: trunk
    88License: GPLv2
     
    7575
    7676== Changelog ==
     77
     78= 2.4.3 =
     79* Debug mode was broken
     80* Update the generated .gz javascript file
     81* modify the media library to have a fallback url
     82* check that option `pte_jpeg_compression` exists before trying to access it
    7783
    7884= 2.4.2 =
  • post-thumbnail-editor/trunk/html/pte.php

    r1001040 r1066688  
    284284<?php
    285285
    286                function evaluate_attributes( $array ) {
    287                    foreach ( $array as $key => $value ) {
    288                        $attributes[] = "$key=\"$value\"";
    289                    }
    290                    return $attributes;
    291                }
    292 
    293                $script_tag = "<script %s></script>";
    294                $options = pte_get_options();
    295                if ( $options['pte_debug'] ) {
    296                    $script_attributes = evaluate_attributes( array(
    297                        'src' => PTE_PLUGINURL . "apps/requirejs/require.js",
    298                        'data-main' => PTE_PLUGINURL . 'js/main'
    299                    ) );
    300                }
    301                else {
    302                    $script_attributes = evaluate_attributes( array(
    303                        'src' => PTE_PLUGINURL . "js-build/main.js"
    304                    ) );
    305                }
    306 
    307 
    308                echo sprintf( $script_tag, join( $script_attributes, " " ) );
     286function enqueue_script_filter($tag, $handle) {
     287    if ('pte-require' !== $handle)
     288        return $tag;
     289    return str_replace(' src', ' data-main="' . PTE_PLUGINURL . 'js/main" src', $tag);
     290}
     291
     292$options = pte_get_options();
     293
     294if ( $options['pte_debug'] ) {
     295    wp_enqueue_script(
     296        'pte-require',
     297        PTE_PLUGINURL . "apps/requirejs/require.js",
     298        null,
     299        PTE_VERSION,
     300        true
     301    );
     302    add_filter('script_loader_tag', 'enqueue_script_filter', 10, 2);
     303}
     304else {
     305    wp_enqueue_script(
     306        'pte-min-js',
     307        PTE_PLUGINURL . "js-build/main.js",
     308        null,
     309        PTE_VERSION,
     310        true
     311    );
     312}
  • post-thumbnail-editor/trunk/js/snippets/pte_enable_media.js

    r982619 r1066688  
    1414     // Change the attachment-details html
    1515     injectTemplate = _.template("<a class=\"pte\" href=\"" +
    16                                  pteL10n.url.replace(/&TB_iframe=true/,'') +
     16                                 pteL10n.fallbackUrl.replace(/&TB_iframe=true/,'') +
    1717                                 "\">\n   " +
    1818                                 pteL10n.PTE +
     
    2525     template = $("#tmpl-attachment-details-two-column").text();
    2626     template = template.replace(/(<div class="actions">)([\s\S]*?)(<\/div>)/m,
    27                                  "$1$2" + injectTemplate + "$3");
     27                                 "$1$2| " + injectTemplate + "$3");
    2828     $("#tmpl-attachment-details-two-column").text(template);
    2929   });
     
    5151      loadPteEditor: function(evt) {
    5252         evt.preventDefault();
     53         evt.stopImmediatePropagation();
     54
    5355         var state = this.controller.state().id;
    5456         var me = this;
  • post-thumbnail-editor/trunk/php/functions.php

    r1001040 r1066688  
    251251        "\nWORDPRESS:   " . $GLOBALS['wp_version'] );
    252252
    253     $script_url = PTE_PLUGINURL . 'php/load-scripts.php?load=jquery,imgareaselect,jquery-json,pte';
    254     $style_url = PTE_PLUGINURL . 'php/load-styles.php?load=imgareaselect,pte';
    255     if ( $options['pte_debug'] ){
    256         $style_url .= "&d=1";
    257         $script_url .= "&d=1";
    258     }
    259 
    260253    // Generate an image and put into the ptetmp directory
    261254    if (false === $editor_image = pte_generate_working_image($id)) {
  • post-thumbnail-editor/trunk/php/options.php

    r982619 r1066688  
    108108    foreach ( $sizes as $size ){
    109109        // Hidden
    110         if ( is_array( $input['pte_hidden_sizes'] )
    111             and in_array( $size, $input['pte_hidden_sizes'] ) ){
     110        if ( isset($input['pte_hidden_sizes']) && is_array( $input['pte_hidden_sizes'] )
     111            && in_array( $size, $input['pte_hidden_sizes'] ) ){
    112112                $pte_hidden_sizes[] = $size;
    113113            }
     
    117117
    118118    // Check the JPEG Compression value
    119     if ( $input['pte_jpeg_compression'] != "" ){
     119    if ( isset($input['pte_jpeg_compression']) && $input['pte_jpeg_compression'] != "" ){
    120120        $tmp_jpeg_compression = (int) preg_replace( "/[\D]/", "", $input['pte_jpeg_compression'] );
    121121        if ( ! is_int( $tmp_jpeg_compression )
  • post-thumbnail-editor/trunk/post-thumbnail-editor.php

    r1001040 r1066688  
    55Author: sewpafly
    66Author URI: http://sewpafly.github.io/post-thumbnail-editor/
    7 Version: 2.4.2
     7Version: 2.4.3
    88Description: Individually manage your post thumbnails
    99
     
    3535define( 'PTE_PLUGINPATH', dirname(__FILE__) . "/");
    3636define( 'PTE_DOMAIN', "post-thumbnail-editor");
    37 define( 'PTE_VERSION', "2.4.2");
     37define( 'PTE_VERSION', "2.4.3");
    3838
    3939// TODO:
     
    211211        , array('PTE' => __('Post Thumbnail Editor', PTE_DOMAIN)
    212212            , 'url' => pte_url( "<%= id %>", true )
     213            , 'fallbackUrl' => pte_url( "<%= id %>" )
    213214        )
    214215    );
     
    339340        , array('PTE' => __('Post Thumbnail Editor', PTE_DOMAIN)
    340341            , 'url' => pte_url( "<%= id %>", true )
     342            , 'fallbackUrl' => pte_url( "<%= id %>" )
    341343        )
    342344    );
     
    443445
    444446    include_once( PTE_PLUGINPATH . "php/functions.php" );
    445     $pte_body = pte_body( $post->ID );
    446447
    447448    // Add the scripts and styles
     
    451452    wp_enqueue_style( 'colors' );
    452453    wp_enqueue_style( 'wp-jquery-ui-dialog' );
     454
     455    $pte_body = pte_body( $post->ID );
    453456}
    454457
Note: See TracChangeset for help on using the changeset viewer.