Post Thumbnail Editor - Version 1.0.3

Version Description

  • Fixed some javascript issues
  • Added Italian translation
Download this release

Release Info

Developer sewpafly
Plugin Icon Post Thumbnail Editor
Version 1.0.3
Comparing to
See all releases

Code changes from version 1.0.2 to 1.0.3

README.txt CHANGED
@@ -63,6 +63,10 @@ Using a version with [json_encode](http://www.php.net/manual/en/function.json-en
63
 
64
  == Changelog ==
65
 
 
 
 
 
66
  = 1.0.2 =
67
  * Problem with SVN commit of 1.0.1
68
 
@@ -88,6 +92,9 @@ Using a version with [json_encode](http://www.php.net/manual/en/function.json-en
88
 
89
  == Upgrade Notice ==
90
 
 
 
 
91
  = 1.0.2 =
92
  Problem with SVN commit of 1.0.1
93
 
63
 
64
  == Changelog ==
65
 
66
+ = 1.0.3 =
67
+ * Fixed some javascript issues
68
+ * Added Italian translation
69
+
70
  = 1.0.2 =
71
  * Problem with SVN commit of 1.0.1
72
 
92
 
93
  == Upgrade Notice ==
94
 
95
+ = 1.0.3 =
96
+ Fixed javascript problems & added italian translation
97
+
98
  = 1.0.2 =
99
  Problem with SVN commit of 1.0.1
100
 
i18n/post-thumbnail-editor-it_IT.mo ADDED
Binary file
i18n/post-thumbnail-editor-it_IT.po ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2010 Post Thumbnail Editor
2
+ # This file is distributed under the same license as the Post Thumbnail Editor package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Post Thumbnail Editor 1.0.2\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/post-thumbnail-editor\n"
7
+ "POT-Creation-Date: 2011-09-06 15:57:59+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2011-09-07 14:33+0100\n"
12
+ "Last-Translator: Mac\n"
13
+ "Language-Team: Marco Rossi <macitaly@gmail.com>\n"
14
+ "X-Poedit-Language: Italian\n"
15
+ "X-Poedit-Country: ITALY\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+
18
+ #: html/pte.php:20
19
+ msgid "Post Thumbnail Editor - Step 1"
20
+ msgstr "Modifica delle miniature - Passo 1"
21
+
22
+ #: html/pte.php:33
23
+ msgid "Create Thumbnails"
24
+ msgstr "Crea miniatura"
25
+
26
+ #: html/pte.php:39
27
+ msgid "Choose the images/thumbnails that you want to edit:"
28
+ msgstr "Scegli le immagini/miniature che vuoi modificare:"
29
+
30
+ #: html/pte.php:42
31
+ msgid "Select: %1$sAll%2$s | %3$sNone%4$s"
32
+ msgstr "Seleziona: %1$sTutte%2$s | %3$sNessuna%4$s"
33
+
34
+ #: html/pte.php:59
35
+ msgid "Current image:"
36
+ msgstr "Dimensione Miniatura:"
37
+
38
+ #: html/pte.php:78
39
+ msgid "Back"
40
+ msgstr "Indietro"
41
+
42
+ #: html/pte.php:80
43
+ msgid "Post Thumbnail Editor - Step 2"
44
+ msgstr "Modifica delle miniature - Passo 2"
45
+
46
+ #: html/pte.php:83
47
+ #: html/pte.php:144
48
+ msgid "We noticed some potential issues:"
49
+ msgstr "Abbiamo rilevato alcuni potenziali problemi:"
50
+
51
+ #: html/pte.php:86
52
+ msgid "View %1$slogs%2$s for further information"
53
+ msgstr "Esamina i %1$slogs%2$s per avere ulteriori informazioni"
54
+
55
+ #: html/pte.php:91
56
+ msgid "%1$sEnable debugging%2$s for additional information"
57
+ msgstr "%1$sAbilita il debugging%2$s per avere ulteriori informazioni"
58
+
59
+ #: html/pte.php:101
60
+ msgid "Select the images you want to keep: %1$sAll%2$s | %3$sNone%4$s"
61
+ msgstr "Seleziona le immagini che vuoi mantenere: %1$sTutte%2$s | %3$sNessuna%4$s"
62
+
63
+ #: html/pte.php:124
64
+ msgid "Okay, these look good..."
65
+ msgstr "Ok, queste vanno bene..."
66
+
67
+ #: html/pte.php:128
68
+ msgid "I'd rather start over..."
69
+ msgstr "Preferisco riprovare ..."
70
+
71
+ #. #-#-#-#-# post-thumbnail-editor.pot (Post Thumbnail Editor 1.0.1-alpha2) #-#-#-#-#
72
+ #. Plugin Name of the plugin/theme
73
+ #: html/pte.php:135
74
+ #: post-thumbnail-editor.php:113
75
+ #: post-thumbnail-editor.php:178
76
+ #: post-thumbnail-editor.php:179
77
+ #: php/options.php:64
78
+ msgid "Post Thumbnail Editor"
79
+ msgstr "Post Thumbnail Editor"
80
+
81
+ #: html/pte.php:138
82
+ msgid "Images were created successfully."
83
+ msgstr "Le nuove immagini sono state create perfettamente."
84
+
85
+ #: html/pte.php:140
86
+ msgid "Click %1$shere%2$s to modify another thumbnail."
87
+ msgstr "Clicca %1$squi%2$s per modificare altre miniature."
88
+
89
+ #: html/pte.php:156
90
+ msgid "Please wait"
91
+ msgstr "Si prega di attendere"
92
+
93
+ #: html/pte.php:160
94
+ msgid "Click here to show application logs"
95
+ msgstr "Clicca qui per mostrare i logs dell'applicazione"
96
+
97
+ #: html/pte.php:162
98
+ #: php/options.php:30
99
+ msgid "Debug"
100
+ msgstr "Debug"
101
+
102
+ #: html/pte.php:167
103
+ msgid "If you are having any issues with this plugin, create a problem report on %1$sgithub%2$s or %3$swordpress.org%4$s so that I can look into it. Copy these log statements and include some information about what you were trying to do, the expected output, and the output you got (the more information the better). Thanks and good luck!"
104
+ msgstr "Se hai problemi con questo plugin, apri un rapporto su %1$sgithub%2$s o %3$swordpress.org%4$s in modo da permettermi di esaminarlo. Copia il testo di questi logs e includi tutte le informazioni necessarie su cosa stavi facendo quando si è verificato il problema, il risultato che ti aspettavi e quello che, invece, hai ottenuto (più informazioni fornisci, meglio sarà).Grazie e buona fortuna!"
105
+
106
+ #: html/pte.php:181
107
+ msgid "Send to Pastebin"
108
+ msgstr "Invia a Pastebin"
109
+
110
+ #: html/pte.php:182
111
+ msgid "Clear Messages"
112
+ msgstr "Cancella messaggi"
113
+
114
+ #: html/pte.php:185
115
+ msgid "Run Tests"
116
+ msgstr "Esegui i tests"
117
+
118
+ #: html/pte.php:186
119
+ msgid "Close"
120
+ msgstr "Chiudi"
121
+
122
+ #: post-thumbnail-editor.php:167
123
+ msgid "Edit Thumbnails"
124
+ msgstr "Modifica Miniature"
125
+
126
+ #: post-thumbnail-editor.php:168
127
+ #: php/options.php:51
128
+ msgid "Thumbnails"
129
+ msgstr "Modifica Miniature"
130
+
131
+ #: php/log.php:15
132
+ msgid "ERROR"
133
+ msgstr "ERRORE"
134
+
135
+ #: php/log.php:18
136
+ msgid "WARNING"
137
+ msgstr "AVVISO"
138
+
139
+ #: php/log.php:21
140
+ msgid "DEBUG"
141
+ msgstr "DEBUG"
142
+
143
+ #: php/log.php:99
144
+ msgid "ERROR Logging Message: %s"
145
+ msgstr "ERRORE messaggio di logging: %s"
146
+
147
+ #: php/options.php:8
148
+ msgid "These site-wide settings can only be changed by an administrator"
149
+ msgstr "Queste impostazioni generali, possono essere cambiate solo dall'amministratore.<br /> Scegli quali, tra le miniature usate nel sito, vuoi mostrare o nascondere nella finestra delle modifiche (di default, sono mostrate)."
150
+
151
+ #: php/options.php:19
152
+ msgid "User Options"
153
+ msgstr "Opzioni utente"
154
+
155
+ #: php/options.php:24
156
+ msgid "Thickbox dimensions"
157
+ msgstr "Dimensione Finestra di modifica"
158
+
159
+ #: php/options.php:36
160
+ msgid "Reset to defaults"
161
+ msgstr "Ripristina la configurazione iniziale"
162
+
163
+ #: php/options.php:47
164
+ msgid "Site Options"
165
+ msgstr "Opzioni del sito"
166
+
167
+ #: php/options.php:72
168
+ msgid "Save Changes"
169
+ msgstr "Registra le modifiche"
170
+
171
+ #: php/options.php:86
172
+ msgid "Only users with the 'manage_options' capability may make changes to these settings."
173
+ msgstr "Solo gli utenti con i permessi di 'manage_options' possono cambiare queste configurazioni."
174
+
175
+ #: php/options.php:118
176
+ msgid "Thickbox width must be at least 750 pixels."
177
+ msgstr "La larghezza dev'essere almeno di 750 pixels."
178
+
179
+ #: php/options.php:128
180
+ msgid "Thickbox height must be greater than 550 pixels."
181
+ msgstr "L'altezza dev'essere almeno di 550 pixels."
182
+
183
+ #: php/options.php:142
184
+ msgid "Width:"
185
+ msgstr "Larghezza:"
186
+
187
+ #: php/options.php:146
188
+ msgid "Set this to a value greater than 750."
189
+ msgstr "Inserire un valore di almeno 750px ."
190
+
191
+ #: php/options.php:153
192
+ msgid "Height:"
193
+ msgstr "Altezza:"
194
+
195
+ #: php/options.php:157
196
+ msgid "Set this to a value greater than 550."
197
+ msgstr "Inserire un valore di almeno 550px ."
198
+
199
+ #: php/options.php:169
200
+ msgid "Enable debugging"
201
+ msgstr "Abilita il debugging"
202
+
203
+ #: php/options.php:178
204
+ msgid "Reset User Options"
205
+ msgstr "Cancella le opzioni utente"
206
+
207
+ #: php/options.php:204
208
+ msgid "Post Thumbnail"
209
+ msgstr "Tipi di Miniature"
210
+
211
+ #: php/options.php:205
212
+ msgid "Hidden"
213
+ msgstr "Nascondi"
214
+
215
+ #: php/functions.php:257
216
+ msgid "Sorry, there was a problem trying to send to pastebin"
217
+ msgstr "Spiacente, c'è stato un problema nell'invio a Pastebin"
218
+
219
+ #: php/functions.php:258
220
+ msgid "PASTEBIN URL:"
221
+ msgstr "PASTEBIN URL:"
222
+
223
+ #: php/functions.php:259
224
+ msgid "Disabling aspect ratio"
225
+ msgstr "Le miniature selezionate sono di proporzioni diverse"
226
+
227
+ #. Plugin URI of the plugin/theme
228
+ msgid "http://wordpress.org/extend/plugins/post-thumbnail-editor/"
229
+ msgstr "http://wordpress.org/extend/plugins/post-thumbnail-editor/"
230
+
231
+ #. Description of the plugin/theme
232
+ msgid "Individually manage your post thumbnails"
233
+ msgstr "Gestione individuale delle miniature"
234
+
235
+ #. Author of the plugin/theme
236
+ msgid "sewpafly"
237
+ msgstr "sewpafly"
238
+
239
+ #. Author URI of the plugin/theme
240
+ msgid "http://sewpafly.github.com/post-thumbnail-editor"
241
+ msgstr "http://sewpafly.github.com/post-thumbnail-editor"
242
+
i18n/post-thumbnail-editor.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the Post Thumbnail Editor package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Post Thumbnail Editor 1.0.1-alpha2\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/post-thumbnail-editor\n"
7
- "POT-Creation-Date: 2011-09-06 15:57:59+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -64,11 +64,10 @@ msgstr ""
64
  msgid "I'd rather start over..."
65
  msgstr ""
66
 
67
- #. #-#-#-#-# post-thumbnail-editor.pot (Post Thumbnail Editor 1.0.1-alpha2) #-#-#-#-#
68
  #. Plugin Name of the plugin/theme
69
- #: html/pte.php:135 post-thumbnail-editor.php:113
70
  #: post-thumbnail-editor.php:178 post-thumbnail-editor.php:179
71
- #: php/options.php:64
72
  msgid "Post Thumbnail Editor"
73
  msgstr ""
74
 
@@ -117,12 +116,28 @@ msgstr ""
117
  msgid "Close"
118
  msgstr ""
119
 
120
- #: post-thumbnail-editor.php:167
121
- msgid "Edit Thumbnails"
122
  msgstr ""
123
 
124
- #: post-thumbnail-editor.php:168 php/options.php:51
125
- msgid "Thumbnails"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  msgstr ""
127
 
128
  #: php/log.php:15
@@ -161,6 +176,10 @@ msgstr ""
161
  msgid "Site Options"
162
  msgstr ""
163
 
 
 
 
 
164
  #: php/options.php:72
165
  msgid "Save Changes"
166
  msgstr ""
@@ -211,16 +230,8 @@ msgstr ""
211
  msgid "Hidden"
212
  msgstr ""
213
 
214
- #: php/functions.php:257
215
- msgid "Sorry, there was a problem trying to send to pastebin"
216
- msgstr ""
217
-
218
- #: php/functions.php:258
219
- msgid "PASTEBIN URL:"
220
- msgstr ""
221
-
222
- #: php/functions.php:259
223
- msgid "Disabling aspect ratio"
224
  msgstr ""
225
 
226
  #. Plugin URI of the plugin/theme
2
  # This file is distributed under the same license as the Post Thumbnail Editor package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Post Thumbnail Editor 1.0.3\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/post-thumbnail-editor\n"
7
+ "POT-Creation-Date: 2011-09-08 15:17:02+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
64
  msgid "I'd rather start over..."
65
  msgstr ""
66
 
67
+ #. #-#-#-#-# post-thumbnail-editor.pot (Post Thumbnail Editor 1.0.3) #-#-#-#-#
68
  #. Plugin Name of the plugin/theme
69
+ #: html/pte.php:135 php/options.php:64 post-thumbnail-editor.php:113
70
  #: post-thumbnail-editor.php:178 post-thumbnail-editor.php:179
 
71
  msgid "Post Thumbnail Editor"
72
  msgstr ""
73
 
116
  msgid "Close"
117
  msgstr ""
118
 
119
+ #: php/functions.php:257
120
+ msgid "Sorry, there was a problem trying to send to pastebin"
121
  msgstr ""
122
 
123
+ #: php/functions.php:258
124
+ msgid "PASTEBIN URL:"
125
+ msgstr ""
126
+
127
+ #: php/functions.php:259
128
+ msgid "Disabling aspect ratio"
129
+ msgstr ""
130
+
131
+ #: php/functions.php:260
132
+ msgid "Error parsing selection information"
133
+ msgstr ""
134
+
135
+ #: php/functions.php:278
136
+ msgid "Invalid meta data for POST #%d: %s"
137
+ msgstr ""
138
+
139
+ #: php/functions.php:283
140
+ msgid "Please contact support"
141
  msgstr ""
142
 
143
  #: php/log.php:15
176
  msgid "Site Options"
177
  msgstr ""
178
 
179
+ #: php/options.php:51 post-thumbnail-editor.php:168
180
+ msgid "Thumbnails"
181
+ msgstr ""
182
+
183
  #: php/options.php:72
184
  msgid "Save Changes"
185
  msgstr ""
230
  msgid "Hidden"
231
  msgstr ""
232
 
233
+ #: post-thumbnail-editor.php:167
234
+ msgid "Edit Thumbnails"
 
 
 
 
 
 
 
 
235
  msgstr ""
236
 
237
  #. Plugin URI of the plugin/theme
js/pte.coffee CHANGED
@@ -72,6 +72,7 @@ $.fn.extend
72
  # if this object is currently hidden, show it
73
  # if this object is currently shown, hide it
74
  isVisible = $elem.is(':visible')
 
75
  if (not isVisible)
76
  $elem.show 0, ->
77
  $(this).animate {'left': move_to}, options.speed, options.easing, next
@@ -79,12 +80,15 @@ $.fn.extend
79
  $elem.animate {'left': move_to}, options.speed, options.easing
80
  $elem.hide 0, next
81
  true
82
- if (options.callback)
83
  pte_queue.queue (next) ->
84
  if options.callbackargs?
85
- options.callback.apply this, options.callbackargs
 
86
  else
 
87
  options.callback.apply this
 
88
  next()
89
  return this
90
 
@@ -196,13 +200,15 @@ do (pte) ->
196
  offset = $("#pte-sizes").offset()
197
  window_height = $(window).height() - offset.top - 2
198
  $("#pte-sizes").height window_height
 
 
 
 
 
199
  , 100
200
  # Add to the resize and load events
201
  $(window).resize(reflow.doFunc).load(reflow.doFunc)
202
 
203
- # Set the left position of stages2,3
204
- $('#stage2, #stage3').css
205
- left: $(window).width()
206
  true
207
 
208
 
@@ -243,6 +249,7 @@ do (pte) ->
243
  zIndex: 1200
244
  instance: true
245
  onSelectEnd: (img, s) ->
 
246
  if s.width && s.width > 0 and s.height && s.height > 0 and $('.pte-size').filter(':checked').size() > 0
247
  $('#pte-submit').removeAttr('disabled')
248
  else
@@ -322,6 +329,10 @@ do (pte) ->
322
  'h': Math.floor(selection.height/scale_factor)
323
  log "===== RESIZE-IMAGES ====="
324
  log submit_data
 
 
 
 
325
  ias_instance.setOptions
326
  hide: true
327
  x1: 0
72
  # if this object is currently hidden, show it
73
  # if this object is currently shown, hide it
74
  isVisible = $elem.is(':visible')
75
+ log [direction,move_to,isVisible]
76
  if (not isVisible)
77
  $elem.show 0, ->
78
  $(this).animate {'left': move_to}, options.speed, options.easing, next
80
  $elem.animate {'left': move_to}, options.speed, options.easing
81
  $elem.hide 0, next
82
  true
83
+ if options.callback?
84
  pte_queue.queue (next) ->
85
  if options.callbackargs?
86
+ log "running callback with arguments"
87
+ options.callback.apply this, options.callbackargs
88
  else
89
+ log "running callback with no arguments"
90
  options.callback.apply this
91
+ log "finished running callback"
92
  next()
93
  return this
94
 
200
  offset = $("#pte-sizes").offset()
201
  window_height = $(window).height() - offset.top - 2
202
  $("#pte-sizes").height window_height
203
+ # Set the left position of stages2,3
204
+ log """WINDOW WIDTH: #{$(window).width()}"""
205
+ $('#stage2, #stage3').filter(":hidden").css
206
+ left: $(window).width()
207
+ true
208
  , 100
209
  # Add to the resize and load events
210
  $(window).resize(reflow.doFunc).load(reflow.doFunc)
211
 
 
 
 
212
  true
213
 
214
 
249
  zIndex: 1200
250
  instance: true
251
  onSelectEnd: (img, s) ->
252
+ # Check that getSelection returns valid information...
253
  if s.width && s.width > 0 and s.height && s.height > 0 and $('.pte-size').filter(':checked').size() > 0
254
  $('#pte-submit').removeAttr('disabled')
255
  else
329
  'h': Math.floor(selection.height/scale_factor)
330
  log "===== RESIZE-IMAGES ====="
331
  log submit_data
332
+ if isNaN(submit_data.x) or isNaN(submit_data.y) or isNaN(submit_data.w) or isNaN(submit_data.h)
333
+ alert objectL10n.crop_submit_data_error
334
+ log "ERROR with submit_data and NaN's"
335
+ return false
336
  ias_instance.setOptions
337
  hide: true
338
  x1: 0
js/pte.full.js CHANGED
@@ -773,6 +773,7 @@
773
  direction = options.direction === 'left' ? -1 : 1;
774
  move_to = $elem.css('left') === "0px" ? $(window).width() * direction : 0;
775
  isVisible = $elem.is(':visible');
 
776
  if (!isVisible) {
777
  $elem.show(0, function() {
778
  return $(this).animate({
@@ -788,13 +789,16 @@
788
  return true;
789
  }, this));
790
  });
791
- if (options.callback) {
792
  pte_queue.queue(function(next) {
793
  if (options.callbackargs != null) {
 
794
  options.callback.apply(this, options.callbackargs);
795
  } else {
 
796
  options.callback.apply(this);
797
  }
 
798
  return next();
799
  });
800
  }
@@ -905,12 +909,14 @@
905
  pte.fixThickbox(window.parent);
906
  offset = $("#pte-sizes").offset();
907
  window_height = $(window).height() - offset.top - 2;
908
- return $("#pte-sizes").height(window_height);
 
 
 
 
 
909
  }, 100);
910
  $(window).resize(reflow.doFunc).load(reflow.doFunc);
911
- $('#stage2, #stage3').css({
912
- left: $(window).width()
913
- });
914
  return true;
915
  };
916
  addRowListeners = function() {
@@ -1021,6 +1027,11 @@
1021
  };
1022
  log("===== RESIZE-IMAGES =====");
1023
  log(submit_data);
 
 
 
 
 
1024
  ias_instance.setOptions({
1025
  hide: true,
1026
  x1: 0,
773
  direction = options.direction === 'left' ? -1 : 1;
774
  move_to = $elem.css('left') === "0px" ? $(window).width() * direction : 0;
775
  isVisible = $elem.is(':visible');
776
+ log([direction, move_to, isVisible]);
777
  if (!isVisible) {
778
  $elem.show(0, function() {
779
  return $(this).animate({
789
  return true;
790
  }, this));
791
  });
792
+ if (options.callback != null) {
793
  pte_queue.queue(function(next) {
794
  if (options.callbackargs != null) {
795
+ log("running callback with arguments");
796
  options.callback.apply(this, options.callbackargs);
797
  } else {
798
+ log("running callback with no arguments");
799
  options.callback.apply(this);
800
  }
801
+ log("finished running callback");
802
  return next();
803
  });
804
  }
909
  pte.fixThickbox(window.parent);
910
  offset = $("#pte-sizes").offset();
911
  window_height = $(window).height() - offset.top - 2;
912
+ $("#pte-sizes").height(window_height);
913
+ log("WINDOW WIDTH: " + ($(window).width()));
914
+ $('#stage2, #stage3').filter(":hidden").css({
915
+ left: $(window).width()
916
+ });
917
+ return true;
918
  }, 100);
919
  $(window).resize(reflow.doFunc).load(reflow.doFunc);
 
 
 
920
  return true;
921
  };
922
  addRowListeners = function() {
1027
  };
1028
  log("===== RESIZE-IMAGES =====");
1029
  log(submit_data);
1030
+ if (isNaN(submit_data.x) || isNaN(submit_data.y) || isNaN(submit_data.w) || isNaN(submit_data.h)) {
1031
+ alert(objectL10n.crop_submit_data_error);
1032
+ log("ERROR with submit_data and NaN's");
1033
+ return false;
1034
+ }
1035
  ias_instance.setOptions({
1036
  hide: true,
1037
  x1: 0,
js/pte.full.min.js CHANGED
@@ -1,32 +1,33 @@
1
- (function(a){function A(f,c,d,b){b={data:b||b===0||b===false?b:c?c.data:{},_wrap:c?c._wrap:null,tmpl:null,parent:c||null,nodes:[],calls:G,nest:H,wrap:o,html:I,update:e};f&&a.extend(b,f,{nodes:[],parent:c});if(d){b.tmpl=d;b._ctnt=b._ctnt||b.tmpl(a,b);b.key=++s;(x.length?m:j)[s]=b}return b}function y(f,c,d){var b;d=d?a.map(d,function(k){return typeof k==="string"?f.key?k.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+h+'="'+f.key+'" $2'):k:y(k,f,k._ctnt)}):f;if(c)return d;d=d.join("");d.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,
2
- function(k,l,n,t){b=a(n).get();u(b);if(l)b=D(l).concat(b);if(t)b=b.concat(D(t))});return b?b:D(d)}function D(f){var c=document.createElement("div");c.innerHTML=f;return a.makeArray(c.childNodes)}function J(f){return new Function("jQuery","$item","var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('"+a.trim(f).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,
3
- function(c,d,b,k,l,n,t){c=a.tmpl.tag[b];if(!c)throw"Unknown template tag: "+b;b=c._default||[];if(n&&!/\w$/.test(l)){l+=n;n=""}if(l){l=B(l);t=t?","+B(t)+")":n?")":"";t=n?l.indexOf(".")>-1?l+B(n):"("+l+").call($item"+t:l;n=n?t:"(typeof("+l+")==='function'?("+l+").call($item):("+l+"))"}else n=t=b.$1||"null";k=B(k);return"');"+c[d?"close":"open"].split("$notnull_1").join(l?"typeof("+l+")!=='undefined' && ("+l+")!=null":"true").split("$1a").join(n).split("$1").join(t).split("$2").join(k||b.$2||"")+"__.push('"})+
4
- "');}return __;")}function E(f,c){f._wrap=y(f,true,a.isArray(c)?c:[i.test(c)?c:a(c).html()]).join("")}function B(f){return f?f.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function u(f){function c(C){function M(L){L+=d;r=l[L]=l[L]||A(r,j[r.parent.key+d]||r.parent)}var z,w=C,r,K;if(K=C.getAttribute(h)){for(;w.parentNode&&(w=w.parentNode).nodeType===1&&!(z=w.getAttribute(h)););if(z!==K){w=w.parentNode?w.nodeType===11?0:w.getAttribute(h)||0:0;if(!(r=j[K])){r=m[K];r=A(r,j[w]||m[w]);r.key=++s;j[s]=r}v&&
5
- M(K)}C.removeAttribute(h)}else if(v&&(r=a.data(C,"tmplItem"))){M(r.key);j[r.key]=r;w=(w=a.data(C.parentNode,"tmplItem"))?w.key:0}if(r){for(z=r;z&&z.key!=w;){z.nodes.push(C);z=z.parent}delete r._ctnt;delete r._wrap;a.data(C,"tmplItem",r)}}var d="_"+v,b,k,l={},n,t,F;n=0;for(t=f.length;n<t;n++)if((b=f[n]).nodeType===1){k=b.getElementsByTagName("*");for(F=k.length-1;F>=0;F--)c(k[F]);c(b)}}function G(f,c,d,b){if(!f)return x.pop();x.push({_:f,tmpl:c,item:this,data:d,options:b})}function H(f,c,d){return a.tmpl(a.template(f),
6
- c,d,this)}function o(f,c){var d=f.options||{};d.wrapped=c;return a.tmpl(a.template(f.tmpl),f.data,d,f.item)}function I(f,c){var d=this._wrap;return a.map(a(a.isArray(d)?d.join(""):d).filter(f||"*"),function(b){if(c)b=b.innerText||b.textContent;else{var k;if(!(k=b.outerHTML)){k=document.createElement("div");k.appendChild(b.cloneNode(true));k=k.innerHTML}b=k}return b})}function e(){var f=this.nodes;a.tmpl(null,null,null,this).insertBefore(f[0]);a(f).remove()}var g=a.fn.domManip,h="_tmplitem",i=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,
7
- j={},m={},q,p={key:0,data:{}},s=0,v=0,x=[];a.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(f,c){a.fn[f]=function(d){var b=[];d=a(d);var k,l,n;k=this.length===1&&this[0].parentNode;q=j||{};if(k&&k.nodeType===11&&k.childNodes.length===1&&d.length===1){d[c](this[0]);b=this}else{l=0;for(n=d.length;l<n;l++){v=l;k=(l>0?this.clone(true):this).get();a(d[l])[c](k);b=b.concat(k)}v=0;b=this.pushStack(b,f,d.selector)}d=q;q=null;a.tmpl.complete(d);
8
- return b}});a.fn.extend({tmpl:function(f,c,d){return a.tmpl(this[0],f,c,d)},tmplItem:function(){return a.tmplItem(this[0])},template:function(f){return a.template(f,this[0])},domManip:function(f,c,d){if(f[0]&&a.isArray(f[0])){for(var b=a.makeArray(arguments),k=f[0],l=k.length,n=0,t;n<l&&!(t=a.data(k[n++],"tmplItem")););if(t&&v)b[2]=function(F){a.tmpl.afterManip(this,F,d)};g.apply(this,b)}else g.apply(this,arguments);v=0;q||a.tmpl.complete(j);return this}});a.extend({tmpl:function(f,c,d,b){var k=!b;
9
- if(k){b=p;f=a.template[f]||a.template(null,f);m={}}else if(!f){f=b.tmpl;j[b.key]=b;b.nodes=[];b.wrapped&&E(b,b.wrapped);return a(y(b,null,b.tmpl(a,b)))}if(!f)return[];if(typeof c==="function")c=c.call(b||{});d&&d.wrapped&&E(d,d.wrapped);c=a.isArray(c)?a.map(c,function(l){return l?A(d,b,f,l):null}):[A(d,b,f,c)];return k?a(y(b,null,c)):c},tmplItem:function(f){var c;if(f instanceof a)f=f[0];for(;f&&f.nodeType===1&&!(c=a.data(f,"tmplItem"))&&(f=f.parentNode););return c||p},template:function(f,c){if(c){if(typeof c===
10
- "string")c=J(c);else if(c instanceof a)c=c[0]||{};if(c.nodeType)c=a.data(c,"tmpl")||a.data(c,"tmpl",J(c.innerHTML));return typeof f==="string"?a.template[f]=c:c}return f?typeof f!=="string"?a.template(null,f):a.template[f]||a.template(null,i.test(f)?f:a(f)):null},encode:function(f){return(""+f).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;")}});a.extend(a.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){__=__.concat($item.nest($1,$2));}"},
11
- wrap:{_default:{$2:"null"},open:"$item.calls(__,$1,$2);__=[];",close:"call=$item.calls();__=call._.concat($item.wrap(call,__));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){__.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){__.push($.encode($1a));}"},"!":{open:""}},complete:function(){j=
12
- {}},afterManip:function(f,c,d){var b=c.nodeType===11?a.makeArray(c.childNodes):c.nodeType===1?[c]:[];d.call(f,c);u(b);v++}})})(jQuery);
13
- (function(){var a,A,y,D,J,E,B,u,G,H,o,I=function(e,g){return function(){return e.apply(g,arguments)}};o=this;a=o.jQuery;o.pte=u=u||{};(function(e){return e.fixThickbox=function(g){var h,i,j,m;h=g.jQuery;if(!(h===null||g.frames.length<1)){log("===== FIXING THICKBOX =====");m=o.options.pte_tb_width+30;j=o.options.pte_tb_height+38;i=h("#TB_window");if(!(i.width()>=m&&i.height()>=j)){log("THICKBOX: "+i.width()+" x "+i.height());i.css({"margin-left":0-m/2,width:m,height:j}).children("iframe").css({width:m});
14
- return g.setTimeout(function(){if(!(h("iframe",i).height()>j)){h("iframe",i).css({height:j});log("THICKBOX: "+i.width()+" x "+i.height());return true}},1E3)}}}})(u);H=function(e){return{}.toString.call(e).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()};A=function(){function e(g){this.message=g;this.date=new Date}e.prototype.toString=function(){var g,h,i,j,m,q,p;q=function(s,v){for(;(""+s).length<v;)s="0"+s;return s};i=this.date;p=q(i.getUTCFullYear(),4);h=q(i.getUTCMonth()+1,2);g=q(i.getUTCDate(),2);j=
15
- q(i.getUTCHours(),2);m=q(i.getUTCMinutes(),2);q=q(i.getUTCSeconds(),2);switch(H(this.message)){case "string":i=this.message;break;default:i=a.toJSON(this.message)}return""+p+h+g+" "+j+":"+m+":"+q+" - ["+H(this.message)+"] "+i};return e}();(function(e){e.messages=[];e.log=function(g){if(!o.options.pte_debug)return true;try{e.messages.push(new A(g));console.log(g);a("#pte-log-messages textarea").filter(":visible").val(e.formatLog())}catch(h){}};e.formatLog=function(){var g,h,i,j,m;g="";m=e.messages;
16
- i=0;for(j=m.length;i<j;i++){h=m[i];g+=""+h+"\n"}return g};e.parseServerLog=function(g){var h,i,j;log("===== SERVER LOG =====");if((g!=null?g.length:void 0)!=null&&g.length>0){i=0;for(j=g.length;i<j;i++){h=g[i];log(h)}}return true};e.sendToPastebin=function(g){return a.ajax({url:"http://dpastey.appspot.com/",data:{title:"PostThumbnailEditor Log",content:g,lexer:"text",format:"json",expire_options:"2592000"},dataType:"json",global:false,type:"POST",error:function(h,i,j){a("#pte-log").fadeOut("900");
17
- alert(objectL10n.pastebin_create_error);log(h);log(i);return log(j)},success:function(h){a("#pte-log").fadeOut("900");return prompt(objectL10n.pastebin_url,h.url)}})};return true})(u);o.log=u.log;a(document).ready(function(e){e("#test").click(function(g){g.stopImmediatePropagation();return true});e("#pastebin").click(function(){return u.sendToPastebin(u.formatLog())});e("#clear-log").click(function(){u.messages=[];return e("#pte-log-messages textarea").val(u.formatLog())});e("#close-log").click(function(){return e("#pte-log").fadeOut("900")});
18
- e("#pte-log-tools a").click(function(g){return g.preventDefault()});return e("body").delegate(".show-log-messages","click",function(g){g.preventDefault();e("#pte-log-messages textarea").val(u.formatLog());return e("#pte-log").fadeIn("900")})});(function(e){return e.admin=function(){var g,h,i,j,m,q;q="&TB_iframe=true&height="+o.options.pte_tb_height+"&width="+o.options.pte_tb_width;i=null;m=function(p){p=p||i||a("#attachment-id").val();return""+ajaxurl+"?action=pte_ajax&pte-action=launch&id="+p+q};
19
- g=function(p){return a('<a class="thickbox" href="'+m(p)+'">'+objectL10n.PTE+"</a>")};h=function(p){log("Start PTE...");if(o.parent.frames.length>0){log("Modifying thickbox...");I(function(){o.parent.tb_click();return true},this)();return p.stopPropagation()}};j=function(){var p;p=a("#imgedit-save-target-"+i);if((p!=null?p.size():void 0)<1){o.log("Edit Thumbnail Menu not visible, waiting for 300ms");o.setTimeout(j,300);return false}return p.append(g().click(h))};return function(){a(".media-item").each(function(p,
20
- s){var v;v=s.id.replace("media-item-","");return g(v).css({"font-size":".8em","margin-left":"5px"}).click(h).appendTo(a("tr.image-size th.label",s))});if(imageEdit.open!=null){imageEdit.oldopen=imageEdit.open;imageEdit.open=function(p,s){i=p;imageEdit.oldopen(p,s);return j()}}return true}()}})(u);y=function(){function e(g,h){this.fn=g;this.timeout=h;this.doFunc=I(this.doFunc,this);this.timer=null}e.prototype.doFunc=function(){o.clearTimeout(this.timer);this.timer=o.setTimeout(this.fn,this.timeout);
21
- return true};return e}();o.randomness=function(){return Math.floor(Math.random()*1000001).toString(16)};o.debugTmpl=function(e){log("===== TEMPLATE DEBUG DATA FOLLOWS =====");log(e);return true};D=function(e){e={id:e,action:"pte_ajax","pte-action":"delete-images","pte-nonce":a("#pte-delete-nonce").val()};return a.ajax({url:ajaxurl,data:e,global:false,dataType:"json",success:J})};J=function(e){log("===== DELETE SUCCESSFUL, DATA DUMP FOLLOWS =====");log(e);return u.parseServerLog(e.log)};G=a({});a.fn.extend({move:function(e){e=
22
- a.extend({direction:"left",speed:500,easing:"swing",toggle:true,callback:null,callbackargs:null},e);this.each(function(){return G.queue(I(function(g){var h,i,j;h=a(this);i=e.direction==="left"?-1:1;j=h.css("left")==="0px"?a(o).width()*i:0;if(h.is(":visible")){h.animate({left:j},e.speed,e.easing);h.hide(0,g)}else h.show(0,function(){return a(this).animate({left:j},e.speed,e.easing,g)});return true},this))});e.callback&&G.queue(function(g){e.callbackargs!=null?e.callback.apply(this,e.callbackargs):
23
- e.callback.apply(this);return g()});return this},moveRight:function(e){e=a.extend(e,{direction:"right"});return this.move(e)},moveLeft:function(e){e=a.extend(e,{direction:"left"});return this.move(e)}});o.goBack=function(e){e!=null&&e.preventDefault();a("#stage2").moveRight();a("#stage1").moveRight({callback:function(){D(a("#pte-post-id").val());return a("#stage2").html("")}});return true};B=function(e,g){if(e===0)return g;for(;g>0;)if(e>g)e-=g;else g-=e;if(e<0||g<0)return null;return e};E=function(e,
24
- g){var h,i,j,m;h=g.crop;m=g.width;j=g.height;h=+h;m=+m;j=+j;i=B(m,j);if(h!=null&&h>0){h=null;if((m!=null)>0&&(j!=null)>0)h=i!=null?""+m/i+":"+j/i:""+m+":"+j;if(e!=null&&h!=null&&h!==e)throw objectL10n.aspect_ratio_disabled;e=h}return e};u.functions={determineAspectRatio:E};(function(e){var g,h,i,j,m,q,p,s,v,x,f;e.editor=function(){p();i();f();h();j();m();g();q();return true};q=function(){var c,d;c=a("#pte-loading");d=function(){c.hide();return true};a("#pte-preview").load(d);c.ajaxStart(function(){return a(this).fadeIn(200)}).ajaxStop(function(){return a(this).fadeOut(200)});
25
- o.setTimeout(d,2E3);return true};p=function(){var c;c=new y(function(){var d;log("===== REFLOW =====");e.fixThickbox(o.parent);d=a("#pte-sizes").offset();d=a(o).height()-d.top-2;return a("#pte-sizes").height(d)},100);a(o).resize(c.doFunc).load(c.doFunc);a("#stage2, #stage3").css({left:a(o).width()});return true};i=function(){var c;c=function(d){d.delegate("tr","click",function(b){b.target.type!=="checkbox"&&a("input:checkbox",this).click();return true});return d.delegate("input:checkbox","click",
26
- function(){this.checked||a(this).is("input:checked")?a(this).parents("tr").first().removeClass("selected"):a(this).parents("tr").first().addClass("selected");return true})};c(a("#stage2"));return c(a("#stage1"))};x=null;v={keys:true,minWidth:3,minHeight:3,handles:true,zIndex:1200,instance:true,onSelectEnd:function(c,d){return d.width&&d.width>0&&d.height&&d.height>0&&a(".pte-size").filter(":checked").size()>0?a("#pte-submit").removeAttr("disabled"):a("#pte-submit").attr("disabled",true)}};f=function(){return e.ias=
27
- x=a("#pte-image img").imgAreaSelect(v)};s=function(c){log("===== SETTING ASPECTRATIO: "+c+" =====");x.setOptions({aspectRatio:c});return x.update()};h=function(){var c,d;d=new y(function(){log("===== CHECK SUBMIT BUTTON =====");if(a(".pte-confirm").filter(":checked").size()>0){log("ENABLE");a("#pte-confirm").removeAttr("disabled")}else{log("DISABLE");a("#pte-confirm").attr("disabled",true)}return true},50);c=new y(function(){var b;b=null;a("input.pte-size").filter(":checked").each(function(k,l){try{b=
28
- E(b,thumbnail_info[a(l).val()])}catch(n){b=null;b!==x.getOptions().aspectRatio&&alert(n);return false}return true});s(b);v.onSelectEnd(null,x.getSelection());return true},50);a.extend(e.functions,{pteVerifySubmitButtonHandler:d});a("input.pte-size").click(c.doFunc);return a(".pte-confirm").live("click",function(){return d.doFunc()})};j=function(){var c;a("#pte-submit").click(function(){var d,b;b=x.getSelection();d=a("#pte-sizer").val();d={id:a("#pte-post-id").val(),action:"pte_ajax","pte-action":"resize-images",
29
- "pte-sizes[]":a(".pte-size").filter(":checked").map(function(){return a(this).val()}).get(),x:Math.floor(b.x1/d),y:Math.floor(b.y1/d),w:Math.floor(b.width/d),h:Math.floor(b.height/d)};log("===== RESIZE-IMAGES =====");log(d);x.setOptions({hide:true,x1:0,y1:0,x2:0,y2:0});a("#pte-submit").attr("disabled",true);a.getJSON(ajaxurl,d,c);return true});return c=function(d){log("===== RESIZE-IMAGES SUCCESS =====");log(d);e.parseServerLog(d.log);if(d.error!=null&&d.thumbnails==null)alert(d.error);else{a("#stage1").moveLeft();
30
- a("#stage2").html(a("#stage2template").tmpl(d)).moveLeft({callback:e.functions.pteVerifySubmitButtonHandler.doFunc});return false}}};m=function(){var c;a("#pte-confirm").live("click",function(){var d,b;b={};a("input.pte-confirm").filter(":checked").each(function(k,l){var n;n=a(l).val();return b[n]=a("#pte-"+n+"-file").val()});d={id:a("#pte-post-id").val(),action:"pte_ajax","pte-action":"confirm-images","pte-nonce":a("#pte-nonce").val(),"pte-confirm":b};log("===== CONFIRM-IMAGES =====");log(d);return a.getJSON(ajaxurl,
31
- d,c)});return c=function(d){log("===== CONFIRM-IMAGES SUCCESS =====");log(d);e.parseServerLog(d.log);a("#stage2").moveLeft();a("#stage3").html(a("#stage3template").tmpl(d)).moveLeft();return false}};g=function(){var c,d;d=function(b){var k,l;b!=null&&b.preventDefault();b=(k=(l=b.data)!=null?l.selector:void 0)!=null?k:".pte-size";return a(b).filter(":checked").click()};c=function(b){var k,l;b!=null&&b.preventDefault();b=(k=b!=null?(l=b.data)!=null?l.selector:void 0:void 0)!=null?k:".pte-size";return a(b).not(":checked").click()};
32
- a("#pte-selectors .all").click(c);a("#pte-selectors .none").click(d).click();a("#stage2").delegate("#pte-stage2-selectors .all","click",{selector:".pte-confirm"},c);a("#stage2").delegate("#pte-stage2-selectors .none","click",{selector:".pte-confirm"},d);return true};return a.extend(e.functions,{iasSetAR:s})})(u)}).call(this);
 
1
+ (function(b){function t(j,c,g,e){e={data:e||e===0||e===!1?e:c?c.data:{},_wrap:c?c._wrap:null,tmpl:null,parent:c||null,nodes:[],calls:x,nest:y,wrap:f,html:z,update:a};j&&b.extend(e,j,{nodes:[],parent:c});if(g)e.tmpl=g,e._ctnt=e._ctnt||e.tmpl(b,e),e.key=++s,(o.length?k:i)[s]=e;return e}function r(a,c,g){var e,g=g?b.map(g,function(b){return typeof b==="string"?a.key?b.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+l+'="'+a.key+'" $2'):b:r(b,a,b._ctnt)}):a;if(c)return g;g=g.join("");g.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,
2
+ function(g,c,a,j){e=b(a).get();n(e);c&&(e=v(c).concat(e));j&&(e=e.concat(v(j)))});return e?e:v(g)}function v(a){var c=document.createElement("div");c.innerHTML=a;return b.makeArray(c.childNodes)}function A(a){return new Function("jQuery","$item","var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('"+b.trim(a).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,
3
+ function(c,g,e,a,j,h,d){c=b.tmpl.tag[e];if(!c)throw"Unknown template tag: "+e;e=c._default||[];h&&!/\w$/.test(j)&&(j+=h,h="");j?(j=u(j),d=d?","+u(d)+")":h?")":"",d=h?j.indexOf(".")>-1?j+u(h):"("+j+").call($item"+d:j,h=h?d:"(typeof("+j+")==='function'?("+j+").call($item):("+j+"))"):h=d=e.$1||"null";a=u(a);return"');"+c[g?"close":"open"].split("$notnull_1").join(j?"typeof("+j+")!=='undefined' && ("+j+")!=null":"true").split("$1a").join(h).split("$1").join(d).split("$2").join(a||e.$2||"")+"__.push('"})+
4
+ "');}return __;")}function w(a,c){a._wrap=r(a,!0,b.isArray(c)?c:[d.test(c)?c:b(c).html()]).join("")}function u(b){return b?b.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function n(a){function c(a){function c(b){var B;b+=g;B=d[b]=d[b]||t(h,i[h.parent.key+g]||h.parent),h=B}var e,j=a,h,f;if(f=a.getAttribute(l)){for(;j.parentNode&&(j=j.parentNode).nodeType===1&&!(e=j.getAttribute(l)););if(e!==f){j=j.parentNode?j.nodeType===11?0:j.getAttribute(l)||0:0;if(!(h=i[f]))h=k[f],h=t(h,i[j]||k[j]),h.key=++s,
5
+ i[s]=h;p&&c(f)}a.removeAttribute(l)}else if(p&&(h=b.data(a,"tmplItem")))c(h.key),i[h.key]=h,j=(j=b.data(a.parentNode,"tmplItem"))?j.key:0;if(h){for(e=h;e&&e.key!=j;)e.nodes.push(a),e=e.parent;delete h._ctnt;delete h._wrap;b.data(a,"tmplItem",h)}}var g="_"+p,e,h,d={},f,q,m;f=0;for(q=a.length;f<q;f++)if((e=a[f]).nodeType===1){h=e.getElementsByTagName("*");for(m=h.length-1;m>=0;m--)c(h[m]);c(e)}}function x(b,a,g,e){if(!b)return o.pop();o.push({_:b,tmpl:a,item:this,data:g,options:e})}function y(a,c,g){return b.tmpl(b.template(a),
6
+ c,g,this)}function f(a,c){var g=a.options||{};g.wrapped=c;return b.tmpl(b.template(a.tmpl),a.data,g,a.item)}function z(a,c){var g=this._wrap;return b.map(b(b.isArray(g)?g.join(""):g).filter(a||"*"),function(b){if(c)b=b.innerText||b.textContent;else{var a;if(!(a=b.outerHTML))a=document.createElement("div"),a.appendChild(b.cloneNode(!0)),a=a.innerHTML;b=a}return b})}function a(){var a=this.nodes;b.tmpl(null,null,null,this).insertBefore(a[0]);b(a).remove()}var h=b.fn.domManip,l="_tmplitem",d=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,
7
+ i={},k={},m,q={key:0,data:{}},s=0,p=0,o=[];b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,c){b.fn[a]=function(g){var e=[],g=b(g),h,d,l;h=this.length===1&&this[0].parentNode;m=i||{};if(h&&h.nodeType===11&&h.childNodes.length===1&&g.length===1)g[c](this[0]),e=this;else{d=0;for(l=g.length;d<l;d++)p=d,h=(d>0?this.clone(!0):this).get(),b(g[d])[c](h),e=e.concat(h);p=0;e=this.pushStack(e,a,g.selector)}g=m;m=null;b.tmpl.complete(g);
8
+ return e}});b.fn.extend({tmpl:function(a,c,g){return b.tmpl(this[0],a,c,g)},tmplItem:function(){return b.tmplItem(this[0])},template:function(a){return b.template(a,this[0])},domManip:function(a,c,g,e){if(a[0]&&b.isArray(a[0])){for(var d=b.makeArray(arguments),l=a[0],f=l.length,k=0,q;k<f&&!(q=b.data(l[k++],"tmplItem")););q&&p&&(d[2]=function(a){b.tmpl.afterManip(this,a,g)});h.apply(this,d)}else h.apply(this,arguments);p=0;m||b.tmpl.complete(i);return this}});b.extend({tmpl:function(a,c,g,e){var h=
9
+ !e;if(h)e=q,a=b.template[a]||b.template(null,a),k={};else if(!a)return a=e.tmpl,i[e.key]=e,e.nodes=[],e.wrapped&&w(e,e.wrapped),b(r(e,null,e.tmpl(b,e)));if(!a)return[];typeof c==="function"&&(c=c.call(e||{}));g&&g.wrapped&&w(g,g.wrapped);c=b.isArray(c)?b.map(c,function(b){return b?t(g,e,a,b):null}):[t(g,e,a,c)];return h?b(r(e,null,c)):c},tmplItem:function(a){var c;for(a instanceof b&&(a=a[0]);a&&a.nodeType===1&&!(c=b.data(a,"tmplItem"))&&(a=a.parentNode););return c||q},template:function(a,c){return c?
10
+ (typeof c==="string"?c=A(c):c instanceof b&&(c=c[0]||{}),c.nodeType&&(c=b.data(c,"tmpl")||b.data(c,"tmpl",A(c.innerHTML))),typeof a==="string"?b.template[a]=c:c):a?typeof a!=="string"?b.template(null,a):b.template[a]||b.template(null,d.test(a)?a:b(a)):null},encode:function(a){return(""+a).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;")}});b.extend(b.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){__=__.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},
11
+ open:"$item.calls(__,$1,$2);__=[];",close:"call=$item.calls();__=call._.concat($item.wrap(call,__));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){__.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){__.push($.encode($1a));}"},"!":{open:""}},complete:function(){i={}},afterManip:function(a,
12
+ c,h){var e=c.nodeType===11?b.makeArray(c.childNodes):c.nodeType===1?[c]:[];h.call(a,c);n(e);p++}})})(jQuery);
13
+ (function(){var b,t,r,v,A,w,u,n,x,y,f,z=function(a,b){return function(){return a.apply(b,arguments)}};f=this;b=f.jQuery;f.pte=n=n||{};(function(a){return a.fixThickbox=function(a){var b,d,i,k;b=a.jQuery;if(!(b===null||a.frames.length<1))if(log("===== FIXING THICKBOX ====="),k=f.options.pte_tb_width+30,i=f.options.pte_tb_height+38,d=b("#TB_window"),!(d.width()>=k&&d.height()>=i))return log("THICKBOX: "+d.width()+" x "+d.height()),d.css({"margin-left":0-k/2,width:k,height:i}).children("iframe").css({width:k}),
14
+ a.setTimeout(function(){if(!(b("iframe",d).height()>i))return b("iframe",d).css({height:i}),log("THICKBOX: "+d.width()+" x "+d.height()),!0},1E3)}})(n);y=function(a){return{}.toString.call(a).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()};t=function(){function a(a){this.message=a;this.date=new Date}a.prototype.toString=function(){var a,l,d,i,f,m,q;m=function(a,b){for(;(""+a).length<b;)a="0"+a;return a};d=this.date;q=m(d.getUTCFullYear(),4);l=m(d.getUTCMonth()+1,2);a=m(d.getUTCDate(),2);i=m(d.getUTCHours(),
15
+ 2);f=m(d.getUTCMinutes(),2);m=m(d.getUTCSeconds(),2);switch(y(this.message)){case "string":d=this.message;break;default:d=b.toJSON(this.message)}return""+q+l+a+" "+i+":"+f+":"+m+" - ["+y(this.message)+"] "+d};return a}();(function(a){a.messages=[];a.log=function(h){if(!f.options.pte_debug)return!0;try{a.messages.push(new t(h)),console.log(h),b("#pte-log-messages textarea").filter(":visible").val(a.formatLog())}catch(l){}};a.formatLog=function(){var b,l,d,i,f;b="";f=a.messages;d=0;for(i=f.length;d<
16
+ i;d++)l=f[d],b+=""+l+"\n";return b};a.parseServerLog=function(a){var b,d,f;log("===== SERVER LOG =====");if((a!=null?a.length:void 0)!=null&&a.length>0){d=0;for(f=a.length;d<f;d++)b=a[d],log(b)}return!0};a.sendToPastebin=function(a){return b.ajax({url:"http://dpastey.appspot.com/",data:{title:"PostThumbnailEditor Log",content:a,lexer:"text",format:"json",expire_options:"2592000"},dataType:"json",global:!1,type:"POST",error:function(a,h,f){b("#pte-log").fadeOut("900");alert(objectL10n.pastebin_create_error);
17
+ log(a);log(h);return log(f)},success:function(a){b("#pte-log").fadeOut("900");return prompt(objectL10n.pastebin_url,a.url)}})};return!0})(n);f.log=n.log;b(document).ready(function(a){a("#test").click(function(a){a.stopImmediatePropagation();return!0});a("#pastebin").click(function(){return n.sendToPastebin(n.formatLog())});a("#clear-log").click(function(){n.messages=[];return a("#pte-log-messages textarea").val(n.formatLog())});a("#close-log").click(function(){return a("#pte-log").fadeOut("900")});
18
+ a("#pte-log-tools a").click(function(a){return a.preventDefault()});return a("body").delegate(".show-log-messages","click",function(b){b.preventDefault();a("#pte-log-messages textarea").val(n.formatLog());return a("#pte-log").fadeIn("900")})});(function(a){return a.admin=function(){var a,l,d,i,k,m;m="&TB_iframe=true&height="+f.options.pte_tb_height+"&width="+f.options.pte_tb_width;d=null;k=function(a){a=a||d||b("#attachment-id").val();return""+ajaxurl+"?action=pte_ajax&pte-action=launch&id="+a+m};
19
+ a=function(a){return b('<a class="thickbox" href="'+k(a)+'">'+objectL10n.PTE+"</a>")};l=function(a){log("Start PTE...");if(f.parent.frames.length>0)return log("Modifying thickbox..."),z(function(){f.parent.tb_click();return!0},this)(),a.stopPropagation()};i=function(){var k;k=b("#imgedit-save-target-"+d);return(k!=null?k.size():void 0)<1?(f.log("Edit Thumbnail Menu not visible, waiting for 300ms"),f.setTimeout(i,300),!1):k.append(a().click(l))};return function(){b(".media-item").each(function(d,f){var i;
20
+ i=f.id.replace("media-item-","");return a(i).css({"font-size":".8em","margin-left":"5px"}).click(l).appendTo(b("tr.image-size th.label",f))});if(imageEdit.open!=null)imageEdit.oldopen=imageEdit.open,imageEdit.open=function(a,b){d=a;imageEdit.oldopen(a,b);return i()};return!0}()}})(n);r=function(){function a(a,b){this.fn=a;this.timeout=b;this.doFunc=z(this.doFunc,this);this.timer=null}a.prototype.doFunc=function(){f.clearTimeout(this.timer);this.timer=f.setTimeout(this.fn,this.timeout);return!0};return a}();
21
+ f.randomness=function(){return Math.floor(Math.random()*1000001).toString(16)};f.debugTmpl=function(a){log("===== TEMPLATE DEBUG DATA FOLLOWS =====");log(a);return!0};v=function(a){a={id:a,action:"pte_ajax","pte-action":"delete-images","pte-nonce":b("#pte-delete-nonce").val()};return b.ajax({url:ajaxurl,data:a,global:!1,dataType:"json",success:A})};A=function(a){log("===== DELETE SUCCESSFUL, DATA DUMP FOLLOWS =====");log(a);return n.parseServerLog(a.log)};x=b({});b.fn.extend({move:function(a){a=b.extend({direction:"left",
22
+ speed:500,easing:"swing",toggle:!0,callback:null,callbackargs:null},a);this.each(function(){return x.queue(z(function(h){var l,d,i,k;l=b(this);d=a.direction==="left"?-1:1;k=l.css("left")==="0px"?b(f).width()*d:0;i=l.is(":visible");log([d,k,i]);i?(l.animate({left:k},a.speed,a.easing),l.hide(0,h)):l.show(0,function(){return b(this).animate({left:k},a.speed,a.easing,h)});return!0},this))});a.callback!=null&&x.queue(function(b){a.callbackargs!=null?(log("running callback with arguments"),a.callback.apply(this,
23
+ a.callbackargs)):(log("running callback with no arguments"),a.callback.apply(this));log("finished running callback");return b()});return this},moveRight:function(a){a=b.extend(a,{direction:"right"});return this.move(a)},moveLeft:function(a){a=b.extend(a,{direction:"left"});return this.move(a)}});f.goBack=function(a){a!=null&&a.preventDefault();b("#stage2").moveRight();b("#stage1").moveRight({callback:function(){v(b("#pte-post-id").val());return b("#stage2").html("")}});return!0};u=function(a,b){if(a===
24
+ 0)return b;for(;b>0;)a>b?a-=b:b-=a;return a<0||b<0?null:a};w=function(a,b){var f,d,i,k;f=b.crop;k=b.width;i=b.height;f=+f;k=+k;i=+i;d=u(k,i);if(f!=null&&f>0){f=null;(k!=null)>0&&(i!=null)>0&&(f=d!=null?""+k/d+":"+i/d:""+k+":"+i);if(a!=null&&f!=null&&f!==a)throw objectL10n.aspect_ratio_disabled;a=f}return a};n.functions={determineAspectRatio:w};(function(a){var h,l,d,i,k,m,n,s,p,o,j;a.editor=function(){n();d();j();l();i();k();h();m();return!0};m=function(){var a,g;a=b("#pte-loading");g=function(){a.hide();
25
+ return!0};b("#pte-preview").load(g);a.ajaxStart(function(){return b(this).fadeIn(200)}).ajaxStop(function(){return b(this).fadeOut(200)});f.setTimeout(g,2E3);return!0};n=function(){var c;c=new r(function(){var c;log("===== REFLOW =====");a.fixThickbox(f.parent);c=b("#pte-sizes").offset();c=b(f).height()-c.top-2;b("#pte-sizes").height(c);log("WINDOW WIDTH: "+b(f).width());b("#stage2, #stage3").filter(":hidden").css({left:b(f).width()});return!0},100);b(f).resize(c.doFunc).load(c.doFunc);return!0};
26
+ d=function(){var a;a=function(a){a.delegate("tr","click",function(a){a.target.type!=="checkbox"&&b("input:checkbox",this).click();return!0});return a.delegate("input:checkbox","click",function(){this.checked||b(this).is("input:checked")?b(this).parents("tr").first().removeClass("selected"):b(this).parents("tr").first().addClass("selected");return!0})};a(b("#stage2"));return a(b("#stage1"))};o=null;p={keys:!0,minWidth:3,minHeight:3,handles:!0,zIndex:1200,instance:!0,onSelectEnd:function(a,g){return g.width&&
27
+ g.width>0&&g.height&&g.height>0&&b(".pte-size").filter(":checked").size()>0?b("#pte-submit").removeAttr("disabled"):b("#pte-submit").attr("disabled",!0)}};j=function(){return a.ias=o=b("#pte-image img").imgAreaSelect(p)};s=function(a){log("===== SETTING ASPECTRATIO: "+a+" =====");o.setOptions({aspectRatio:a});return o.update()};l=function(){var c,g;g=new r(function(){log("===== CHECK SUBMIT BUTTON =====");b(".pte-confirm").filter(":checked").size()>0?(log("ENABLE"),b("#pte-confirm").removeAttr("disabled")):
28
+ (log("DISABLE"),b("#pte-confirm").attr("disabled",!0));return!0},50);c=new r(function(){var a;a=null;b("input.pte-size").filter(":checked").each(function(c,g){try{a=w(a,thumbnail_info[b(g).val()])}catch(d){return a=null,a!==o.getOptions().aspectRatio&&alert(d),!1}return!0});s(a);p.onSelectEnd(null,o.getSelection());return!0},50);b.extend(a.functions,{pteVerifySubmitButtonHandler:g});b("input.pte-size").click(c.doFunc);return b(".pte-confirm").live("click",function(){return g.doFunc()})};i=function(){var c;
29
+ b("#pte-submit").click(function(){var a,e;e=o.getSelection();a=b("#pte-sizer").val();a={id:b("#pte-post-id").val(),action:"pte_ajax","pte-action":"resize-images","pte-sizes[]":b(".pte-size").filter(":checked").map(function(){return b(this).val()}).get(),x:Math.floor(e.x1/a),y:Math.floor(e.y1/a),w:Math.floor(e.width/a),h:Math.floor(e.height/a)};log("===== RESIZE-IMAGES =====");log(a);if(isNaN(a.x)||isNaN(a.y)||isNaN(a.w)||isNaN(a.h))return alert(objectL10n.crop_submit_data_error),log("ERROR with submit_data and NaN's"),
30
+ !1;o.setOptions({hide:!0,x1:0,y1:0,x2:0,y2:0});b("#pte-submit").attr("disabled",!0);b.getJSON(ajaxurl,a,c);return!0});return c=function(c){log("===== RESIZE-IMAGES SUCCESS =====");log(c);a.parseServerLog(c.log);if(c.error!=null&&c.thumbnails==null)alert(c.error);else return b("#stage1").moveLeft(),b("#stage2").html(b("#stage2template").tmpl(c)).moveLeft({callback:a.functions.pteVerifySubmitButtonHandler.doFunc}),!1}};k=function(){var c;b("#pte-confirm").live("click",function(){var a,e;e={};b("input.pte-confirm").filter(":checked").each(function(a,
31
+ c){var d;d=b(c).val();return e[d]=b("#pte-"+d+"-file").val()});a={id:b("#pte-post-id").val(),action:"pte_ajax","pte-action":"confirm-images","pte-nonce":b("#pte-nonce").val(),"pte-confirm":e};log("===== CONFIRM-IMAGES =====");log(a);return b.getJSON(ajaxurl,a,c)});return c=function(c){log("===== CONFIRM-IMAGES SUCCESS =====");log(c);a.parseServerLog(c.log);b("#stage2").moveLeft();b("#stage3").html(b("#stage3template").tmpl(c)).moveLeft();return!1}};h=function(){var a,d;d=function(a){var e;var c,d;
32
+ a!=null&&a.preventDefault();e=(c=(d=a.data)!=null?d.selector:void 0)!=null?c:".pte-size",a=e;return b(a).filter(":checked").click()};a=function(a){var e;var c,d;a!=null&&a.preventDefault();e=(c=a!=null?(d=a.data)!=null?d.selector:void 0:void 0)!=null?c:".pte-size",a=e;return b(a).not(":checked").click()};b("#pte-selectors .all").click(a);b("#pte-selectors .none").click(d).click();b("#stage2").delegate("#pte-stage2-selectors .all","click",{selector:".pte-confirm"},a);b("#stage2").delegate("#pte-stage2-selectors .none",
33
+ "click",{selector:".pte-confirm"},d);return!0};return b.extend(a.functions,{iasSetAR:s})})(n)}).call(this);
php/functions.php CHANGED
@@ -167,7 +167,7 @@ function pte_get_image_data( $id, $size, $size_data ){
167
  $size_data['crop']
168
  );
169
  if ($resized){
170
- $metadata = wp_get_attachment_metadata($id);
171
  $metadata['sizes'][$size] = $resized;
172
  wp_update_attachment_metadata( $id, $metadata);
173
  }
@@ -257,6 +257,7 @@ function pte_launch(){
257
  , array( 'pastebin_create_error' => __( 'Sorry, there was a problem trying to send to pastebin', PTE_DOMAIN )
258
  , 'pastebin_url' => __( 'PASTEBIN URL:', PTE_DOMAIN )
259
  , 'aspect_ratio_disabled' => __( 'Disabling aspect ratio', PTE_DOMAIN )
 
260
  )
261
  );
262
 
@@ -267,12 +268,26 @@ function pte_launch(){
267
  // Get the information needed for image preview
268
  // (See wp-admin/includes/image-edit.php)
269
  $nonce = wp_create_nonce("image_editor-$id");
270
- $meta = wp_get_attachment_metadata($id);
271
 
272
- if ( is_array($meta) && isset($meta['width']) )
273
  $big = max( $meta['width'], $meta['height'] );
 
 
 
 
 
 
 
 
 
 
274
 
275
  $sizer = $big > 400 ? 400 / $big : 1;
 
 
 
 
276
 
277
  require( PTE_PLUGINPATH . "html/pte.php" );
278
  }
@@ -585,7 +600,7 @@ function pte_confirm_images(){
585
  list( $w, $h, $type ) = $image_dimensions;
586
  //print("IMAGE DIMENSIONS...");
587
  //print_r( $image_dimensions );
588
- $metadata = wp_get_attachment_metadata( $id );
589
  $metadata['sizes'][$size] = array(
590
  'file' => basename( $new_file ),
591
  'width' => $w,
167
  $size_data['crop']
168
  );
169
  if ($resized){
170
+ $metadata = wp_get_attachment_metadata($id, true);
171
  $metadata['sizes'][$size] = $resized;
172
  wp_update_attachment_metadata( $id, $metadata);
173
  }
257
  , array( 'pastebin_create_error' => __( 'Sorry, there was a problem trying to send to pastebin', PTE_DOMAIN )
258
  , 'pastebin_url' => __( 'PASTEBIN URL:', PTE_DOMAIN )
259
  , 'aspect_ratio_disabled' => __( 'Disabling aspect ratio', PTE_DOMAIN )
260
+ , 'crop_submit_data_error' => __( 'Error parsing selection information', PTE_DOMAIN )
261
  )
262
  );
263
 
268
  // Get the information needed for image preview
269
  // (See wp-admin/includes/image-edit.php)
270
  $nonce = wp_create_nonce("image_editor-$id");
271
+ $meta = wp_get_attachment_metadata($id, true);
272
 
273
+ if ( is_array($meta) && isset( $meta['width'] ) ){
274
  $big = max( $meta['width'], $meta['height'] );
275
+ }
276
+ else {
277
+ $logger->error(
278
+ sprintf( __( "Invalid meta data for POST #%d: %s" )
279
+ , $id
280
+ , print_r( $meta, true )
281
+ )
282
+ );
283
+ $logger->error( __( "Please contact support", PTE_DOMAIN ) );
284
+ }
285
 
286
  $sizer = $big > 400 ? 400 / $big : 1;
287
+ $sizer = sprintf( "%.8F", $sizer );
288
+ $logger->debug( "USER-AGENT: " . $_SERVER['HTTP_USER_AGENT'] );
289
+ $logger->debug( "WORDPRESS: " . $GLOBALS['wp_version'] );
290
+ $logger->debug( "SIZER: ${sizer}" );
291
 
292
  require( PTE_PLUGINPATH . "html/pte.php" );
293
  }
600
  list( $w, $h, $type ) = $image_dimensions;
601
  //print("IMAGE DIMENSIONS...");
602
  //print_r( $image_dimensions );
603
+ $metadata = wp_get_attachment_metadata( $id, true );
604
  $metadata['sizes'][$size] = array(
605
  'file' => basename( $new_file ),
606
  'width' => $w,
post-thumbnail-editor.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin URI: http://wordpress.org/extend/plugins/post-thumbnail-editor/
4
  Author: sewpafly
5
  Author URI: http://sewpafly.github.com/post-thumbnail-editor
6
- Version: 1.0.2
7
  Description: Individually manage your post thumbnails
8
 
9
  LICENSE
@@ -35,7 +35,7 @@
35
  define( 'PTE_PLUGINURL', plugins_url(basename( dirname(__FILE__))) . "/");
36
  define( 'PTE_PLUGINPATH', dirname(__FILE__) . "/");
37
  define( 'PTE_DOMAIN', "post-thumbnail-editor");
38
- define( 'PTE_VERSION', "1.0.2");
39
 
40
  /*
41
  * Option Functionality
3
  Plugin URI: http://wordpress.org/extend/plugins/post-thumbnail-editor/
4
  Author: sewpafly
5
  Author URI: http://sewpafly.github.com/post-thumbnail-editor
6
+ Version: 1.0.3
7
  Description: Individually manage your post thumbnails
8
 
9
  LICENSE
35
  define( 'PTE_PLUGINURL', plugins_url(basename( dirname(__FILE__))) . "/");
36
  define( 'PTE_PLUGINPATH', dirname(__FILE__) . "/");
37
  define( 'PTE_DOMAIN', "post-thumbnail-editor");
38
+ define( 'PTE_VERSION', "1.0.3");
39
 
40
  /*
41
  * Option Functionality