Version Description
- Debug mode was broken
- Update the generated .gz javascript file
- modify the media library to have a fallback url
- check that option
pte_jpeg_compression
exists before trying to access it
Download this release
Release Info
Developer | sewpafly |
Plugin | Post Thumbnail Editor |
Version | 2.4.3 |
Comparing to | |
See all releases |
Code changes from version 2.4.2 to 2.4.3
- README.txt +8 -2
- html/pte.php +25 -21
- js-build/main.js.gz +0 -0
- js/snippets/pte_enable_media.js +4 -2
- php/functions.php +0 -7
- php/options.php +3 -3
- post-thumbnail-editor.php +6 -3
README.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: sewpafly
|
3 |
Donate link: http://sewpafly.github.io/post-thumbnail-editor/#toc_donations
|
4 |
Tags: post-thumbnail, post thumbnail, featured image, featured, editor, image, awesome, crop
|
5 |
-
Requires at least:
|
6 |
-
Tested up to: 4.
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2
|
9 |
|
@@ -75,6 +75,12 @@ If you want to post a problem on the [support forums][wp] or at [github][gh] ple
|
|
75 |
|
76 |
== Changelog ==
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
= 2.4.2 =
|
79 |
* Fix CSRF vulnerabilities. Thanks to [J.D. Grimes](http://codesymphony.co/) for reporting them.
|
80 |
|
2 |
Contributors: sewpafly
|
3 |
Donate link: http://sewpafly.github.io/post-thumbnail-editor/#toc_donations
|
4 |
Tags: post-thumbnail, post thumbnail, featured image, featured, editor, image, awesome, crop
|
5 |
+
Requires at least: 4.1
|
6 |
+
Tested up to: 4.1.x
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2
|
9 |
|
75 |
|
76 |
== 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
|
83 |
+
|
84 |
= 2.4.2 =
|
85 |
* Fix CSRF vulnerabilities. Thanks to [J.D. Grimes](http://codesymphony.co/) for reporting them.
|
86 |
|
html/pte.php
CHANGED
@@ -283,26 +283,30 @@ function u( $path ){
|
|
283 |
</div>
|
284 |
<?php
|
285 |
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
</div>
|
284 |
<?php
|
285 |
|
286 |
+
function 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 |
|
294 |
+
if ( $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 |
+
}
|
304 |
+
else {
|
305 |
+
wp_enqueue_script(
|
306 |
+
'pte-min-js',
|
307 |
+
PTE_PLUGINURL . "js-build/main.js",
|
308 |
+
null,
|
309 |
+
PTE_VERSION,
|
310 |
+
true
|
311 |
+
);
|
312 |
+
}
|
js-build/main.js.gz
CHANGED
Binary file
|
js/snippets/pte_enable_media.js
CHANGED
@@ -13,7 +13,7 @@
|
|
13 |
var injectTemplate, template;
|
14 |
// Change the attachment-details html
|
15 |
injectTemplate = _.template("<a class=\"pte\" href=\"" +
|
16 |
-
pteL10n.
|
17 |
"\">\n " +
|
18 |
pteL10n.PTE +
|
19 |
"\n</a>", {id:"{{ data.id }}"});
|
@@ -24,7 +24,7 @@
|
|
24 |
// Change the *other* attachment details
|
25 |
template = $("#tmpl-attachment-details-two-column").text();
|
26 |
template = template.replace(/(<div class="actions">)([\s\S]*?)(<\/div>)/m,
|
27 |
-
"$1$2" + injectTemplate + "$3");
|
28 |
$("#tmpl-attachment-details-two-column").text(template);
|
29 |
});
|
30 |
|
@@ -50,6 +50,8 @@
|
|
50 |
//
|
51 |
loadPteEditor: function(evt) {
|
52 |
evt.preventDefault();
|
|
|
|
|
53 |
var state = this.controller.state().id;
|
54 |
var me = this;
|
55 |
if ( !featuredImageOpen && state !== "pte" ) {
|
13 |
var injectTemplate, template;
|
14 |
// Change the attachment-details html
|
15 |
injectTemplate = _.template("<a class=\"pte\" href=\"" +
|
16 |
+
pteL10n.fallbackUrl.replace(/&TB_iframe=true/,'') +
|
17 |
"\">\n " +
|
18 |
pteL10n.PTE +
|
19 |
"\n</a>", {id:"{{ data.id }}"});
|
24 |
// Change the *other* attachment details
|
25 |
template = $("#tmpl-attachment-details-two-column").text();
|
26 |
template = template.replace(/(<div class="actions">)([\s\S]*?)(<\/div>)/m,
|
27 |
+
"$1$2| " + injectTemplate + "$3");
|
28 |
$("#tmpl-attachment-details-two-column").text(template);
|
29 |
});
|
30 |
|
50 |
//
|
51 |
loadPteEditor: function(evt) {
|
52 |
evt.preventDefault();
|
53 |
+
evt.stopImmediatePropagation();
|
54 |
+
|
55 |
var state = this.controller.state().id;
|
56 |
var me = this;
|
57 |
if ( !featuredImageOpen && state !== "pte" ) {
|
php/functions.php
CHANGED
@@ -250,13 +250,6 @@ function pte_body( $id ){
|
|
250 |
"\nUSER-AGENT: " . $_SERVER['HTTP_USER_AGENT'] .
|
251 |
"\nWORDPRESS: " . $GLOBALS['wp_version'] );
|
252 |
|
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 |
-
|
260 |
// Generate an image and put into the ptetmp directory
|
261 |
if (false === $editor_image = pte_generate_working_image($id)) {
|
262 |
$editor_image = sprintf("%s?action=pte_imgedit_preview&_ajax_nonce=%s&postid=%d&rand=%d",
|
250 |
"\nUSER-AGENT: " . $_SERVER['HTTP_USER_AGENT'] .
|
251 |
"\nWORDPRESS: " . $GLOBALS['wp_version'] );
|
252 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
// Generate an image and put into the ptetmp directory
|
254 |
if (false === $editor_image = pte_generate_working_image($id)) {
|
255 |
$editor_image = sprintf("%s?action=pte_imgedit_preview&_ajax_nonce=%s&postid=%d&rand=%d",
|
php/options.php
CHANGED
@@ -107,8 +107,8 @@ function pte_site_options_validate( $input ){
|
|
107 |
|
108 |
foreach ( $sizes as $size ){
|
109 |
// Hidden
|
110 |
-
if ( is_array( $input['pte_hidden_sizes'] )
|
111 |
-
|
112 |
$pte_hidden_sizes[] = $size;
|
113 |
}
|
114 |
}
|
@@ -116,7 +116,7 @@ function pte_site_options_validate( $input ){
|
|
116 |
$output = array( 'pte_hidden_sizes' => $pte_hidden_sizes );
|
117 |
|
118 |
// Check the JPEG Compression value
|
119 |
-
if ( $input['pte_jpeg_compression'] != "" ){
|
120 |
$tmp_jpeg_compression = (int) preg_replace( "/[\D]/", "", $input['pte_jpeg_compression'] );
|
121 |
if ( ! is_int( $tmp_jpeg_compression )
|
122 |
|| $tmp_jpeg_compression < 0
|
107 |
|
108 |
foreach ( $sizes as $size ){
|
109 |
// Hidden
|
110 |
+
if ( isset($input['pte_hidden_sizes']) && is_array( $input['pte_hidden_sizes'] )
|
111 |
+
&& in_array( $size, $input['pte_hidden_sizes'] ) ){
|
112 |
$pte_hidden_sizes[] = $size;
|
113 |
}
|
114 |
}
|
116 |
$output = array( 'pte_hidden_sizes' => $pte_hidden_sizes );
|
117 |
|
118 |
// Check the JPEG Compression value
|
119 |
+
if ( isset($input['pte_jpeg_compression']) && $input['pte_jpeg_compression'] != "" ){
|
120 |
$tmp_jpeg_compression = (int) preg_replace( "/[\D]/", "", $input['pte_jpeg_compression'] );
|
121 |
if ( ! is_int( $tmp_jpeg_compression )
|
122 |
|| $tmp_jpeg_compression < 0
|
post-thumbnail-editor.php
CHANGED
@@ -4,7 +4,7 @@ Plugin name: Post Thumbnail Editor
|
|
4 |
Plugin URI: http://sewpafly.github.io/post-thumbnail-editor/
|
5 |
Author: sewpafly
|
6 |
Author URI: http://sewpafly.github.io/post-thumbnail-editor/
|
7 |
-
Version: 2.4.
|
8 |
Description: Individually manage your post thumbnails
|
9 |
|
10 |
LICENSE
|
@@ -34,7 +34,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
34 |
define( 'PTE_PLUGINURL', plugins_url(basename( dirname(__FILE__))) . "/");
|
35 |
define( 'PTE_PLUGINPATH', dirname(__FILE__) . "/");
|
36 |
define( 'PTE_DOMAIN', "post-thumbnail-editor");
|
37 |
-
define( 'PTE_VERSION', "2.4.
|
38 |
|
39 |
// TODO:
|
40 |
// * Find the best place for the require log (only when it's really needed, create an init function?)
|
@@ -210,6 +210,7 @@ function pte_admin_media_scripts($post_type){
|
|
210 |
, 'pteL10n'
|
211 |
, array('PTE' => __('Post Thumbnail Editor', PTE_DOMAIN)
|
212 |
, 'url' => pte_url( "<%= id %>", true )
|
|
|
213 |
)
|
214 |
);
|
215 |
}
|
@@ -338,6 +339,7 @@ function pte_load_media_library() {
|
|
338 |
, 'pteL10n'
|
339 |
, array('PTE' => __('Post Thumbnail Editor', PTE_DOMAIN)
|
340 |
, 'url' => pte_url( "<%= id %>", true )
|
|
|
341 |
)
|
342 |
);
|
343 |
}
|
@@ -442,7 +444,6 @@ function pte_edit_setup() {
|
|
442 |
$title = __( "Post Thumbnail Editor", PTE_DOMAIN );
|
443 |
|
444 |
include_once( PTE_PLUGINPATH . "php/functions.php" );
|
445 |
-
$pte_body = pte_body( $post->ID );
|
446 |
|
447 |
// Add the scripts and styles
|
448 |
wp_enqueue_script( 'jquery' );
|
@@ -450,6 +451,8 @@ function pte_edit_setup() {
|
|
450 |
wp_enqueue_script( 'iris' );
|
451 |
wp_enqueue_style( 'colors' );
|
452 |
wp_enqueue_style( 'wp-jquery-ui-dialog' );
|
|
|
|
|
453 |
}
|
454 |
|
455 |
/**
|
4 |
Plugin URI: http://sewpafly.github.io/post-thumbnail-editor/
|
5 |
Author: sewpafly
|
6 |
Author URI: http://sewpafly.github.io/post-thumbnail-editor/
|
7 |
+
Version: 2.4.3
|
8 |
Description: Individually manage your post thumbnails
|
9 |
|
10 |
LICENSE
|
34 |
define( 'PTE_PLUGINURL', plugins_url(basename( dirname(__FILE__))) . "/");
|
35 |
define( 'PTE_PLUGINPATH', dirname(__FILE__) . "/");
|
36 |
define( 'PTE_DOMAIN', "post-thumbnail-editor");
|
37 |
+
define( 'PTE_VERSION', "2.4.3");
|
38 |
|
39 |
// TODO:
|
40 |
// * Find the best place for the require log (only when it's really needed, create an init function?)
|
210 |
, 'pteL10n'
|
211 |
, array('PTE' => __('Post Thumbnail Editor', PTE_DOMAIN)
|
212 |
, 'url' => pte_url( "<%= id %>", true )
|
213 |
+
, 'fallbackUrl' => pte_url( "<%= id %>" )
|
214 |
)
|
215 |
);
|
216 |
}
|
339 |
, 'pteL10n'
|
340 |
, array('PTE' => __('Post Thumbnail Editor', PTE_DOMAIN)
|
341 |
, 'url' => pte_url( "<%= id %>", true )
|
342 |
+
, 'fallbackUrl' => pte_url( "<%= id %>" )
|
343 |
)
|
344 |
);
|
345 |
}
|
444 |
$title = __( "Post Thumbnail Editor", PTE_DOMAIN );
|
445 |
|
446 |
include_once( PTE_PLUGINPATH . "php/functions.php" );
|
|
|
447 |
|
448 |
// Add the scripts and styles
|
449 |
wp_enqueue_script( 'jquery' );
|
451 |
wp_enqueue_script( 'iris' );
|
452 |
wp_enqueue_style( 'colors' );
|
453 |
wp_enqueue_style( 'wp-jquery-ui-dialog' );
|
454 |
+
|
455 |
+
$pte_body = pte_body( $post->ID );
|
456 |
}
|
457 |
|
458 |
/**
|