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.

video/class-foogallery-pro-video-legacy.php (29 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
 * All Legacy FooVideo Code lives in this class
4
  */
5
if ( ! class_exists( 'FooGallery_Pro_Video_Legacy' ) ) {
6
7
	define( 'FOOGALLERY_FOOVIDEO_MIGRATION_REQUIRED', 'foogallery-foovideo-migration-required' );
8
	define( 'FOOGALLERY_FOOVIDEO_MIGRATED', 'foogallery-foovideo-migrated' );
9
10
	class FooGallery_Pro_Video_Legacy {
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...
11
12
		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...
13
			add_filter( 'foogallery_is_attachment_video', array( $this, 'foogallery_is_attachment_video_legacy' ), 10, 2 );
14
15
			add_filter( 'foogallery_clean_video_url', array( $this, 'foogallery_clean_video_url_legacy_filter' ) );
16
			add_filter( 'foogallery_youtubekey', array( $this, 'foogallery_youtubekey_legacy_filter' ) );
17
18
			//make sure that all plugins are loaded first before we do checks for FooVideo
19
			add_action( 'plugins_loaded', array( $this, 'load_legacy_overrides' ) );
20
21
			// Ajax calls for migrating
22
			add_action( 'wp_ajax_foogallery_video_migration', array( $this, 'ajax_foogallery_video_migration' ) );
23
			add_action( 'wp_ajax_foogallery_video_migration_reset', array( $this, 'ajax_foogallery_video_migration_reset' ) );
24
		}
25
26
		/**
27
		 * Run legacy override hooks and filters
28
		 */
29
		function load_legacy_overrides() {
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...
30
			if ( is_admin() ) {
31
32
				//check if the old FooVideo was/is installed
33
				if ( $this->migration_required() ) {
34
					add_action( 'admin_notices', array( $this, 'display_foovideo_notice') );
35
					add_action( 'admin_menu',  array( $this, 'add_migration_menu' ) );
36
37
					add_filter( 'foogallery_render_gallery_settings_metabox', array( $this, 'migrate_settings' ) );
38
39
					add_action( 'foogallery_after_save_gallery', array( $this, 'migrate_gallery' ), 99, 2 );
40
				}
41
42
				//check if the old FooVideo is still activated
43
				if ( class_exists( 'Foo_Video' ) ) {
44
					//rename the Video Slider template
45
					add_filter( 'foogallery_gallery_templates', array( $this, 'rename_videoslider_template' ), 99 );
46
47
					//remove legacy fields added by FooVideo
48
					add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'remove_legacy_template_fields' ), 99 );
49
50
					//short-circuit saving the post meta for video count on the gallery
51
					add_filter( 'update_post_metadata', array( $this, 'short_circuit_legacy_video_count' ), 10, 5 );
52
				}
53
54
				add_filter( 'foogallery_foovideo_discount_offer_notice_title', array( $this, 'override_discount_offer_notice_title' ) );
55
				add_filter( 'foogallery_foovideo_discount_offer_notice_message', array( $this, 'override_discount_offer_notice_message' ) );
56
				add_filter( 'foogallery_foovideo_discount_offer_menu', array( $this, 'override_discount_offer_menu' ) );
57
				add_filter( 'foogallery_foovideo_discount_offer_show_upgrade', '__return_false' );
58
				add_filter( 'foogallery_foovideo_discount_offer_message', array( $this, 'override_discount_offer_message' ) );
59
				add_filter( 'foogallery_foovideo_pricing_menu_text', array( $this, 'override_pricing_menu_text' ) );
60
			}
61
62
			if ( !is_admin() && class_exists( 'Foo_Video' ) ) {
63
				add_filter( 'foogallery_build_class_attribute', array( $this, 'foogallery_build_class_attribute' ), 20 );
64
			}
65
		}
66
67
		/**
68
		 * Determines if a migration is needed
69
		 *
70
		 * @return bool
71
		 */
72
		function migration_required() {
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...
73
			//first try to get the saved option
74
 			$migration_required = get_option( FOOGALLERY_FOOVIDEO_MIGRATION_REQUIRED, 0 );
75
76
			//we require migration - get out early
77
			if ( "1" === $migration_required ) {
78
				return true;
79
			}
80
81
			if ( class_exists('Foo_Video') ) {
82
				//the legacy plugin is installed, so set the option for future use
83
				$migration_required = true;
84
85
				update_option( FOOGALLERY_FOOVIDEO_MIGRATION_REQUIRED, $migration_required );
86
			}
87
88
			//we have no option saved and no legacy plugin, so no migration required
89
			if ( 0 === $migration_required ) {
90
				$migration_required = false;
91
			}
92
93
			return $migration_required;
94
		}
95
96
		/**
97
		 * Migrate the gallery settings
98
		 *
99
		 * @param $foogallery
100
		 *
101
		 * @return FooGallery
102
		 */
103
		function migrate_settings( $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...
104
			$helper = new FooGallery_Pro_Video_Migration_Helper();
105
			$foogallery = $helper->migrate_gallery( $foogallery, false );
106
			return $foogallery;
107
		}
108
109
		/**
110
		 * Short-circuit the post meta updates for the legacy FooVideo while both plugins are activated
111
		 *
112
		 * @param $check
113
		 * @param $object_id
114
		 * @param $meta_key
115
		 * @param $meta_value
116
		 * @param $prev_value
117
		 *
118
		 * @return bool
119
		 */
120
		function short_circuit_legacy_video_count( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
0 ignored issues
show
The parameter $meta_value 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 $prev_value 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...
121
			if ( '_foovideo_video_count' === $meta_key ) {
122
				$check = true;
123
			}
124
			return $check;
125
		}
126
127
		/**
128
		 * Migrate video for the gallery that is saved
129
		 *
130
		 * @param $post_id
131
		 * @param $post
132
		 */
133
		function migrate_gallery($post_id, $post) {
0 ignored issues
show
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...
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...
134
			if ( $this->migration_required() ) {
135
136
				$helper = new FooGallery_Pro_Video_Migration_Helper();
137
138
				if ( $helper->check_gallery_needs_migration( $post_id ) ) {
139
140
					//migrate all the video attachments
141
					$gallery = FooGallery::get_by_id( $post_id );
142
					foreach ( $gallery->attachments() as $attachment ) {
143
						$helper->migrate_attachment( $attachment->ID );
144
					}
145
146
					$helper->migrate_video_counts( $post_id );
147
				}
148
			}
149
		}
150
151
		/**
152
		 * Remove the legacy template fields added by FooVideo
153
		 *
154
		 * @param $fields
155
		 *
156
		 * @return array
157
		 */
158
		function remove_legacy_template_fields( $fields ) {
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...
159
			$new_fields = array();
160
161
			foreach ( $fields as $field ) {
162
163
				if ( $field['id'] !== 'foovideo_video_overlay' &&
164
					$field['id'] !== 'foovideo_sticky_icon' &&
165
					$field['id'] !== 'foovideo_video_size' &&
166
					$field['id'] !== 'foovideo_autoplay' ) {
167
168
					$new_fields[] = $field;
169
				}
170
			}
171
172
			return $new_fields;
173
		}
174
175
		/**
176
		 * Rename the Video Slider template to include the text 'Deprecated'
177
		 * @param $templates
178
		 *
179
		 * @return mixed
180
		 */
181
		function rename_videoslider_template( $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...
182
			foreach( $templates as &$template ) {
183
				if ( 'videoslider' === $template['slug'] ) {
184
					$template['name'] = __( 'Video Slider (Deprecated!)', 'foogallery' );
185
				}
186
			}
187
188
			return $templates;
189
		}
190
191
		/**
192
		 * Legacy way of knowing if an attachment is a video
193
		 *
194
		 * @param $is_video
195
		 * @param $foogallery_attachment
196
		 *
197
		 * @return bool
198
		 */
199
		function foogallery_is_attachment_video_legacy( $is_video, $foogallery_attachment ) {
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...
200
			$video_info = get_post_meta( $foogallery_attachment->ID, FOOGALLERY_VIDEO_POST_META, true );
201
202
			return isset( $video_info ) && isset( $video_info['id'] );
203
		}
204
205
		/**
206
		 * Applies the legacy filter for backwards compatibility
207
		 * @param $url
208
		 *
209
		 * @return string
210
		 */
211
		function foogallery_clean_video_url_legacy_filter( $url ) {
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...
212
			return apply_filters( 'foogallery_foovideo_clean_video_url', $url );
213
		}
214
215
		public function foogallery_build_class_attribute( $classes ) {
216
			//remove any legacy classes
217
			if ( ( $key = array_search( 'video-icon-1', $classes ) ) !== false ) {
218
				unset( $classes[$key] );
219
			}
220
			if ( ( $key = array_search( 'video-icon-2', $classes ) ) !== false ) {
221
				unset( $classes[$key] );
222
			}
223
			if ( ( $key = array_search( 'video-icon-3', $classes ) ) !== false ) {
224
				unset( $classes[$key] );
225
			}
226
			if ( ( $key = array_search( 'video-icon-default', $classes ) ) !== false ) {
227
				unset( $classes[$key] );
228
			}
229
230
			return $classes;
231
		}
232
233
		/**
234
		 * Display a message if the FooVideo extension is also installed
235
		 */
236
		function display_foovideo_notice() {
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...
237
			if ( 'foogallery' !== foo_current_screen_post_type() ) return;
238
239
			$url = admin_url( add_query_arg( array( 'page' => 'foogallery-video-migration' ), foogallery_admin_menu_parent_slug() ) );
240
			?>
241
			<div class="notice error">
242
				<p>
243
					<strong><?php _e('FooGallery Video Migration Required!', 'foogallery'); ?></strong><br/>
244
					<?php if ( class_exists( 'Foo_Video' ) ) { ?>
245
						<?php _e('You have both FooGallery PRO and the legacy FooVideo extension activated. FooGallery PRO now includes all the video features that FooVideo had, plus more! Which means the FooVideo extension is now redundant.', 'foogallery'); ?>
246
						<br/>
247
						<?php _e('Your video galleries will continue to work, but we recommend you migrate them across to use the video features in FooGallery PRO as soon as possible.', 'foogallery'); ?>
248
					<?php } else { ?>
249
						<?php _e('At some point you had the FooVideo extension installed. FooGallery PRO now includes all the video features that FooVideo had, plus more! Which means the FooVideo extension is now redundant.', 'foogallery'); ?>
250
						<br/>
251
						<?php _e('You will need to migrate your video galleries across to use the new video features in FooGallery PRO as soon as possible.', 'foogallery'); ?>
252
					<?php } ?>
253
					<br/>
254
					<br/>
255
					<a href="<?php echo $url; ?>" class="button button-primary button-large"><?php _e('Migrate Video Galleries', 'foogallery'); ?></a>
256
					<br/>
257
				</p>
258
			</div>
259
			<?php
260
		}
261
262
		/**
263
		 * Outputs the video migration view
264
		 */
265
		function render_video_migration_view() {
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...
266
			require_once 'view-video-migration.php';
267
		}
268
269
		/**
270
		 * Add a new menu item for running the migration
271
		 */
272
		function add_migration_menu() {
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...
273
			foogallery_add_submenu_page( __( 'Video Migration', 'foogallery' ), 'manage_options', 'foogallery-video-migration', array( $this, 'render_video_migration_view', ) );
274
		}
275
276
		/**
277
		 * Handle the Video Migration Step from an AJAX call
278
		 */
279
		function ajax_foogallery_video_migration() {
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...
280
			if ( check_admin_referer( 'foogallery_video_migration' ) ) {
281
				$helper = new FooGallery_Pro_Video_Migration_Helper();
282
				$state = $helper->run_next_migration_step();
283
				header( 'Content-type: application/json' );
284
				echo json_encode( $state );
285
			}
286
			die();
287
		}
288
289
		/**
290
		 * Handle the Video Migration Reset from an AJAX call
291
		 */
292
		function ajax_foogallery_video_migration_reset() {
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...
293
			if ( check_admin_referer( 'foogallery_video_migration' ) ) {
294
				$helper = new FooGallery_Pro_Video_Migration_Helper();
295
				$state = $helper->reset_state();
296
				header( 'Content-type: application/json' );
297
				echo json_encode( $state );
298
			}
299
			die();
300
		}
301
302
		/**
303
		 * Override the Discount Offer admin notice title
304
		 * @param $title
305
		 *
306
		 * @return string
307
		 */
308
		function override_discount_offer_notice_title( $title ) {
0 ignored issues
show
The parameter $title 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...
309
			$title = __( 'FooGallery Renewal Offer Available!', 'foogallery' );
310
			return $title;
311
		}
312
313
		/**
314
		 * Override the Discount Offer admin notice message
315
		 * @param $message
316
		 *
317
		 * @return string
318
		 */
319
		function override_discount_offer_notice_message( $message ) {
0 ignored issues
show
The parameter $message 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...
320
			$message = __( 'We noticed that you own licenses for FooVideo and FooGallery PRO. FooGallery PRO now has all the awesome features of FooVideo, plus more! And because you already own both, you are eligible for a free renewal on your existing FooGallery PRO license.', 'foogallery' );
321
			return $message;
322
		}
323
324
		/**
325
		 * Override the Discount Offer menu
326
		 * @param $menu
327
		 *
328
		 * @return string
329
		 */
330
		function override_discount_offer_menu( $menu ) {
0 ignored issues
show
The parameter $menu 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...
331
			$menu = __( 'Renewal Offer', 'foogallery' );
332
			return $menu;
333
		}
334
335
		/**
336
		 * Override the Discount Offer page message
337
		 * @param $message
338
		 *
339
		 * @return string
340
		 */
341
		function override_discount_offer_message( $message ) {
0 ignored issues
show
The parameter $message 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...
342
			$message = __( 'Thank you for your support - you are awesome! FooGallery PRO now has all the awesome features of FooVideo, plus more! And because you already own both, you are eligible for a free renewal on your existing FooGallery PRO license.', 'foogallery' );
343
			return $message;
344
		}
345
346
		/**
347
		 * Override the pricing page menu text
348
		 * @param $text
349
		 *
350
		 * @return string
351
		 */
352
		function override_pricing_menu_text( $text ) {
0 ignored issues
show
The parameter $text 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...
353
			$text = __('FooGallery -> Pricing', 'foogallery');
354
			return $text;
355
		}
356
	}
357
}