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.

Issues (1881)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

justified/class-justified-gallery-template.php (14 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
if ( !class_exists( 'FooGallery_Justified_Gallery_Template' ) ) {
4
5
	define('FOOGALLERY_JUSTIFIED_GALLERY_TEMPLATE_URL', plugin_dir_url( __FILE__ ));
6
7
	class FooGallery_Justified_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
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_template_thumbnail_dimensions-justified', array( $this, 'get_thumbnail_dimensions' ), 10, 2 );
15
16
			add_action( 'foogallery_located_template-justified', array( $this, 'enqueue_dependencies' ) );
17
18
			//add the data options needed for justified
19
			add_filter( 'foogallery_build_container_data_options-justified', array( $this, 'add_justified_options' ), 10, 3 );
20
21
			//build up any preview arguments
22
			add_filter( 'foogallery_preview_arguments-justified', array( $this, 'preview_arguments' ), 10, 2 );
23
24
			//build up the thumb dimensions from some arguments
25
			add_filter( 'foogallery_calculate_thumbnail_dimensions-justified', array( $this, 'build_thumbnail_dimensions_from_arguments' ), 10, 2 );
26
27
            //build up the arguments needed for rendering this template
28
            add_filter( 'foogallery_gallery_template_arguments-justified', array( $this, 'build_gallery_template_arguments' ) );
29
        }
30
31
		/**
32
		 * Register myself so that all associated JS and CSS files can be found and automatically included
33
		 * @param $extensions
34
		 *
35
		 * @return array
36
		 */
37
		function register_myself( $extensions ) {
0 ignored issues
show
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...
38
			$extensions[] = __FILE__;
39
			return $extensions;
40
		}
41
42
		/**
43
		 * Add our gallery template to the list of templates available for every gallery
44
		 * @param $gallery_templates
45
		 *
46
		 * @return array
47
		 */
48
		function add_template( $gallery_templates ) {
0 ignored issues
show
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...
49
			$gallery_templates[] = array(
50
                'slug'        => 'justified',
51
                'name'        => __( 'Justified Gallery', 'foogallery' ),
52
				'preview_support' => true,
53
				'common_fields_support' => true,
54
                'lazyload_support' => true,
55
				'paging_support' => true,
56
				'mandatory_classes' => 'fg-justified',
57
				'thumbnail_dimensions' => true,
58
				'filtering_support' => true,
59
                'fields'	  => array(
60
                    array(
61
                        'id'      => 'thumb_height',
62
                        'title'   => __( 'Thumb Height', 'foogallery' ),
63
                        'desc'    => __( 'Choose the height of your thumbnails. Thumbnails will be generated on the fly and cached once generated', 'foogallery' ),
64
                        'section' => __( 'General', 'foogallery' ),
65
                        'type'    => 'number',
66
                        'class'   => 'small-text',
67
                        'default' => 250,
68
                        'step'    => '10',
69
                        'min'     => '0',
70
						'row_data'=> array(
71
							'data-foogallery-preview' => 'shortcode',
72
							'data-foogallery-change-selector' => 'input',
73
						)
74
                    ),
75
                    array(
76
                        'id'      => 'row_height',
77
                        'title'   => __( 'Row Height', 'foogallery' ),
78
                        'desc'    => __( 'The preferred height of your gallery rows. This can be different from the thumbnail height', 'foogallery' ),
79
                        'section' => __( 'General', 'foogallery' ),
80
                        'type'    => 'number',
81
                        'class'   => 'small-text',
82
                        'default' => 150,
83
                        'step'    => '10',
84
                        'min'     => '0',
85
						'row_data'=> array(
86
							'data-foogallery-change-selector' => 'input',
87
							'data-foogallery-value-selector' => 'input',
88
							'data-foogallery-preview' => 'shortcode',
89
						)
90
                    ),
91
                    array(
92
                        'id'      => 'max_row_height',
93
                        'title'   => __( 'Max Row Height', 'foogallery' ),
94
                        'desc'    => __( 'A number (e.g 200) which specifies the maximum row height in pixels. A negative value for no limits. Alternatively, use a percentage (e.g. 200% which means that the row height cannot exceed 2 * rowHeight)', 'foogallery' ),
95
                        'section' => __( 'General', 'foogallery' ),
96
                        'type'    => 'text',
97
                        'class'   => 'small-text',
98
                        'default' => '200%',
99
						'row_data'=> array(
100
							'data-foogallery-change-selector' => 'input',
101
							'data-foogallery-value-selector' => 'input',
102
							'data-foogallery-preview' => 'shortcode',
103
						)
104
                    ),
105
                    array(
106
                        'id'      => 'margins',
107
                        'title'   => __( 'Margins', 'foogallery' ),
108
                        'desc'    => __( 'The spacing between your thumbnails.', 'foogallery' ),
109
						'section' => __( 'General', 'foogallery' ),
110
                        'type'    => 'number',
111
                        'class'   => 'small-text',
112
                        'default' => 1,
113
                        'step'    => '1',
114
                        'min'     => '0',
115
						'row_data'=> array(
116
							'data-foogallery-change-selector' => 'input',
117
							'data-foogallery-value-selector' => 'input',
118
							'data-foogallery-preview' => 'shortcode',
119
						)
120
                    ),
121
                    array(
122
                        'id'      => 'thumbnail_link',
123
                        'title'   => __( 'Thumbnail Link', 'foogallery' ),
124
                        'section' => __( 'General', 'foogallery' ),
125
                        'default' => 'image' ,
126
                        'type'    => 'thumb_link',
127
                        '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' ),
128
                    ),
129
                    array(
130
                        'id'      => 'lightbox',
131
                        'title'   => __( 'Lightbox', 'foogallery' ),
132
                        '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' ),
133
                        'section' => __( 'General', 'foogallery' ),
134
                        'default' => 'none',
135
                        'type'    => 'lightbox',
136
                    ),
137
                    array(
138
                        'id'      => 'lastrow',
139
                        'title'   => __( 'Last Row', 'foogallery' ),
140
                        'desc'    => __( 'What should be done with the last row in the gallery?', 'foogallery' ),
141
                        'section' => __( 'General', 'foogallery' ),
142
                        'type'    => 'radio',
143
                        'spacer'  => '<span class="spacer"></span>',
144
                        'default' => 'center',
145
                        'choices' => array(
146
                            'hide' => __( 'Hide', 'foogallery' ),
147
                            'justify' => __( 'Justify', 'foogallery' ),
148
                            'nojustify' => __( 'No Justify', 'foogallery' ),
149
                            'right' => __( 'Right', 'foogallery' ),
150
                            'center' => __( 'Center', 'foogallery' ),
151
                            'left' => __( 'Left', 'foogallery' ),
152
                        ),
153
                        'row_data'=> array(
154
                            'data-foogallery-change-selector' => 'input:radio',
155
                            'data-foogallery-value-selector' => 'input:checked',
156
                            'data-foogallery-preview' => 'shortcode',
157
                        )
158
                    ),
159
                ),
160
			);
161
162
			return $gallery_templates;
163
		}
164
165
		/**
166
		 * Get the thumb dimensions arguments saved for the gallery for this gallery template
167
		 *
168
		 * @param array $dimensions
169
		 * @param FooGallery $foogallery
170
		 *
171
		 * @return mixed
172
		 */
173
		function get_thumbnail_dimensions( $dimensions, $foogallery ) {
0 ignored issues
show
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...
174
			$height = $foogallery->get_meta( 'justified_thumb_height', false );
175
			return array(
176
				'height' => intval( $height ),
177
				'width'  => 0,
178
				'crop'   => false
179
			);
180
		}
181
182
		/**
183
		 * Enqueue scripts that the default gallery template relies on
184
		 */
185
		function enqueue_dependencies( $gallery ) {
0 ignored issues
show
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...
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...
186
			//enqueue core files
187
			foogallery_enqueue_core_gallery_template_style();
188
			foogallery_enqueue_core_gallery_template_script();
189
		}
190
191
		/**
192
		 * Add the required justified options if needed
193
		 *
194
		 * @param $options
195
		 * @param $gallery    FooGallery
196
		 *
197
		 * @param $attributes array
198
		 *
199
		 * @return array
200
		 */
201
		function add_justified_options($options, $gallery, $attributes) {
0 ignored issues
show
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...
The parameter $attributes 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...
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...
202
203
			$row_height = foogallery_gallery_template_setting( 'row_height', '150' );
204
			$max_row_height = foogallery_gallery_template_setting( 'max_row_height', '200%' );
205
			if ( strpos( $max_row_height, '%' ) === false ) {
206
				$max_row_height = intval( $max_row_height );
207
			}
208
			$margins = foogallery_gallery_template_setting( 'margins', '1' );
209
			$lastRow = foogallery_gallery_template_setting( 'lastrow', 'center' );
210
211
			$options['template']['rowHeight'] = intval($row_height);
212
			$options['template']['maxRowHeight'] = $max_row_height;
213
			$options['template']['margins'] = intval($margins);
214
            $options['template']['lastRow'] = $lastRow;
215
216
			return $options;
217
		}
218
219
		/**
220
		 * Build up a arguments used in the preview of the gallery
221
		 * @param $args
222
		 * @param $post_data
223
		 *
224
		 * @return mixed
225
		 */
226
		function preview_arguments( $args, $post_data ) {
0 ignored issues
show
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...
227
			$args['thumbnail_height'] = $post_data[FOOGALLERY_META_SETTINGS]['justified_thumb_height'];
228
			$args['row_height'] = $post_data[FOOGALLERY_META_SETTINGS]['justified_row_height'];
229
			$args['max_row_height'] = $post_data[FOOGALLERY_META_SETTINGS]['justified_max_row_height'];
230
			$args['margins'] = $post_data[FOOGALLERY_META_SETTINGS]['justified_margins'];
231
            $args['lastrow'] = $post_data[FOOGALLERY_META_SETTINGS]['justified_lastrow'];
232
			return $args;
233
		}
234
235
		/**
236
		 * Builds thumb dimensions from arguments
237
		 *
238
		 * @param array $dimensions
239
		 * @param array $arguments
240
		 *
241
		 * @return mixed
242
		 */
243
		function build_thumbnail_dimensions_from_arguments( $dimensions, $arguments ) {
0 ignored issues
show
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...
244
		    if ( array_key_exists( 'thumbnail_height', $arguments) ) {
245
                return array(
246
                    'height' => intval($arguments['thumbnail_height']),
247
                    'width' => 0,
248
                    'crop' => false
249
                );
250
            }
251
252
            return null;
253
		}
254
255
        /**
256
         * Build up the arguments needed for rendering this gallery template
257
         *
258
         * @param $args
259
         * @return array
260
         */
261
        function build_gallery_template_arguments( $args ) {
0 ignored issues
show
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...
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...
262
            $height = foogallery_gallery_template_setting( 'thumb_height', '250' );
263
            $args = array(
264
                'height' => $height,
265
                'link' => foogallery_gallery_template_setting( 'thumbnail_link', 'image' ),
266
				'crop' => false
267
            );
268
269
            return $args;
270
        }
271
	}
272
}