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 ( b3ee5f...a83cd4 )
by Brad
06:08 queued 03:01
created

FooGallery_Shortcodes::init_shortcodes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/*
3
 * FooGallery Shortcodes
4
 */
5
6
if ( ! class_exists( 'FooGallery_Shortcodes' ) ) {
7
8
	class FooGallery_Shortcodes {
9
10
		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...
11
			add_action( 'foogallery_load_template', array( $this, 'handle_lightbox_field' ) );
12
			add_action( 'foogallery_loaded_template', array( $this, 'render_custom_css' ) );
13
			add_action( 'plugins_loaded', array( $this, 'init_shortcodes' ) );
14
		}
15
16
		function init_shortcodes() {
17
			add_shortcode( foogallery_gallery_shortcode_tag(), array( $this, 'render_foogallery_shortcode' ) );
18
			add_shortcode( 'foogallery-enqueue', array( $this, 'render_foogallery_enqueue' ) );
19
		}
20
21
		function render_foogallery_shortcode( $atts ) {
22
23
			$args = wp_parse_args( $atts, array(
24
				'id'      => 0,
25
				'gallery' => '',
26
			) );
27
28
			$args = apply_filters( 'foogallery_shortcode_atts', $args );
29
30
			//create new instance of template engine
31
			$engine = new FooGallery_Template_Loader();
32
33
			ob_start();
34
35
			$engine->render_template( $args );
36
37
			$output_string = ob_get_contents();
38
			ob_end_clean();
39
			return $output_string;
40
		}
41
42
		function render_foogallery_enqueue() {
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...
43
			foogallery_enqueue_core_gallery_template_script();
44
			foogallery_enqueue_core_gallery_template_style();
45
			wp_enqueue_script( 'masonry' );
46
		}
47
48
		/**
49
		 * Handle a gallery that has a lightbox. This allows us to include any scripts or CSS that is needed for the lightbox
50
		 *
51
		 * @param $gallery FooGallery
52
		 */
53
		function handle_lightbox_field( $gallery ) {
54
			if ( $gallery->gallery_template_has_field_of_type( 'lightbox' ) ) {
55
				$lightbox = foogallery_gallery_template_setting( 'lightbox' );
56
57
				if ( false != $lightbox ) {
58
					do_action( "foogallery_template_lightbox-{$lightbox}", $gallery );
59
				}
60
			}
61
		}
62
63
		function render_custom_css( $foogallery ) {
64
			if ( !empty( $foogallery->custom_css ) ) {
65
				echo '<style type="text/css">';
66
				echo $foogallery->custom_css;
67
				echo '</style>';
68
			}
69
		}
70
	}
71
}
72