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/attachment-taxonomies ( 9fe273...54ac97 )
by Brad
06:02 queued 02:51
created

__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
 * FooGallery Pro Gallery Shortcode Override Class
4
 */
5
if ( ! class_exists( 'FooGallery_Pro_Gallery_Shortcode_Override' ) ) {
6
7
    class FooGallery_Pro_Gallery_Shortcode_Override {
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
        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...
10
            add_filter( 'foogallery_admin_settings_override', array( $this, 'gallery_shortcode_override_settings' ) );
11
            add_filter( 'post_gallery', array( $this, 'override_gallery_output' ), 10, 3 );
12
        }
13
14
        /**
15
         * Create the override
16
         * @return array
17
         */
18
        function gallery_shortcode_override_settings($settings) {
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...
19
            $settings['settings'][] = array(
20
                'id' => 'override_gallery_shortcode',
21
                'title' => __('Override Gallery Shortcode', 'foogallery'),
22
                'desc' => sprintf(__('This will allow you to override all default gallery shortcodes to rather use a %s template. The defaults above will be used when displaying the gallery.', 'foogallery'), foogallery_plugin_name()),
23
                'type' => 'checkbox',
24
                'tab' => 'general',
25
                'section' => __('Shortcodes', 'foogallery')
26
            );
27
28
            return $settings;
29
        }
30
31
        /*
32
         * Override the gallery shortcode output if enabled
33
         * @param $output
34
         * @param $attr
35
         * @param $instance
36
         * @return string
37
         */
38
        function override_gallery_output( $output, $attr, $instance) {
0 ignored issues
show
Unused Code introduced by
The parameter $instance 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...
39
            $override_enabled = foogallery_get_setting( 'override_gallery_shortcode');
40
41
            if ($override_enabled  === 'on') {
42
                $attr['attachment_ids'] = $attr['ids'];
43
44
				//create new instance of template engine
45
				$engine = new FooGallery_Template_Loader();
46
47
				ob_start();
48
49
				$engine->render_template( $attr );
50
51
				$output_string = ob_get_contents();
52
				ob_end_clean();
53
				return $output_string;
54
            }
55
56
            return '';
57
        }
58
    }
59
}