Plugin Directory

Changeset 697354


Ignore:
Timestamp:
04/14/2013 03:08:12 PM (13 years ago)
Author:
sewpafly
Message:

Fixed adding multiple thumbnails

Location:
post-thumbnail-extras/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • post-thumbnail-extras/trunk/README.txt

    r696871 r697354  
    3939
    4040== Screenshots ==
    41 
    42411. In Settings → Media, click the plus sign to add a new post thumbnail.
    43422. Update the width/height and whether or not the post-thumbnail should be cropped to an exact size. (If the width or height is set to 0, that boundary constraint is not enforced). Make sure you click the "save" button so that the changes are stored in the database.
  • post-thumbnail-extras/trunk/php/options.php

    r696870 r697354  
    3838            (function($){
    3939                $(function(){
    40                     var post_template = $('#ptx-template').html();
     40                    var post_template = $('#ptx-template').html(), counter = 0;
    4141                    $('.ptx-add-thumb').click(function(e){
    4242                        e.preventDefault();
    43                         $(this).parents('tr').siblings().last().after($(post_template));
     43                        var html = post_template.replace(/new-name/g, 'new-name-' + counter++);
     44                        $(this).parents('tr').siblings().last().after($(html));
    4445                    });
    4546                    $('body').delegate('.ptx-delete-thumb', 'click', function(e){
     
    130131        $pattern = "/[^[:alnum:]-]+/";
    131132        foreach ( $input as $name => $thumbnail ) {
    132             if ( !isset( $thumbnail['name'] ) || $thumbnail['name'] == "" )
    133                 if ( $name == "new-name" )
     133            if ( !isset( $thumbnail['name'] ) || $thumbnail['name'] == "" ) {
     134                if ( preg_match( "/^new-name-[0-9]{1,2}/", $name ) ) {
    134135                    $thumbnail['name'] = 'new-name-' . preg_replace( $pattern, "", uniqid() );
    135                 else
     136                } else {
    136137                    $thumbnail['name'] = $name;
     138                }
     139            }
    137140
    138141            //add_settings_error( 'ptx-post-thumbnails'
    139142            //    , NULL, "'$thumbnail[name]'");
    140143            // Validate the name
    141             if ( preg_match( "$pattern", $thumbnail['name'] ) ) {
     144            if ( preg_match( $pattern, $thumbnail['name'] ) ) {
    142145                add_settings_error( 'ptx-post-thumbnails'
    143146                    , NULL
  • post-thumbnail-extras/trunk/post-thumbnail-extras.php

    r696870 r697354  
    55Author: sewpafly
    66Author URI: http://sewpafly.github.io/post-thumbnail-editor/
    7 Version: 2.0
     7Version: 2.1
    88Description: Little things that make using post thumbnails easier
    99*/
Note: See TracChangeset for help on using the changeset viewer.