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.
Passed
Push — master ( 33ed65...dc0f35 )
by Christian
02:27
created

inc/Setup.php (4 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
class Setup {
12
13
	public static function activation( $network_wide ) {
14
		if ( is_multisite() ) {
15
			self::activate_for_network( $network_wide );
16
		} else {
17
			self::activate_for_current_blog();
18
		}
19
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
20
21
	public static function activate_for_current_blog() {
22
23
		// Build Databases
24
		Model\Button::build();
25
26
		$default_values = Defaults::options();
27
28
		foreach ( $default_values as $option => $default_value ) {
29
			if ( ! get_option( 'podlove_subscribe_button_default_' . $option ) ) {
30
				update_option( 'podlove_subscribe_button_default_' . $option, $default_value );
31
			}
32
		}
33
34
	}
35
36
	public static function activate_for_network( $network_wide ) {
0 ignored issues
show
Method name "Setup::activate_for_network" is not in camel caps format
Loading history...
Coding Style Documentation introduced by
Missing doc comment for function activate_for_network()
Loading history...
37
38
		Model\NetworkButton::build();
39
40
		if ( $network_wide ) {
41
			global $wpdb;
42
43
			set_time_limit( 0 ); // may take a while, depending on network size
44
			$blogids = $wpdb->get_col( "SELECT blog_id FROM " . $wpdb->blogs );
45
			foreach ( $blogids as $blog_id ) {
46
				switch_to_blog( $blog_id );
47
				self::activate_for_current_blog();
48
			}
49
		} else {
50
			self::activate_for_current_blog();
51
		}
52
53
	}
54
55
	public static function deactivation( $network_wide ) {
56
57
	}
58
59
	public static function uninstall() {
60
		if ( is_multisite() ) {
61
			self::uninstall_for_network();
62
		} else {
63
			self::uninstall_for_current_blog();
64
		}
65
	}
66
67
	public static function uninstall_for_network() {
68
69
		global $wpdb;
70
71
		Model\NetworkButton::destroy();
72
73
		$current_blog = $wpdb->blogid;
74
		$blogids      = $wpdb->get_col( "SELECT blog_id FROM " . $wpdb->blogs );
75
76
		foreach ( $blogids as $blog_id ) {
77
			switch_to_blog( $blog_id );
78
			self::uninstall_for_current_blog();
79
		}
80
81
		switch_to_blog( $current_blog );
82
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
83
84
	public static function uninstall_for_current_blog() {
85
86
		// remove DB tables
87
		Model\Button::destroy();
88
89
		$options = array(
90
			/** 1.4+ */
91
			'podlove_subscribe_button_defaults',
92
			'widget_podlove_subscribe_button_wp_plugin_widget',
93
			/** 1.3.x */
94
			'podlove_subscribe_button_default_size',
95
			'podlove_subscribe_button_default_autowidth',
96
			'podlove_subscribe_button_default_color',
97
			'podlove_subscribe_button_default_style',
98
			'podlove_subscribe_button_default_format',
99
			'podlove_subscribe_button_default_language',
100
			'podlove_subscribe_button_plugin_database_version',
101
		);
102
103
		foreach ( $options as $option ) {
104
			delete_option( $option );
105
		}
106
107
	}
108
109
} // END class
110