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 ( fa35e8...bb810f )
by Brad
02:38
created

FooGallery_Masonry_Gallery_Template::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
if ( !class_exists( 'FooGallery_Masonry_Gallery_Template' ) ) {
4
5
	define('FOOGALLERY_MASONRY_GALLERY_TEMPLATE_URL', plugin_dir_url( __FILE__ ));
6
7
	class FooGallery_Masonry_Gallery_Template {
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...
8
		/**
9
		 * Wire up everything we need to run the extension
10
		 */
11
		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...
12
			add_filter( 'foogallery_gallery_templates', array( $this, 'add_template' ) );
13
			add_filter( 'foogallery_gallery_templates_files', array( $this, 'register_myself' ) );
14
			add_filter( 'foogallery_located_template-masonry', array( $this, 'enqueue_dependencies' ) );
15
		}
16
17
		/**
18
		 * Register myself so that all associated JS and CSS files can be found and automatically included
19
		 * @param $extensions
20
		 *
21
		 * @return array
22
		 */
23
		function register_myself( $extensions ) {
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...
24
			$extensions[] = __FILE__;
25
			return $extensions;
26
		}
27
28
		/**
29
		 * Add our gallery template to the list of templates available for every gallery
30
		 * @param $gallery_templates
31
		 *
32
		 * @return array
33
		 */
34
		function add_template( $gallery_templates ) {
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...
35
			$gallery_templates[] = array(
36
					'slug'        => 'masonry',
37
					'name'        => __( 'Masonry Image Gallery', 'foogallery' ),
38
					'admin_js'	  => FOOGALLERY_MASONRY_GALLERY_TEMPLATE_URL . 'js/admin-gallery-masonry.js',
39
					'fields'	  => array(
40
							array(
41
									'id'      => 'thumbnail_width',
42
									'title'   => __( 'Thumbnail Width', 'foogallery' ),
43
									'desc'    => __( 'Choose the width of your thumbnails. Thumbnails will be generated on the fly and cached once generated.', 'foogallery' ),
44
									'type'    => 'number',
45
									'class'   => 'small-text',
46
									'default' => 150,
47
									'step'    => '1',
48
									'min'     => '0',
49
							),
50
							array(
51
									'id'      => 'layout',
52
									'title'   => __( 'Masonry Layout', 'foogallery' ),
53
									'desc'    => __( 'Choose a fixed width thumb layout, or responsive columns.', 'foogallery' ),
54
									'type'    => 'radio',
55
									'choices' => array(
56
											'fixed'  => __( 'Fixed Width', 'foogallery' ),
57
											'2col'   => __( '2 Columns', 'foogallery' ),
58
											'3col'   => __( '3 Columns', 'foogallery' ),
59
											'4col'   => __( '4 Columns', 'foogallery' ),
60
											'5col'   => __( '5 Columns', 'foogallery' )
61
									),
62
									'spacer'  => '<span class="spacer"></span>',
63
									'default' => 'fixed'
64
							),
65
							array(
66
									'id'      => 'gutter_width',
67
									'title'   => __( 'Gutter Width', 'foogallery' ),
68
									'desc'    => __( 'The spacing between your thumbnails. Only applicable when using a fixed layout!', 'foogallery' ),
69
									'type'    => 'number',
70
									'class'   => 'small-text',
71
									'default' => 10,
72
									'step'    => '1',
73
									'min'     => '0',
74
							),
75
							array(
76
									'id'      => 'center_align',
77
									'title'   => __( 'Image Alignment', 'foogallery' ),
78
									'desc'    => __( 'You can choose to center align your images or leave them at the default. Only applicable when using a fixed layout!', 'foogallery' ),
79
									'type'    => 'radio',
80
									'choices' => array(
81
											'default'  => __( 'Left Alignment', 'foogallery' ),
82
											'center'   => __( 'Center Alignment', 'foogallery' )
83
									),
84
									'spacer'  => '<span class="spacer"></span>',
85
									'default' => 'default'
86
							),
87
							array(
88
									'id'      => 'gutter_percent',
89
									'title'   => __( 'Gutter Size', 'foogallery' ),
90
									'desc'    => __( 'Choose a gutter size when using responsive columns.', 'foogallery' ),
91
									'type'    => 'radio',
92
									'choices' => array(
93
											'no-gutter'   => __( 'No Gutter', 'foogallery' ),
94
											''  => __( 'Normal Size Gutter', 'foogallery' ),
95
											'large-gutter'   => __( 'Larger Gutter', 'foogallery' )
96
									),
97
									'spacer'  => '<span class="spacer"></span>',
98
									'default' => ''
99
							),
100
							array(
101
									'id'      => 'hover_zoom',
102
									'title'   => __( 'Hover Zoom', 'foogallery' ),
103
									'desc'    => __( 'The effect that is applied to images when you move your mouse over them.', 'foogallery' ),
104
									'type'    => 'radio',
105
									'choices' => array(
106
											'default'  => __( 'Zoom Slightly', 'foogallery' ),
107
											'none'   => __( 'No Zoom', 'foogallery' )
108
									),
109
									'spacer'  => '<span class="spacer"></span>',
110
									'default' => 'default'
111
							),
112
							array(
113
									'id'      => 'thumbnail_link',
114
									'title'   => __( 'Thumbnail Link', 'foogallery' ),
115
									'default' => 'image' ,
116
									'type'    => 'thumb_link',
117
									'spacer'  => '<span class="spacer"></span>',
118
									'desc'	  => __( 'You can choose to link each thumbnail to the full size image, or to the image\'s attachment page, or you can choose to not link to anything.', 'foogallery' ),
119
							),
120
							array(
121
									'id'      => 'lightbox',
122
									'title'   => __( 'Lightbox', 'foogallery' ),
123
									'desc'    => __( 'Choose which lightbox you want to display images with. The lightbox will only work if you set the thumbnail link to "Full Size Image".', 'foogallery' ),
124
									'type'    => 'lightbox',
125
							),
126
					),
127
			);
128
129
130
			return $gallery_templates;
131
		}
132
133
		/**
134
		 * Enqueue scripts that the masonry gallery template relies on
135
		 */
136
		function enqueue_dependencies() {
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...
137
			wp_enqueue_script( 'jquery' );
138
			wp_enqueue_script( 'masonry' );
139
			foogallery_enqueue_imagesloaded_script();
140
		}
141
	}
142
}