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 ( 88f370...1732e9 )
by Brad
06:19
created

Compatibility::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Builds in support for the Responsive Lightbox plugin by dFactory
4
 * Created by brad.
5
 * Date: 13/05/2017
6
 *
7
 * @since 1.2.21
8
 */
9
if ( ! class_exists( 'FooGallery_Responsive_Lightbox_dFactory_Compatibility' ) ) {
10
11
	class FooGallery_Responsive_Lightbox_dFactory_Compatibility {
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...
12
13
		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...
14
			add_filter( 'foogallery_gallery_template_field_lightboxes', array( $this, 'add_lightbox' ), 99 );
15
			add_filter( 'foogallery_attachment_html_link_attributes', array( $this, 'add_attributes' ), 10, 3 );
16
		}
17
18
		/**
19
		 * Add the dFactory lightbox to the available FooGallery lightboxes
20
		 * @param $lightboxes
21
		 *
22
		 * @return mixed
23
		 * @since 1.2.21
24
		 */
25
		function add_lightbox($lightboxes) {
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...
26
			$option_text = __( 'Responsive Lightbox by dFactory', 'foogallery' );
27
			if ( !class_exists( 'Responsive_Lightbox' ) ) {
28
				$option_text .= __( ' (Not installed!)', 'foogallery' );
29
			}
30
31
			$lightboxes['dfactory'] = $option_text;
32
			return $lightboxes;
33
		}
34
35
		/**
36
		 * If the dFactory lightbox is selected for the gallery, then make the integration work
37
		 *
38
		 * @param $attr
39
		 * @param $args
40
		 * @param $attachment
41
		 *
42
		 * @return mixed
43
		 * @since 1.2.21
44
		 */
45
		function add_attributes($attr, $args, $attachment) {
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...
46
			if ( class_exists( 'Responsive_Lightbox' ) ) {
47
				$lightbox = foogallery_gallery_template_setting( 'lightbox', 'unknown' );
48
49
				//only add attributes if the dfactory lightbox is in use
50
				if ( 'dfactory' === $lightbox ) {
51
					$attr['data-rel'] = 'lightbox';
52
53
					if ( !empty( $attachment->caption ) ) {
54
						$attr['title'] = $attachment->caption;
55
					}
56
				}
57
			}
58
59
    		return $attr;
60
		}
61
	}
62
}