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 (1495)

widget.php (86 issues)

1
<?php
0 ignored issues
show
Class file names should be based on the class name with "class-" prepended. Expected class-podlove-subscribe-button-widget.php, but found widget.php.
Loading history...
2
3
namespace PodloveSubscribeButton;
4
5
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
6
7
class Podlove_Subscribe_Button_Widget extends \WP_Widget {
8
9
	public function __construct() {
10
		parent::__construct(
11
					'podlove_subscribe_button_wp_plugin_widget',
12
					( self::is_podlove_publisher_active() ? 'Podlove Subscribe Button (WordPress plugin)' : 'Podlove Subscribe Button' ),
13
					array( 'description' => __( 'Adds a Podlove Subscribe Button to your Sidebar', 'podlove-subscribe-button' ), )
0 ignored issues
show
Comma not allowed after last value in single-line array declaration
Loading history...
14
				);
15
	}
16
17
	public static $widget_settings = array('infotext', 'title', 'size', 'style', 'format', 'autowidth', 'button', 'color');
0 ignored issues
show
Missing space after array opener.
Loading history...
Missing space before array closer.
Loading history...
18
19
	public static function is_podlove_publisher_active() {
20
		if ( is_plugin_active("podlove-podcasting-plugin-for-wordpress/podlove.php") ) {
21
			return true;
22
		}
23
24
		return false;
25
	}
26
27
	public function widget( $args, $instance ) {
28
		// Fetch the (network)button by it's name
29
		if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name($instance['button']) )
0 ignored issues
show
Variable assignment found within a condition. Did you mean to do a comparison?
Loading history...
30
			return sprintf( __('Oops. There is no button with the ID "%s".', 'podlove-subscribe-button'), $args['button'] );
0 ignored issues
show
A gettext call containing placeholders was found, but was not accompanied by a "translators:" comment on the line above to clarify the meaning of the placeholders.
Loading history...
31
32
		echo $args['before_widget'];
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$args'.
Loading history...
33
		echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title'];
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$args'.
Loading history...
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'apply_filters'.
Loading history...
34
35
		echo $button->render(
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$button'.
Loading history...
36
				\PodloveSubscribeButton::get_array_value_with_fallback($instance, 'size'),
37
				\PodloveSubscribeButton::get_array_value_with_fallback($instance, 'autowidth'),
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'PodloveSubscribeButton'.
Loading history...
38
				\PodloveSubscribeButton::get_array_value_with_fallback($instance, 'style'),
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'PodloveSubscribeButton'.
Loading history...
39
				\PodloveSubscribeButton::get_array_value_with_fallback($instance, 'format'),
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'PodloveSubscribeButton'.
Loading history...
40
				\PodloveSubscribeButton::get_array_value_with_fallback($instance, 'color')
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'PodloveSubscribeButton'.
Loading history...
41
			);
42
43
		if ( strlen($instance['infotext']) )
44
			echo wpautop($instance['infotext']);
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'wpautop'.
Loading history...
45
46
		echo $args['after_widget'];
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$args'.
Loading history...
47
	}
48
49
	public function form( $instance ) {
50
51
        $title     = isset( $instance[ 'title' ] )     ? $instance[ 'title' ]     : '';
0 ignored issues
show
Array keys must NOT be surrounded by spaces if they only contain a string or an integer.
Loading history...
Expected 1 space before "?"; 5 found
Loading history...
Expected 1 space before ":"; 5 found
Loading history...
52
        $button = isset( $instance[ 'button' ] )    ? $instance[ 'button' ]    : '';
0 ignored issues
show
Array keys must NOT be surrounded by spaces if they only contain a string or an integer.
Loading history...
Expected 1 space before "?"; 4 found
Loading history...
Expected 1 space before ":"; 4 found
Loading history...
53
        $size      = isset( $instance[ 'size' ] )      ? $instance[ 'size' ]      : 'big';
0 ignored issues
show
Array keys must NOT be surrounded by spaces if they only contain a string or an integer.
Loading history...
Expected 1 space before "?"; 6 found
Loading history...
Expected 1 space before ":"; 6 found
Loading history...
54
        $style     = isset( $instance[ 'style' ] )     ? $instance[ 'style' ]     : 'filled';
0 ignored issues
show
Array keys must NOT be surrounded by spaces if they only contain a string or an integer.
Loading history...
Expected 1 space before "?"; 5 found
Loading history...
Expected 1 space before ":"; 5 found
Loading history...
55
        $format    = isset( $instance[ 'format' ] )    ? $instance[ 'format' ]    : 'cover';
0 ignored issues
show
Array keys must NOT be surrounded by spaces if they only contain a string or an integer.
Loading history...
Expected 1 space before "?"; 4 found
Loading history...
Expected 1 space before ":"; 4 found
Loading history...
56
        $autowidth = isset( $instance[ 'autowidth' ] ) ? $instance[ 'autowidth' ] : true;
0 ignored issues
show
Array keys must NOT be surrounded by spaces if they only contain a string or an integer.
Loading history...
57
        $infotext  = isset( $instance[ 'infotext' ] )  ? $instance[ 'infotext' ]  : '';
0 ignored issues
show
Array keys must NOT be surrounded by spaces if they only contain a string or an integer.
Loading history...
Expected 1 space before "?"; 2 found
Loading history...
Expected 1 space before ":"; 2 found
Loading history...
58
        $color     = isset( $instance[ 'color' ] )     ? $instance[ 'color' ]     : '#75ad91';
0 ignored issues
show
Array keys must NOT be surrounded by spaces if they only contain a string or an integer.
Loading history...
Expected 1 space before "?"; 5 found
Loading history...
Expected 1 space before ":"; 5 found
Loading history...
59
60
		$buttons = \PodloveSubscribeButton\Model\Button::all();
61
		if ( is_multisite() )
62
			$network_buttons = \PodloveSubscribeButton\Model\NetworkButton::all();
63
		?>
64
        <p>
65
            <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title', 'podlove-subscribe-button' ); ?></label>
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$this'.
Loading history...
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
66
            <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr($title); ?>" />
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$this'.
Loading history...
67
68
            <label for="<?php echo $this->get_field_id( 'color' ); ?>"><?php _e( 'Color', 'podlove-subscribe-button' ); ?></label>
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$this'.
Loading history...
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
69
            <input class="podlove_subscribe_button_color" id="<?php echo $this->get_field_id( 'color' ); ?>" name="<?php echo $this->get_field_name( 'color' ); ?>" value="<?php echo esc_attr($color); ?>" />
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$this'.
Loading history...
70
            <style type="text/css">
71
                .sp-replacer {
72
                    display: flex;
73
                }
74
                .sp-preview {
75
                    flex-grow: 10;
76
                }
77
            </style>
78
79
            <label for="<?php echo $this->get_field_id( 'button' ); ?>"><?php _e( 'Button', 'podlove-subscribe-button' ); ?></label>
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$this'.
Loading history...
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
80
            <select class="widefat" id="<?php echo $this->get_field_id( 'button' ); ?>"
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$this'.
Loading history...
81
                    name="<?php echo $this->get_field_name( 'button' ); ?>">
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$this'.
Loading history...
82
				<?php if ( isset($network_buttons) && count($network_buttons) > 0 ) : ?>
83
                    <optgroup label="<?php _e('Local', 'podlove'); ?>">
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
84
						<?php
85
						foreach ($buttons as $subscribebutton) {
0 ignored issues
show
No space after opening parenthesis is prohibited
Loading history...
No space before closing parenthesis is prohibited
Loading history...
86
							echo "<option value='" . sanitize_title($subscribebutton->name) . "' " . selected( sanitize_title($subscribebutton->name), $button ) . " >" . sanitize_title($subscribebutton->title) . " (" . sanitize_title($subscribebutton->name) . ")</option>";
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'sanitize_title'.
Loading history...
87
						}
88
                        ?>
89
                    </optgroup>
90
                    <optgroup label="<?php _e('Network', 'podlove'); ?>">
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
91
						<?php
92
						foreach ($network_buttons as $subscribebutton) {
0 ignored issues
show
No space after opening parenthesis is prohibited
Loading history...
No space before closing parenthesis is prohibited
Loading history...
93
							echo "<option value='" . sanitize_title($subscribebutton->name) . "' " . selected( sanitize_title($subscribebutton->name), $button ) . " >" . sanitize_title($subscribebutton->title) . " (" . sanitize_title($subscribebutton->name) . ")</option>";
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'sanitize_title'.
Loading history...
94
						}
95
                        ?>
96
                    </optgroup>
97
				<?php else :
98
					foreach ($buttons as $subscribebutton) {
0 ignored issues
show
No space after opening parenthesis is prohibited
Loading history...
No space before closing parenthesis is prohibited
Loading history...
99
						echo "<option value='" . sanitize_title($subscribebutton->name) . "' " . selected( sanitize_title($subscribebutton->name), $button ) . " >" . sanitize_title($subscribebutton->title) . " (" . sanitize_title($subscribebutton->name) . ")</option>";
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'sanitize_title'.
Loading history...
100
					}
101
				endif; ?>
102
            </select>
103
104
			<?php
105
			$customize_options = array(
106
				'size'      => array(
107
					'name'    => __( 'Size', 'podlove-subscribe-button' ),
108
					'options' => \PodloveSubscribeButton\Model\Button::$size
0 ignored issues
show
Each array item in a multi-line array declaration must end in a comma
Loading history...
109
				),
110
				'style'     => array(
111
					'name'    => __( 'Style', 'podlove-subscribe-button' ),
112
					'options' => \PodloveSubscribeButton\Model\Button::$style
0 ignored issues
show
Each array item in a multi-line array declaration must end in a comma
Loading history...
113
				),
114
				'format'    => array(
115
					'name'    => __( 'Format', 'podlove-subscribe-button' ),
116
					'options' => \PodloveSubscribeButton\Model\Button::$format
0 ignored issues
show
Each array item in a multi-line array declaration must end in a comma
Loading history...
117
				),
118
				'autowidth' => array(
119
					'name'    => __( 'Autowidth', 'podlove-subscribe-button' ),
120
					'options' => \PodloveSubscribeButton\Model\Button::$width
0 ignored issues
show
Each array item in a multi-line array declaration must end in a comma
Loading history...
121
				)
0 ignored issues
show
Each array item in a multi-line array declaration must end in a comma
Loading history...
122
			);
123
124
			foreach ($customize_options as $slug => $properties) : ?>
0 ignored issues
show
No space after opening parenthesis is prohibited
Loading history...
No space before closing parenthesis is prohibited
Loading history...
125
				<label for="<?php echo $this->get_field_id( $slug ); ?>"><?php echo $properties['name']; ?></label>
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$this'.
Loading history...
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$properties'.
Loading history...
126
				<select class="widefat" id="<?php echo $this->get_field_id( $slug ); ?>" name="<?php echo $this->get_field_name( $slug ); ?>">
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$this'.
Loading history...
127
					<option value="default" <?php echo ( $$slug == 'default' ? 'selected="selected"' : '' ); ?>><?php printf( __( 'Default %s', 'podlove-subscribe-button' ), $properties['name'] ) ?></option>
0 ignored issues
show
Found: ==. Use strict comparisons (=== or !==).
Loading history...
Use Yoda Condition checks, you must.
Loading history...
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.
Loading history...
A gettext call containing placeholders was found, but was not accompanied by a "translators:" comment on the line above to clarify the meaning of the placeholders.
Loading history...
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$properties'.
Loading history...
128
					<optgroup>
129
						<?php foreach ( $properties['options'] as $property => $name ) : ?>
130
						<option value="<?php echo $property; ?>" <?php echo ( $$slug == $property ? 'selected="selected"' : '' ); ?>><?php echo $name; ?></option>
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$property'.
Loading history...
Found: ==. Use strict comparisons (=== or !==).
Loading history...
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$name'.
Loading history...
131
						<?php endforeach; ?>
132
					</optgroup>
133
				</select>
134
			<?php endforeach; ?>
135
136
			<label for="<?php echo $this->get_field_id( 'infotext' ); ?>"><?php _e( 'Description', 'podlove-subscribe-button' ); ?></label>
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$this'.
Loading history...
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
137
			<textarea class="widefat" rows="10" id="<?php echo $this->get_field_id( 'infotext' ); ?>" name="<?php echo $this->get_field_name( 'infotext' ); ?>"><?php echo $infotext; ?></textarea>
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$this'.
Loading history...
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$infotext'.
Loading history...
138
		</p>
139
		<?php
140
	}
141
142
	public function update( $new_instance, $old_instance ) {
143
		$instance = array();
144
145
		foreach (self::$widget_settings as $setting) {
0 ignored issues
show
No space after opening parenthesis is prohibited
Loading history...
No space before closing parenthesis is prohibited
Loading history...
146
			$instance[$setting]  = ( ! empty( $new_instance[$setting] ) ) ? strip_tags( $new_instance[$setting] ) : '';
0 ignored issues
show
strip_tags() is discouraged. Use the more comprehensive wp_strip_all_tags() instead.
Loading history...
Array keys must be surrounded by spaces unless they contain a string or an integer.
Loading history...
147
		}
148
149
		return $instance;
150
	}
151
}
152
add_action( 'widgets_init', function(){
153
     register_widget( '\PodloveSubscribeButton\Podlove_Subscribe_Button_Widget' );
0 ignored issues
show
Found precision alignment of 1 spaces.
Loading history...
154
});
155