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 — master ( 9c0c8a...f2b063 )
by Brad
05:17 queued 02:45
created

FooGallery_Pro_Video::include_video_settings()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 52

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 52
rs 9.0472
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 8 and the first side effect is on line 11.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**
3
 * Adds video support within FooGallery
4
 */
5
6
if ( ! class_exists( 'FooGallery_Pro_Video' ) ) {
7
8
	define( 'FOOGALLERY_VIDEO_POST_META', '_foogallery_video_data' );
9
	define( 'FOOGALLERY_VIDEO_POST_META_VIDEO_COUNT', '_foogallery_video_count' );
10
11
	require_once plugin_dir_path( __FILE__ ) . 'functions.php';
12
	require_once plugin_dir_path( __FILE__ ) . 'class-foogallery-pro-video-query.php';
13
	require_once plugin_dir_path( __FILE__ ) . 'class-foogallery-pro-video-import.php';
14
15
	class FooGallery_Pro_Video {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
16
		/**
17
		 * Wire up everything we need
18
		 */
19
		function __construct() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
20
			new FooGallery_Pro_Video_Query();
21
			new FooGallery_Pro_Video_Import();
22
23
			//setup script includes
24
			add_action( 'wp_enqueue_media', array( $this, 'enqueue_assets' ) );
25
26
			//make sure the gallery items render with a video icon
27
			add_filter( 'foogallery_admin_render_gallery_item_extra_classes', array( $this, 'render_gallery_item_with_video_icon' ), 10, 2 );
28
29
			//add attachment custom fields
30
			add_filter( 'foogallery_attachment_custom_fields', array( $this, 'attachment_custom_fields' ) );
31
32
			//add extra fields to all templates
33
			add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'all_template_fields' ) );
34
35
			// add additional templates
36
			add_action( 'admin_footer', array( $this, 'add_media_templates' ) );
37
38
			//load all video info into the attachment, so that it is only done once
39
			add_action( 'foogallery_attachment_instance_after_load', array( $this, 'set_video_flag_on_attachment' ), 10, 2 );
40
41
			//add attributes to front-end anchor
42
			add_filter( 'foogallery_attachment_html_link_attributes', array( $this, 'alter_video_link_attributes' ), 24, 3 );
43
44
			//add class to front-end item
45
			add_filter( 'foogallery_attachment_html_item_classes', array( $this, 'alter_video_item_attributes' ), 24, 3 );
46
47
			//add video icon class to galleries
48
			add_filter( 'foogallery_build_class_attribute', array( $this, 'foogallery_build_class_attribute' ) );
49
50
			//intercept gallery save and calculate how many videos are in the gallery
51
			add_action( 'foogallery_after_save_gallery', array( $this, 'calculate_video_count' ) );
52
53
			//change the image count to include videos if they are present in the gallery
54
			add_filter( 'foogallery_image_count', array( $this, 'include_video_count' ), 11, 2 );
55
56
			//check if the gallery is using foobox free and also has a video and if so, enqueue foobox video scripts.
57
			add_action( 'foogallery_loaded_template', array( $this, 'enqueue_foobox_free_dependencies' ) );
58
59
			//add settings for video
60
			add_filter( 'foogallery_admin_settings_override', array( $this, 'include_video_settings' ) );
61
62
			//output the embeds after the gallery if needed
63
			add_action( 'foogallery_loaded_template', array( $this, 'include_video_embeds' ) );
64
65
			//ajax call to save the Vimeo access token
66
			add_action('wp_ajax_fgi_save_access_token', array($this, 'save_vimeo_access_token'));
67
		}
68
69
		/**
70
		 * Enqueue styles and scripts
71
		 */
72
		function enqueue_assets() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
73
			foogallery_enqueue_media_views_script();
74
			foogallery_enqueue_media_views_style();
75
		}
76
77
		/**
78
		 * Include the templates into the page if they are needed
79
		 */
80
		public function add_media_templates() {
81
			if ( wp_script_is( 'foogallery-media-views' ) ) {
82
				foogallery_include_media_views_templates();
83
			}
84
		}
85
86
		/**
87
		 * Add an extra class so that a video icon shows for videos
88
		 *
89
		 * @param $extra_class
90
		 * @param $attachment_post
91
		 *
92
		 * @return string
93
		 */
94
		function render_gallery_item_with_video_icon( $extra_class, $attachment_post ) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
95
			//check if the attachment is a video and append a class
96
			if ( foogallery_is_attachment_video( $attachment_post ) ) {
97
				if ( ! isset( $extra_class ) ) {
98
					$extra_class = '';
99
				}
100
				$extra_class .= ' subtype-foogallery';
101
			}
102
103
			return $extra_class;
104
		}
105
106
		/**
107
		 * Add video specific custom fields.
108
		 *
109
		 * @uses "foogallery_attachment_custom_fields" filter
110
		 *
111
		 * @param array $fields
112
		 *
113
		 * @return array
114
		 */
115
		public function attachment_custom_fields( $fields ) {
116
			$fields['data-width']  = array(
117
				'label'       => __( 'Override Width', 'foogallery' ),
118
				'input'       => 'text',
119
				'application' => 'image/foogallery',
120
			);
121
			$fields['data-height'] = array(
122
				'label'       => __( 'Override Height', 'foogallery' ),
123
				'input'       => 'text',
124
				'application' => 'image/foogallery',
125
			);
126
127
			return $fields;
128
		}
129
130
		/**
131
		 * Add fields to all galleries.
132
		 *
133
		 * @uses "foogallery_override_gallery_template_fields"
134
		 *
135
		 * @param $fields
136
		 *
137
		 * @return mixed
138
		 */
139
		public function all_template_fields( $fields ) {
140
			$fields[] = array(
141
				'id'       => 'video_hover_icon',
142
				'section'  => __( 'Video', 'foogallery' ),
143
				'title'    => __( 'Video Hover Icon', 'foogallery' ),
144
				'type'     => 'htmlicon',
145
				'default'  => 'fg-video-default',
146
				'choices'  => apply_filters(
147
					'foogallery_gallery_template_video_hover_icon_choices', array(
148
						''                 => array( 'label' => __( 'None', 'foogallery' ), 'html' => '<div class="foogallery-setting-video_overlay"></div>' ),
149
						'fg-video-default' => array( 'label' => __( 'Default Icon', 'foogallery' ), 'html' => '<div class="foogallery-setting-video_overlay fg-video-default"></div>' ),
150
						'fg-video-1'       => array( 'label' => __( 'Icon 1', 'foogallery' ), 'html' => '<div class="foogallery-setting-video_overlay fg-video-1"></div>' ),
151
						'fg-video-2'       => array( 'label' => __( 'Icon 2', 'foogallery' ), 'html' => '<div class="foogallery-setting-video_overlay fg-video-2"></div>' ),
152
						'fg-video-3'       => array( 'label' => __( 'Icon 3', 'foogallery' ), 'html' => '<div class="foogallery-setting-video_overlay fg-video-3"></div>' ),
153
						'fg-video-4'       => array( 'label' => __( 'Icon 4', 'foogallery' ), 'html' => '<div class="foogallery-setting-video_overlay fg-video-4"></div>' ),
154
					)
155
				),
156
				'row_data' => array(
157
					'data-foogallery-change-selector' => 'input:radio',
158
					'data-foogallery-preview'         => 'class'
159
				)
160
			);
161
			$fields[] = array(
162
				'id'       => 'video_sticky_icon',
163
				'section'  => __( 'Video', 'foogallery' ),
164
				'title'    => __( 'Sticky Video Icon', 'foogallery' ),
165
				'desc'     => __( 'Always show the video icon for videos in the gallery, and not only when you hover.', 'foogallery' ),
166
				'type'     => 'radio',
167
				'default'  => '',
168
				'spacer'   => '<span class="spacer"></span>',
169
				'choices'  => array(
170
					'fg-video-sticky' => __( 'Yes', 'foogallery' ),
171
					''                => __( 'No', 'foogallery' ),
172
				),
173
				'row_data' => array(
174
					'data-foogallery-change-selector' => 'input:radio',
175
					'data-foogallery-preview'         => 'class'
176
				)
177
			);
178
179
			$fields[] = array(
180
				'id'      => 'video_size_help',
181
				'title'   => __( 'Video Size Help', 'foogallery' ),
182
				'desc'    => __( 'The lightbox video size can be overridden on each individual video by editing the attachment info, and changing the Override Width and Override Height properties.', 'foogallery' ),
183
				'section' => __( 'Video', 'foogallery' ),
184
				'type'    => 'help',
185
			);
186
187
			$fields[] = array(
188
				'id'      => 'video_size',
189
				'section' => __( 'Video', 'foogallery' ),
190
				'title'   => __( 'Lightbox Video Size', 'foogallery' ),
191
				'desc'    => __( 'The default video size when opening videos in the lightbox.', 'foogallery' ),
192
				'type'    => 'select',
193
				'default' => '640x360',
194
				'choices' => array(
195
					'640x360'   => __( '640 x 360', 'foogallery' ),
196
					'854x480'   => __( '854 x 480', 'foogallery' ),
197
					'960x540'   => __( '960 x 540', 'foogallery' ),
198
					'1024x576'  => __( '1024 x 576', 'foogallery' ),
199
					'1280x720'  => __( '1280 x 720 (HD)', 'foogallery' ),
200
					'1366x768'  => __( '1366 x 768', 'foogallery' ),
201
					'1600x900'  => __( '1600 x 900', 'foogallery' ),
202
					'1920x1080' => __( '1920 x 1080 (Full HD)', 'foogallery' ),
203
				),
204
			);
205
206
			$fields[] = array(
207
				'id'      => 'video_autoplay',
208
				'section' => __( 'Video', 'foogallery' ),
209
				'title'   => __( 'Lightbox Autoplay', 'foogallery' ),
210
				'desc'    => __( 'Try to autoplay the video when opened in a lightbox. This will only work with videos hosted on Youtube or Vimeo.', 'foogallery' ),
211
				'type'    => 'radio',
212
				'default' => 'yes',
213
				'spacer'  => '<span class="spacer"></span>',
214
				'choices' => array(
215
					'yes' => __( 'Yes', 'foogallery' ),
216
					'no'  => __( 'No', 'foogallery' ),
217
				),
218
			);
219
220
			return $fields;
221
		}
222
223
		public function set_video_flag_on_attachment( $foogallery_attachment, $post ) {
0 ignored issues
show
Unused Code introduced by
The parameter $post is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
224
			$foogallery_attachment->is_video = false;
225
226
			if ( foogallery_is_attachment_video( $foogallery_attachment ) ) {
227
				$foogallery_attachment->is_video = true;
228
			}
229
		}
230
231
		/**
232
		 * @uses "foogallery_attachment_html_item_classes" filter
233
		 *
234
		 * @param                             $classes
235
		 * @param                             $args
236
		 * @param object|FooGalleryAttachment $attachment
237
		 *
238
		 * @return mixed
239
		 */
240
		public function alter_video_item_attributes( $classes, $attachment, $args ) {
0 ignored issues
show
Unused Code introduced by
The parameter $args is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
241
			if ( $attachment->is_video ) {
242
				$classes[] = 'fg-video';
243
			}
244
245
			return $classes;
246
		}
247
248
		/**
249
		 * @uses "foogallery_attachment_html_link_attributes" filter
250
		 *
251
		 * @param                             $attr
252
		 * @param                             $args
253
		 * @param object|FooGalleryAttachment $attachment
254
		 *
255
		 * @return mixed
256
		 */
257
		public function alter_video_link_attributes( $attr, $args, $attachment ) {
258
			global $current_foogallery;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
259
			global $current_foogallery_template;
260
261
			if ( $attachment->is_video ) {
262
				$video_data = get_post_meta( $attachment->ID, FOOGALLERY_VIDEO_POST_META, true );
263
264
				if ( empty( $video_data ) ) {
265
					//get out early if we have no video data
266
					return $attr;
267
				}
268
269
				$current_foogallery->has_videos = true;
270
271
				$is_embed = false;
272
273
				if ( isset( $video_data['type'] ) ) {
274
275
					$is_embed = 'embed' === $video_data['type'];
276
277
					//check that the gallery template supports embeds
278
					$template_data = foogallery_get_gallery_template( $current_foogallery_template );
279
280
					//check the template supports filtering
281
					if ( $template_data && array_key_exists( 'embed_support', $template_data ) && true === $template_data['embed_support'] ) {
282
						//do nothing
283
						$attr['data-type'] = $is_embed ? 'embed' : 'video';
284
					} else {
285
						//should be for templates that do not support embeds natively e.g. responsive gallery
286
						//we need to check that the lightbox is FooBox, because embeds will only then work with FooBox
287
						$lightbox = foogallery_gallery_template_setting( 'lightbox' );
288
						$is_embed = $is_embed && ( 'foobox' === $lightbox );
289
						if ( $is_embed ) {
290
							$attr['data-type'] = 'embed';
291
						}
292
					}
293
				}
294
295
				//set the cover image for the video
296
				$attr['data-cover'] = $attachment->url;
297
298
				//if we have no widths or heights then use video default size
299
				if ( ! isset( $attr['data-width'] ) ) {
300
					$size = foogallery_gallery_template_setting( 'video_size', '640x360' );
301
					list( $width, $height ) = explode( 'x', $size );
302
					$attr['data-width']  = $width;
303
					$attr['data-height'] = $height;
304
				}
305
306
				//override width
307
				$override_width = get_post_meta( $attachment->ID, '_data-width', true );
308
				if ( ! empty( $override_width ) ) {
309
					$attr['data-width'] = intval( $override_width );
310
				}
311
312
				//override height
313
				$override_height = get_post_meta( $attachment->ID, '_data-height', true );
314
				if ( ! empty( $override_height ) ) {
315
					$attr['data-height'] = intval( $override_height );
316
				}
317
318
				//make some changes for embeds
319
				if ( $is_embed ) {
320
321
					$args = array();
322
					if ( isset( $attr['data-width'] ) ) {
323
						$args['width'] = $attr['data-width'];
324
					}
325
326
					$oembed_data = foogallery_oembed_get_data( $attachment->custom_url, $args );
327
328
					$data = array(
329
						'id'            => 'foogallery_embed_'.$current_foogallery->ID . '-' . $attachment->ID,
330
						'attachment_id' => $attachment->ID,
331
						'url'           => $attachment->custom_url,
332
						'provider'      => $video_data['provider'],
333
						'html'          => $oembed_data->html
334
					);
335
336
					$current_foogallery->video_embeds[] = $data;
337
338
					$attr['href'] = '#' . $data['id'];
339
					//make sure FooBox opens the embed
340
					$attr['target'] = 'foobox';
341
				} else {
342
					$attr['href'] = foogallery_get_video_url_from_attachment( $attachment );
343
				}
344
345
				$lightbox = foogallery_gallery_template_setting( 'lightbox', 'unknown' );
346
				//if no lightbox is being used then force to open in new tab
347
				if ( 'unknown' === $lightbox || 'none' === $lightbox ) {
348
					$attr['target'] = '_blank';
349
				}
350
351
				//remove the targets for slider and grid pro galleries
352
				if ( array_key_exists( 'target', $attr ) && 'slider' === $current_foogallery_template || 'foogridpro' === $current_foogallery_template ) {
353
					unset( $attr['target'] );
354
				}
355
			}
356
357
			return $attr;
358
		}
359
360
		public function foogallery_build_class_attribute( $classes ) {
361
			global $current_foogallery;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
362
363
			//first determine if the gallery has any videos
364
			if ( 0 === foogallery_get_gallery_video_count( $current_foogallery->ID ) ) {
365
				return $classes;
366
			}
367
368
			$current_foogallery->has_videos = true;
369
370
			//get the selected video icon
371
			$classes[] = foogallery_gallery_template_setting( 'video_hover_icon', 'fg-video-default' );
372
373
			//include the video sticky class
374
			$classes[] = foogallery_gallery_template_setting( 'video_sticky_icon', '' );;
375
376
			return $classes;
377
		}
378
379
		/**
380
		 * Enqueue any script or stylesheet file dependencies that FooGallery_Pro_Video relies on
381
		 *
382
		 * @param $foogallery FooGallery
383
		 */
384
		function enqueue_foobox_free_dependencies( $foogallery ) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
385
			if ( $foogallery ) {
386
				$video_count = foogallery_get_gallery_video_count( $foogallery->ID );
387
388
				if ( $video_count > 0 ) {
389
390
					$lightbox = foogallery_gallery_template_setting( 'lightbox', 'unknown' );
391
					//we want to add some JS to the front-end ONLY if we are using FooBox Free
392
393
					if ( class_exists( 'Foobox_Free' ) && ( 'foobox' == $lightbox || 'foobox-free' == $lightbox ) ) {
394
						$js = FOOGALLERY_PRO_URL . 'js/foobox.video.min.js';
395
						wp_enqueue_script(
396
							'foogallery-foobox-video',
397
							$js,
398
							array( 'jquery', 'foobox-free-min' ),
399
							FOOGALLERY_VERSION
400
						);
401
					}
402
				}
403
			}
404
		}
405
406
		public function calculate_video_count( $post_id ) {
407
			foogallery_set_gallery_video_count( $post_id );
408
		}
409
410
		public function include_video_count( $image_count_text, $gallery ) {
411
			$count       = sizeof( $gallery->attachment_ids );
412
			$video_count = foogallery_get_gallery_video_count( $gallery->ID );
413
			$image_count = $count - $video_count;
414
415
			return foogallery_gallery_image_count_text( $count, $image_count, $video_count );
416
		}
417
418
		public function include_video_settings( $settings ) {
419
420
			$settings['tabs']['video'] = __( 'Video', 'foogallery' );
421
422
			$settings['settings'][] = array(
423
				'id'      => 'video_default_target',
424
				'title'   => __( 'Default Video Target', 'foogallery' ),
425
				'desc'    => __( 'The default target set for a video when it is imported into the gallery.', 'foogallery' ),
426
				'type'    => 'select',
427
				'default' => '_blank',
428
				'tab'     => 'video',
429
				'choices' => array(
430
					'default' => __( 'Default', 'foogallery' ),
431
					'_blank'  => __( 'New tab (_blank)', 'foogallery' ),
432
					'_self'   => __( 'Same tab (_self)', 'foogallery' ),
433
					'foobox'  => __( 'FooBox', 'foogallery' ),
434
				),
435
			);
436
437
			$settings['settings'][] = array(
438
				'id'      => 'vimeo_access_token',
439
				'title'   => __( 'Vimeo Access Token', 'foogallery' ),
440
				'desc'    => __( 'An access token is required by the Vimeo API in order to import multiple videos from channels, albums or a user. This is not required to import a single video.', 'foogallery' ),
441
				'type'    => 'text',
442
				'default' => '',
443
				'tab'     => 'video',
444
			);
445
446
			$settings['settings'][] = array(
447
				'id'      => 'language_video_count_none_text',
448
				'title'   => __( 'Video Count None Text', 'foogallery' ),
449
				'type'    => 'text',
450
				'default' => __( 'No images or videos', 'foogallery' ),
451
				'tab'     => 'language',
452
			);
453
			$settings['settings'][] = array(
454
				'id'      => 'language_video_count_single_text',
455
				'title'   => __( 'Video Count Single Text', 'foogallery' ),
456
				'type'    => 'text',
457
				'default' => __( '1 video', 'foogallery' ),
458
				'tab'     => 'language',
459
			);
460
			$settings['settings'][] = array(
461
				'id'      => 'language_video_count_plural_text',
462
				'title'   => __( 'Video Count Many Text', 'foogallery' ),
463
				'type'    => 'text',
464
				'default' => __( '%s videos', 'foogallery' ),
465
				'tab'     => 'language',
466
			);
467
468
			return $settings;
469
		}
470
471
472
		/**
473
		 * Renders any video embeds for the gallery
474
		 *
475
		 * @param FooGallery $gallery
476
		 */
477
		function include_video_embeds( $gallery ) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
478
			if ( isset( $gallery->has_videos ) && $gallery->has_videos && isset( $gallery->video_embeds ) ) {
479
480
				?>
481
				<div style="display: none;"><?php
482
483
				foreach ( $gallery->video_embeds as $embed ) {
484
					?>
485
					<div id="<?php echo $embed['id']; ?>" data-provider="<?php echo $embed['provider']; ?>">
486
						<?php echo $embed['html']; ?>
487
					</div>
488
					<?php
489
				}
490
491
				?></div><?php
492
			}
493
		}
494
495
		/**
496
		 * Save the Vimeo Access Token to the foogallery settings
497
		 */
498
		function save_vimeo_access_token() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
499
			$nonce = !empty($_POST["fgi_nonce"]) ? $_POST["fgi_nonce"] : null;
500
501
			if (wp_verify_nonce($nonce, "fgi_nonce")) {
502
				$access_token = !empty( $_POST["access_token"] ) ? $_POST["access_token"] : null;
503
504
				foogallery_settings_set_vimeo_access_token( $access_token );
505
				wp_send_json_success( __('Saved successfully.', 'foogallery' ) );
506
			}
507
			die();
508
		}
509
	}
510
}