GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( fc9531...c44ae7 )
by Brad
02:36
created

include_required_scripts()   B

Complexity

Conditions 6
Paths 4

Size

Total Lines 28
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 1
Metric Value
cc 6
eloc 15
c 3
b 0
f 1
nc 4
nop 0
dl 0
loc 28
rs 8.439
1
<?php
2
3
/*
4
 * FooGallery Admin Gallery MetaBoxes class
5
 */
6
7
if ( ! class_exists( 'FooGallery_Admin_Gallery_MetaBoxes' ) ) {
8
9
	class FooGallery_Admin_Gallery_MetaBoxes {
10
11
		private $_gallery;
12
13
		public function __construct() {
14
			//add our foogallery metaboxes
15
			add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes_to_gallery' ) );
16
17
			//save extra post data for a gallery
18
			add_action( 'save_post', array( $this, 'save_gallery' ) );
19
20
			//save custom field on a page or post
21
			add_Action( 'save_post', array( $this, 'attach_gallery_to_post' ), 10, 2 );
22
23
			//whitelist metaboxes for our gallery postype
24
			add_filter( 'foogallery_metabox_sanity', array( $this, 'whitelist_metaboxes' ) );
25
26
			//add scripts used by metaboxes
27
			add_action( 'admin_enqueue_scripts', array( $this, 'include_required_scripts' ) );
28
29
			// Ajax calls for creating a page for the gallery
30
			add_action( 'wp_ajax_foogallery_create_gallery_page', array( $this, 'ajax_create_gallery_page' ) );
31
32
			// Ajax call for clearing thumb cache for the gallery
33
			add_action( 'wp_ajax_foogallery_clear_gallery_thumb_cache', array( $this, 'ajax_clear_gallery_thumb_cache' ) );
34
		}
35
36
		public function whitelist_metaboxes() {
37
			return array(
38
				FOOGALLERY_CPT_GALLERY => array(
39
					'whitelist'  => apply_filters( 'foogallery_metabox_sanity_foogallery',
40
						array(
41
							'submitdiv',
42
							'slugdiv',
43
							'postimagediv',
44
							'foogallery_items',
45
							'foogallery_settings',
46
							'foogallery_help',
47
							'foogallery_pages',
48
							'foogallery_customcss',
49
							'foogallery_sorting',
50
							'foogallery_thumb_cache'
51
						) ),
52
					'contexts'   => array( 'normal', 'advanced', 'side', ),
53
					'priorities' => array( 'high', 'core', 'default', 'low', ),
54
				)
55
			);
56
		}
57
58
		public function add_meta_boxes_to_gallery() {
59
			global $post;
60
61
			add_meta_box(
62
				'foogallery_items',
63
				__( 'Gallery Items', 'foogallery' ),
64
				array( $this, 'render_gallery_media_metabox' ),
65
				FOOGALLERY_CPT_GALLERY,
66
				'normal',
67
				'high'
68
			);
69
70
			add_meta_box(
71
				'foogallery_settings',
72
				__( 'Gallery Settings', 'foogallery' ),
73
				array( $this, 'render_gallery_settings_metabox' ),
74
				FOOGALLERY_CPT_GALLERY,
75
				'normal',
76
				'high'
77
			);
78
79
			add_meta_box(
80
				'foogallery_help',
81
				__( 'Gallery Shortcode', 'foogallery' ),
82
				array( $this, 'render_gallery_shortcode_metabox' ),
83
				FOOGALLERY_CPT_GALLERY,
84
				'side',
85
				'default'
86
			);
87
88
			if ( 'publish' == $post->post_status ) {
89
				add_meta_box( 'foogallery_pages',
90
					__( 'Gallery Usage', 'foogallery' ),
91
					array( $this, 'render_gallery_usage_metabox' ),
92
					FOOGALLERY_CPT_GALLERY,
93
					'side',
94
					'default'
95
				);
96
			}
97
98
			add_meta_box(
99
				'foogallery_customcss',
100
				__( 'Custom CSS', 'foogallery' ),
101
				array( $this, 'render_customcss_metabox' ),
102
				FOOGALLERY_CPT_GALLERY,
103
				'normal',
104
				'low'
105
			);
106
107
			add_meta_box(
108
				'foogallery_sorting',
109
				__( 'Gallery Sorting', 'foogallery' ),
110
				array( $this, 'render_sorting_metabox' ),
111
				FOOGALLERY_CPT_GALLERY,
112
				'side',
113
				'default'
114
			);
115
116
			add_meta_box(
117
				'foogallery_thumb_cache',
118
				__( 'Thumbnail Cache', 'foogallery' ),
119
				array( $this, 'render_thumb_cache_metabox' ),
120
				FOOGALLERY_CPT_GALLERY,
121
				'side',
122
				'default'
123
			);
124
		}
125
126
		public function get_gallery( $post ) {
127
			if ( ! isset($this->_gallery) ) {
128
				$this->_gallery = FooGallery::get( $post );
129
130
				//attempt to load default gallery settings from another gallery, as per FooGallery settings page
131
				$this->_gallery->load_default_settings_if_new();
132
			}
133
134
			return $this->_gallery;
135
		}
136
137
		public function save_gallery( $post_id ) {
138
			// check autosave
139
			if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
140
				return $post_id;
141
			}
142
143
			// verify nonce
144
			if ( array_key_exists( FOOGALLERY_CPT_GALLERY . '_nonce', $_POST ) &&
145
				wp_verify_nonce( $_POST[FOOGALLERY_CPT_GALLERY . '_nonce'], plugin_basename( FOOGALLERY_FILE ) )
146
			) {
147
				//if we get here, we are dealing with the Gallery custom post type
148
149
				$attachments = apply_filters( 'foogallery_save_gallery_attachments', explode( ',', $_POST[FOOGALLERY_META_ATTACHMENTS] ) );
150
				update_post_meta( $post_id, FOOGALLERY_META_ATTACHMENTS, $attachments );
151
152
				$settings = isset($_POST[FOOGALLERY_META_SETTINGS]) ?
153
					$_POST[FOOGALLERY_META_SETTINGS] : array();
154
155
				$settings = apply_filters( 'foogallery_save_gallery_settings', $settings );
156
157
				update_post_meta( $post_id, FOOGALLERY_META_TEMPLATE, $_POST[FOOGALLERY_META_TEMPLATE] );
158
159
				update_post_meta( $post_id, FOOGALLERY_META_SETTINGS, $settings );
160
161
				update_post_meta( $post_id, FOOGALLERY_META_SORT, $_POST[FOOGALLERY_META_SORT] );
162
163
				$custom_css = isset($_POST[FOOGALLERY_META_CUSTOM_CSS]) ?
164
					$_POST[FOOGALLERY_META_CUSTOM_CSS] : '';
165
166
				if ( empty( $custom_css ) ) {
167
					delete_post_meta( $post_id, FOOGALLERY_META_CUSTOM_CSS );
168
				} else {
169
					update_post_meta( $post_id, FOOGALLERY_META_CUSTOM_CSS, $custom_css );
170
				}
171
172
				do_action( 'foogallery_after_save_gallery', $post_id, $_POST );
173
			}
174
		}
175
176
		public function attach_gallery_to_post( $post_id, $post ) {
177
178
			// check autosave
179
			if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
180
				return $post_id;
181
			}
182
183
			//only do this check for a page or post
184
			if ( 'post' == $post->post_type ||
185
				'page' == $post->post_type ) {
186
187
                do_action( 'foogallery_start_attach_gallery_to_post', $post_id );
188
189
				//Clear any foogallery usages that the post might have
190
				delete_post_meta( $post_id, FOOGALLERY_META_POST_USAGE );
191
192
				//get all foogallery shortcodes that are on the page/post
193
				$gallery_shortcodes = foogallery_extract_gallery_shortcodes( $post->post_content );
194
195
                if ( is_array( $gallery_shortcodes ) && count( $gallery_shortcodes ) > 0 ) {
196
197
                    foreach ( $gallery_shortcodes as $id => $shortcode ) {
198
                        //if the content contains the foogallery shortcode then add a custom field
199
                        add_post_meta( $post_id, FOOGALLERY_META_POST_USAGE, $id, false );
200
201
                        do_action( 'foogallery_attach_gallery_to_post', $post_id, $id );
202
                    }
203
                }
204
			}
205
		}
206
207
		public function render_gallery_media_metabox( $post ) {
208
			$gallery = $this->get_gallery( $post );
209
210
			wp_enqueue_media();
211
212
			?>
213
			<input type="hidden" name="<?php echo FOOGALLERY_CPT_GALLERY; ?>_nonce"
214
				   id="<?php echo FOOGALLERY_CPT_GALLERY; ?>_nonce"
215
				   value="<?php echo wp_create_nonce( plugin_basename( FOOGALLERY_FILE ) ); ?>"/>
216
			<input type="hidden" name='foogallery_attachments' id="foogallery_attachments"
217
				   value="<?php echo $gallery->attachment_id_csv(); ?>"/>
218
			<div>
219
				<ul class="foogallery-attachments-list">
220
				<?php
221
				if ( $gallery->has_attachments() ) {
222
					foreach ( $gallery->attachments() as $attachment ) {
223
						$this->render_gallery_item( $attachment );
224
					}
225
				} ?>
226
					<li class="add-attachment">
227
						<a href="#" data-uploader-title="<?php _e( 'Add Media To Gallery', 'foogallery' ); ?>"
228
						   data-uploader-button-text="<?php _e( 'Add Media', 'foogallery' ); ?>"
229
						   data-post-id="<?php echo $post->ID; ?>" class="upload_image_button"
230
						   title="<?php _e( 'Add Media To Gallery', 'foogallery' ); ?>">
231
							<div class="dashicons dashicons-format-gallery"></div>
232
							<span><?php _e( 'Add Media', 'foogallery' ); ?></span>
233
						</a>
234
					</li>
235
				</ul>
236
				<div style="clear: both;"></div>
237
			</div>
238
			<textarea style="display: none" id="foogallery-attachment-template">
239
				<?php $this->render_gallery_item(); ?>
240
			</textarea>
241
		<?php
242
243
		}
244
245
		public function render_gallery_item( $attachment_post = false ) {
246
			if ( $attachment_post != false ) {
247
				$attachment_id = $attachment_post->ID;
248
				$attachment = wp_get_attachment_image_src( $attachment_id );
249
			} else {
250
				$attachment_id = '';
251
				$attachment = '';
252
			}
253
			$data_attribute = empty($attachment_id) ? '' : "data-attachment-id=\"{$attachment_id}\"";
254
			$img_tag        = empty($attachment) ? '<img width="150" height="150" />' : "<img width=\"150\" height=\"150\" src=\"{$attachment[0]}\" />";
255
			?>
256
			<li class="attachment details" <?php echo $data_attribute; ?>>
257
				<div class="attachment-preview type-image">
258
					<div class="thumbnail">
259
						<div class="centered">
260
							<?php echo $img_tag; ?>
261
						</div>
262
					</div>
263
					<a class="info" href="#" title="<?php _e( 'Edit Info', 'foogallery' ); ?>">
264
						<span class="dashicons dashicons-info"></span>
265
					</a>
266
					<a class="remove" href="#" title="<?php _e( 'Remove from gallery', 'foogallery' ); ?>">
267
						<span class="dashicons dashicons-dismiss"></span>
268
					</a>
269
				</div>
270
				<!--				<input type="text" value="" class="describe" data-setting="caption" placeholder="Caption this image…" />-->
271
			</li>
272
		<?php
273
		}
274
275
		public function render_gallery_settings_metabox( $post ) {
276
			//gallery settings including:
277
			//gallery images link to image or attachment page
278
			//default template to use
279
			$gallery             = $this->get_gallery( $post );
280
			$available_templates = foogallery_gallery_templates();
281
282
			//check if we have no templates
283
			if ( 0 === count( $available_templates ) ) {
284
				//force the default template to activate if there are no other gallery templates
285
				foogallery_activate_default_templates_extension();
286
				$available_templates = foogallery_gallery_templates();
287
			}
288
289
			$gallery_template = foogallery_default_gallery_template();
290
			if ( ! empty($gallery->gallery_template) ) {
291
				$gallery_template = $gallery->gallery_template;
292
			}
293
			$hide_help = 'on' == foogallery_get_setting( 'hide_gallery_template_help' );
294
			?>
295
			<table class="foogallery-metabox-settings">
296
				<tbody>
297
				<tr class="gallery_template_field gallery_template_field_selector">
298
					<th>
299
						<label for="FooGallerySettings_GalleryTemplate"><?php _e( 'Gallery Template', 'foogallery' ); ?></label>
300
					</th>
301
					<td>
302
						<select id="FooGallerySettings_GalleryTemplate" name="<?php echo FOOGALLERY_META_TEMPLATE; ?>">
303
							<?php
304
							foreach ( $available_templates as $template ) {
305
								$selected = ($gallery_template === $template['slug']) ? 'selected' : '';
306
307
								$preview_css = '';
308
								if ( isset( $template['preview_css'] ) ) {
309
									if ( is_array( $template['preview_css'] ) ) {
310
										//dealing with an array of css files to include
311
										$preview_css = implode( ',', $template['preview_css'] );
312
									} else {
313
										$preview_css = $template['preview_css'];
314
									}
315
								}
316
								$preview_css = empty( $preview_css ) ? '' : ' data-preview-css="' . $preview_css . '" ';
317
318
								echo "<option {$selected}{$preview_css} value=\"{$template['slug']}\">{$template['name']}</option>";
319
							}
320
							?>
321
						</select>
322
						<br />
323
						<small><?php _e( 'The gallery template that will be used when the gallery is output to the frontend.', 'foogallery' ); ?></small>
324
					</td>
325
				</tr>
326
				<?php
327
				foreach ( $available_templates as $template ) {
328
					$field_visibility = ($gallery_template !== $template['slug']) ? 'style="display:none"' : '';
329
330
					//allow for extensions to override fields for every gallery template.
331
					// Also passes the $template along so you can inspect and conditionally alter fields based on the template properties
332
					$fields = apply_filters( 'foogallery_override_gallery_template_fields', $template['fields'], $template );
333
334
					$section = '';
335
					foreach ( $fields as $field ) {
336
337
						//allow for the field to be altered by extensions. Also used by the build-in fields, e.g. lightbox
338
						$field = apply_filters( 'foogallery_alter_gallery_template_field', $field, $gallery );
339
340
						$class = "gallery_template_field gallery_template_field-{$template['slug']} gallery_template_field-{$template['slug']}-{$field['id']}";
341
342
						if ( isset($field['section']) && $field['section'] !== $section ) {
343
							$section = $field['section'];
344
							?>
345
							<tr class="<?php echo $class; ?>" <?php echo $field_visibility; ?>>
346
								<td colspan="2"><h4><?php echo $section; ?></h4></td>
347
							</tr>
348
						<?php }
349
						if (isset($field['type']) && 'help' == $field['type'] && $hide_help) {
350
							continue; //skip help if the 'hide help' setting is turned on
351
						}
352
						?>
353
						<tr class="<?php echo $class; ?>" <?php echo $field_visibility; ?>>
354
							<?php if ( isset($field['type']) && 'help' == $field['type'] ) { ?>
355
							<td colspan="2">
356
								<div class="foogallery-help">
357
									<?php echo $field['desc']; ?>
358
								</div>
359
							</td>
360
							<?php } else { ?>
361
							<th>
362
								<label
363
									for="FooGallerySettings_<?php echo $template['slug'] . '_' . $field['id']; ?>"><?php echo $field['title']; ?></label>
364
							</th>
365
							<td>
366
								<?php do_action( 'foogallery_render_gallery_template_field', $field, $gallery, $template ); ?>
367
							</td>
368
							<?php } ?>
369
						</tr>
370
					<?php
371
					}
372
				}
373
				?>
374
				</tbody>
375
			</table>
376
		<?php
377
		}
378
379
		public function render_gallery_shortcode_metabox( $post ) {
380
			$gallery = $this->get_gallery( $post );
381
			$shortcode = $gallery->shortcode();
382
			?>
383
			<p class="foogallery-shortcode">
384
				<input type="text" id="foogallery-copy-shortcode" size="<?php echo strlen( $shortcode ); ?>" value="<?php echo htmlspecialchars( $shortcode ); ?>" readonly="readonly" />
385
			</p>
386
			<p>
387
				<?php _e( 'Paste the above shortcode into a post or page to show the gallery.', 'foogallery' ); ?>
388
			</p>
389
			<script>
390
				jQuery(function($) {
391
					var shortcodeInput = document.querySelector('#foogallery-copy-shortcode');
392
					shortcodeInput.addEventListener('click', function () {
393
						try {
394
							// select the contents
395
							shortcodeInput.select();
396
							//copy the selection
397
							document.execCommand('copy');
398
							//show the copied message
399
							$('.foogallery-shortcode-message').remove();
400
							$(shortcodeInput).after('<p class="foogallery-shortcode-message"><?php _e( 'Shortcode copied to clipboard :)','foogallery' ); ?></p>');
401
						} catch(err) {
402
							console.log('Oops, unable to copy!');
403
						}
404
					}, false);
405
				});
406
			</script>
407
			<?php
408
		}
409
410
		public function render_gallery_usage_metabox( $post ) {
411
			$gallery = $this->get_gallery( $post );
412
			$posts = $gallery->find_usages();
413
			if ( $posts && count( $posts ) > 0 ) { ?>
414
				<p>
415
					<?php _e( 'This gallery is used on the following posts or pages:', 'foogallery' ); ?>
416
				</p>
417
				<ul class="ul-disc">
418
				<?php foreach ( $posts as $post ) {
419
					$url = get_permalink( $post->ID );
420
					echo '<li>' . $post->post_title . '&nbsp;';
421
					edit_post_link( __( 'Edit', 'foogallery' ), '<span class="edit">', ' | </span>', $post->ID );
422
					echo '<span class="view"><a href="' . esc_url( $url ) . '" target="_blank">' . __( 'View', 'foogallery' ) . '</a></li>';
423
				} ?>
424
				</ul>
425
			<?php } else { ?>
426
				<p>
427
					<?php _e( 'This gallery is not used on any pages or pages yet. Quickly create a page:', 'foogallery' ); ?>
428
				</p>
429
				<div class="foogallery_metabox_actions">
430
					<button class="button button-primary button-large" id="foogallery_create_page"><?php _e( 'Create Gallery Page', 'foogallery' ); ?></button>
431
					<span id="foogallery_create_page_spinner" class="spinner"></span>
432
					<?php wp_nonce_field( 'foogallery_create_gallery_page', 'foogallery_create_gallery_page_nonce', false ); ?>
433
				</div>
434
				<p>
435
					<?php _e( 'A draft page will be created which includes the gallery shortcode in the content. The title of the page will be the same title as the gallery.', 'foogallery' ); ?>
436
				</p>
437
			<?php }
438
		}
439
440
		public function render_sorting_metabox( $post ) {
441
			$gallery = $this->get_gallery( $post );
442
			$sorting_options = foogallery_sorting_options();
443
			if ( empty( $gallery->sorting ) ) {
444
				$gallery->sorting = '';
445
			}
446
			?>
447
			<p>
448
				<?php _e('Change the way images are sorted within your gallery. By default, they are sorted in the order you see them.', 'foogallery'); ?>
449
			</p>
450
			<?php
451
			foreach ( $sorting_options as $sorting_key => $sorting_label ) { ?>
452
				<p>
453
				<input type="radio" value="<?php echo $sorting_key; ?>" <?php checked( $sorting_key === $gallery->sorting ); ?> id="FooGallerySettings_GallerySort_<?php echo $sorting_key; ?>" name="<?php echo FOOGALLERY_META_SORT; ?>" />
454
				<label for="FooGallerySettings_GallerySort_<?php echo $sorting_key; ?>"><?php echo $sorting_label; ?></label>
455
				</p><?php
456
			}
457
		}
458
459
		public function render_thumb_cache_metabox( $post ) {
460
			?>
461
			<p>
462
				<?php _e( 'Clear all the previously cached thumbnails that have been generated for this gallery.', 'foogallery' ); ?>
463
			</p>
464
			<div class="foogallery_metabox_actions">
465
				<button class="button button-primary button-large" id="foogallery_clear_thumb_cache"><?php _e( 'Clear Thumbnail Cache', 'foogallery' ); ?></button>
466
				<span id="foogallery_clear_thumb_cache_spinner" class="spinner"></span>
467
				<?php wp_nonce_field( 'foogallery_clear_gallery_thumb_cache', 'foogallery_clear_gallery_thumb_cache_nonce', false ); ?>
468
			</div>
469
			<?php
470
		}
471
472
		public function include_required_scripts() {
473
			$screen_id = foo_current_screen_id();
474
475
			//only include scripts if we on the foogallery add/edit page
476
			if ( FOOGALLERY_CPT_GALLERY === $screen_id ||
477
			     'edit-' . FOOGALLERY_CPT_GALLERY === $screen_id ) {
478
479
				//spectrum needed for the colorpicker field
480
				$url = FOOGALLERY_URL . 'lib/spectrum/spectrum.js';
481
				wp_enqueue_script( 'foogallery-spectrum', $url, array('jquery'), FOOGALLERY_VERSION );
482
				$url = FOOGALLERY_URL . 'lib/spectrum/spectrum.css';
483
				wp_enqueue_style( 'foogallery-spectrum', $url, array(), FOOGALLERY_VERSION );
484
485
				//include any admin js required for the templates
486
				foreach ( foogallery_gallery_templates() as $template ) {
487
					$admin_js = foo_safe_get( $template, 'admin_js' );
488
					if ( is_array( $admin_js ) ) {
489
						//dealing with an array of js files to include
490
						foreach( $admin_js as $admin_js_key => $admin_js_src ) {
491
							wp_enqueue_script( 'foogallery-gallery-admin-' . $template['slug'] . '-' . $admin_js_key, $admin_js_src, array('jquery', 'media-upload', 'jquery-ui-sortable'), FOOGALLERY_VERSION );
492
						}
493
					} else {
494
						//dealing with a single js file to include
495
						wp_enqueue_script( 'foogallery-gallery-admin-' . $template['slug'], $admin_js, array('jquery', 'media-upload', 'jquery-ui-sortable'), FOOGALLERY_VERSION );
496
					}
497
				}
498
			}
499
		}
500
501
		public function render_customcss_metabox( $post ) {
502
			$gallery = $this->get_gallery( $post );
503
			$custom_css = $gallery->custom_css;
504
			$example = '<code>#foogallery-gallery-' . $post->ID . ' { }</code>';
505
			?>
506
			<p>
507
				<?php printf( __( 'Add any custom CSS to target this specific gallery. For example %s', 'foogallery' ), $example ); ?>
508
			</p>
509
			<table id="table_styling" class="form-table">
510
				<tbody>
511
				<tr>
512
					<td>
513
						<textarea class="foogallery_metabox_custom_css" name="<?php echo FOOGALLERY_META_CUSTOM_CSS; ?>" type="text"><?php echo $custom_css; ?></textarea>
514
					</td>
515
				</tr>
516
				</tbody>
517
			</table>
518
		<?php
519
		}
520
521
		public function ajax_create_gallery_page() {
522
			if ( check_admin_referer( 'foogallery_create_gallery_page', 'foogallery_create_gallery_page_nonce' ) ) {
523
524
				$foogallery_id = $_POST['foogallery_id'];
525
526
				$foogallery = FooGallery::get_by_id( $foogallery_id );
527
528
				$post = array(
529
					'post_content' => $foogallery->shortcode(),
530
					'post_title'   => $foogallery->name,
531
					'post_status'  => 'draft',
532
					'post_type'    => 'page',
533
				);
534
535
				wp_insert_post( $post );
536
			}
537
			die();
538
		}
539
540
		public function ajax_clear_gallery_thumb_cache() {
541
			if ( check_admin_referer( 'foogallery_clear_gallery_thumb_cache', 'foogallery_clear_gallery_thumb_cache_nonce' ) ) {
542
543
				$foogallery_id = $_POST['foogallery_id'];
544
545
				$foogallery = FooGallery::get_by_id( $foogallery_id );
546
547
				ob_start();
548
549
				//loop through all images, get the full sized file
550
				foreach ( $foogallery->attachments() as $attachment ) {
551
					$meta_data = wp_get_attachment_metadata( $attachment->ID );
552
553
					$file = $meta_data['file'];
554
555
					wpthumb_delete_cache_for_file( $file );
556
				}
557
558
				ob_end_clean();
559
560
				echo __( 'The thumbnail cache has been cleared!', 'foogallery' );
561
			}
562
563
			die();
564
		}
565
	}
566
}
567