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 ( dc0f35...efd704 )
by Christian
15s
created

Options::field()   B

Complexity

Conditions 8
Paths 14

Size

Total Lines 42
Code Lines 34

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 8
eloc 34
c 0
b 0
f 0
nc 14
nop 1
dl 0
loc 42
rs 8.1315
1
<?php
0 ignored issues
show
introduced by
Filenames should be all lowercase with hyphens as word separators. Expected options.php, but found Options.php.
Loading history...
introduced by
Class file names should be based on the class name with "class-" prepended. Expected class-options.php, but found Options.php.
Loading history...
2
/**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
3
 * @author    Podlove <[email protected]>
4
 * @copyright Copyright (c) 2014-2018, Podlove
5
 * @license   https://github.com/podlove/podlove-subscribe-button-wp-plugin/blob/master/LICENSE MIT
6
 * @package   Podlove\PodloveSubscribeButton
7
 */
8
9
namespace PodloveSubscribeButton;
10
11
class Options {
0 ignored issues
show
Coding Style Documentation introduced by
Missing doc comment for class Options
Loading history...
12
13
	public static function register_settings() {
0 ignored issues
show
Coding Style introduced by
Method name "Options::register_settings" is not in camel caps format
Loading history...
Coding Style Documentation introduced by
Missing doc comment for function register_settings()
Loading history...
14
15
		$args = array(
16
			'description'       => '',
17
			'sanitize_callback' => array( __CLASS__, 'sanitize_settings' ),
18
		);
19
20
		register_setting(
21
			'podlove-psb',
22
			'podlove_psb_defaults',
23
			$args
24
		);
25
26
		add_settings_section(
27
			'podlove-psb-defaults',
28
			__( 'Default Settings', 'podlove-subscribe-button' ),
29
			'__return_empty_string',
30
			'podlove-psb'
31
		);
32
33
		add_settings_field(
34
			'size',
35
			__( 'Size', 'podlove-subscribe-button' ),
36
			array( __CLASS__, 'field' ),
37
			'podlove-psb',
38
			'podlove-psb-defaults',
39
			array(
40
				'label_for' => 'size',
41
				'type'      => 'select',
42
			)
43
		);
44
45
		add_settings_field(
46
			'autowidth',
47
			__( 'Autowidth', 'podlove-subscribe-button' ),
48
			array( __CLASS__, 'field' ),
49
			'podlove-psb',
50
			'podlove-psb-defaults',
51
			array(
52
				'label_for' => 'autowidth',
53
				'type'      => 'checkbox',
54
			)
55
		);
56
57
		add_settings_field(
58
			'color',
59
			__( 'Color', 'podlove-subscribe-button' ),
60
			array( __CLASS__, 'field' ),
61
			'podlove-psb',
62
			'podlove-psb-defaults',
63
			array(
64
				'label_for' => 'color',
65
				'type'      => 'color',
66
			)
67
		);
68
69
		add_settings_field(
70
			'style',
71
			__( 'Style', 'podlove-subscribe-button' ),
72
			array( __CLASS__, 'field' ),
73
			'podlove-psb',
74
			'podlove-psb-defaults',
75
			array(
76
				'label_for' => 'style',
77
				'type'      => 'select',
78
			)
79
		);
80
81
		add_settings_field(
82
			'format',
83
			__( 'Format', 'podlove-subscribe-button' ),
84
			array( __CLASS__, 'field' ),
85
			'podlove-psb',
86
			'podlove-psb-defaults',
87
			array(
88
				'label_for' => 'format',
89
				'type'      => 'select',
90
			)
91
		);
92
93
		add_settings_field(
94
			'language',
95
			__( 'Language', 'podlove-subscribe-button' ),
96
			array( __CLASS__, 'field' ),
97
			'podlove-psb',
98
			'podlove-psb-defaults',
99
			array(
100
				'label_for' => 'language',
101
				'type'      => 'language',
102
			)
103
		);
104
105
	}
106
107
	public static function field( $args ) {
0 ignored issues
show
Coding Style Documentation introduced by
Missing doc comment for function field()
Loading history...
108
109
		if ( is_network_admin() ) {
110
			$option = get_site_option( 'podlove_psb_defaults' );
111
		} else {
112
			$option = get_option( 'podlove_psb_defaults' );
113
		}
114
115
		switch ( $args['type'] ) {
116
			case 'checkbox':
117
				?>
118
                <input type="checkbox" name="<?php echo "podlove_psb_defaults[{$args['label_for']}]"; ?>"
0 ignored issues
show
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '"podlove_psb_defaults[$args['label_for']]"'.
Loading history...
119
                       id="<?php echo "podlove_psb_defaults[{$args['label_for']}]"; ?>" <?php checked( $option[ $args['label_for'] ], 'on' ); ?> />
0 ignored issues
show
introduced by
Found precision alignment of 3 spaces.
Loading history...
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '"podlove_psb_defaults[$args['label_for']]"'.
Loading history...
120
				<?php
121
				break;
122
123
			case 'color':
124
				?>
125
                <input id="podlove_psb_defaults[color]" name="podlove_psb_defaults[color]" class="podlove_subscribe_button_color"
126
                       value="<?php echo $option['color'] ?>"/>
0 ignored issues
show
introduced by
Found precision alignment of 3 spaces.
Loading history...
Coding Style introduced by
Inline PHP statement must end with a semicolon
Loading history...
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$option'.
Loading history...
127
				<?php
128
				break;
129
130
			case 'language':
131
				?>
132
                <select name="podlove_psb_defaults[language]" id="podlove_psb_defaults[language]">
133
					<?php foreach ( Defaults::button( 'language' ) as $value ) : ?>
134
                        <option value="<?php echo $value; ?>" <?php selected( $option['language'], $value ); ?>><?php echo $value; ?></option>
0 ignored issues
show
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$value'.
Loading history...
135
					<?php endforeach; ?>
136
                </select>
137
				<?php
138
				break;
139
0 ignored issues
show
Coding Style introduced by
Functions must not contain multiple empty lines in a row; found 2 empty lines
Loading history...
140
141
			case 'select':
142
				?>
143
                <select name="podlove_psb_defaults[<?php echo $args['label_for']; ?>]" id="podlove_psb_defaults[<?php echo $args['label_for']; ?>]">
0 ignored issues
show
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$args'.
Loading history...
144
					<?php foreach ( Defaults::button( $args['label_for'] ) as $value => $description ) { ?>
145
                        <option value="<?php echo $value; ?>" <?php selected( $option[ $args['label_for'] ], $value ); ?>><?php echo $description; ?></option>
0 ignored issues
show
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$value'.
Loading history...
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$description'.
Loading history...
146
					<?php } ?>
147
                </select>
148
				<?php break;
0 ignored issues
show
Coding Style introduced by
Opening PHP tag must be on a line by itself
Loading history...
149
150
		}
151
	}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
152
153
	public static function sanitize_settings( $input = null ) {
0 ignored issues
show
Coding Style introduced by
Method name "Options::sanitize_settings" is not in camel caps format
Loading history...
Coding Style Documentation introduced by
Missing doc comment for function sanitize_settings()
Loading history...
154
155
	    $output = $input;
156
157
	    if ( ! array_key_exists('autowidth', $input ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
158
		    $output['autowidth'] = 'off';
159
        }
160
161
		return $output;
162
	}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
163
164
} // END class
165