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 ( fc808e...eee123 )
by Christian
10s
created

settings/buttons_list_table.php (5 issues)

1
<?php
2
/**
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
if ( ! class_exists( 'WP_List_Table' ) ) {
12
    require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
13
}
14
15
class Button_List_Table extends \WP_List_Table {
16
17
	public function __construct() {
18
19
		global $status, $page;
20
21
		// Set parent defaults
22
		parent::__construct( array(
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
23
			'singular' => 'feed', // singular name of the listed records
24
			'plural'   => 'feeds', // plural name of the listed records
25
			'ajax'     => false,  // does this table support ajax?
26
		) );
0 ignored issues
show
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
27
28
	}
29
30
	public function column_name( $button ) {
31
32
		$actions = array(
33
			'edit'   => Settings\Buttons::get_action_link( $button, __( 'Edit', 'podlove-subscribe-button' ), 'edit' ),
34
			'delete' => Settings\Buttons::get_action_link( $button, __( 'Delete', 'podlove-subscribe-button' ), 'confirm_delete' )
35
		);
36
37
		return sprintf( '%1$s %2$s',
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
38
		    /*$1%s*/ $button->title . '<br><code>[podlove-subscribe-button button="' . $button->name . '"]</code>',
39
		    /*$3%s*/ $this->row_actions( $actions )
40
		);
41
42
	}
43
44
	public function column_button_preview( $button ) {
45
46
		if ( ! $button->feeds ) {
47
			return '<code>' . __( 'No preview. Please set a feed.', 'podlove-subscribe-button' ) . '</code>';
48
		} else {
49
50
			$preview  = "<div class='podlove-button-preview-container'>";
51
			$preview .= $button->render(
52
				'big',
53
				'false',
54
				get_option( 'podlove_subscribe_button_default_style', 'filled' ),
55
				'rectangle'
56
			);
57
			$preview .= "</div>";
58
59
			return $preview;
60
61
		}
62
63
	}
64
65
	public function column_id( $button ) {
66
		return $button->id;
67
	}
68
69
	public function get_columns() {
70
		return array(
71
			'name'           => __( 'Title & Shortcode', 'podlove-subscribe-button' ),
72
			'button_preview' => __( 'Preview', 'podlove-subscribe-button' ),
73
		);
74
	}
75
76
	public function prepare_items() {
77
78
		// number of items per page
79
		$per_page = 1000;
80
81
		// define column headers
82
		$columns = $this->get_columns();
83
		$hidden = array();
84
		$sortable = $this->get_sortable_columns();
85
		$this->_column_headers = array( $columns, $hidden, $sortable );
86
87
		// retrieve data
88
		// TODO select data for current page only
89
		$data = ( is_network_admin() ? \PodloveSubscribeButton\Model\NetworkButton::all() : \PodloveSubscribeButton\Model\Button::all() );
90
91
		// get current page
92
		$current_page = $this->get_pagenum();
93
		// get total items
94
		$total_items = count( $data );
95
		// extrage page for current page only
96
		$data = array_slice( $data, ( ( $current_page - 1 ) * $per_page ), $per_page );
97
		// add items to table
98
		$this->items = $data;
99
100
		// register pagination options & calculations
101
		$this->set_pagination_args( array(
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
102
			'total_items' => $total_items,
103
			'per_page'    => $per_page,
104
			'total_pages' => ceil( $total_items / $per_page ),
105
		) );
0 ignored issues
show
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
106
107
	}
108
109
} // END class
110