Simple Image Sizes - Version 2.2.3

Version Description

Download this release

Release Info

Developer Rahe
Plugin Icon wp plugin Simple Image Sizes
Version 2.2.3
Comparing to
See all releases

Code changes from version 2.2 to 2.2.3

css/sis-style.css CHANGED
@@ -1,62 +1,70 @@
1
- .progress {
2
- position:relative;
3
- height:13px;
4
- margin-bottom: 43px;
5
- margin-top: 60px;
6
- color:#FFFFFF;
7
- display:none;
8
- }
9
-
10
- .progress .progress-percent {
11
- position: absolute;
12
- left: 0%;
13
- top: -63px;
14
- width: 82px;
15
- height: 49px;
16
- margin-top: -9px;
17
- font-weight: bold;
18
- line-height: 39px;
19
- text-align: center;
20
- }
21
- input.h,input.w{
22
- border-color: #DFDFDF;
23
- background-color: white;
24
- border-width: 1px;
25
- border-style: solid;
26
- -moz-border-radius: 3px;
27
- -khtml-border-radius: 3px;
28
- -webkit-border-radius: 3px;
29
- border-radius: 3px;
30
- }
31
- tr{
32
- -webkit-transition: all .5s ease-in-out;
33
- -moz-transition: all .5s ease-in-out;
34
- -o-transition: all .5s ease-in-out;
35
- transition: all .5s ease-in-out;
36
- }
37
- table.sis tr:nth-child(even) {
38
- background-color:#FCFCFC ;
39
- }
40
- table.sis tr:nth-child(odd) {
41
- background-color:transparent ;
42
- }
43
- tr.addPending {
44
- background-color:#6CA1D7;
45
- }
46
- tr.successAdding {
47
- background-color:#89D76A;
48
- }
49
- tr.errorAdding {
50
- background-color:#C45858;
51
- }
52
- tr.notChangedAdding {
53
- background-color:#F2A13A;
54
- }
55
-
56
- #regenerate_message,#time,#thumb {
57
- display:none;
58
- }
59
-
60
- #ajax_thumbnail_rebuild {
61
- margin-top:40px;
 
 
 
 
 
 
 
 
62
  }
1
+ .progress {
2
+ position:relative;
3
+ height:13px;
4
+ margin-bottom: 43px;
5
+ margin-top: 60px;
6
+ color:#FFFFFF;
7
+ display:none;
8
+ }
9
+
10
+ .progress .progress-percent {
11
+ position: absolute;
12
+ left: 0%;
13
+ top: -63px;
14
+ width: 82px;
15
+ height: 49px;
16
+ margin-top: -9px;
17
+ font-weight: bold;
18
+ line-height: 39px;
19
+ text-align: center;
20
+ }
21
+ input.h,input.w{
22
+ border-color: #DFDFDF;
23
+ background-color: white;
24
+ border-width: 1px;
25
+ border-style: solid;
26
+ -moz-border-radius: 3px;
27
+ -khtml-border-radius: 3px;
28
+ -webkit-border-radius: 3px;
29
+ border-radius: 3px;
30
+ }
31
+ tr{
32
+ -webkit-transition: all .5s ease-in-out;
33
+ -moz-transition: all .5s ease-in-out;
34
+ -o-transition: all .5s ease-in-out;
35
+ transition: all .5s ease-in-out;
36
+ }
37
+ table.sis tr:nth-child(even) {
38
+ background-color:#FCFCFC ;
39
+ }
40
+ table.sis tr:nth-child(odd) {
41
+ background-color:transparent ;
42
+ }
43
+ tr.addPending {
44
+ background-color:#6CA1D7;
45
+ }
46
+ tr.successAdding {
47
+ background-color:#89D76A;
48
+ }
49
+ tr.errorAdding {
50
+ background-color:#C45858;
51
+ }
52
+ tr.notChangedAdding {
53
+ background-color:#F2A13A;
54
+ }
55
+
56
+ #regenerate_message,#time,#thumb {
57
+ display:none;
58
+ }
59
+
60
+ #ajax_thumbnail_rebuild {
61
+ margin-top:40px;
62
+ }
63
+ @media screen and (max-width: 820px) {
64
+ .sis-label {
65
+ display:block;
66
+ }
67
+ .size_options label{
68
+ margin-top: -5px;
69
+ }
70
  }
inc/class.admin.php CHANGED
@@ -1,763 +1,783 @@
1
- <?php
2
- Class SISAdmin {
3
-
4
- // Original sizes
5
- public $original = array( 'thumbnail', 'medium', 'large' );
6
-
7
- public function __construct(){
8
- // Init
9
- add_action ( 'admin_menu', array( &$this, 'init' ) );
10
- add_action ( 'admin_enqueue_scripts', array( &$this, 'registerScripts' ), 11 );
11
-
12
- // Add ajax action
13
- add_action('wp_ajax_sis_ajax_thumbnail_rebuild', array( &$this, 'ajaxThumbnailRebuildAjax' ) );
14
- add_action('wp_ajax_get_sizes', array( &$this, 'ajaxGetSizes' ) );
15
- add_action('wp_ajax_add_size', array( &$this, 'ajaxAddSize' ) );
16
- add_action('wp_ajax_remove_size', array( &$this, 'ajaxRemoveSize' ) );
17
-
18
- // Add image sizes in the form
19
- add_filter( 'attachment_fields_to_edit', array( &$this, 'sizesInForm' ), 11, 2 ); // Add our sizes to media forms
20
-
21
- // Add link in plugins list
22
- add_filter('plugin_action_links', array( &$this,'addSettingsLink'), 10, 2 );
23
-
24
- // Add action in media row quick actions
25
- add_filter( 'media_row_actions', array(&$this, 'addActionsList'), 10, 2 );
26
- }
27
-
28
- /**
29
- * Register javascripts and css.
30
- *
31
- * @access public
32
- * @return void
33
- * @author Nicolas Juen
34
- */
35
- public function registerScripts($hook_suffix = '' ) {
36
- if( isset( $hook_suffix ) && $hook_suffix == 'options-media.php' ) {
37
- // Add javascript
38
- wp_enqueue_script( 'sis-jquery-ui-sis', SIS_URL.'js/jquery-ui-1.8.16.custom.min.js', array('jquery'), '1.8.16' );
39
- wp_enqueue_script( 'sis_js', SIS_URL.'js/sis.min.js', array('jquery','sis-jquery-ui-sis'), SIS_VERSION );
40
-
41
- // Add javascript translation
42
- wp_localize_script( 'sis_js', 'sis', $this->localizeVars() );
43
-
44
- // Add CSS
45
- wp_enqueue_style( 'jquery-ui-sis', SIS_URL.'css/Aristo/jquery-ui-1.8.7.custom.css', array(), '1.8.7' );
46
- wp_enqueue_style( 'sis_css', SIS_URL.'css/sis-style.css', array(), SIS_VERSION );
47
- } elseif( isset( $hook_suffix ) && $hook_suffix == 'upload.php' ) {
48
- // Add javascript
49
- wp_enqueue_script( 'sis_js', SIS_URL.'js/sis-attachments.min.js', array( 'jquery' ), SIS_VERSION );
50
-
51
- // Add javascript translation
52
- wp_localize_script( 'sis_js', 'sis', $this->localizeVars() );
53
- }
54
- }
55
-
56
- /**
57
- * Localize the var for javascript
58
- *
59
- * @access public
60
- * @return void
61
- * @author Nicolas Juen
62
- */
63
- public function localizeVars() {
64
- return array(
65
- 'ajaxUrl' => admin_url( '/admin-ajax.php' ),
66
- 'reading' => __( 'Reading attachments...', 'sis' ),
67
- 'maximumWidth' => __( 'Maximum width', 'sis' ),
68
- 'maximumHeight' => __( 'Maximum height', 'sis' ),
69
- 'crop' => __( 'Crop ?', 'sis' ),
70
- 'tr' => __( 'yes', 'sis' ),
71
- 'fl' => __( 'no', 'sis' ),
72
- 'show' => __( 'Show in post insertion ?', 'sis' ),
73
- 'of' => __( ' of ', 'sis' ),
74
- 'or' => __( ' or ', 'sis' ),
75
- 'beforeEnd' => __( ' before the end.', 'sis' ),
76
- 'deleteImage' => __( 'Delete', 'sis' ),
77
- 'noMedia' => __( 'No media in your site to regenerate !', 'sis' ),
78
- 'regenerating' => __( 'Regenerating ', 'sis'),
79
- 'validate' => __( 'Validate image size name', 'sis' ),
80
- 'done' => __( 'Done.', 'sis' ),
81
- 'size' => __( 'Size', 'sis' ),
82
- 'notOriginal' => __( 'Don\'t use the basic Wordpress thumbnail size name, use the form above to edit them', 'sis' ),
83
- 'alreadyPresent' => __( 'This size is already registered, edit it instead of recreating it.', 'sis' ),
84
- 'confirmDelete' => __( 'Do you really want to delete these size ?', 'sis' ),
85
- 'update' => __( 'Update', 'sis' ),
86
- 'ajaxErrorHandler' => __( 'Error requesting page', 'sis' ),
87
- 'messageRegenerated' => __( 'images have been regenerated !', 'sis' ),
88
- 'validateButton' => __( 'Validate', 'sis' ),
89
- 'startedAt' => __( ' started at', 'sis' ),
90
- 'finishedAt' => __( ' finished at :', 'sis' ),
91
- 'phpError' => __( 'Error during the php treatment, be sure to not have php errors in your page', 'sis' ),
92
- 'notSaved' => __( 'All the sizes you have modifed are not saved, continue anyway ?', 'sis' ),
93
- 'soloRegenerated' => __( 'This image has been regenerated in %s seconds', 'sis' ),
94
- );
95
- }
96
-
97
- /**
98
- * Add action in media row
99
- *
100
- * @since 2.2
101
- * @access public
102
- * @return $actions : array of actions and content to display
103
- * @author Nicolas Juen
104
- */
105
- function addActionsList( $actions, $object ) {
106
-
107
- // Add action for regeneration
108
- $actions['sis-regenerate'] = "<a href='#' class='sis-regenerate-one'>".__( 'Regenerate thumbnails', 'sis' )."</a>";
109
-
110
- // Return actions
111
- return $actions;
112
- }
113
-
114
- /**
115
- * Add a link to the setting option page
116
- *
117
- * @access public
118
- * @param array $links
119
- * @param string $file
120
- * @return void
121
- * @author Nicolas Juen
122
- */
123
- public function addSettingsLink( $links, $file ) {
124
-
125
- if( $file != 'simple-image-sizes/simple_image_sizes.php' )
126
- return $links;
127
-
128
- $settings_link = '<a href="'.admin_url('options-media.php').'"> '.__( 'Settings', 'sis' ).' </a>';
129
- array_unshift($links, $settings_link);
130
-
131
- return $links;
132
- }
133
-
134
- /**
135
- * Init for the option page
136
- *
137
- * @access public
138
- * @return void
139
- * @author Nicolas Juen
140
- */
141
- function init() {
142
- // Check if admin
143
- if( !is_admin() )
144
- return false;
145
-
146
- // Get the image sizes
147
- global $_wp_additional_image_sizes;
148
- $options = get_option( SIS_OPTION );
149
-
150
- // Get the sizes and add the settings
151
- foreach ( get_intermediate_image_sizes() as $s ) {
152
- // Don't make the original sizes or numeric sizes that appear
153
- if( in_array( $s, $this->original ) || is_integer( $s ) )
154
- continue;
155
-
156
- // Set width
157
- if ( isset( $_wp_additional_image_sizes[$s]['width'] ) ) // For theme-added sizes
158
- $width = intval( $_wp_additional_image_sizes[$s]['width'] );
159
- else // For default sizes set in options
160
- $width = get_option( "{$s}_size_w" );
161
-
162
- // Set height
163
- if ( isset( $_wp_additional_image_sizes[$s]['height'] ) ) // For theme-added sizes
164
- $height = intval( $_wp_additional_image_sizes[$s]['height'] );
165
- else // For default sizes set in options
166
- $height = get_option( "{$s}_size_h" );
167
-
168
- //Set crop
169
- if ( isset( $_wp_additional_image_sizes[$s]['crop'] ) ) { // For theme-added sizes
170
- $crop = intval( $_wp_additional_image_sizes[$s]['crop'] );
171
- } else {
172
- // For default sizes set in options
173
- $crop = get_option( "{$s}_crop" );
174
- }
175
-
176
- // Add the setting field for this size
177
- add_settings_field( 'image_size_'.$s, sprintf( __( '%s size', 'sis' ), $s ), array( &$this, 'imageSizes' ), 'media' , 'default', array( 'name' => $s , 'width' => $width , 'height' => $height, 'c' => $crop ) );
178
- }
179
-
180
- // Register the setting for media option page
181
- register_setting( 'media', SIS_OPTION );
182
-
183
- // Add the button
184
- add_settings_field( 'add_size_button', __( 'Add a new size', 'sis' ), array( &$this, 'addSizeButton' ), 'media' );
185
-
186
- // Add legend
187
- add_settings_field( 'add_legend', __( 'Legend of the sizes', 'sis' ), array( &$this, 'addLegend' ), 'media' );
188
-
189
- // Add php button
190
- add_settings_field( 'get_php_button', __( 'Get php for theme', 'sis' ), array( &$this, 'getPhpButton' ), 'media' );
191
-
192
- // Add section for the thumbnail regeneration
193
- add_settings_section( 'thumbnail_regenerate', __( 'Thumbnail regeneration', 'sis' ), array( &$this, 'thumbnailRegenerate' ), 'media' );
194
- }
195
-
196
- /**
197
- * Display the row of the image size
198
- *
199
- * @access public
200
- * @param mixed $args
201
- * @return void
202
- * @author Nicolas Juen
203
- */
204
- public function imageSizes( $args ) {
205
-
206
- if( is_integer( $args['name'] ) )
207
- return false;
208
-
209
- // Get the options
210
- $sizes = (array)get_option( SIS_OPTION );
211
-
212
- // Get the vars
213
- $height = isset( $sizes[$args['name']]['h'] )? $sizes[$args['name']]['h'] : $args['height'] ;
214
- $width = isset( $sizes[$args['name']]['w'] )? $sizes[$args['name']]['w'] : $args['width'] ;
215
- $crop = isset( $sizes[$args['name']]['c'] ) && !empty( $sizes[$args['name']]['c'] )? $sizes[$args['name']]['c'] : $args['c'] ;
216
- $show = isset( $sizes[$args['name']]['s'] ) && !empty( $sizes[$args['name']]['s'] )? '1' : '0' ;
217
- $custom = isset( $sizes[$args['name']]['custom'] ) && !empty( $sizes[$args['name']]['custom'] )? '1' : '0' ;
218
- ?>
219
- <input type="hidden" value="<?php echo $args['name']; ?>" name="image_name" />
220
- <?php if( $custom ): ?>
221
- <input name="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][custom]' ); ?>" type="hidden" id="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][custom]' ); ?>" value="1" />
222
- <?php else: ?>
223
- <input name="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][theme]' ); ?>" type="hidden" id="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][theme]' ); ?>" value="1" />
224
- <?php endif; ?>
225
- <label for="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][w]' ); ?>">
226
- <?php _e( 'Maximum width', 'sis'); ?>
227
- <input name="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][w]' ); ?>" class='w small-text' type="number" step='1' min='0' id="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][w]' ); ?>" base_w='<?php esc_attr_e( $width ); ?>' value="<?php esc_attr_e( $width ); ?>" />
228
- </label>
229
-
230
- <label for="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][h]' ); ?>">
231
- <?php _e( 'Maximum height', 'sis'); ?>
232
- <input name="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][h]' ); ?>" class='h small-text' type="number" step='1' min='0' id="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][h]' ); ?>" base_h='<?php esc_attr_e( $height ); ?>' value="<?php esc_attr_e( $height ); ?>" />
233
- </label>
234
-
235
- <div class="crop">
236
- <input type='checkbox' id="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][c]' ); ?>" <?php checked( $crop, 1 ) ?> class="c" base_c='<?php esc_attr_e( $crop ); ?>' name="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][c]' ); ?>" value="1" />
237
- <label for="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][c]' ); ?>"><?php _e( 'Crop ?', 'sis'); ?></label>
238
- </div>
239
-
240
- <div class="show">
241
- <input type='checkbox' id="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][s]'); ?>" <?php checked( $show, 1 ) ?> class="s" base_s='<?php esc_attr_e( $show ); ?>' name="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][s]'); ?>" value="1" />
242
- <label for="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][s]'); ?>"><?php _e( 'Show in post insertion ?', 'sis'); ?></label>
243
- </div>
244
- <div class="delete_size"><?php _e( 'Delete', 'sis'); ?></div>
245
- <div class="add_size validate_size"><?php _e( 'Update', 'sis'); ?></div>
246
- <?php }
247
-
248
- /**
249
- * Add the button to add a size
250
- *
251
- * @access public
252
- * @return void
253
- * @author Nicolas Juen
254
- */
255
- public function addSizeButton() { ?>
256
- <input type="button" class="button-secondary action" id="add_size" value="<?php esc_attr_e( 'Add a new size of thumbnail', 'sis'); ?>" />
257
- <?php
258
- }
259
-
260
- /**
261
- * Add the button to get the php for th sizes
262
- *
263
- * @access public
264
- * @return void
265
- * @author Nicolas Juen
266
- */
267
- public function getPhpButton() { ?>
268
- <input type="button" class="button-secondary action" id="get_php" value="<?php esc_attr_e( 'Get the PHP for the theme', 'sis'); ?>" />
269
- <p> <?php _e( 'Copy and paste the code below into your Wordpress theme function file if you wanted to save them and deactivate the plugin.', 'sis'); ?> </p>
270
- <code></code>
271
- <?php
272
- }
273
-
274
- /**
275
- * Add the legend fo the colors
276
- *
277
- * @access public
278
- * @return void
279
- * @author Nicolas Juen
280
- */
281
- public function addLegend() { ?>
282
- <?php _e('The images created on your theme are <span style="color:#F2A13A">orange</span> and your custom size are <span style="color:#89D76A"> green </span>.', 'sis'); ?>
283
- <?php
284
- }
285
-
286
- /**
287
- * Display the Table of sizes and post types for regenerating
288
- *
289
- * @access public
290
- * @return void
291
- * @author Nicolas Juen
292
- */
293
- public function thumbnailRegenerate() {
294
- // Get the sizes
295
- global $_wp_additional_image_sizes;
296
- ?>
297
- <div id="sis-regen">
298
- <div class="wrapper" style="">
299
- <h4> <?php _e( 'Select which thumbnails you want to rebuild:', 'sis'); ?> </h4>
300
- <table cellspacing="0" class="widefat page fixed sis">
301
- <thead>
302
- <tr>
303
- <th class="manage-column" scope="col"><?php _e( 'Resize ?', 'sis'); ?></th>
304
- <th class="manage-column" scope="col"><?php _e( 'Size name', 'sis'); ?></th>
305
- <th class="manage-column" scope="col"><?php _e( 'Width', 'sis'); ?></th>
306
- <th class="manage-column" scope="col"><?php _e( 'Height', 'sis'); ?></th>
307
- <th class="manage-column" scope="col"><?php _e( 'Crop ?', 'sis'); ?></th>
308
- </tr>
309
- </thead>
310
- <tbody>
311
- <?php
312
- // Display the sizes in the array
313
- foreach ( get_intermediate_image_sizes() as $s ):
314
- // Don't make or numeric sizes that appear
315
- if( is_integer( $s ) )
316
- continue;
317
-
318
- if ( isset( $_wp_additional_image_sizes[$s]['width'] ) ) // For theme-added sizes
319
- $width = intval( $_wp_additional_image_sizes[$s]['width'] );
320
- else // For default sizes set in options
321
- $width = get_option( "{$s}_size_w" );
322
-
323
- if ( isset( $_wp_additional_image_sizes[$s]['height'] ) ) // For theme-added sizes
324
- $height = intval( $_wp_additional_image_sizes[$s]['height'] );
325
- else // For default sizes set in options
326
- $height = get_option( "{$s}_size_h" );
327
-
328
- if ( isset( $_wp_additional_image_sizes[$s]['crop'] ) ) // For theme-added sizes
329
- $crop = intval( $_wp_additional_image_sizes[$s]['crop'] );
330
- else // For default sizes set in options
331
- $crop = get_option( "{$s}_crop" );
332
- ?>
333
- <tr>
334
- <td>
335
- <input type="checkbox" class="thumbnails" id="<?php echo $s ?>" name="thumbnails[]" checked="checked" value="<?php echo esc_attr( $s ); ?>" />
336
- </td>
337
- <td>
338
- <label for="<?php echo esc_attr( $s ); ?>">
339
- <?php echo esc_html( $s ); ?>
340
- </label>
341
- </td>
342
- <td>
343
- <label for="<?php echo esc_attr( $s ); ?>">
344
- <?php echo esc_html( $width); ?> px
345
- </label>
346
- </td>
347
- <td>
348
- <label for="<?php echo esc_attr( $s ); ?>">
349
- <?php echo esc_html( $height ); ?> px
350
- </label>
351
- </td>
352
- <td>
353
- <label for="<?php echo esc_attr( $s ); ?>">
354
- <?php echo ( $crop == 1 )? __( 'yes', 'sis' ):__( 'no', 'sis' ); ?>
355
- </label>
356
- </td>
357
- </tr>
358
- <?php endforeach;?>
359
- </tbody>
360
- <tfoot>
361
- <tr>
362
- <th class="manage-column" scope="col"><?php _e( 'Resize ?', 'sis'); ?></th>
363
- <th class="manage-column" scope="col"><?php _e( 'Size name', 'sis'); ?></th>
364
- <th class="manage-column" scope="col"><?php _e( 'Width', 'sis'); ?></th>
365
- <th class="manage-column" scope="col"><?php _e( 'Height', 'sis'); ?></th>
366
- <th class="manage-column" scope="col"><?php _e( 'Crop ?', 'sis'); ?></th>
367
- </tr>
368
- </tfoot>
369
- </table>
370
-
371
- <h4><?php _e( 'Select which post type source thumbnails you want to rebuild:', 'sis'); ?></h4>
372
- <table cellspacing="0" class="widefat page fixed sis">
373
- <thead>
374
- <tr>
375
- <th class="manage-column" scope="col"><?php _e( 'Resize ?', 'sis'); ?></th>
376
- <th class="manage-column" scope="col"><?php _e( 'Post type', 'sis'); ?></th>
377
- </tr>
378
- </thead>
379
- <tbody>
380
- <?php
381
- // Diplay the post types table
382
- foreach ( get_post_types( array( 'public' => true ), 'objects' ) as $ptype ):
383
- ?>
384
- <tr>
385
- <td>
386
- <label for="<?php echo esc_attr( $ptype->name ); ?>">
387
- <input type="checkbox" class="post_types" name="post_types[]" checked="checked" id="<?php echo esc_attr( $ptype->name ); ?>" value="<?php echo esc_attr( $ptype->name ); ?>" />
388
- </label>
389
- </td>
390
- <td>
391
- <label for="<?php echo esc_attr( $ptype->name ); ?>">
392
- <em><?php echo esc_html( $ptype->labels->name ); ?></em>
393
- </label>
394
- </td>
395
- </tr>
396
- <?php endforeach;?>
397
- </tbody>
398
- <tfoot>
399
- <tr>
400
- <th class="manage-column" scope="col"><?php _e( 'Resize ?', 'sis'); ?></th>
401
- <th class="manage-column" scope="col"><?php _e( 'Post type', 'sis'); ?></th>
402
- </tr>
403
- </tfoot>
404
- </table>
405
- </div>
406
- </div>
407
- <div >
408
- <div id="regenerate_message"></div>
409
- <div class="progress">
410
- <div class=" progress-percent ui-widget">
411
- <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
412
- <p>
413
- <span class="ui-icon ui-icon-info" style="float: left; margin-right: .7em;"></span>
414
- <span class="text">0%</span>
415
- </p>
416
- </div>
417
- </div>
418
- </div>
419
- <div class="ui-widget" id="time">
420
- <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
421
- <p>
422
- <span class="ui-icon ui-icon-info" style="float: left; margin-right: .7em;"></span>
423
- <span><strong><?php _e( 'End time calculated :', 'sis' ); ?></strong> <span class='time_message'>Calculating...</span> </span>
424
- </p>
425
- <ul class="messages"></ul>
426
- </div>
427
- </div>
428
- <div id="error_messages">
429
- <p>
430
- <ul class="messages">
431
- </ul>
432
- </p>
433
- </div>
434
- <div id="thumb"><h4><?php _e( 'Last image:', 'sis'); ?></h4><img id="thumb-img" /></div>
435
- <input type="button" class="button" name="ajax_thumbnail_rebuild" id="ajax_thumbnail_rebuild" value="<?php _e( 'Regenerate Thumbnails', 'sis' ) ?>" />
436
- </div>
437
- <?php
438
- }
439
-
440
- /**
441
- * Add a size by Ajax
442
- *
443
- * @access public
444
- * @return void
445
- * @author Nicolas Juen
446
- */
447
- public function ajaxAddSize() {
448
-
449
- // Get old options
450
- $sizes = (array)get_option( SIS_OPTION );
451
-
452
- // Check entries
453
- $name = isset( $_POST['name'] ) ? remove_accents ( $_POST['name'] ): '' ;
454
- $height = !isset( $_POST['height'] )? 0 : absint( $_POST['height'] );
455
- $width = !isset( $_POST['width'] )? 0 : absint( $_POST['width'] );
456
- $crop = isset( $_POST['crop'] ) && $_POST['crop'] == 'false' ? false : true;
457
- $show = isset( $_POST['show'] ) && $_POST['show'] == 'false' ? false : true;
458
-
459
- // If no name given do not save
460
- if( empty( $name ) ) {
461
- echo 0;
462
- die();
463
- }
464
-
465
- // Make values
466
- $values = array( 'custom' => 1, 'w' => $width , 'h' => $height, 'c' => $crop, 's' => $show );
467
-
468
- // If the size have not changed return 2
469
- if( isset( $sizes[$name] ) && $sizes[$name] === $values ) {
470
- echo 2;
471
- die();
472
- }
473
-
474
- // Put the new values
475
- $sizes[$name] = $values;
476
-
477
- // display update result
478
- echo (int)update_option( 'custom_image_sizes', $sizes );
479
- die();
480
- }
481
-
482
- /**
483
- * Remove a size by Ajax
484
- *
485
- * @access public
486
- * @return void
487
- * @author Nicolas Juen
488
- */
489
- public function ajaxRemoveSize() {
490
- // Get old options
491
- $sizes = (array)get_option( SIS_OPTION );
492
-
493
- // Remove the size
494
- unset( $sizes[apply_filters( 'sanitize_title', $_POST['name'] )] );
495
- unset( $sizes[0] );
496
-
497
- // Display the results
498
- echo (int)update_option( SIS_OPTION, $sizes );
499
- die();
500
- }
501
-
502
- /**
503
- * Display the add_image_size for the registered sizes
504
- *
505
- * @access public
506
- * @return void
507
- */
508
- public function ajaxGetSizes() {
509
- global $_wp_additional_image_sizes;
510
-
511
- foreach ( get_intermediate_image_sizes() as $s ):
512
-
513
- // Don't make the original sizes
514
- if( in_array( $s, $this->original ) )
515
- continue;
516
-
517
- if ( isset( $_wp_additional_image_sizes[$s]['width'] ) ) // For theme-added sizes
518
- $width = intval( $_wp_additional_image_sizes[$s]['width'] );
519
- else // For default sizes set in options
520
- $width = get_option( "{$s}_size_w" );
521
-
522
- if ( isset( $_wp_additional_image_sizes[$s]['height'] ) ) // For theme-added sizes
523
- $height = intval( $_wp_additional_image_sizes[$s]['height'] );
524
- else // For default sizes set in options
525
- $height = get_option( "{$s}_size_h" );
526
-
527
- if ( isset( $_wp_additional_image_sizes[$s]['crop'] ) ) // For theme-added sizes
528
- $crop = intval( $_wp_additional_image_sizes[$s]['crop'] );
529
- else // For default sizes set in options
530
- $crop = get_option( "{$s}_crop" );
531
-
532
- $crop = ( $crop == 0 )? 'false' : 'true' ;
533
- ?>
534
- add_image_size( '<?php echo $s; ?>', '<?php echo $width; ?>', '<?php echo $height; ?>', <?php echo $crop ?> );<br />
535
- <?php endforeach;
536
-
537
- die();
538
- }
539
-
540
- /**
541
- * Rebuild the image
542
- *
543
- * @access public
544
- * @return void
545
- * @author Nicolas Juen
546
- */
547
- public function ajaxThumbnailRebuildAjax() {
548
- global $wpdb;
549
-
550
- // Time a the begining
551
- $start_time = microtime(true);
552
-
553
- // Get the action
554
- $action = $_POST["do"];
555
-
556
- // Get the thumbnails
557
- $thumbnails = isset( $_POST['thumbnails'] )? $_POST['thumbnails'] : NULL;
558
-
559
- if ( $action == "getlist" ) {
560
- if ( isset( $_POST['post_types'] ) && !empty( $_POST['post_types'] ) ) {
561
-
562
- // Get image medias
563
- $whichmimetype = wp_post_mime_type_where( 'image', $wpdb->posts );
564
-
565
- // Get all parent from post type
566
- $attachments = $wpdb->get_results( "SELECT *
567
- FROM $wpdb->posts
568
- WHERE 1 = 1
569
- AND post_type = 'attachment'
570
- $whichmimetype
571
- AND post_parent IN (
572
- SELECT DISTINCT ID
573
- FROM $wpdb->posts
574
- WHERE post_type IN ('".implode( "', '", $_POST['post_types'] )."')
575
- )" );
576
-
577
- } else {
578
- $attachments =& get_children( array(
579
- 'post_type' => 'attachment',
580
- 'post_mime_type' => 'image',
581
- 'numberposts' => -1,
582
- 'post_status' => null,
583
- 'post_parent' => null, // any parent
584
- 'output' => 'object',
585
- ) );
586
- }
587
-
588
- // Get the attachments
589
- foreach ( $attachments as $attachment ) {
590
- $res[] = array('id' => $attachment->ID, 'title' => $attachment->post_title);
591
- }
592
- // Return the Id's and Title of medias
593
- die( json_encode( $res ) );
594
- } else if ( $action == "regen" ) {
595
- // Get the id
596
- $id = $_POST["id"];
597
-
598
- // Check Id
599
- if( (int)$id == 0 ) {
600
- die( json_encode( array( round( microtime( true ) - $start_time, 4 ), 'error' => __( 'No id given in POST datas.', 'sis' ) ) ) );
601
- }
602
-
603
- // Get the path
604
- $fullsizepath = get_attached_file( $id );
605
-
606
- // Regen the attachment
607
- if ( FALSE !== $fullsizepath && @file_exists( $fullsizepath ) ) {
608
- set_time_limit( 30 );
609
- if( wp_update_attachment_metadata( $id, $this->wp_generate_attachment_metadata_custom( $id, $fullsizepath, $thumbnails ) ) == false )
610
- die( json_encode( array( 'src' => wp_get_attachment_thumb_url( $id ), 'time' => round( microtime( true ) - $start_time, 4 ) ,'message' => sprintf( __( 'This file does not exists and have not been regenerated :<br/><a target="_blank" href="%1$s" >%2$s</a>', 'sis'), get_edit_post_link( $id ), get_the_title( $id ) ) ) ) );
611
- } else {
612
- die( json_encode( array( 'src' => wp_get_attachment_thumb_url( $id ), 'time' => round( microtime( true ) - $start_time, 4 ), 'error' => sprintf( __( 'This file does not exists and have not been regenerated :<br/><a target="_blank" href="%1$s" >%2$s</a>', 'sis'), get_edit_post_link( $id ), get_the_title( $id ) ) ) ) );
613
- }
614
- // Display the attachment url for feedback
615
- die( json_encode( array( 'time' => round( microtime( true ) - $start_time, 4 ) , 'src' => wp_get_attachment_thumb_url( $id ), 'title' => get_the_title( $id ) ) ) );
616
- }
617
- }
618
-
619
- /**
620
- * Generate post thumbnail attachment meta data.
621
- *
622
- * @since 2.1.0
623
- *
624
- * @param int $attachment_id Attachment Id to process.
625
- * @param string $file Filepath of the Attached image.
626
- * @return mixed Metadata for attachment.
627
- */
628
- public function wp_generate_attachment_metadata_custom( $attachment_id, $file, $thumbnails = NULL ) {
629
- $attachment = get_post( $attachment_id );
630
-
631
- $meta_datas = get_post_meta( $attachment_id, '_wp_attachment_metadata', true );
632
-
633
- $metadata = array();
634
- if ( preg_match('!^image/!', get_post_mime_type( $attachment )) && file_is_displayable_image($file) ) {
635
- $imagesize = getimagesize( $file );
636
- $metadata['width'] = $imagesize[0];
637
- $metadata['height'] = $imagesize[1];
638
- list($uwidth, $uheight) = wp_constrain_dimensions($metadata['width'], $metadata['height'], 128, 96);
639
- $metadata['hwstring_small'] = "height='$uheight' width='$uwidth'";
640
-
641
- // Make the file path relative to the upload dir
642
- $metadata['file'] = _wp_relative_upload_path($file);
643
-
644
- // make thumbnails and other intermediate sizes
645
- global $_wp_additional_image_sizes;
646
-
647
- foreach ( get_intermediate_image_sizes() as $s ) {
648
- $sizes[$s] = array( 'width' => '', 'height' => '', 'crop' => FALSE );
649
- if ( isset( $_wp_additional_image_sizes[$s]['width'] ) )
650
- $sizes[$s]['width'] = intval( $_wp_additional_image_sizes[$s]['width'] ); // For theme-added sizes
651
- else
652
- $sizes[$s]['width'] = get_option( "{$s}_size_w" ); // For default sizes set in options
653
- if ( isset( $_wp_additional_image_sizes[$s]['height'] ) )
654
- $sizes[$s]['height'] = intval( $_wp_additional_image_sizes[$s]['height'] ); // For theme-added sizes
655
- else
656
- $sizes[$s]['height'] = get_option( "{$s}_size_h" ); // For default sizes set in options
657
- if ( isset( $_wp_additional_image_sizes[$s]['crop'] ) )
658
- $sizes[$s]['crop'] = intval( $_wp_additional_image_sizes[$s]['crop'] ); // For theme-added sizes
659
- else
660
- $sizes[$s]['crop'] = get_option( "{$s}_crop" ); // For default sizes set in options
661
- }
662
-
663
- $sizes = apply_filters( 'intermediate_image_sizes_advanced', $sizes );
664
-
665
- foreach ( $sizes as $size => $size_data ) {
666
- if( isset( $thumbnails ) )
667
- if( !in_array( $size, $thumbnails ) ) {
668
- continue;
669
- }
670
-
671
- $resized = image_make_intermediate_size( $file, $size_data['width'], $size_data['height'], $size_data['crop'] );
672
-
673
- // Remove the size from the orignal sizes for after work
674
- unset( $meta_datas['size'][$size] );
675
-
676
- if ( $resized )
677
- $metadata['sizes'][$size] = $resized;
678
- }
679
-
680
- // Only if not all sizes
681
- if( is_array( $thumbnails ) ) {
682
- // Fill the array with the other sizes not have to be done
683
- foreach( $meta_datas['sizes'] as $name => $fsize ) {
684
- $metadata['sizes'][$name] = $fsize;
685
- }
686
- }
687
-
688
- // fetch additional metadata from exif/iptc
689
- $image_meta = wp_read_image_metadata( $file );
690
- if ( $image_meta )
691
- $metadata['image_meta'] = $image_meta;
692
- }
693
- return apply_filters( 'wp_generate_attachment_metadata', $metadata, $attachment_id );
694
- }
695
-
696
- /**
697
- * Add the custom sizes to the image sizes in article edition
698
- *
699
- * @access public
700
- * @param array $form_fields
701
- * @param object $post
702
- * @return void
703
- * @author Nicolas Juen
704
- * @author Additional Image Sizes (zui)
705
- */
706
- public function sizesInForm( $form_fields, $post ) {
707
- // Protect from being view in Media editor where there are no sizes
708
- if ( isset( $form_fields['image-size'] ) ) {
709
- $out = NULL;
710
- $size_names = array();
711
- $sizes_custom = get_option( SIS_OPTION );
712
-
713
- if ( is_array( $sizes_custom ) ) {
714
- foreach( $sizes_custom as $key => $value ) {
715
- if( $value['s'] == 1 )
716
- $size_names[$key] = $key;
717
- }
718
- }
719
- foreach ( $size_names as $size => $label ) {
720
- $downsize = image_downsize( $post->ID, $size );
721
-
722
- // is this size selectable?
723
- $enabled = ( $downsize[3] || 'full' == $size );
724
- $css_id = "image-size-{$size}-{$post->ID}";
725
-
726
- // We must do a clumsy search of the existing html to determine is something has been checked yet
727
- if ( FALSE === strpos( 'checked="checked"', $form_fields['image-size']['html'] ) ) {
728
-
729
- if ( empty($check) )
730
- $check = get_user_setting( 'imgsize' ); // See if they checked a custom size last time
731
-
732
- $checked = '';
733
-
734
- // if this size is the default but that's not available, don't select it
735
- if ( $size == $check || str_replace( " ", "", $size ) == $check ) {
736
- if ( $enabled )
737
- $checked = " checked='checked'";
738
- else
739
- $check = '';
740
- } elseif ( !$check && $enabled && 'thumbnail' != $size ) {
741
- // if $check is not enabled, default to the first available size that's bigger than a thumbnail
742
- $check = $size;
743
- $checked = " checked='checked'";
744
- }
745
- }
746
- $html = "<div class='image-size-item' style='min-height: 50px; margin-top: 18px;'><input type='radio' " . disabled( $enabled, false, false ) . "name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'$checked />";
747
-
748
- $html .= "<label for='{$css_id}'>$label</label>";
749
- // only show the dimensions if that choice is available
750
- if ( $enabled )
751
- $html .= " <label for='{$css_id}' class='help'>" . sprintf( "(%d&nbsp;&times;&nbsp;%d)", $downsize[1], $downsize[2] ). "</label>";
752
-
753
- $html .= '</div>';
754
-
755
- $out .= $html;
756
- }
757
- $form_fields['image-size']['html'] .= $out;
758
- } // End protect from Media editor
759
-
760
- return $form_fields;
761
- }
762
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
763
  ?>
1
+ <?php
2
+ Class SISAdmin {
3
+
4
+ // Original sizes
5
+ public $original = array( 'thumbnail', 'medium', 'large' );
6
+
7
+ public function __construct(){
8
+ // Init
9
+ add_action ( 'admin_menu', array( &$this, 'init' ) );
10
+ add_action ( 'admin_enqueue_scripts', array( &$this, 'registerScripts' ), 11 );
11
+
12
+ // Add ajax action
13
+ add_action('wp_ajax_sis_ajax_thumbnail_rebuild', array( &$this, 'ajaxThumbnailRebuildAjax' ) );
14
+ add_action('wp_ajax_get_sizes', array( &$this, 'ajaxGetSizes' ) );
15
+ add_action('wp_ajax_add_size', array( &$this, 'ajaxAddSize' ) );
16
+ add_action('wp_ajax_remove_size', array( &$this, 'ajaxRemoveSize' ) );
17
+
18
+ // Add image sizes in the form
19
+ add_filter( 'attachment_fields_to_edit', array( &$this, 'sizesInForm' ), 11, 2 ); // Add our sizes to media forms
20
+
21
+ // Add link in plugins list
22
+ add_filter('plugin_action_links', array( &$this,'addSettingsLink'), 10, 2 );
23
+
24
+ // Add action in media row quick actions
25
+ add_filter( 'media_row_actions', array(&$this, 'addActionsList'), 10, 2 );
26
+ }
27
+
28
+ /**
29
+ * Register javascripts and css.
30
+ *
31
+ * @access public
32
+ * @return void
33
+ * @author Nicolas Juen
34
+ */
35
+ public function registerScripts($hook_suffix = '' ) {
36
+ if( isset( $hook_suffix ) && $hook_suffix == 'options-media.php' ) {
37
+ // Add javascript
38
+ wp_enqueue_script( 'sis-jquery-ui-sis', SIS_URL.'js/jquery-ui-1.8.16.custom.min.js', array('jquery'), '1.8.16' );
39
+ wp_enqueue_script( 'sis_js', SIS_URL.'js/sis.min.js', array('jquery','sis-jquery-ui-sis'), SIS_VERSION );
40
+
41
+ // Add javascript translation
42
+ wp_localize_script( 'sis_js', 'sis', $this->localizeVars() );
43
+
44
+ // Add CSS
45
+ wp_enqueue_style( 'jquery-ui-sis', SIS_URL.'css/Aristo/jquery-ui-1.8.7.custom.css', array(), '1.8.7' );
46
+ wp_enqueue_style( 'sis_css', SIS_URL.'css/sis-style.css', array(), SIS_VERSION );
47
+ } elseif( isset( $hook_suffix ) && $hook_suffix == 'upload.php' ) {
48
+ // Add javascript
49
+ wp_enqueue_script( 'sis_js', SIS_URL.'js/sis-attachments.min.js', array( 'jquery' ), SIS_VERSION );
50
+
51
+ // Add javascript translation
52
+ wp_localize_script( 'sis_js', 'sis', $this->localizeVars() );
53
+ }
54
+
55
+ // Check if user have already close the box or not
56
+ $welcome = get_user_setting( 'sis_medias_config_pointer', 0 );
57
+ $welcome = false;
58
+ if ( !$welcome ) {
59
+ // Add the pointer lib we need and css
60
+ wp_enqueue_script( 'wp-pointer' );
61
+
62
+ // needed for setUserSetting in js
63
+ wp_enqueue_script( 'utils' );
64
+
65
+ // Pointer Css
66
+ wp_enqueue_style( 'wp-pointer' );
67
+
68
+ //Javascript file for pointer
69
+ wp_enqueue_script( 'sis_pointers', SIS_URL.'js/sis-pointers.js', array( 'jquery', 'wp-pointer' ), SIS_VERSION );
70
+
71
+ // Localize the elements for the pointers
72
+ wp_localize_script( 'sis_pointers' , 'sis_pointer', array(
73
+ 'pointerMediasConfig'=> sprintf( __( '<h3>Welcome to Simple Image Sizes !</h3><p>In this plugin, you can add new image sizes<br/> and regenerate the images that doesn\'t exist yet.<br/> Click on <a href="%s">Medias</a> for configurate the images</p>' , 'sis' ), admin_url( 'options-media.php' ) ),
74
+ )
75
+ );
76
+ }
77
+ }
78
+
79
+ /**
80
+ * Localize the var for javascript
81
+ *
82
+ * @access public
83
+ * @return void
84
+ * @author Nicolas Juen
85
+ */
86
+ public function localizeVars() {
87
+ return array(
88
+ 'ajaxUrl' => admin_url( '/admin-ajax.php' ),
89
+ 'reading' => __( 'Reading attachments...', 'sis' ),
90
+ 'maximumWidth' => __( 'Maximum width', 'sis' ),
91
+ 'maximumHeight' => __( 'Maximum height', 'sis' ),
92
+ 'crop' => __( 'Crop ?', 'sis' ),
93
+ 'tr' => __( 'yes', 'sis' ),
94
+ 'fl' => __( 'no', 'sis' ),
95
+ 'show' => __( 'Show in post insertion ?', 'sis' ),
96
+ 'of' => __( ' of ', 'sis' ),
97
+ 'or' => __( ' or ', 'sis' ),
98
+ 'beforeEnd' => __( ' before the end.', 'sis' ),
99
+ 'deleteImage' => __( 'Delete', 'sis' ),
100
+ 'noMedia' => __( 'No media in your site to regenerate !', 'sis' ),
101
+ 'regenerating' => __( 'Regenerating ', 'sis'),
102
+ 'validate' => __( 'Validate image size name', 'sis' ),
103
+ 'done' => __( 'Done.', 'sis' ),
104
+ 'size' => __( 'Size', 'sis' ),
105
+ 'notOriginal' => __( 'Don\'t use the basic Wordpress thumbnail size name, use the form above to edit them', 'sis' ),
106
+ 'alreadyPresent' => __( 'This size is already registered, edit it instead of recreating it.', 'sis' ),
107
+ 'confirmDelete' => __( 'Do you really want to delete these size ?', 'sis' ),
108
+ 'update' => __( 'Update', 'sis' ),
109
+ 'ajaxErrorHandler' => __( 'Error requesting page', 'sis' ),
110
+ 'messageRegenerated' => __( 'images have been regenerated !', 'sis' ),
111
+ 'validateButton' => __( 'Validate', 'sis' ),
112
+ 'startedAt' => __( ' started at', 'sis' ),
113
+ 'finishedAt' => __( ' finished at :', 'sis' ),
114
+ 'phpError' => __( 'Error during the php treatment, be sure to not have php errors in your page', 'sis' ),
115
+ 'notSaved' => __( 'All the sizes you have modifed are not saved, continue anyway ?', 'sis' ),
116
+ 'soloRegenerated' => __( 'This image has been regenerated in %s seconds', 'sis' ),
117
+ );
118
+ }
119
+
120
+ /**
121
+ * Add action in media row
122
+ *
123
+ * @since 2.2
124
+ * @access public
125
+ * @return $actions : array of actions and content to display
126
+ * @author Nicolas Juen
127
+ */
128
+ function addActionsList( $actions, $object ) {
129
+
130
+ // Add action for regeneration
131
+ $actions['sis-regenerate'] = "<a href='#' class='sis-regenerate-one'>".__( 'Regenerate thumbnails', 'sis' )."</a>";
132
+
133
+ // Return actions
134
+ return $actions;
135
+ }
136
+
137
+ /**
138
+ * Add a link to the setting option page
139
+ *
140
+ * @access public
141
+ * @param array $links
142
+ * @param string $file
143
+ * @return void
144
+ * @author Nicolas Juen
145
+ */
146
+ public function addSettingsLink( $links, $file ) {
147
+
148
+ if( $file != 'simple-image-sizes/simple_image_sizes.php' )
149
+ return $links;
150
+
151
+ $settings_link = '<a href="'.admin_url('options-media.php').'"> '.__( 'Settings', 'sis' ).' </a>';
152
+ array_unshift($links, $settings_link);
153
+
154
+ return $links;
155
+ }
156
+
157
+ /**
158
+ * Init for the option page
159
+ *
160
+ * @access public
161
+ * @return void
162
+ * @author Nicolas Juen
163
+ */
164
+ function init() {
165
+ // Check if admin
166
+ if( !is_admin() )
167
+ return false;
168
+
169
+ // Get the image sizes
170
+ global $_wp_additional_image_sizes;
171
+ $options = get_option( SIS_OPTION );
172
+
173
+ // Get the sizes and add the settings
174
+ foreach ( get_intermediate_image_sizes() as $s ) {
175
+ // Don't make the original sizes or numeric sizes that appear
176
+ if( in_array( $s, $this->original ) || is_integer( $s ) )
177
+ continue;
178
+
179
+ // Set width
180
+ if ( isset( $_wp_additional_image_sizes[$s]['width'] ) ) // For theme-added sizes
181
+ $width = intval( $_wp_additional_image_sizes[$s]['width'] );
182
+ else // For default sizes set in options
183
+ $width = get_option( "{$s}_size_w" );
184
+
185
+ // Set height
186
+ if ( isset( $_wp_additional_image_sizes[$s]['height'] ) ) // For theme-added sizes
187
+ $height = intval( $_wp_additional_image_sizes[$s]['height'] );
188
+ else // For default sizes set in options
189
+ $height = get_option( "{$s}_size_h" );
190
+
191
+ //Set crop
192
+ if ( isset( $_wp_additional_image_sizes[$s]['crop'] ) ) { // For theme-added sizes
193
+ $crop = intval( $_wp_additional_image_sizes[$s]['crop'] );
194
+ } else {
195
+ // For default sizes set in options
196
+ $crop = get_option( "{$s}_crop" );
197
+ }
198
+
199
+ // Add the setting field for this size
200
+ add_settings_field( 'image_size_'.$s, sprintf( __( '%s size', 'sis' ), $s ), array( &$this, 'imageSizes' ), 'media' , 'default', array( 'name' => $s , 'width' => $width , 'height' => $height, 'c' => $crop ) );
201
+ }
202
+
203
+ // Register the setting for media option page
204
+ register_setting( 'media', SIS_OPTION );
205
+
206
+ // Add the button
207
+ add_settings_field( 'add_size_button', __( 'Add a new size', 'sis' ), array( &$this, 'addSizeButton' ), 'media' );
208
+
209
+ // Add legend
210
+ add_settings_field( 'add_legend', __( 'Legend of the sizes', 'sis' ), array( &$this, 'addLegend' ), 'media' );
211
+
212
+ // Add php button
213
+ add_settings_field( 'get_php_button', __( 'Get php for theme', 'sis' ), array( &$this, 'getPhpButton' ), 'media' );
214
+
215
+ // Add section for the thumbnail regeneration
216
+ add_settings_section( 'thumbnail_regenerate', __( 'Thumbnail regeneration', 'sis' ), array( &$this, 'thumbnailRegenerate' ), 'media' );
217
+ }
218
+
219
+ /**
220
+ * Display the row of the image size
221
+ *
222
+ * @access public
223
+ * @param mixed $args
224
+ * @return void
225
+ * @author Nicolas Juen
226
+ */
227
+ public function imageSizes( $args ) {
228
+
229
+ if( is_integer( $args['name'] ) )
230
+ return false;
231
+
232
+ // Get the options
233
+ $sizes = (array)get_option( SIS_OPTION );
234
+
235
+ // Get the vars
236
+ $height = isset( $sizes[$args['name']]['h'] )? $sizes[$args['name']]['h'] : $args['height'] ;
237
+ $width = isset( $sizes[$args['name']]['w'] )? $sizes[$args['name']]['w'] : $args['width'] ;
238
+ $crop = isset( $sizes[$args['name']]['c'] ) && !empty( $sizes[$args['name']]['c'] )? $sizes[$args['name']]['c'] : $args['c'] ;
239
+ $show = isset( $sizes[$args['name']]['s'] ) && !empty( $sizes[$args['name']]['s'] )? '1' : '0' ;
240
+ $custom = isset( $sizes[$args['name']]['custom'] ) && !empty( $sizes[$args['name']]['custom'] )? '1' : '0' ;
241
+ ?>
242
+ <input type="hidden" value="<?php echo $args['name']; ?>" name="image_name" />
243
+ <?php if( $custom ): ?>
244
+ <input name="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][custom]' ); ?>" type="hidden" id="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][custom]' ); ?>" value="1" />
245
+ <?php else: ?>
246
+ <input name="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][theme]' ); ?>" type="hidden" id="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][theme]' ); ?>" value="1" />
247
+ <?php endif; ?>
248
+ <label class="sis-label" for="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][w]' ); ?>">
249
+ <?php _e( 'Maximum width', 'sis'); ?>
250
+ <input name="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][w]' ); ?>" class='w small-text' type="number" step='1' min='0' id="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][w]' ); ?>" base_w='<?php esc_attr_e( $width ); ?>' value="<?php esc_attr_e( $width ); ?>" />
251
+ </label>
252
+
253
+ <label class="sis-label" for="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][h]' ); ?>">
254
+ <?php _e( 'Maximum height', 'sis'); ?>
255
+ <input name="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][h]' ); ?>" class='h small-text' type="number" step='1' min='0' id="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][h]' ); ?>" base_h='<?php esc_attr_e( $height ); ?>' value="<?php esc_attr_e( $height ); ?>" />
256
+ </label>
257
+ <span class="size_options">
258
+ <input type='checkbox' id="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][c]' ); ?>" <?php checked( $crop, 1 ) ?> class="c crop" base_c='<?php esc_attr_e( $crop ); ?>' name="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][c]' ); ?>" value="1" />
259
+ <label class="c" for="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][c]' ); ?>"><?php _e( 'Crop ?', 'sis'); ?></label>
260
+
261
+ <input type='checkbox' id="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][s]'); ?>" <?php checked( $show, 1 ) ?> class="s show" base_s='<?php esc_attr_e( $show ); ?>' name="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][s]'); ?>" value="1" />
262
+ <label class="s" for="<?php esc_attr_e( 'custom_image_sizes['.$args['name'].'][s]'); ?>"><?php _e( 'Show in post insertion ?', 'sis'); ?></label>
263
+ </span>
264
+ <span class="delete_size"><?php _e( 'Delete', 'sis'); ?></span>
265
+ <span class="add_size validate_size"><?php _e( 'Update', 'sis'); ?></span>
266
+ <?php }
267
+
268
+ /**
269
+ * Add the button to add a size
270
+ *
271
+ * @access public
272
+ * @return void
273
+ * @author Nicolas Juen
274
+ */
275
+ public function addSizeButton() { ?>
276
+ <input type="button" class="button-secondary action" id="add_size" value="<?php esc_attr_e( 'Add a new size of thumbnail', 'sis'); ?>" />
277
+ <?php
278
+ }
279
+
280
+ /**
281
+ * Add the button to get the php for th sizes
282
+ *
283
+ * @access public
284
+ * @return void
285
+ * @author Nicolas Juen
286
+ */
287
+ public function getPhpButton() { ?>
288
+ <input type="button" class="button-secondary action" id="get_php" value="<?php esc_attr_e( 'Get the PHP for the theme', 'sis'); ?>" />
289
+ <p> <?php _e( 'Copy and paste the code below into your Wordpress theme function file if you wanted to save them and deactivate the plugin.', 'sis'); ?> </p>
290
+ <code></code>
291
+ <?php
292
+ }
293
+
294
+ /**
295
+ * Add the legend fo the colors
296
+ *
297
+ * @access public
298
+ * @return void
299
+ * @author Nicolas Juen
300
+ */
301
+ public function addLegend() { ?>
302
+ <?php _e('The images created on your theme are <span style="color:#F2A13A">orange</span> and your custom size are <span style="color:#89D76A"> green </span>.', 'sis'); ?>
303
+ <?php
304
+ }
305
+
306
+ /**
307
+ * Display the Table of sizes and post types for regenerating
308
+ *
309
+ * @access public
310
+ * @return void
311
+ * @author Nicolas Juen
312
+ */
313
+ public function thumbnailRegenerate() {
314
+ // Get the sizes
315
+ global $_wp_additional_image_sizes;
316
+ ?>
317
+ <div id="sis-regen">
318
+ <div class="wrapper" style="">
319
+ <h4> <?php _e( 'Select which thumbnails you want to rebuild:', 'sis'); ?> </h4>
320
+ <table cellspacing="0" class="widefat page fixed sis">
321
+ <thead>
322
+ <tr>
323
+ <th class="manage-column" scope="col"><?php _e( 'Resize ?', 'sis'); ?></th>
324
+ <th class="manage-column" scope="col"><?php _e( 'Size name', 'sis'); ?></th>
325
+ <th class="manage-column" scope="col"><?php _e( 'Width', 'sis'); ?></th>
326
+ <th class="manage-column" scope="col"><?php _e( 'Height', 'sis'); ?></th>
327
+ <th class="manage-column" scope="col"><?php _e( 'Crop ?', 'sis'); ?></th>
328
+ </tr>
329
+ </thead>
330
+ <tbody>
331
+ <?php
332
+ // Display the sizes in the array
333
+ foreach ( get_intermediate_image_sizes() as $s ):
334
+ // Don't make or numeric sizes that appear
335
+ if( is_integer( $s ) )
336
+ continue;
337
+
338
+ if ( isset( $_wp_additional_image_sizes[$s]['width'] ) ) // For theme-added sizes
339
+ $width = intval( $_wp_additional_image_sizes[$s]['width'] );
340
+ else // For default sizes set in options
341
+ $width = get_option( "{$s}_size_w" );
342
+
343
+ if ( isset( $_wp_additional_image_sizes[$s]['height'] ) ) // For theme-added sizes
344
+ $height = intval( $_wp_additional_image_sizes[$s]['height'] );
345
+ else // For default sizes set in options
346
+ $height = get_option( "{$s}_size_h" );
347
+
348
+ if ( isset( $_wp_additional_image_sizes[$s]['crop'] ) ) // For theme-added sizes
349
+ $crop = intval( $_wp_additional_image_sizes[$s]['crop'] );
350
+ else // For default sizes set in options
351
+ $crop = get_option( "{$s}_crop" );
352
+ ?>
353
+ <tr>
354
+ <td>
355
+ <input type="checkbox" class="thumbnails" id="<?php echo $s ?>" name="thumbnails[]" checked="checked" value="<?php echo esc_attr( $s ); ?>" />
356
+ </td>
357
+ <td>
358
+ <label for="<?php echo esc_attr( $s ); ?>">
359
+ <?php echo esc_html( $s ); ?>
360
+ </label>
361
+ </td>
362
+ <td>
363
+ <label for="<?php echo esc_attr( $s ); ?>">
364
+ <?php echo esc_html( $width); ?> px
365
+ </label>
366
+ </td>
367
+ <td>
368
+ <label for="<?php echo esc_attr( $s ); ?>">
369
+ <?php echo esc_html( $height ); ?> px
370
+ </label>
371
+ </td>
372
+ <td>
373
+ <label for="<?php echo esc_attr( $s ); ?>">
374
+ <?php echo ( $crop == 1 )? __( 'yes', 'sis' ):__( 'no', 'sis' ); ?>
375
+ </label>
376
+ </td>
377
+ </tr>
378
+ <?php endforeach;?>
379
+ </tbody>
380
+ <tfoot>
381
+ <tr>
382
+ <th class="manage-column" scope="col"><?php _e( 'Resize ?', 'sis'); ?></th>
383
+ <th class="manage-column" scope="col"><?php _e( 'Size name', 'sis'); ?></th>
384
+ <th class="manage-column" scope="col"><?php _e( 'Width', 'sis'); ?></th>
385
+ <th class="manage-column" scope="col"><?php _e( 'Height', 'sis'); ?></th>
386
+ <th class="manage-column" scope="col"><?php _e( 'Crop ?', 'sis'); ?></th>
387
+ </tr>
388
+ </tfoot>
389
+ </table>
390
+
391
+ <h4><?php _e( 'Select which post type source thumbnails you want to rebuild:', 'sis'); ?></h4>
392
+ <table cellspacing="0" class="widefat page fixed sis">
393
+ <thead>
394
+ <tr>
395
+ <th class="manage-column" scope="col"><?php _e( 'Resize ?', 'sis'); ?></th>
396
+ <th class="manage-column" scope="col"><?php _e( 'Post type', 'sis'); ?></th>
397
+ </tr>
398
+ </thead>
399
+ <tbody>
400
+ <?php
401
+ // Diplay the post types table
402
+ foreach ( get_post_types( array( 'public' => true ), 'objects' ) as $ptype ):
403
+ ?>
404
+ <tr>
405
+ <td>
406
+ <label for="<?php echo esc_attr( $ptype->name ); ?>">
407
+ <input type="checkbox" class="post_types" name="post_types[]" checked="checked" id="<?php echo esc_attr( $ptype->name ); ?>" value="<?php echo esc_attr( $ptype->name ); ?>" />
408
+ </label>
409
+ </td>
410
+ <td>
411
+ <label for="<?php echo esc_attr( $ptype->name ); ?>">
412
+ <em><?php echo esc_html( $ptype->labels->name ); ?></em>
413
+ </label>
414
+ </td>
415
+ </tr>
416
+ <?php endforeach;?>
417
+ </tbody>
418
+ <tfoot>
419
+ <tr>
420
+ <th class="manage-column" scope="col"><?php _e( 'Resize ?', 'sis'); ?></th>
421
+ <th class="manage-column" scope="col"><?php _e( 'Post type', 'sis'); ?></th>
422
+ </tr>
423
+ </tfoot>
424
+ </table>
425
+ </div>
426
+ </div>
427
+ <div >
428
+ <div id="regenerate_message"></div>
429
+ <div class="progress">
430
+ <div class=" progress-percent ui-widget">
431
+ <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
432
+ <p>
433
+ <span class="ui-icon ui-icon-info" style="float: left; margin-right: .7em;"></span>
434
+ <span class="text">0%</span>
435
+ </p>
436
+ </div>
437
+ </div>
438
+ </div>
439
+ <div class="ui-widget" id="time">
440
+ <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
441
+ <p>
442
+ <span class="ui-icon ui-icon-info" style="float: left; margin-right: .7em;"></span>
443
+ <span><strong><?php _e( 'End time calculated :', 'sis' ); ?></strong> <span class='time_message'>Calculating...</span> </span>
444
+ </p>
445
+ <ul class="messages"></ul>
446
+ </div>
447
+ </div>
448
+ <div id="error_messages">
449
+ <p>
450
+ <ul class="messages">
451
+ </ul>
452
+ </p>
453
+ </div>
454
+ <div id="thumb"><h4><?php _e( 'Last image:', 'sis'); ?></h4><img id="thumb-img" /></div>
455
+ <input type="button" class="button" name="ajax_thumbnail_rebuild" id="ajax_thumbnail_rebuild" value="<?php _e( 'Regenerate Thumbnails', 'sis' ) ?>" />
456
+ </div>
457
+ <?php
458
+ }
459
+
460
+ /**
461
+ * Add a size by Ajax
462
+ *
463
+ * @access public
464
+ * @return void
465
+ * @author Nicolas Juen
466
+ */
467
+ public function ajaxAddSize() {
468
+
469
+ // Get old options
470
+ $sizes = (array)get_option( SIS_OPTION );
471
+
472
+ // Check entries
473
+ $name = isset( $_POST['name'] ) ? remove_accents ( $_POST['name'] ): '' ;
474
+ $height = !isset( $_POST['height'] )? 0 : absint( $_POST['height'] );
475
+ $width = !isset( $_POST['width'] )? 0 : absint( $_POST['width'] );
476
+ $crop = isset( $_POST['crop'] ) && $_POST['crop'] == 'false' ? false : true;
477
+ $show = isset( $_POST['show'] ) && $_POST['show'] == 'false' ? false : true;
478
+
479
+ // If no name given do not save
480
+ if( empty( $name ) ) {
481
+ echo 0;
482
+ die();
483
+ }
484
+
485
+ // Make values
486
+ $values = array( 'custom' => 1, 'w' => $width , 'h' => $height, 'c' => $crop, 's' => $show );
487
+
488
+ // If the size have not changed return 2
489
+ if( isset( $sizes[$name] ) && $sizes[$name] === $values ) {
490
+ echo 2;
491
+ die();
492
+ }
493
+
494
+ // Put the new values
495
+ $sizes[$name] = $values;
496
+
497
+ // display update result
498
+ echo (int)update_option( 'custom_image_sizes', $sizes );
499
+ die();
500
+ }
501
+
502
+ /**
503
+ * Remove a size by Ajax
504
+ *
505
+ * @access public
506
+ * @return void
507
+ * @author Nicolas Juen
508
+ */
509
+ public function ajaxRemoveSize() {
510
+ // Get old options
511
+ $sizes = (array)get_option( SIS_OPTION );
512
+
513
+ // Remove the size
514
+ unset( $sizes[apply_filters( 'sanitize_title', $_POST['name'] )] );
515
+ unset( $sizes[0] );
516
+
517
+ // Display the results
518
+ echo (int)update_option( SIS_OPTION, $sizes );
519
+ die();
520
+ }
521
+
522
+ /**
523
+ * Display the add_image_size for the registered sizes
524
+ *
525
+ * @access public
526
+ * @return void
527
+ */
528
+ public function ajaxGetSizes() {
529
+ global $_wp_additional_image_sizes;
530
+
531
+ foreach ( get_intermediate_image_sizes() as $s ):
532
+
533
+ // Don't make the original sizes
534
+ if( in_array( $s, $this->original ) )
535
+ continue;
536
+
537
+ if ( isset( $_wp_additional_image_sizes[$s]['width'] ) ) // For theme-added sizes
538
+ $width = intval( $_wp_additional_image_sizes[$s]['width'] );
539
+ else // For default sizes set in options
540
+ $width = get_option( "{$s}_size_w" );
541
+
542
+ if ( isset( $_wp_additional_image_sizes[$s]['height'] ) ) // For theme-added sizes
543
+ $height = intval( $_wp_additional_image_sizes[$s]['height'] );
544
+ else // For default sizes set in options
545
+ $height = get_option( "{$s}_size_h" );
546
+
547
+ if ( isset( $_wp_additional_image_sizes[$s]['crop'] ) ) // For theme-added sizes
548
+ $crop = intval( $_wp_additional_image_sizes[$s]['crop'] );
549
+ else // For default sizes set in options
550
+ $crop = get_option( "{$s}_crop" );
551
+
552
+ $crop = ( $crop == 0 )? 'false' : 'true' ;
553
+ ?>
554
+ add_image_size( '<?php echo $s; ?>', '<?php echo $width; ?>', '<?php echo $height; ?>', <?php echo $crop ?> );<br />
555
+ <?php endforeach;
556
+
557
+ die();
558
+ }
559
+
560
+ /**
561
+ * Rebuild the image
562
+ *
563
+ * @access public
564
+ * @return void
565
+ * @author Nicolas Juen
566
+ */
567
+ public function ajaxThumbnailRebuildAjax() {
568
+ global $wpdb;
569
+
570
+ // Time a the begining
571
+ $start_time = microtime(true);
572
+
573
+ // Get the action
574
+ $action = $_POST["do"];
575
+
576
+ // Get the thumbnails
577
+ $thumbnails = isset( $_POST['thumbnails'] )? $_POST['thumbnails'] : NULL;
578
+
579
+ if ( $action == "getlist" ) {
580
+ if ( isset( $_POST['post_types'] ) && !empty( $_POST['post_types'] ) ) {
581
+
582
+ // Get image medias
583
+ $whichmimetype = wp_post_mime_type_where( 'image', $wpdb->posts );
584
+
585
+ // Get all parent from post type
586
+ $attachments = $wpdb->get_results( "SELECT *
587
+ FROM $wpdb->posts
588
+ WHERE 1 = 1
589
+ AND post_type = 'attachment'
590
+ $whichmimetype
591
+ AND post_parent IN (
592
+ SELECT DISTINCT ID
593
+ FROM $wpdb->posts
594
+ WHERE post_type IN ('".implode( "', '", $_POST['post_types'] )."')
595
+ )" );
596
+
597
+ } else {
598
+ $attachments =& get_children( array(
599
+ 'post_type' => 'attachment',
600
+ 'post_mime_type' => 'image',
601
+ 'numberposts' => -1,
602
+ 'post_status' => null,
603
+ 'post_parent' => null, // any parent
604
+ 'output' => 'object',
605
+ ) );
606
+ }
607
+
608
+ // Get the attachments
609
+ foreach ( $attachments as $attachment ) {
610
+ $res[] = array('id' => $attachment->ID, 'title' => $attachment->post_title);
611
+ }
612
+ // Return the Id's and Title of medias
613
+ die( json_encode( $res ) );
614
+ } else if ( $action == "regen" ) {
615
+ // Get the id
616
+ $id = $_POST["id"];
617
+
618
+ // Check Id
619
+ if( (int)$id == 0 ) {
620
+ die( json_encode( array( round( microtime( true ) - $start_time, 4 ), 'error' => __( 'No id given in POST datas.', 'sis' ) ) ) );
621
+ }
622
+
623
+ // Get the path
624
+ $fullsizepath = get_attached_file( $id );
625
+
626
+ // Regen the attachment
627
+ if ( FALSE !== $fullsizepath && @file_exists( $fullsizepath ) ) {
628
+ set_time_limit( 30 );
629
+ if( wp_update_attachment_metadata( $id, $this->wp_generate_attachment_metadata_custom( $id, $fullsizepath, $thumbnails ) ) == false )
630
+ die( json_encode( array( 'src' => wp_get_attachment_thumb_url( $id ), 'time' => round( microtime( true ) - $start_time, 4 ) ,'message' => sprintf( __( 'This file does not exists and have not been regenerated :<br/><a target="_blank" href="%1$s" >%2$s</a>', 'sis'), get_edit_post_link( $id ), get_the_title( $id ) ) ) ) );
631
+ } else {
632
+ die( json_encode( array( 'src' => wp_get_attachment_thumb_url( $id ), 'time' => round( microtime( true ) - $start_time, 4 ), 'error' => sprintf( __( 'This file does not exists and have not been regenerated :<br/><a target="_blank" href="%1$s" >%2$s</a>', 'sis'), get_edit_post_link( $id ), get_the_title( $id ) ) ) ) );
633
+ }
634
+ // Display the attachment url for feedback
635
+ die( json_encode( array( 'time' => round( microtime( true ) - $start_time, 4 ) , 'src' => wp_get_attachment_thumb_url( $id ), 'title' => get_the_title( $id ) ) ) );
636
+ }
637
+ }
638
+
639
+ /**
640
+ * Generate post thumbnail attachment meta data.
641
+ *
642
+ * @since 2.1.0
643
+ *
644
+ * @param int $attachment_id Attachment Id to process.
645
+ * @param string $file Filepath of the Attached image.
646
+ * @return mixed Metadata for attachment.
647
+ */
648
+ public function wp_generate_attachment_metadata_custom( $attachment_id, $file, $thumbnails = NULL ) {
649
+ $attachment = get_post( $attachment_id );
650
+
651
+ $meta_datas = get_post_meta( $attachment_id, '_wp_attachment_metadata', true );
652
+
653
+ $metadata = array();
654
+ if ( preg_match('!^image/!', get_post_mime_type( $attachment )) && file_is_displayable_image($file) ) {
655
+ $imagesize = getimagesize( $file );
656
+ $metadata['width'] = $imagesize[0];
657
+ $metadata['height'] = $imagesize[1];
658
+ list($uwidth, $uheight) = wp_constrain_dimensions($metadata['width'], $metadata['height'], 128, 96);
659
+ $metadata['hwstring_small'] = "height='$uheight' width='$uwidth'";
660
+
661
+ // Make the file path relative to the upload dir
662
+ $metadata['file'] = _wp_relative_upload_path($file);
663
+
664
+ // make thumbnails and other intermediate sizes
665
+ global $_wp_additional_image_sizes;
666
+
667
+ foreach ( get_intermediate_image_sizes() as $s ) {
668
+ $sizes[$s] = array( 'width' => '', 'height' => '', 'crop' => FALSE );
669
+ if ( isset( $_wp_additional_image_sizes[$s]['width'] ) )
670
+ $sizes[$s]['width'] = intval( $_wp_additional_image_sizes[$s]['width'] ); // For theme-added sizes
671
+ else
672
+ $sizes[$s]['width'] = get_option( "{$s}_size_w" ); // For default sizes set in options
673
+ if ( isset( $_wp_additional_image_sizes[$s]['height'] ) )
674
+ $sizes[$s]['height'] = intval( $_wp_additional_image_sizes[$s]['height'] ); // For theme-added sizes
675
+ else
676
+ $sizes[$s]['height'] = get_option( "{$s}_size_h" ); // For default sizes set in options
677
+ if ( isset( $_wp_additional_image_sizes[$s]['crop'] ) )
678
+ $sizes[$s]['crop'] = intval( $_wp_additional_image_sizes[$s]['crop'] ); // For theme-added sizes
679
+ else
680
+ $sizes[$s]['crop'] = get_option( "{$s}_crop" ); // For default sizes set in options
681
+ }
682
+
683
+ $sizes = apply_filters( 'intermediate_image_sizes_advanced', $sizes );
684
+
685
+ foreach ( $sizes as $size => $size_data ) {
686
+ if( isset( $thumbnails ) )
687
+ if( !in_array( $size, $thumbnails ) ) {
688
+ continue;
689
+ }
690
+
691
+ $resized = image_make_intermediate_size( $file, $size_data['width'], $size_data['height'], $size_data['crop'] );
692
+
693
+ // Remove the size from the orignal sizes for after work
694
+ unset( $meta_datas['size'][$size] );
695
+
696
+ if ( $resized )
697
+ $metadata['sizes'][$size] = $resized;
698
+ }
699
+
700
+ // Only if not all sizes
701
+ if( is_array( $thumbnails ) ) {
702
+ // Fill the array with the other sizes not have to be done
703
+ foreach( $meta_datas['sizes'] as $name => $fsize ) {
704
+ $metadata['sizes'][$name] = $fsize;
705
+ }
706
+ }
707
+
708
+ // fetch additional metadata from exif/iptc
709
+ $image_meta = wp_read_image_metadata( $file );
710
+ if ( $image_meta )
711
+ $metadata['image_meta'] = $image_meta;
712
+ }
713
+ return apply_filters( 'wp_generate_attachment_metadata', $metadata, $attachment_id );
714
+ }
715
+
716
+ /**
717
+ * Add the custom sizes to the image sizes in article edition
718
+ *
719
+ * @access public
720
+ * @param array $form_fields
721
+ * @param object $post
722
+ * @return void
723
+ * @author Nicolas Juen
724
+ * @author Additional Image Sizes (zui)
725
+ */
726
+ public function sizesInForm( $form_fields, $post ) {
727
+ // Protect from being view in Media editor where there are no sizes
728
+ if ( isset( $form_fields['image-size'] ) ) {
729
+ $out = NULL;
730
+ $size_names = array();
731
+ $sizes_custom = get_option( SIS_OPTION );
732
+
733
+ if ( is_array( $sizes_custom ) ) {
734
+ foreach( $sizes_custom as $key => $value ) {
735
+ if( $value['s'] == 1 )
736
+ $size_names[$key] = $key;
737
+ }
738
+ }
739
+ foreach ( $size_names as $size => $label ) {
740
+ $downsize = image_downsize( $post->ID, $size );
741
+
742
+ // is this size selectable?
743
+ $enabled = ( $downsize[3] || 'full' == $size );
744
+ $css_id = "image-size-{$size}-{$post->ID}";
745
+
746
+ // We must do a clumsy search of the existing html to determine is something has been checked yet
747
+ if ( FALSE === strpos( 'checked="checked"', $form_fields['image-size']['html'] ) ) {
748
+
749
+ if ( empty($check) )
750
+ $check = get_user_setting( 'imgsize' ); // See if they checked a custom size last time
751
+
752
+ $checked = '';
753
+
754
+ // if this size is the default but that's not available, don't select it
755
+ if ( $size == $check || str_replace( " ", "", $size ) == $check ) {
756
+ if ( $enabled )
757
+ $checked = " checked='checked'";
758
+ else
759
+ $check = '';
760
+ } elseif ( !$check && $enabled && 'thumbnail' != $size ) {
761
+ // if $check is not enabled, default to the first available size that's bigger than a thumbnail
762
+ $check = $size;
763
+ $checked = " checked='checked'";
764
+ }
765
+ }
766
+ $html = "<div class='image-size-item' style='min-height: 50px; margin-top: 18px;'><input type='radio' " . disabled( $enabled, false, false ) . "name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'$checked />";
767
+
768
+ $html .= "<label for='{$css_id}'>$label</label>";
769
+ // only show the dimensions if that choice is available
770
+ if ( $enabled )
771
+ $html .= " <label for='{$css_id}' class='help'>" . sprintf( "(%d&nbsp;&times;&nbsp;%d)", $downsize[1], $downsize[2] ). "</label>";
772
+
773
+ $html .= '</div>';
774
+
775
+ $out .= $html;
776
+ }
777
+ $form_fields['image-size']['html'] .= $out;
778
+ } // End protect from Media editor
779
+
780
+ return $form_fields;
781
+ }
782
+ }
783
  ?>
js/sis-pointers.js ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(function() {
2
+ if( getUserSetting('sis_medias_config_pointer') == false ) {
3
+ jQuery('#menu-settings').pointer({
4
+ content: sis_pointer.pointerMediasConfig,
5
+ position: {
6
+ my: 'right top',
7
+ at: 'left top',
8
+ offset: '0 -2'
9
+ },
10
+ arrow: {
11
+ edge: 'left',
12
+ align: 'top',
13
+ offset: 10
14
+ },
15
+ close: function() {
16
+ setUserSetting( 'sis_medias_config_pointer', true );
17
+ }
18
+ }).pointer('open');
19
+ }
20
+ });
js/sis.js CHANGED
@@ -1,3 +1,4 @@
 
1
  // Functions for the regenerating of images
2
  var regenerate = {
3
  post_types : '',
@@ -222,7 +223,7 @@ var sizes = {
222
  e.preventDefault();
223
 
224
  // Create the template
225
- var elTr = jQuery( '<tr />' ).attr( 'valign', 'top' ).addClass( 'new_size_' + this.i );
226
  jQuery( '<th />' ).attr( 'scope', 'row' ).append(
227
  jQuery( '<input />' )
228
  .attr( {
@@ -276,7 +277,7 @@ var sizes = {
276
  jQuery( '<input />' ).attr( { type: 'hidden', name: 'image_name' } ).val( name ).appendTo( tdEl ) ;
277
  jQuery( '<input />' ).attr( { type :'hidden', name : 'custom_image_sizes[' + name + '][custom]' } ).val( "1" ).appendTo( tdEl );
278
 
279
- jQuery( '<label />' ).attr( 'for', 'custom_image_sizes[' + name + '][w]' ).text(sis.maximumWidth).append(
280
  jQuery( '<input />' ).attr( { type: 'number',
281
  name: 'custom_image_sizes[' + name + '][w]',
282
  step: 1,
@@ -287,7 +288,7 @@ var sizes = {
287
  ).val( "0" ).addClass( "w small-text" )
288
  ).appendTo( tdEl );
289
 
290
- jQuery( '<label />' ).attr( 'for', 'custom_image_sizes[' + name + '][h]' ).text(sis.maximumHeight).append(
291
  jQuery( '<input />' ).attr( { type: 'number',
292
  name: 'custom_image_sizes[' + name + '][h]',
293
  step: 1,
@@ -298,9 +299,9 @@ var sizes = {
298
  ).val( "0" ).addClass( "h small-text" )
299
  ).appendTo( tdEl );
300
 
301
- jQuery( '<div />' )
302
- .addClass( 'crop' )
303
- .append(
304
  jQuery( '<input />' )
305
  .attr( {
306
  type: 'checkbox',
@@ -309,19 +310,19 @@ var sizes = {
309
  base_c:0
310
  } )
311
  .val( "1" )
312
- .addClass( 'c' )
313
  )
314
  .append(
315
  jQuery( '<label />' )
316
  .attr( {
317
- 'for': 'checkbox',
318
- id: 'custom_image_sizes[' + name + '][c]'
 
 
319
  } )
320
  .text( sis.crop )
321
- ).appendTo( tdEl );
322
- jQuery( '<div />' )
323
- .addClass( 'show' )
324
- .append(
325
  jQuery( '<input />' )
326
  .attr( {
327
  type: 'checkbox',
@@ -330,16 +331,19 @@ var sizes = {
330
  base_s:0
331
  } )
332
  .val( "1" )
333
- .addClass( 's' )
334
  )
335
  .append(
336
  jQuery( '<label />' )
337
  .attr( {
338
- 'for': 'checkbox',
339
- id: 'custom_image_sizes[' + name + '][s]'
 
 
340
  } )
341
  .text( sis.show )
342
- ).appendTo( tdEl );
 
343
 
344
  jQuery( '<div />' ).text( sis.deleteImage ).addClass('delete_size').appendTo( tdEl );
345
  jQuery( '<div />' ).text( sis.validateButton ).addClass('add_size validate_size').appendTo( tdEl );
@@ -347,8 +351,13 @@ var sizes = {
347
  // Add the row to the current list
348
  jQuery('#' + id).closest( 'tr' ).html( thEl.after( tdEl ) );
349
 
350
- // Refresh the buttons
351
- this.setButtons();
 
 
 
 
 
352
  },
353
  deleteSize: function( e, el ) {
354
  e.preventDefault();
@@ -392,8 +401,8 @@ var sizes = {
392
  var timer;
393
  var parent = jQuery( el ).closest( 'tr' );
394
  var n = parent.find( 'input[name="image_name"]' ).val();
395
- var c = parent.find( 'input.c' ).attr( 'checked' );
396
- var s = parent.find( 'input.s' ).attr( 'checked' );
397
 
398
  if( c == false || c == undefined ) {
399
  c = false;
@@ -418,14 +427,14 @@ var sizes = {
418
  data: { action : "add_size", width: w, height: h, crop: c, name: n, show: s },
419
  beforeSend: function() {
420
  // Remove status and set pending
421
- parent.removeClass( 'errorAdding notChangedAdding successAdding' );
422
  parent.addClass( 'addPending' );
423
  parentTable.addClass( 'ajaxing' );
424
  },
425
  success: function(result) {
426
  // Set basic class and remove pending
427
  var classTr = '';
428
- parent.removeClass( 'addPending' );
429
  parentTable.removeClass( 'ajaxing' )
430
 
431
  // Check the result for the different messages
@@ -534,57 +543,83 @@ var sizes = {
534
  jQuery(".delete_size").button( {
535
  icons: {
536
  primary: 'ui-icon-circle-close'
537
- }
 
538
  } );
539
  jQuery(".add_size").button( {
540
  icons: {
541
  primary: 'ui-icon-check'
542
- }
 
543
  } );
544
  jQuery(".crop").button({
545
  icons: {
546
  primary: 'ui-icon-arrow-4-diag'
547
- }
 
548
  });
549
  jQuery(".show").button({
550
  icons: {
551
  primary: 'ui-icon-lightbulb'
552
- }
 
553
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
554
  },
555
  displayChange : function( el ) {
556
  el = jQuery( el );
 
557
 
558
- var h_el = el.closest( 'tr' ).find( 'input.h' );
559
- var w_el = el.closest( 'tr' ).find( 'input.w' );
560
- var c_el = el.closest( 'tr' ).find( 'input.c' );
561
- var s_el = el.closest( 'tr' ).find( 'input.s' );
 
 
 
 
562
 
563
  var h = h_el.val();
564
  var w = w_el.val();
565
- var c = c_el.prop( 'checked' );
566
- var s = s_el.prop( 'checked' );
567
 
568
  var base_h = h_el.attr( 'base_h' );
569
  var base_w = w_el.attr( 'base_w' );
570
  var base_c = c_el.attr( 'base_c' );
571
  var base_s = s_el.attr( 'base_s' );
572
 
573
- if( base_c == "0" )
574
  base_c = false;
575
  else
576
  base_c = true;
577
 
578
- if( base_s == "0" )
579
  base_s = false;
580
  else
581
  base_s = true;
582
 
583
 
 
584
  if( h != base_h || w != base_w || c != base_c || s != base_s ) {
585
- el.closest( 'td' ).addClass( 'notSaved' ).find('.add_size').show();
586
  } else {
587
- el.closest( 'td' ).removeClass( 'notSaved' ).find('.add_size').hide();
588
  }
589
  }
590
  }
@@ -617,8 +652,6 @@ jQuery(function() {
617
  'color': '#F2A13A'
618
  } );
619
 
620
- // Set the buttons
621
- sizes.setButtons();
622
 
623
  jQuery(".add_size").hide();
624
 
@@ -629,4 +662,20 @@ jQuery(function() {
629
  jQuery("#msg").ajaxError( function(event, request, settings ) {
630
  jQuery( this ).find( '.msg' ).append( "<li>"+sis.ajaxErrorHandler+" " + settings.url + ", status "+request.status+" : "+request.statusText+"</li>" ).end().stop( false, false ).slideDown( 200 ).delay( 5000 ).slideUp( 200 );
631
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
632
  });
1
+ sis_small = true;
2
  // Functions for the regenerating of images
3
  var regenerate = {
4
  post_types : '',
223
  e.preventDefault();
224
 
225
  // Create the template
226
+ var elTr = jQuery( '<tr />' ).attr( 'valign', 'top' ).addClass( 'new_size_' + this.i+' new_size' );
227
  jQuery( '<th />' ).attr( 'scope', 'row' ).append(
228
  jQuery( '<input />' )
229
  .attr( {
277
  jQuery( '<input />' ).attr( { type: 'hidden', name: 'image_name' } ).val( name ).appendTo( tdEl ) ;
278
  jQuery( '<input />' ).attr( { type :'hidden', name : 'custom_image_sizes[' + name + '][custom]' } ).val( "1" ).appendTo( tdEl );
279
 
280
+ jQuery( '<label />' ).attr( 'for', 'custom_image_sizes[' + name + '][w]' ).addClass( 'sis-label' ).text(sis.maximumWidth).append(
281
  jQuery( '<input />' ).attr( { type: 'number',
282
  name: 'custom_image_sizes[' + name + '][w]',
283
  step: 1,
288
  ).val( "0" ).addClass( "w small-text" )
289
  ).appendTo( tdEl );
290
 
291
+ jQuery( '<label />' ).attr( 'for', 'custom_image_sizes[' + name + '][h]' ).addClass( 'sis-label' ).text(sis.maximumHeight).append(
292
  jQuery( '<input />' ).attr( { type: 'number',
293
  name: 'custom_image_sizes[' + name + '][h]',
294
  step: 1,
299
  ).val( "0" ).addClass( "h small-text" )
300
  ).appendTo( tdEl );
301
 
302
+ els = jQuery( '<span />' )
303
+ .addClass( 'size_options' )
304
+ .append(
305
  jQuery( '<input />' )
306
  .attr( {
307
  type: 'checkbox',
310
  base_c:0
311
  } )
312
  .val( "1" )
313
+ .addClass( 'c crop' )
314
  )
315
  .append(
316
  jQuery( '<label />' )
317
  .attr( {
318
+ 'for': 'custom_image_sizes[' + name + '][c]',
319
+ id: 'custom_image_sizes[' + name + '][c]',
320
+ 'class': 'c',
321
+ title:sis.crop
322
  } )
323
  .text( sis.crop )
324
+ )
325
+ .append(
 
 
326
  jQuery( '<input />' )
327
  .attr( {
328
  type: 'checkbox',
331
  base_s:0
332
  } )
333
  .val( "1" )
334
+ .addClass( 's show' )
335
  )
336
  .append(
337
  jQuery( '<label />' )
338
  .attr( {
339
+ 'for': 'custom_image_sizes[' + name + '][s]',
340
+ id: 'custom_image_sizes[' + name + '][s]',
341
+ 'class': 's',
342
+ title:sis.show
343
  } )
344
  .text( sis.show )
345
+ );
346
+ els.appendTo(tdEl);
347
 
348
  jQuery( '<div />' ).text( sis.deleteImage ).addClass('delete_size').appendTo( tdEl );
349
  jQuery( '<div />' ).text( sis.validateButton ).addClass('add_size validate_size').appendTo( tdEl );
351
  // Add the row to the current list
352
  jQuery('#' + id).closest( 'tr' ).html( thEl.after( tdEl ) );
353
 
354
+ if( sis_small == true ){
355
+ // Refresh the buttons
356
+ this.setButtonsSmall();
357
+ } else {
358
+ // Refresh the buttons
359
+ this.setButtons();
360
+ }
361
  },
362
  deleteSize: function( e, el ) {
363
  e.preventDefault();
401
  var timer;
402
  var parent = jQuery( el ).closest( 'tr' );
403
  var n = parent.find( 'input[name="image_name"]' ).val();
404
+ var c = parent.find( 'label.c' ).hasClass( 'ui-state-active' );
405
+ var s = parent.find( 'label.s' ).hasClass( 'ui-state-active' );
406
 
407
  if( c == false || c == undefined ) {
408
  c = false;
427
  data: { action : "add_size", width: w, height: h, crop: c, name: n, show: s },
428
  beforeSend: function() {
429
  // Remove status and set pending
430
+ parent.removeClass();
431
  parent.addClass( 'addPending' );
432
  parentTable.addClass( 'ajaxing' );
433
  },
434
  success: function(result) {
435
  // Set basic class and remove pending
436
  var classTr = '';
437
+ parent.removeClass();
438
  parentTable.removeClass( 'ajaxing' )
439
 
440
  // Check the result for the different messages
543
  jQuery(".delete_size").button( {
544
  icons: {
545
  primary: 'ui-icon-circle-close'
546
+ },
547
+ text: true
548
  } );
549
  jQuery(".add_size").button( {
550
  icons: {
551
  primary: 'ui-icon-check'
552
+ },
553
+ text: true
554
  } );
555
  jQuery(".crop").button({
556
  icons: {
557
  primary: 'ui-icon-arrow-4-diag'
558
+ },
559
+ text: true
560
  });
561
  jQuery(".show").button({
562
  icons: {
563
  primary: 'ui-icon-lightbulb'
564
+ },
565
+ text: true
566
  });
567
+ jQuery( '.size_options' ).buttonset();
568
+ },
569
+ setButtonsSmall: function() {
570
+ // UI for delete,crop and add buttons
571
+ jQuery(".delete_size").button( {icons: {
572
+ primary: 'ui-icon-circle-close'
573
+ },text: false} );
574
+ jQuery(".add_size").button( { icons: {
575
+ primary: 'ui-icon-check'
576
+ },text: false} );
577
+ jQuery(".crop").button({icons: {
578
+ primary: 'ui-icon-arrow-4-diag'
579
+ },text: false});
580
+ jQuery(".show").button( {icons: {
581
+ primary: 'ui-icon-lightbulb'
582
+ },text: false});
583
  },
584
  displayChange : function( el ) {
585
  el = jQuery( el );
586
+ var parent = el.closest( 'tr' );
587
 
588
+ // Check not new size
589
+ if( parent.hasClass( 'new_size' ) )
590
+ return false;
591
+
592
+ var h_el = parent.find( 'input.h' );
593
+ var w_el = parent.find( 'input.w' );
594
+ var c_el = parent.find( 'input.c' );
595
+ var s_el = parent.find( 'input.s' );
596
 
597
  var h = h_el.val();
598
  var w = w_el.val();
599
+ var c = parent.find( 'label.c' ).hasClass( 'ui-state-active' );
600
+ var s = parent.find( 'label.s' ).hasClass( 'ui-state-active' );
601
 
602
  var base_h = h_el.attr( 'base_h' );
603
  var base_w = w_el.attr( 'base_w' );
604
  var base_c = c_el.attr( 'base_c' );
605
  var base_s = s_el.attr( 'base_s' );
606
 
607
+ if( base_c == '0' )
608
  base_c = false;
609
  else
610
  base_c = true;
611
 
612
+ if( base_s == '0' )
613
  base_s = false;
614
  else
615
  base_s = true;
616
 
617
 
618
+
619
  if( h != base_h || w != base_w || c != base_c || s != base_s ) {
620
+ el.closest( 'td' ).addClass( 'notSaved' ).find('.add_size').css( 'display', 'inline-block' );
621
  } else {
622
+ el.closest( 'td' ).removeClass( 'notSaved' ).find('.add_size').css( 'display', 'none' );
623
  }
624
  }
625
  }
652
  'color': '#F2A13A'
653
  } );
654
 
 
 
655
 
656
  jQuery(".add_size").hide();
657
 
662
  jQuery("#msg").ajaxError( function(event, request, settings ) {
663
  jQuery( this ).find( '.msg' ).append( "<li>"+sis.ajaxErrorHandler+" " + settings.url + ", status "+request.status+" : "+request.statusText+"</li>" ).end().stop( false, false ).slideDown( 200 ).delay( 5000 ).slideUp( 200 );
664
  });
665
+
666
+ // Check resizing of the window
667
+ jQuery(window).bind('resize', sisCheckWindowSize );
668
+
669
+ function sisCheckWindowSize() {
670
+ if( window.innerWidth <= 820 && sis_small == false ) {
671
+ sizes.setButtonsSmall();
672
+ sis_small = true;
673
+ } else if( window.innerWidth > 820 && sis_small == true ){
674
+ sizes.setButtons();
675
+ sis_small = false;
676
+ }
677
+ }
678
+
679
+ // Set the buttons
680
+ sizes.setButtons();
681
  });
js/sis.min.js CHANGED
@@ -1 +1,23 @@
1
- var regenerate={post_types:"",thumbnails:"",list:"",cur:0,timeScript:new Array,dateScript:"",percent:"",getThumbnails:function(){var a=this;var b=jQuery("input.thumbnails:checked");if(b.length!=jQuery('input.thumbnails[type="checkbox"]').length){b.each(function(b){a.thumbnails+="&thumbnails[]="+jQuery(this).val()})}},getPostTypes:function(){var a=this;var b=jQuery("input.post_types:checked");if(b.length!=jQuery('input.post_types[type="checkbox"]').length){b.each(function(){a.post_types+="&post_types[]="+jQuery(this).val()})}},setMessage:function(a){jQuery("#regenerate_message").html("<p>"+a+"</p>").addClass("updated").addClass("fade").show();this.refreshProgressBar()},setTimeMessage:function(a){jQuery("#time p span.time_message").html(a)},refreshProgressBar:function(){jQuery(".progress").progressbar()},checkStartRegenerating:function(){if(jQuery(".notSaved").size()>0){var a=confirm(sis.notSaved);if(a==true){this.startRegenerating()}else{return false}}else{this.startRegenerating()}},startRegenerating:function(){var a=this;this.dateScript=new Date;jQuery.ajax({url:sis.ajaxUrl,type:"POST",dataType:"json",data:"action=sis_ajax_thumbnail_rebuild&do=getlist"+a.post_types,beforeSend:function(){jQuery("#ajax_thumbnail_rebuild").attr("disabled",true);a.setMessage(sis.reading);a.getThumbnails();a.getPostTypes()},success:function(b){if(typeof b!=="object"){a.reInit();a.setMessage(sis.phpError);return false}jQuery("#time").show();a.list=b;a.curr=0;jQuery(".progress").show();a.regenItem()}})},regenItem:function(){var a=this;if(!this.list){this.reInit();this.setMessage(sis.noMedia);return false}if(this.curr>=this.list.length){var b=new Date;this.reInit();this.setMessage(sis.done+this.curr+" "+sis.messageRegenerated+sis.startedAt+b.getHours()+":"+b.getMinutes()+":"+b.getSeconds()+sis.finishedAt+b.getHours()+":"+b.getMinutes()+":"+b.getSeconds());return}this.setMessage(sis.regenerating+(this.curr+1)+sis.of+this.list.length+" ("+this.list[this.curr].title+")...");jQuery.ajax({url:sis.ajaxUrl,type:"POST",dataType:"json",data:"action=sis_ajax_thumbnail_rebuild&do=regen&id="+this.list[this.curr].id+this.thumbnails,beforeSend:function(){a.percent=a.curr/a.list.length*100;jQuery(".progress").progressbar("value",a.percent);jQuery(".progress-percent span.text").html(Math.round(a.percent)+"%").closest(".progress-percent").animate({left:Math.round(a.percent)-2.5+"%"},500)},success:function(b){if(!b.src||!b.time||b.error||typeof b!=="object"){var c="";if(typeof b!=="object")c=sis.phpError;else c=b.error;jQuery("#error_messages").addClass("error message");jQuery("#error_messages ul.messages").append("<li>"+c+"</li>")}else{if(b.message)jQuery("#time ul.messages").append("<li>"+b.message+"</li>");var d=new Date;var e=new Date;jQuery("#thumb").show();jQuery("#thumb-img").attr("src",b.src);a.timeScript.push(b.time);var f=a.timeScript.length;var g=0;for(var h=0;h<f;h++){g+=a.timeScript[h]}var i=g/f;var j=Math.round(i*a.list.length*1e3);d.setTime(a.dateScript.getTime()+j);var k=a.s2t((d.getTime()-e.getTime())/1e3);a.setTimeMessage(d.getHours()+":"+d.getMinutes()+":"+d.getSeconds()+sis.or+k+sis.beforeEnd)}a.curr++;a.regenItem()}})},s2t:function(a){a=a%86400;var b=new Date(1970,0,1);b.setSeconds(a);var c=b.toTimeString().substr(0,8);if(a>86399)c=Math.floor((b-Date.parse("1/1/70"))/36e5)+c.substr(2);return c},reInit:function(){jQuery("#ajax_thumbnail_rebuild").removeAttr("disabled");jQuery(".progress, #thumb").hide()}};var sizes={i:0,add:function(a,b){a.preventDefault();var c=jQuery("<tr />").attr("valign","top").addClass("new_size_"+this.i);jQuery("<th />").attr("scope","row").append(jQuery("<input />").attr({type:"text",id:"new_size_"+this.i}).val("thumbnail-name")).appendTo(c);jQuery("<td />").append(jQuery("<input />").attr({type:"button",id:"validate_"+this.i}).val(sis.validate).addClass("button-secondary action add_size_name")).appendTo(c);jQuery(b).closest("tr").before(c);this.i++},register:function(a,b){a.preventDefault();var c=jQuery(b).closest("tr").children("th").find("input").val();var d=jQuery(b).closest("tr").children("th").find("input").attr("id");var e=jQuery(b).closest("tbody").find('input[value="'+c+'"]').length;if(c=="thumbnail"||c=="medium"||c=="large"){alert(sis.notOriginal);return false}else if(e!=0){alert(sis.alreadyPresent);return false}var f=jQuery("<th />").attr("scope","row").text(sis.size+" "+c);var g=jQuery("<td />");jQuery("<input />").attr({type:"hidden",name:"image_name"}).val(c).appendTo(g);jQuery("<input />").attr({type:"hidden",name:"custom_image_sizes["+c+"][custom]"}).val("1").appendTo(g);jQuery("<label />").attr("for","custom_image_sizes["+c+"][w]").text(sis.maximumWidth).append(jQuery("<input />").attr({type:"number",name:"custom_image_sizes["+c+"][w]",step:1,min:0,id:"custom_image_sizes["+c+"][w]",base_w:0}).val("0").addClass("w small-text")).appendTo(g);jQuery("<label />").attr("for","custom_image_sizes["+c+"][h]").text(sis.maximumHeight).append(jQuery("<input />").attr({type:"number",name:"custom_image_sizes["+c+"][h]",step:1,min:0,id:"custom_image_sizes["+c+"][h]",base_h:0}).val("0").addClass("h small-text")).appendTo(g);jQuery("<div />").addClass("crop").append(jQuery("<input />").attr({type:"checkbox",name:"custom_image_sizes["+c+"][c]",id:"custom_image_sizes["+c+"][c]",base_c:0}).val("1").addClass("c")).append(jQuery("<label />").attr({"for":"checkbox",id:"custom_image_sizes["+c+"][c]"}).text(sis.crop)).appendTo(g);jQuery("<div />").addClass("show").append(jQuery("<input />").attr({type:"checkbox",name:"custom_image_sizes["+c+"][s]",id:"custom_image_sizes["+c+"][s]",base_s:0}).val("1").addClass("s")).append(jQuery("<label />").attr({"for":"checkbox",id:"custom_image_sizes["+c+"][s]"}).text(sis.show)).appendTo(g);jQuery("<div />").text(sis.deleteImage).addClass("delete_size").appendTo(g);jQuery("<div />").text(sis.validateButton).addClass("add_size validate_size").appendTo(g);jQuery("#"+d).closest("tr").html(f.after(g));this.setButtons()},deleteSize:function(a,b){a.preventDefault();var c=confirm(sis.confirmDelete);if(c==true){jQuery(b).closest("tr").remove();this.ajaxUnregister(b)}},getPhp:function(a,b){a.preventDefault();var c=jQuery(b).closest("tr");jQuery.ajax({url:sis.ajaxUrl,type:"POST",data:{action:"get_sizes"},beforeSend:function(){c.removeClass("addPending");c.addClass("addPending")},success:function(a){jQuery("#get_php").nextAll("code").html("<br />"+a).show().css({display:"block"});c.removeClass("addPending")}})},ajaxRegister:function(a,b){a.preventDefault();var c=this;var d=jQuery(b).closest("table");var e;var f=jQuery(b).closest("tr");var g=f.find('input[name="image_name"]').val();var h=f.find("input.c").attr("checked");var i=f.find("input.s").attr("checked");if(h==false||h==undefined){h=false}else{h=true}if(i==false||i==undefined){i=false}else{i=true}var j=parseInt(f.find("input.w").val());var k=parseInt(f.find("input.h").val());if(!d.hasClass("ajaxing")){jQuery.ajax({url:sis.ajaxUrl,type:"POST",dataType:"json",data:{action:"add_size",width:j,height:k,crop:h,name:g,show:i},beforeSend:function(){f.removeClass("errorAdding notChangedAdding successAdding");f.addClass("addPending");d.addClass("ajaxing")},success:function(a){var b="";f.removeClass("addPending");d.removeClass("ajaxing");if(a==0){b="errorAdding"}else if(a==2){b="notChangedAdding";c.addToArray(g,j,k,h,b)}else{b="successAdding";c.addToArray(g,j,k,h,b)}f.find("input.h").attr({base_h:k});f.find("input.w").attr({base_w:j});f.find("input.c").attr({base_c:h});f.find("input.s").attr({base_s:i});f.addClass(b);f.find("td").removeClass("notSaved");f.find(".add_size").removeClass("validate_size").hide().children(".ui-button-text").text(sis.update);clearTimeout(e);e=setTimeout(function(){f.removeClass("errorAdding notChangedAdding successAdding")},3*1e3)}})}},ajaxUnregister:function(a){var b=this;var c=jQuery(a).closest("tr").find('input[name="image_name"]').val();jQuery.ajax({url:sis.ajaxUrl,type:"POST",data:{action:"remove_size",name:c},success:function(c){b.removeFromArray(a)}})},addToArray:function(a,b,c,d,e){var f=jQuery('#sis-regen .wrapper > table > tbody input[value="'+a+'"]');var g="";var h;if(f.length!=0)g=f.closest("tr");else g=jQuery("#sis-regen .wrapper > table > tbody > tr:first").clone();if(d==true)d=sis.tr;else d=sis.fl;g.find("td > label").attr("for",a).end().find("input.thumbnails").val(a).attr("id",a).end().find("td:nth-child(2) > label").text(a).end().find("td:nth-child(3) > label").text(b+"px").end().find("td:nth-child(4) > label").text(c+"px").end().find("td:nth-child(5) > label").text(d);if(f.length==0)g.appendTo("#sis-regen .wrapper > table > tbody");g.removeClass("errorAdding notChangedAdding successAdding").addClass(e);clearTimeout(h);h=setTimeout(function(){g.removeClass("errorAdding notChangedAdding successAdding")},3*1e3)},removeFromArray:function(a){var b=jQuery(a).closest("tr").find("input[name=image_name]").val();jQuery('#sis-regen .wrapper > table > tbody input[value="'+b+'"]').closest("tr").remove()},setButtons:function(){jQuery(".delete_size").button({icons:{primary:"ui-icon-circle-close"}});jQuery(".add_size").button({icons:{primary:"ui-icon-check"}});jQuery(".crop").button({icons:{primary:"ui-icon-arrow-4-diag"}});jQuery(".show").button({icons:{primary:"ui-icon-lightbulb"}})},displayChange:function(a){a=jQuery(a);var b=a.closest("tr").find("input.h");var c=a.closest("tr").find("input.w");var d=a.closest("tr").find("input.c");var e=a.closest("tr").find("input.s");var f=b.val();var g=c.val();var h=d.prop("checked");var i=e.prop("checked");var j=b.attr("base_h");var k=c.attr("base_w");var l=d.attr("base_c");var m=e.attr("base_s");if(l=="0")l=false;else l=true;if(m=="0")m=false;else m=true;if(f!=j||g!=k||h!=l||i!=m){a.closest("td").addClass("notSaved").find(".add_size").show()}else{a.closest("td").removeClass("notSaved").find(".add_size").hide()}}};jQuery(function(){jQuery("#ajax_thumbnail_rebuild").click(function(){regenerate.checkStartRegenerating()});jQuery("#add_size").click(function(a){sizes.add(a,this)});jQuery(".add_size_name").live("click",function(a){sizes.register(a,this)});jQuery(".delete_size").live("click",function(a){sizes.deleteSize(a,this)});jQuery(".add_size").live("click",function(a){sizes.ajaxRegister(a,this)});jQuery(".h,.w,.c,.s").live("click",function(a){sizes.displayChange(this)});jQuery("#get_php").click(function(a){sizes.getPhp(a,this)});jQuery("#get_php").nextAll("code").hide();jQuery("span.custom_size").closest("tr").children("th").css({color:"#89D76A"});jQuery("span.theme_size").closest("tr").children("th").css({color:"#F2A13A"});sizes.setButtons();jQuery(".add_size").hide();jQuery('<div class="ui-widget" id="msg"><div class="ui-state-error ui-corner-all" style="padding: 0 .7em;"><p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span><strong>Alert:</strong> <ul class="msg" ></ul></p></div></div>').prependTo("div#wpwrap").slideUp(0);jQuery("#msg").ajaxError(function(a,b,c){jQuery(this).find(".msg").append("<li>"+sis.ajaxErrorHandler+" "+c.url+", status "+b.status+" : "+b.statusText+"</li>").end().stop(false,false).slideDown(200).delay(5e3).slideUp(200)})})
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ sis_small=true;var regenerate={post_types:"",thumbnails:"",list:"",cur:0,timeScript:[],dateScript:"",percent:"",getThumbnails:function(){var a=this,b=jQuery("input.thumbnails:checked");b.length!=jQuery('input.thumbnails[type="checkbox"]').length&&b.each(function(){a.thumbnails+="&thumbnails[]="+jQuery(this).val()})},getPostTypes:function(){var a=this,b=jQuery("input.post_types:checked");b.length!=jQuery('input.post_types[type="checkbox"]').length&&b.each(function(){a.post_types+="&post_types[]="+jQuery(this).val()})},
2
+ setMessage:function(a){jQuery("#regenerate_message").html("<p>"+a+"</p>").addClass("updated").addClass("fade").show();this.refreshProgressBar()},setTimeMessage:function(a){jQuery("#time p span.time_message").html(a)},refreshProgressBar:function(){jQuery(".progress").progressbar()},checkStartRegenerating:function(){if(jQuery(".notSaved").size()>0)if(confirm(sis.notSaved)==true)this.startRegenerating();else return false;else this.startRegenerating()},startRegenerating:function(){var a=this;this.dateScript=
3
+ new Date;jQuery.ajax({url:sis.ajaxUrl,type:"POST",dataType:"json",data:"action=sis_ajax_thumbnail_rebuild&do=getlist"+a.post_types,beforeSend:function(){jQuery("#ajax_thumbnail_rebuild").attr("disabled",true);a.setMessage(sis.reading);a.getThumbnails();a.getPostTypes()},success:function(b){if(typeof b!=="object")return a.reInit(),a.setMessage(sis.phpError),false;jQuery("#time").show();a.list=b;a.curr=0;jQuery(".progress").show();a.regenItem()}})},regenItem:function(){var a=this;if(!this.list)return this.reInit(),
4
+ this.setMessage(sis.noMedia),false;if(this.curr>=this.list.length){var b=new Date;this.reInit();this.setMessage(sis.done+this.curr+" "+sis.messageRegenerated+sis.startedAt+b.getHours()+":"+b.getMinutes()+":"+b.getSeconds()+sis.finishedAt+b.getHours()+":"+b.getMinutes()+":"+b.getSeconds())}else this.setMessage(sis.regenerating+(this.curr+1)+sis.of+this.list.length+" ("+this.list[this.curr].title+")..."),jQuery.ajax({url:sis.ajaxUrl,type:"POST",dataType:"json",data:"action=sis_ajax_thumbnail_rebuild&do=regen&id="+
5
+ this.list[this.curr].id+this.thumbnails,beforeSend:function(){a.percent=a.curr/a.list.length*100;jQuery(".progress").progressbar("value",a.percent);jQuery(".progress-percent span.text").html(Math.round(a.percent)+"%").closest(".progress-percent").animate({left:Math.round(a.percent)-2.5+"%"},500)},success:function(c){if(!c.src||!c.time||c.error||typeof c!=="object"){var b="",b=typeof c!=="object"?sis.phpError:c.error;jQuery("#error_messages").addClass("error message");jQuery("#error_messages ul.messages").append("<li>"+
6
+ b+"</li>")}else{c.message&&jQuery("#time ul.messages").append("<li>"+c.message+"</li>");var b=new Date,e=new Date;jQuery("#thumb").show();jQuery("#thumb-img").attr("src",c.src);a.timeScript.push(c.time);for(var c=a.timeScript.length,d=0,g=0;g<c;g++)d+=a.timeScript[g];c=Math.round(d/c*a.list.length*1E3);b.setTime(a.dateScript.getTime()+c);e=a.s2t((b.getTime()-e.getTime())/1E3);a.setTimeMessage(b.getHours()+":"+b.getMinutes()+":"+b.getSeconds()+sis.or+e+sis.beforeEnd)}a.curr++;a.regenItem()}})},s2t:function(a){a%=
7
+ 86400;var b=new Date(1970,0,1);b.setSeconds(a);var c=b.toTimeString().substr(0,8);a>86399&&(c=Math.floor((b-Date.parse("1/1/70"))/36E5)+c.substr(2));return c},reInit:function(){jQuery("#ajax_thumbnail_rebuild").removeAttr("disabled");jQuery(".progress, #thumb").hide()}},sizes={i:0,add:function(a,b){a.preventDefault();var c=jQuery("<tr />").attr("valign","top").addClass("new_size_"+this.i+" new_size");jQuery("<th />").attr("scope","row").append(jQuery("<input />").attr({type:"text",id:"new_size_"+
8
+ this.i}).val("thumbnail-name")).appendTo(c);jQuery("<td />").append(jQuery("<input />").attr({type:"button",id:"validate_"+this.i}).val(sis.validate).addClass("button-secondary action add_size_name")).appendTo(c);jQuery(b).closest("tr").before(c);this.i++},register:function(a,b){a.preventDefault();var c=jQuery(b).closest("tr").children("th").find("input").val(),f=jQuery(b).closest("tr").children("th").find("input").attr("id"),e=jQuery(b).closest("tbody").find('input[value="'+c+'"]').length;if(c==
9
+ "thumbnail"||c=="medium"||c=="large")return alert(sis.notOriginal),false;else if(e!=0)return alert(sis.alreadyPresent),false;var e=jQuery("<th />").attr("scope","row").text(sis.size+" "+c),d=jQuery("<td />");jQuery("<input />").attr({type:"hidden",name:"image_name"}).val(c).appendTo(d);jQuery("<input />").attr({type:"hidden",name:"custom_image_sizes["+c+"][custom]"}).val("1").appendTo(d);jQuery("<label />").attr("for","custom_image_sizes["+c+"][w]").addClass("sis-label").text(sis.maximumWidth).append(jQuery("<input />").attr({type:"number",
10
+ name:"custom_image_sizes["+c+"][w]",step:1,min:0,id:"custom_image_sizes["+c+"][w]",base_w:0}).val("0").addClass("w small-text")).appendTo(d);jQuery("<label />").attr("for","custom_image_sizes["+c+"][h]").addClass("sis-label").text(sis.maximumHeight).append(jQuery("<input />").attr({type:"number",name:"custom_image_sizes["+c+"][h]",step:1,min:0,id:"custom_image_sizes["+c+"][h]",base_h:0}).val("0").addClass("h small-text")).appendTo(d);els=jQuery("<span />").addClass("size_options").append(jQuery("<input />").attr({type:"checkbox",
11
+ name:"custom_image_sizes["+c+"][c]",id:"custom_image_sizes["+c+"][c]",base_c:0}).val("1").addClass("c crop")).append(jQuery("<label />").attr({"for":"custom_image_sizes["+c+"][c]",id:"custom_image_sizes["+c+"][c]","class":"c",title:sis.crop}).text(sis.crop)).append(jQuery("<input />").attr({type:"checkbox",name:"custom_image_sizes["+c+"][s]",id:"custom_image_sizes["+c+"][s]",base_s:0}).val("1").addClass("s show")).append(jQuery("<label />").attr({"for":"custom_image_sizes["+c+"][s]",id:"custom_image_sizes["+
12
+ c+"][s]","class":"s",title:sis.show}).text(sis.show));els.appendTo(d);jQuery("<div />").text(sis.deleteImage).addClass("delete_size").appendTo(d);jQuery("<div />").text(sis.validateButton).addClass("add_size validate_size").appendTo(d);jQuery("#"+f).closest("tr").html(e.after(d));sis_small==true?this.setButtonsSmall():this.setButtons()},deleteSize:function(a,b){a.preventDefault();confirm(sis.confirmDelete)==true&&(jQuery(b).closest("tr").remove(),this.ajaxUnregister(b))},getPhp:function(a,b){a.preventDefault();
13
+ var c=jQuery(b).closest("tr");jQuery.ajax({url:sis.ajaxUrl,type:"POST",data:{action:"get_sizes"},beforeSend:function(){c.removeClass("addPending");c.addClass("addPending")},success:function(a){jQuery("#get_php").nextAll("code").html("<br />"+a).show().css({display:"block"});c.removeClass("addPending")}})},ajaxRegister:function(a,b){a.preventDefault();var c=this,f=jQuery(b).closest("table"),e,d=jQuery(b).closest("tr"),g=d.find('input[name="image_name"]').val(),h=d.find("label.c").hasClass("ui-state-active"),
14
+ i=d.find("label.s").hasClass("ui-state-active"),h=h==false||h==void 0?false:true,i=i==false||i==void 0?false:true,j=parseInt(d.find("input.w").val()),k=parseInt(d.find("input.h").val());f.hasClass("ajaxing")||jQuery.ajax({url:sis.ajaxUrl,type:"POST",dataType:"json",data:{action:"add_size",width:j,height:k,crop:h,name:g,show:i},beforeSend:function(){d.removeClass();d.addClass("addPending");f.addClass("ajaxing")},success:function(a){var b="";d.removeClass();f.removeClass("ajaxing");a==0?b="errorAdding":
15
+ (b=a==2?"notChangedAdding":"successAdding",c.addToArray(g,j,k,h,b));d.find("input.h").attr({base_h:k});d.find("input.w").attr({base_w:j});d.find("input.c").attr({base_c:h});d.find("input.s").attr({base_s:i});d.addClass(b);d.find("td").removeClass("notSaved");d.find(".add_size").removeClass("validate_size").hide().children(".ui-button-text").text(sis.update);clearTimeout(e);e=setTimeout(function(){d.removeClass("errorAdding notChangedAdding successAdding")},3E3)}})},ajaxUnregister:function(a){var b=
16
+ this,c=jQuery(a).closest("tr").find('input[name="image_name"]').val();jQuery.ajax({url:sis.ajaxUrl,type:"POST",data:{action:"remove_size",name:c},success:function(){b.removeFromArray(a)}})},addToArray:function(a,b,c,f,e){var d=jQuery('#sis-regen .wrapper > table > tbody input[value="'+a+'"]'),g="",h,g=d.length!=0?d.closest("tr"):jQuery("#sis-regen .wrapper > table > tbody > tr:first").clone(),f=f==true?sis.tr:sis.fl;g.find("td > label").attr("for",a).end().find("input.thumbnails").val(a).attr("id",
17
+ a).end().find("td:nth-child(2) > label").text(a).end().find("td:nth-child(3) > label").text(b+"px").end().find("td:nth-child(4) > label").text(c+"px").end().find("td:nth-child(5) > label").text(f);d.length==0&&g.appendTo("#sis-regen .wrapper > table > tbody");g.removeClass("errorAdding notChangedAdding successAdding").addClass(e);clearTimeout(h);h=setTimeout(function(){g.removeClass("errorAdding notChangedAdding successAdding")},3E3)},removeFromArray:function(a){a=jQuery(a).closest("tr").find("input[name=image_name]").val();
18
+ jQuery('#sis-regen .wrapper > table > tbody input[value="'+a+'"]').closest("tr").remove()},setButtons:function(){jQuery(".delete_size").button({icons:{primary:"ui-icon-circle-close"},text:true});jQuery(".add_size").button({icons:{primary:"ui-icon-check"},text:true});jQuery(".crop").button({icons:{primary:"ui-icon-arrow-4-diag"},text:true});jQuery(".show").button({icons:{primary:"ui-icon-lightbulb"},text:true});jQuery(".size_options").buttonset()},setButtonsSmall:function(){jQuery(".delete_size").button({icons:{primary:"ui-icon-circle-close"},
19
+ text:false});jQuery(".add_size").button({icons:{primary:"ui-icon-check"},text:false});jQuery(".crop").button({icons:{primary:"ui-icon-arrow-4-diag"},text:false});jQuery(".show").button({icons:{primary:"ui-icon-lightbulb"},text:false})},displayChange:function(a){var a=jQuery(a),b=a.closest("tr");if(b.hasClass("new_size"))return false;var c=b.find("input.h"),f=b.find("input.w"),e=b.find("input.c"),d=b.find("input.s"),g=c.val(),h=f.val(),i=b.find("label.c").hasClass("ui-state-active"),b=b.find("label.s").hasClass("ui-state-active"),
20
+ c=c.attr("base_h"),f=f.attr("base_w"),e=e.attr("base_c"),d=d.attr("base_s");g!=c||h!=f||i!=(e=="0"?false:true)||b!=(d=="0"?false:true)?a.closest("td").addClass("notSaved").find(".add_size").css("display","inline-block"):a.closest("td").removeClass("notSaved").find(".add_size").css("display","none")}};
21
+ jQuery(function(){jQuery("#ajax_thumbnail_rebuild").click(function(){regenerate.checkStartRegenerating()});jQuery("#add_size").click(function(a){sizes.add(a,this)});jQuery(".add_size_name").live("click",function(a){sizes.register(a,this)});jQuery(".delete_size").live("click",function(a){sizes.deleteSize(a,this)});jQuery(".add_size").live("click",function(a){sizes.ajaxRegister(a,this)});jQuery(".h,.w,.c,.s").live("click",function(){sizes.displayChange(this)});jQuery("#get_php").click(function(a){sizes.getPhp(a,
22
+ this)});jQuery("#get_php").nextAll("code").hide();jQuery("span.custom_size").closest("tr").children("th").css({color:"#89D76A"});jQuery("span.theme_size").closest("tr").children("th").css({color:"#F2A13A"});jQuery(".add_size").hide();jQuery('<div class="ui-widget" id="msg"><div class="ui-state-error ui-corner-all" style="padding: 0 .7em;"><p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span><strong>Alert:</strong> <ul class="msg" ></ul></p></div></div>').prependTo("div#wpwrap").slideUp(0);
23
+ jQuery("#msg").ajaxError(function(a,b,c){jQuery(this).find(".msg").append("<li>"+sis.ajaxErrorHandler+" "+c.url+", status "+b.status+" : "+b.statusText+"</li>").end().stop(false,false).slideDown(200).delay(5E3).slideUp(200)});jQuery(window).bind("resize",function(){window.innerWidth<=820&&sis_small==false?(sizes.setButtonsSmall(),sis_small=true):window.innerWidth>820&&sis_small==true&&(sizes.setButtons(),sis_small=false)});sizes.setButtons()});
languages/sis-fr_FR.mo CHANGED
Binary file
languages/sis-fr_FR.po CHANGED
@@ -4,8 +4,8 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: Simple image sizes\n"
6
  "Report-Msgid-Bugs-To: \n"
7
- "POT-Creation-Date: 2011-10-02 00:05+0100\n"
8
- "PO-Revision-Date: 2011-10-02 00:06+0100\n"
9
  "Last-Translator: \n"
10
  "Language-Team: Beapi <njuen@beapi.fr>\n"
11
  "MIME-Version: 1.0\n"
@@ -18,219 +18,224 @@ msgstr ""
18
  "X-Poedit-Basepath: ../\n"
19
  "X-Poedit-SearchPath-0: .\n"
20
 
21
- #: inc/class.admin.php:66
22
  msgid "Reading attachments..."
23
  msgstr "Chargement des médias..."
24
 
25
- #: inc/class.admin.php:67
26
- #: inc/class.admin.php:226
27
  msgid "Maximum width"
28
  msgstr "Largeur maximum"
29
 
30
- #: inc/class.admin.php:68
31
- #: inc/class.admin.php:231
32
  msgid "Maximum height"
33
  msgstr "Hauteur maximum"
34
 
35
- #: inc/class.admin.php:69
36
- #: inc/class.admin.php:237
37
- #: inc/class.admin.php:307
38
- #: inc/class.admin.php:366
39
  msgid "Crop ?"
40
  msgstr "Rogner ?"
41
 
42
- #: inc/class.admin.php:70
43
- #: inc/class.admin.php:354
44
  msgid "yes"
45
  msgstr "oui"
46
 
47
- #: inc/class.admin.php:71
48
- #: inc/class.admin.php:354
49
  msgid "no"
50
  msgstr "non"
51
 
52
- #: inc/class.admin.php:72
53
- #: inc/class.admin.php:242
54
  msgid "Show in post insertion ?"
55
  msgstr "Afficher dans l'insertion ?"
56
 
57
- #: inc/class.admin.php:73
58
  msgid " of "
59
  msgstr " de "
60
 
61
- #: inc/class.admin.php:74
62
  msgid " or "
63
  msgstr " ou "
64
 
65
- #: inc/class.admin.php:75
66
  msgid " before the end."
67
  msgstr " avant la fin."
68
 
69
- #: inc/class.admin.php:76
70
- #: inc/class.admin.php:244
71
  msgid "Delete"
72
  msgstr "Supprimer"
73
 
74
- #: inc/class.admin.php:77
75
  msgid "No media in your site to regenerate !"
76
  msgstr "Pas de médias à regénérer !"
77
 
78
- #: inc/class.admin.php:78
79
  msgid "Regenerating "
80
  msgstr "Regénération "
81
 
82
- #: inc/class.admin.php:79
83
  msgid "Validate image size name"
84
  msgstr "Valider le nom de la taille d'image"
85
 
86
- #: inc/class.admin.php:80
87
  msgid "Done."
88
  msgstr "Fini."
89
 
90
- #: inc/class.admin.php:81
91
  msgid "Size"
92
  msgstr "Taille "
93
 
94
- #: inc/class.admin.php:82
95
  msgid "Don't use the basic Wordpress thumbnail size name, use the form above to edit them"
96
  msgstr "N'utilisez pas les tailles par défaut de WordPress comme nom de taille, éditez leurs valeurs avec le formulaire ci-dessus."
97
 
98
- #: inc/class.admin.php:83
99
  msgid "This size is already registered, edit it instead of recreating it."
100
  msgstr "Cette taille existe déjà, éditez la au lieu de la recréer."
101
 
102
- #: inc/class.admin.php:84
103
  msgid "Do you really want to delete these size ?"
104
  msgstr "Voulez-vous réellement supprimer cette taille ?"
105
 
106
- #: inc/class.admin.php:85
107
- #: inc/class.admin.php:245
108
  msgid "Update"
109
  msgstr "Mettre à jour"
110
 
111
- #: inc/class.admin.php:86
112
  msgid "Error requesting page"
113
  msgstr "Erreur lors de la requête vers la page"
114
 
115
- #: inc/class.admin.php:87
116
  msgid "images have been regenerated !"
117
  msgstr "images ont été regénérées !"
118
 
119
- #: inc/class.admin.php:88
120
  msgid "Validate"
121
  msgstr "Valider"
122
 
123
- #: inc/class.admin.php:89
124
  msgid " started at"
125
  msgstr " commencé à"
126
 
127
- #: inc/class.admin.php:90
128
  msgid " finished at :"
129
  msgstr " terminé à"
130
 
131
- #: inc/class.admin.php:91
132
  msgid "Error during the php treatment, be sure to not have php errors in your page"
133
  msgstr "Erreur lors du traitement PHP, soyez sûr que vous n'avez pas d'erreurs PHP dans vos pages"
134
 
135
- #: inc/class.admin.php:92
136
  msgid "All the sizes you have modifed are not saved, continue anyway ?"
137
  msgstr "Toutes les tailles que vous avez modifié n'ont pas été enregistrées, continuer ?"
138
 
139
- #: inc/class.admin.php:93
140
  #, php-format
141
  msgid "This image has been regenerated in %s seconds"
142
- msgstr "Cette image a été regénérée en % secondes"
143
 
144
- #: inc/class.admin.php:108
 
 
 
 
 
145
  msgid "Regenerate thumbnails"
146
  msgstr "Régénérer les vignettes"
147
 
148
- #: inc/class.admin.php:128
149
  msgid "Settings"
150
  msgstr "Paramètres"
151
 
152
- #: inc/class.admin.php:177
153
  #, php-format
154
  msgid "%s size"
155
  msgstr "Taille %s"
156
 
157
- #: inc/class.admin.php:184
158
  msgid "Add a new size"
159
  msgstr "Ajouter une nouvelle taille"
160
 
161
- #: inc/class.admin.php:187
162
  msgid "Legend of the sizes"
163
  msgstr "Légende des tailles"
164
 
165
- #: inc/class.admin.php:190
166
  msgid "Get php for theme"
167
  msgstr "Récupérer le PHP pour le thème"
168
 
169
- #: inc/class.admin.php:193
170
  msgid "Thumbnail regeneration"
171
  msgstr "Régénération des vignettes"
172
 
173
- #: inc/class.admin.php:269
174
  msgid "Copy and paste the code below into your Wordpress theme function file if you wanted to save them and deactivate the plugin."
175
  msgstr "Copiez et collez le code ci-dessous dans votre fichier de fonctions de votre thème WordPress si vous voulez les conserver et désactiver ce plugin."
176
 
177
- #: inc/class.admin.php:282
178
  msgid "The images created on your theme are <span style=\"color:#F2A13A\">orange</span> and your custom size are <span style=\"color:#89D76A\"> green </span>."
179
  msgstr "Les tailles d'images crées par votre thème sont en <span style=\"color:#F2A13A\">orange</span> et vos tailles personnalisées sont en <span style=\"color:#89D76A\"> vert </span>."
180
 
181
- #: inc/class.admin.php:299
182
  msgid "Select which thumbnails you want to rebuild:"
183
  msgstr "Sélectionnez les tailles de vignettes à régénérer"
184
 
185
- #: inc/class.admin.php:303
186
- #: inc/class.admin.php:362
187
- #: inc/class.admin.php:375
188
- #: inc/class.admin.php:400
189
  msgid "Resize ?"
190
  msgstr "Regénérer ?"
191
 
192
- #: inc/class.admin.php:304
193
- #: inc/class.admin.php:363
194
  msgid "Size name"
195
  msgstr "Nom de la taille"
196
 
197
- #: inc/class.admin.php:305
198
- #: inc/class.admin.php:364
199
  msgid "Width"
200
  msgstr "Largeur"
201
 
202
- #: inc/class.admin.php:306
203
- #: inc/class.admin.php:365
204
  msgid "Height"
205
  msgstr "Hauteur"
206
 
207
- #: inc/class.admin.php:371
208
  msgid "Select which post type source thumbnails you want to rebuild:"
209
  msgstr "Sélectionnez quelles vignettes de quel type de contenu vous souhaitez régénérer : "
210
 
211
- #: inc/class.admin.php:376
212
- #: inc/class.admin.php:401
213
  msgid "Post type"
214
  msgstr "Type de contenu"
215
 
216
- #: inc/class.admin.php:423
217
  msgid "End time calculated :"
218
  msgstr "Fin du traitement calculé :"
219
 
220
- #: inc/class.admin.php:434
221
  msgid "Last image:"
222
  msgstr "Dernière image :"
223
 
224
- #: inc/class.admin.php:435
225
  msgid "Regenerate Thumbnails"
226
  msgstr "Régénérer les vignettes"
227
 
228
- #: inc/class.admin.php:600
229
  msgid "No id given in POST datas."
230
  msgstr "Pas d'id donné dans les données du POST."
231
 
232
- #: inc/class.admin.php:610
233
- #: inc/class.admin.php:612
234
  #, php-format
235
  msgid "This file does not exists and have not been regenerated :<br/><a target=\"_blank\" href=\"%1$s\" >%2$s</a>"
236
  msgstr "Ce fichier existe déjà dans cette ces tailles d'image et n'a pas été regénéré :<br/><a target=\"_blank\" href=\"%1$s\" >%2$s</a>"
4
  msgstr ""
5
  "Project-Id-Version: Simple image sizes\n"
6
  "Report-Msgid-Bugs-To: \n"
7
+ "POT-Creation-Date: 2011-10-07 00:52+0100\n"
8
+ "PO-Revision-Date: 2011-10-07 01:19+0100\n"
9
  "Last-Translator: \n"
10
  "Language-Team: Beapi <njuen@beapi.fr>\n"
11
  "MIME-Version: 1.0\n"
18
  "X-Poedit-Basepath: ../\n"
19
  "X-Poedit-SearchPath-0: .\n"
20
 
21
+ #: inc/class.admin.php:76
22
  msgid "Reading attachments..."
23
  msgstr "Chargement des médias..."
24
 
25
+ #: inc/class.admin.php:77
26
+ #: inc/class.admin.php:237
27
  msgid "Maximum width"
28
  msgstr "Largeur maximum"
29
 
30
+ #: inc/class.admin.php:78
31
+ #: inc/class.admin.php:242
32
  msgid "Maximum height"
33
  msgstr "Hauteur maximum"
34
 
35
+ #: inc/class.admin.php:79
36
+ #: inc/class.admin.php:247
37
+ #: inc/class.admin.php:315
38
+ #: inc/class.admin.php:374
39
  msgid "Crop ?"
40
  msgstr "Rogner ?"
41
 
42
+ #: inc/class.admin.php:80
43
+ #: inc/class.admin.php:362
44
  msgid "yes"
45
  msgstr "oui"
46
 
47
+ #: inc/class.admin.php:81
48
+ #: inc/class.admin.php:362
49
  msgid "no"
50
  msgstr "non"
51
 
52
+ #: inc/class.admin.php:82
53
+ #: inc/class.admin.php:250
54
  msgid "Show in post insertion ?"
55
  msgstr "Afficher dans l'insertion ?"
56
 
57
+ #: inc/class.admin.php:83
58
  msgid " of "
59
  msgstr " de "
60
 
61
+ #: inc/class.admin.php:84
62
  msgid " or "
63
  msgstr " ou "
64
 
65
+ #: inc/class.admin.php:85
66
  msgid " before the end."
67
  msgstr " avant la fin."
68
 
69
+ #: inc/class.admin.php:86
70
+ #: inc/class.admin.php:252
71
  msgid "Delete"
72
  msgstr "Supprimer"
73
 
74
+ #: inc/class.admin.php:87
75
  msgid "No media in your site to regenerate !"
76
  msgstr "Pas de médias à regénérer !"
77
 
78
+ #: inc/class.admin.php:88
79
  msgid "Regenerating "
80
  msgstr "Regénération "
81
 
82
+ #: inc/class.admin.php:89
83
  msgid "Validate image size name"
84
  msgstr "Valider le nom de la taille d'image"
85
 
86
+ #: inc/class.admin.php:90
87
  msgid "Done."
88
  msgstr "Fini."
89
 
90
+ #: inc/class.admin.php:91
91
  msgid "Size"
92
  msgstr "Taille "
93
 
94
+ #: inc/class.admin.php:92
95
  msgid "Don't use the basic Wordpress thumbnail size name, use the form above to edit them"
96
  msgstr "N'utilisez pas les tailles par défaut de WordPress comme nom de taille, éditez leurs valeurs avec le formulaire ci-dessus."
97
 
98
+ #: inc/class.admin.php:93
99
  msgid "This size is already registered, edit it instead of recreating it."
100
  msgstr "Cette taille existe déjà, éditez la au lieu de la recréer."
101
 
102
+ #: inc/class.admin.php:94
103
  msgid "Do you really want to delete these size ?"
104
  msgstr "Voulez-vous réellement supprimer cette taille ?"
105
 
106
+ #: inc/class.admin.php:95
107
+ #: inc/class.admin.php:253
108
  msgid "Update"
109
  msgstr "Mettre à jour"
110
 
111
+ #: inc/class.admin.php:96
112
  msgid "Error requesting page"
113
  msgstr "Erreur lors de la requête vers la page"
114
 
115
+ #: inc/class.admin.php:97
116
  msgid "images have been regenerated !"
117
  msgstr "images ont été regénérées !"
118
 
119
+ #: inc/class.admin.php:98
120
  msgid "Validate"
121
  msgstr "Valider"
122
 
123
+ #: inc/class.admin.php:99
124
  msgid " started at"
125
  msgstr " commencé à"
126
 
127
+ #: inc/class.admin.php:100
128
  msgid " finished at :"
129
  msgstr " terminé à"
130
 
131
+ #: inc/class.admin.php:101
132
  msgid "Error during the php treatment, be sure to not have php errors in your page"
133
  msgstr "Erreur lors du traitement PHP, soyez sûr que vous n'avez pas d'erreurs PHP dans vos pages"
134
 
135
+ #: inc/class.admin.php:102
136
  msgid "All the sizes you have modifed are not saved, continue anyway ?"
137
  msgstr "Toutes les tailles que vous avez modifié n'ont pas été enregistrées, continuer ?"
138
 
139
+ #: inc/class.admin.php:103
140
  #, php-format
141
  msgid "This image has been regenerated in %s seconds"
142
+ msgstr "Cette image a été regénérée en %s secondes"
143
 
144
+ #: inc/class.admin.php:104
145
+ #, php-format
146
+ msgid "<h3>Welcome to Simple Image Sizes !</h3><p>In this plugin, you can add new image sizes<br/> and regenerate the images that doesn't exist yet.<br/> Click on <a href=\"%s\">Medias</a> for configurate the images</p>"
147
+ msgstr "<h3>Bienvenue dans Simple Image Sizes !</h3><p>Avec ce plugin, vous pouvez ajouter de nouvelles tailes d'images<br/> et regénérer les images qui n'existent pas encore.<br/> Cliquez sur <a href=\"%s\">Médias</a> pour configurer les tailles d'images.</p>"
148
+
149
+ #: inc/class.admin.php:119
150
  msgid "Regenerate thumbnails"
151
  msgstr "Régénérer les vignettes"
152
 
153
+ #: inc/class.admin.php:139
154
  msgid "Settings"
155
  msgstr "Paramètres"
156
 
157
+ #: inc/class.admin.php:188
158
  #, php-format
159
  msgid "%s size"
160
  msgstr "Taille %s"
161
 
162
+ #: inc/class.admin.php:195
163
  msgid "Add a new size"
164
  msgstr "Ajouter une nouvelle taille"
165
 
166
+ #: inc/class.admin.php:198
167
  msgid "Legend of the sizes"
168
  msgstr "Légende des tailles"
169
 
170
+ #: inc/class.admin.php:201
171
  msgid "Get php for theme"
172
  msgstr "Récupérer le PHP pour le thème"
173
 
174
+ #: inc/class.admin.php:204
175
  msgid "Thumbnail regeneration"
176
  msgstr "Régénération des vignettes"
177
 
178
+ #: inc/class.admin.php:277
179
  msgid "Copy and paste the code below into your Wordpress theme function file if you wanted to save them and deactivate the plugin."
180
  msgstr "Copiez et collez le code ci-dessous dans votre fichier de fonctions de votre thème WordPress si vous voulez les conserver et désactiver ce plugin."
181
 
182
+ #: inc/class.admin.php:290
183
  msgid "The images created on your theme are <span style=\"color:#F2A13A\">orange</span> and your custom size are <span style=\"color:#89D76A\"> green </span>."
184
  msgstr "Les tailles d'images crées par votre thème sont en <span style=\"color:#F2A13A\">orange</span> et vos tailles personnalisées sont en <span style=\"color:#89D76A\"> vert </span>."
185
 
186
+ #: inc/class.admin.php:307
187
  msgid "Select which thumbnails you want to rebuild:"
188
  msgstr "Sélectionnez les tailles de vignettes à régénérer"
189
 
190
+ #: inc/class.admin.php:311
191
+ #: inc/class.admin.php:370
192
+ #: inc/class.admin.php:383
193
+ #: inc/class.admin.php:408
194
  msgid "Resize ?"
195
  msgstr "Regénérer ?"
196
 
197
+ #: inc/class.admin.php:312
198
+ #: inc/class.admin.php:371
199
  msgid "Size name"
200
  msgstr "Nom de la taille"
201
 
202
+ #: inc/class.admin.php:313
203
+ #: inc/class.admin.php:372
204
  msgid "Width"
205
  msgstr "Largeur"
206
 
207
+ #: inc/class.admin.php:314
208
+ #: inc/class.admin.php:373
209
  msgid "Height"
210
  msgstr "Hauteur"
211
 
212
+ #: inc/class.admin.php:379
213
  msgid "Select which post type source thumbnails you want to rebuild:"
214
  msgstr "Sélectionnez quelles vignettes de quel type de contenu vous souhaitez régénérer : "
215
 
216
+ #: inc/class.admin.php:384
217
+ #: inc/class.admin.php:409
218
  msgid "Post type"
219
  msgstr "Type de contenu"
220
 
221
+ #: inc/class.admin.php:431
222
  msgid "End time calculated :"
223
  msgstr "Fin du traitement calculé :"
224
 
225
+ #: inc/class.admin.php:442
226
  msgid "Last image:"
227
  msgstr "Dernière image :"
228
 
229
+ #: inc/class.admin.php:443
230
  msgid "Regenerate Thumbnails"
231
  msgstr "Régénérer les vignettes"
232
 
233
+ #: inc/class.admin.php:608
234
  msgid "No id given in POST datas."
235
  msgstr "Pas d'id donné dans les données du POST."
236
 
237
+ #: inc/class.admin.php:618
238
+ #: inc/class.admin.php:620
239
  #, php-format
240
  msgid "This file does not exists and have not been regenerated :<br/><a target=\"_blank\" href=\"%1$s\" >%2$s</a>"
241
  msgstr "Ce fichier existe déjà dans cette ces tailles d'image et n'a pas été regénéré :<br/><a target=\"_blank\" href=\"%1$s\" >%2$s</a>"
readme.txt CHANGED
@@ -1,107 +1,118 @@
1
- === Simple Image Sizes ===
2
- Contributors: Rahe
3
- Donate link: http://www.beapi.fr/donate/
4
- Tags: images, image, custom sizes, custom images, thumbnail regenerate, thumbnail, regenerate
5
- Requires at least: 3.0
6
- Tested up to: 3.2
7
- Stable tag: 2.2
8
-
9
- == Description ==
10
-
11
- This plugin allow create custom image sizes for your site. Override your theme sizes directly on the media option page.
12
- You can regenerate all the sizes you have just created and choose which one you wanted to regenerate.
13
- You can now get all the code to copy and paste to your function theme file.
14
- Now you can use the generated sizes directly into your posts and insert images at the right size !
15
- Now you choose if you want display the size in the post insert image.
16
-
17
- I have added a timer so when you regeneration your thumbnails, you can know approximately when the regeneration will be ended.
18
- I have improved the php and javascript, you can know if the image have been regenerated or not or if there is an error and which one.
19
-
20
- == Installation ==
21
- **PHP5 Required.**
22
-
23
- 1. Download, unzip and upload to your WordPress plugins directory
24
- 2. Activate the plugin within you WordPress Administration Backend
25
- 3. Go to Settings > Medias
26
- 4. Configure your new image sizes and regenerate the thumbnails !
27
-
28
- == Screenshots ==
29
-
30
- 1. Settings page
31
- 2. Get PHP for the theme
32
- 3. Choose the sizes to regenerate
33
- 4. Regenerating image sizes
34
-
35
- == Changelog ==
36
- * 2.2
37
- * Add new version of css aristo
38
- * Add some icons
39
- * Display button for saving changes only when changes detected
40
- * Display message when a size is modified but not saved and wanted to regenerate
41
- * Debug functionnality when regenerating only some sizes, metas not crushed
42
- * Add solo regenerating
43
- * Remove displaying for theme/not theme sizes
44
- * Use WordPress class for small inputs
45
- * 2.1
46
- * Add javascript timer
47
- * Improve javascript and more IE friendly
48
- * You can now choose if you want to display the image sizes in image insertion or not
49
- * Handle errors and messages
50
- * Remove some css useless rules
51
- * Fix bad translation for french
52
- * Remove accents in image sizes
53
- * Do not update size properties if there is an ajax query for an another size name
54
- * 2.0.3
55
- * Resolve issue with theme sizes witch by default are displayed as not cropped. Thanks to momo360modena for the bug signalment.
56
- * 2.0.2
57
- * Remove debug on php for javascript
58
- * Resolve issue with the different versions on jquery ( like in WP3.2 ) with attr return for checked components
59
- * 2.0.1
60
- * Resolve javascript issue when clicking on delete button
61
- * Resolve issue of never unchecking crop button
62
- * 2.0
63
- * Code refactoring
64
- * Update translations
65
- * Ajaxification of the process
66
- * Deleting by Ajax
67
- * Updating by Ajax
68
- * Adding by Ajax
69
- * Change UI
70
- * Change theme
71
- * Handle ajax errors
72
- * Handle not modified sizes, cropped
73
- * Handle same names
74
- * Sanitize the names
75
- * Customize jQuery ui
76
- * Customize jQuery ui theme
77
- * HTML5 Elements
78
- * CSS3 Animations
79
- * 1.0.6
80
- * Minify javascript names
81
- * Change progressbar style
82
- * Add animations on progressbar
83
- * 1.0.5
84
- * Only add css and js script in the media page to avoid any javascript error in other pages
85
- * Rectify css
86
- * Add function to get the code for the function.php file of the theme
87
- * Don't redefine the Wordpress basic size names
88
- * 1.0.4
89
- * Fix the add_image_size issue ( height and width reversed )
90
- * 1.0.3
91
- * Fix the plugin language
92
- * Add some translations
93
- * Externalise some css
94
- * Add sizes in the image adding to an article
95
- * Add setting link in the plugins list
96
- * Use admin_url instead of home_url
97
- * Add legend for colors
98
- * Some code refactoring
99
- * 1.0.2
100
- * Fix the plugin license
101
- * 1.0.1
102
- * Add POT file
103
- * Add french translation
104
- * 1.0
105
- * First release
106
- * Thumbnail regenerate
 
 
 
 
 
 
 
 
 
 
 
107
  * Image size generation
1
+ === Simple Image Sizes ===
2
+ Contributors: Rahe
3
+ Donate link: http://www.beapi.fr/donate/
4
+ Tags: images, image, custom sizes, custom images, thumbnail regenerate, thumbnail, regenerate
5
+ Requires at least: 3.0
6
+ Tested up to: 3.3
7
+ Stable tag: 2.2.3
8
+
9
+ == Description ==
10
+
11
+ This plugin allow create custom image sizes for your site. Override your theme sizes directly on the media option page.
12
+ You can regenerate all the sizes you have just created and choose which one you wanted to regenerate.
13
+ You can now get all the code to copy and paste to your function theme file.
14
+ Now you can use the generated sizes directly into your posts and insert images at the right size !
15
+ Now you choose if you want display the size in the post insert image.
16
+ Now you can regenerate the images one by one in the 'Medias' general pane.
17
+
18
+ I have added a timer so when you regeneration your thumbnails, you can know approximately when the regeneration will be ended.
19
+ I have improved the php and javascript, you can know if the image have been regenerated or not or if there is an error and which one.
20
+
21
+ == Installation ==
22
+ **PHP5 Required.**
23
+
24
+ 1. Download, unzip and upload to your WordPress plugins directory
25
+ 2. Activate the plugin within you WordPress Administration Backend
26
+ 3. Go to Settings > Medias
27
+ 4. Configure your new image sizes and regenerate the thumbnails !
28
+
29
+ == Screenshots ==
30
+
31
+ 1. Settings page
32
+ 2. Get PHP for the theme
33
+ 3. Choose the sizes to regenerate
34
+ 4. Regenerating image sizes
35
+
36
+ == Changelog ==
37
+ * 2.2.3
38
+ * Do not force network usage
39
+ * 2.2.2
40
+ * Debug js for the buttons
41
+ * Remove console.log calls
42
+ * 2.2.1
43
+ * Use buttonset for the checkboxes
44
+ * Add Pointer for WordPress 3.3
45
+ * Fix translation in French
46
+ * Some medias queries for small windows ( change size of buttons and alignment )
47
+ * 2.2
48
+ * Add new version of css aristo
49
+ * Add some icons
50
+ * Display button for saving changes only when changes detected
51
+ * Display message when a size is modified but not saved and wanted to regenerate
52
+ * Debug functionnality when regenerating only some sizes, metas not crushed
53
+ * Add solo regenerating
54
+ * Remove displaying for theme/not theme sizes
55
+ * Use WordPress class for small inputs
56
+ * 2.1
57
+ * Add javascript timer
58
+ * Improve javascript and more IE friendly
59
+ * You can now choose if you want to display the image sizes in image insertion or not
60
+ * Handle errors and messages
61
+ * Remove some css useless rules
62
+ * Fix bad translation for french
63
+ * Remove accents in image sizes
64
+ * Do not update size properties if there is an ajax query for an another size name
65
+ * 2.0.3
66
+ * Resolve issue with theme sizes witch by default are displayed as not cropped. Thanks to momo360modena for the bug signalment.
67
+ * 2.0.2
68
+ * Remove debug on php for javascript
69
+ * Resolve issue with the different versions on jquery ( like in WP3.2 ) with attr return for checked components
70
+ * 2.0.1
71
+ * Resolve javascript issue when clicking on delete button
72
+ * Resolve issue of never unchecking crop button
73
+ * 2.0
74
+ * Code refactoring
75
+ * Update translations
76
+ * Ajaxification of the process
77
+ * Deleting by Ajax
78
+ * Updating by Ajax
79
+ * Adding by Ajax
80
+ * Change UI
81
+ * Change theme
82
+ * Handle ajax errors
83
+ * Handle not modified sizes, cropped
84
+ * Handle same names
85
+ * Sanitize the names
86
+ * Customize jQuery ui
87
+ * Customize jQuery ui theme
88
+ * HTML5 Elements
89
+ * CSS3 Animations
90
+ * 1.0.6
91
+ * Minify javascript names
92
+ * Change progressbar style
93
+ * Add animations on progressbar
94
+ * 1.0.5
95
+ * Only add css and js script in the media page to avoid any javascript error in other pages
96
+ * Rectify css
97
+ * Add function to get the code for the function.php file of the theme
98
+ * Don't redefine the Wordpress basic size names
99
+ * 1.0.4
100
+ * Fix the add_image_size issue ( height and width reversed )
101
+ * 1.0.3
102
+ * Fix the plugin language
103
+ * Add some translations
104
+ * Externalise some css
105
+ * Add sizes in the image adding to an article
106
+ * Add setting link in the plugins list
107
+ * Use admin_url instead of home_url
108
+ * Add legend for colors
109
+ * Some code refactoring
110
+ * 1.0.2
111
+ * Fix the plugin license
112
+ * 1.0.1
113
+ * Add POT file
114
+ * Add french translation
115
+ * 1.0
116
+ * First release
117
+ * Thumbnail regenerate
118
  * Image size generation
simple_image_sizes.php CHANGED
@@ -1,48 +1,48 @@
1
- <?php
2
- /*
3
- Plugin Name: Simple Image Size
4
- Plugin URI: http://redmine.beapi.fr/projects/show/simple-image-sizes
5
- Description: Add options in media setting page for images sizes
6
- Version: 2.2
7
- Author: Rahe
8
- Author URI: http://nicolas-juen.fr
9
- Text Domain: sis
10
- Domain Path: /languages/
11
- Network: true
12
-
13
- Copyright 2011 Nicolas JUEN (njuen@beapi.fr) - Be-API
14
-
15
- This program is free software; you can redistribute it and/or modify
16
- it under the terms of the GNU General Public License as published by
17
- the Free Software Foundation; either version 2 of the License, or
18
- (at your option) any later version.
19
-
20
- This program is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
-
25
- You should have received a copy of the GNU General Public License
26
- along with this program; if not, write to the Free Software
27
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
- */
29
-
30
- define( 'SIS_URL', plugins_url('/', __FILE__) );
31
- define( 'SIS_DIR', dirname(__FILE__) );
32
- define( 'SIS_VERSION', '2.2' );
33
- define( 'SIS_OPTION', 'custom_image_sizes' );
34
-
35
- require_once( SIS_DIR . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'class.admin.php' );
36
- require_once( SIS_DIR . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'class.client.php' );
37
-
38
- add_action ( 'plugins_loaded', 'initSIS' );
39
- function initSIS() {
40
- global $SIS;
41
- if( is_admin() )
42
- $SIS['admin'] = new SISAdmin();
43
-
44
- $SIS['client'] = new SISClient();
45
-
46
- load_plugin_textdomain ( 'sis', false, basename( rtrim( SIS_DIR, '/' ) ) . '/languages' );
47
- }
48
  ?>
1
+ <?php
2
+ /*
3
+ Plugin Name: Simple Image Size
4
+ Plugin URI: http://redmine.beapi.fr/projects/show/simple-image-sizes
5
+ Description: Add options in media setting page for images sizes
6
+ Version: 2.2.3
7
+ Author: Rahe
8
+ Author URI: http://nicolas-juen.fr
9
+ Text Domain: sis
10
+ Domain Path: /languages/
11
+ Network: false
12
+
13
+ Copyright 2011 Nicolas JUEN (njuen@beapi.fr) - Be-API
14
+
15
+ This program is free software; you can redistribute it and/or modify
16
+ it under the terms of the GNU General Public License as published by
17
+ the Free Software Foundation; either version 2 of the License, or
18
+ (at your option) any later version.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
+ */
29
+
30
+ define( 'SIS_URL', plugins_url('/', __FILE__) );
31
+ define( 'SIS_DIR', dirname(__FILE__) );
32
+ define( 'SIS_VERSION', '2.2.3' );
33
+ define( 'SIS_OPTION', 'custom_image_sizes' );
34
+
35
+ require_once( SIS_DIR . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'class.admin.php' );
36
+ require_once( SIS_DIR . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'class.client.php' );
37
+
38
+ add_action ( 'plugins_loaded', 'initSIS' );
39
+ function initSIS() {
40
+ global $SIS;
41
+ if( is_admin() )
42
+ $SIS['admin'] = new SISAdmin();
43
+
44
+ $SIS['client'] = new SISClient();
45
+
46
+ load_plugin_textdomain ( 'sis', false, basename( rtrim( SIS_DIR, '/' ) ) . '/languages' );
47
+ }
48
  ?>