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 — feature/gallery-template-clien... ( a56405...b693b9 )
by Brad
02:39
created

FooGallery_Default_Gallery_Template::render_thumbnail_preview()   B

Complexity

Conditions 3
Paths 3

Size

Total Lines 33
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 23
nc 3
nop 3
dl 0
loc 33
rs 8.8571
c 0
b 0
f 0
1
<?php
2
3
if ( !class_exists( 'FooGallery_Default_Gallery_Template' ) ) {
4
5
	define('FOOGALLERY_DEFAULT_GALLERY_TEMPLATE_URL', plugin_dir_url( __FILE__ ));
6
7
	class FooGallery_Default_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
14
			//add extra fields to the templates
15
			add_filter( 'foogallery_override_gallery_template_fields-default', array( $this, 'add_common_thumbnail_fields' ), 10, 2 );
16
17
			add_action( 'foogallery_located_template-default', array( $this, 'enqueue_dependencies' ) );
18
19
			add_filter( 'foogallery_gallery_templates_files', array( $this, 'register_myself' ) );
20
		}
21
22
		/**
23
		 * Register myself so that all associated JS and CSS files can be found and automatically included
24
		 * @param $extensions
25
		 *
26
		 * @return array
27
		 */
28
		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...
29
			$extensions[] = __FILE__;
30
			return $extensions;
31
		}
32
33
		/**
34
		 * Add our gallery template to the list of templates available for every gallery
35
		 * @param $gallery_templates
36
		 *
37
		 * @return array
38
		 */
39
		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...
40
			$gallery_templates[] = array(
41
				'slug'        => 'default',
42
				'name'        => __( 'Responsive Image Gallery', 'foogallery' ),
43
				'lazyload_support' => true,
44
				'fields'	  => array(
45
                    array(
46
                        'id'      => 'thumbnail_dimensions',
47
                        'title'   => __( 'Thumbnail Size', 'foogallery' ),
48
                        'desc'    => __( 'Choose the size of your thumbnails.', 'foogallery' ),
49
                        'section' => __( 'General', 'foogallery' ),
50
                        'type'    => 'thumb_size',
51
                        'default' => array(
52
                            'width' => get_option( 'thumbnail_size_w' ),
53
                            'height' => get_option( 'thumbnail_size_h' ),
54
                            'crop' => true,
55
                        ),
56
                    ),
57
                    array(
58
                        'id'      => 'thumbnail_link',
59
                        'title'   => __( 'Link To', 'foogallery' ),
60
                        'section' => __( 'General', 'foogallery' ),
61
                        'default' => 'image',
62
                        'type'    => 'thumb_link',
63
                        'desc'	  => __( 'You can choose to link each thumbnail to the full size image, the image\'s attachment page, a custom URL, or you can choose to not link to anything.', 'foogallery' ),
64
                    ),
65
					array(
66
						'id'      => 'lightbox',
67
						'title'   => __( 'Lightbox', 'foogallery' ),
68
						'desc'    => __( 'Choose which lightbox you want to use. The lightbox will generally only work if you set the thumbnail link to "Full Size Image".', 'foogallery' ),
69
                        'section' => __( 'General', 'foogallery' ),
70
						'type'    => 'lightbox'
71
					),
72
					array(
73
						'id'      => 'spacing',
74
						'title'   => __( 'Spacing', 'foogallery' ),
75
						'desc'    => __( 'The spacing or gap between thumbnails in the gallery.', 'foogallery' ),
76
                        'section' => __( 'General', 'foogallery' ),
77
						'type'    => 'select',
78
						'default' => 'fg-gutter-10',
79
						'choices' => array(
80
							'fg-gutter-0' => __( 'none', 'foogallery' ),
81
							'fg-gutter-5' => __( '5 pixels', 'foogallery' ),
82
							'fg-gutter-10' => __( '10 pixels', 'foogallery' ),
83
							'fg-gutter-15' => __( '15 pixels', 'foogallery' ),
84
							'fg-gutter-20' => __( '20 pixels', 'foogallery' ),
85
							'fg-gutter-25' => __( '25 pixels', 'foogallery' ),
86
						),
87
                        'row_data'=> array(
88
                            'data-foogallery-change-selector' => 'select',
89
							'data-foogallery-preview' => 'true'
90
                        )
91
					),
92
					array(
93
						'id'      => 'alignment',
94
						'title'   => __( 'Alignment', 'foogallery' ),
95
						'desc'    => __( 'The horizontal alignment of the thumbnails inside the gallery.', 'foogallery' ),
96
                        'section' => __( 'General', 'foogallery' ),
97
						'default' => 'fg-center',
98
						'type'    => 'radio',
99
						'spacer'  => '<span class="spacer"></span>',
100
						'choices' => array(
101
							'fg-left' => __( 'Left', 'foogallery' ),
102
							'fg-center' => __( 'Center', 'foogallery' ),
103
							'fg-right' => __( 'Right', 'foogallery' ),
104
						),
105
                        'row_data'=> array(
106
                            'data-foogallery-change-selector' => 'input:radio',
107
							'data-foogallery-preview' => 'class'
108
                        )
109
					)
110
				)
111
			);
112
113
			return $gallery_templates;
114
		}
115
116
		/**
117
		 * Add thumbnail fields to the gallery template
118
		 *
119
		 * @uses "foogallery_override_gallery_template_fields"
120
		 * @param $fields
121
		 * @param $template
122
		 *
123
		 * @return array
124
		 */
125
		function add_common_thumbnail_fields( $fields, $template ) {
0 ignored issues
show
Unused Code introduced by
The parameter $template 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...
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...
126
			return apply_filters( 'foogallery_gallery_template_common_thumbnail_fields', $fields );
127
		}
128
129
		/**
130
		 * Enqueue scripts that the default gallery template relies on
131
		 */
132
		function enqueue_dependencies( $gallery ) {
0 ignored issues
show
Unused Code introduced by
The parameter $gallery 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...
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...
133
			//enqueue core files
134
			foogallery_enqueue_core_gallery_template_style();
135
			foogallery_enqueue_core_gallery_template_script();
136
		}
137
	}
138
}