Completed
Branch master (f1f294)
by
unknown
62:10 queued 53:43
created
core/domain/values/Url.php 2 patches
Indentation   +193 added lines, -193 removed lines patch added patch discarded remove patch
@@ -17,197 +17,197 @@
 block discarded – undo
17 17
 class Url
18 18
 {
19 19
 
20
-    /**
21
-     * @var string $scheme
22
-     */
23
-    private $scheme;
24
-
25
-    /**
26
-     * @var string $host
27
-     */
28
-    private $host;
29
-
30
-    /**
31
-     * @var string $path
32
-     */
33
-    private $path;
34
-
35
-    /**
36
-     * @var string $query
37
-     */
38
-    private $query;
39
-
40
-    /**
41
-     * @var string $fragment
42
-     */
43
-    private $fragment;
44
-
45
-
46
-    /**
47
-     * Url constructor.
48
-     *
49
-     * @param $url
50
-     * @throws InvalidArgumentException
51
-     */
52
-    public function __construct($url)
53
-    {
54
-        if (! filter_var(
55
-            $url,
56
-            FILTER_VALIDATE_URL
57
-        )) {
58
-            throw new InvalidArgumentException(
59
-                esc_html__(
60
-                    'Invalid URL. Both the "Scheme" and "Host" are required.',
61
-                    'event_espresso'
62
-                )
63
-            );
64
-        }
65
-        $url = parse_url($url);
66
-        $this->setScheme($url);
67
-        $this->setHost($url);
68
-        $this->setPath($url);
69
-        $this->setQuery($url);
70
-        $this->setFragment($url);
71
-    }
72
-
73
-
74
-    /**
75
-     * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
76
-     * will return a string like: 'abc://'
77
-     *
78
-     * @return string
79
-     */
80
-    public function scheme()
81
-    {
82
-        return $this->scheme;
83
-    }
84
-
85
-
86
-    /**
87
-     * @param array $url
88
-     */
89
-    private function setScheme($url)
90
-    {
91
-        $this->scheme = $url['scheme'] . '://';
92
-    }
93
-
94
-
95
-    /**
96
-     * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
97
-     * will return a string like: 'example.com'
98
-     *
99
-     * @return string
100
-     */
101
-    public function host()
102
-    {
103
-        return $this->host;
104
-    }
105
-
106
-
107
-    /**
108
-     * @param array $url
109
-     */
110
-    private function setHost($url)
111
-    {
112
-        $this->host = $url['host'];
113
-    }
114
-
115
-
116
-    /**
117
-     * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
118
-     * will return a string like: '/path/data'
119
-     *
120
-     * @return string
121
-     */
122
-    public function path()
123
-    {
124
-        return $this->path;
125
-    }
126
-
127
-
128
-    /**
129
-     * @param array $url
130
-     */
131
-    private function setPath($url)
132
-    {
133
-        $this->path = isset($url['path']) ? $url['path'] : '';
134
-    }
135
-
136
-
137
-    /**
138
-     * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
139
-     * will return a string like: '?key=value'
140
-     *
141
-     * @return string
142
-     */
143
-    public function queryString()
144
-    {
145
-        return $this->query !== '' ? '?' . $this->query : '';
146
-    }
147
-
148
-
149
-    /**
150
-     * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
151
-     * will return an array like: array('key' => 'value')
152
-     *
153
-     * @return array
154
-     */
155
-    public function queryParams()
156
-    {
157
-        return wp_parse_args($this->query);
158
-    }
159
-
160
-
161
-    /**
162
-     * @param array $url
163
-     */
164
-    private function setQuery($url)
165
-    {
166
-        $this->query = isset($url['query']) ? $url['query'] : '';
167
-    }
168
-
169
-
170
-    /**
171
-     * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
172
-     * will return a string like: '#id'
173
-     *
174
-     * @return string
175
-     */
176
-    public function fragment()
177
-    {
178
-        return $this->fragment !== '' ? '#' . $this->fragment : '';
179
-    }
180
-
181
-
182
-    /**
183
-     * @param array $url
184
-     */
185
-    private function setFragment($url)
186
-    {
187
-        $this->fragment = isset($url['fragment']) ? $url['fragment'] : '';
188
-    }
189
-
190
-
191
-    /**
192
-     * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
193
-     * will return a string like: 'abc://example.com/path/data?key=value#id'
194
-     *
195
-     * @return string
196
-     */
197
-    public function getFullUrl()
198
-    {
199
-        return $this->scheme() . $this->host() . $this->path() . $this->queryString() . $this->fragment();
200
-    }
201
-
202
-
203
-    /**
204
-     * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
205
-     * will return a string like: 'abc://example.com/path/data?key=value#id'
206
-     *
207
-     * @return string
208
-     */
209
-    public function __toString()
210
-    {
211
-        return $this->getFullUrl();
212
-    }
20
+	/**
21
+	 * @var string $scheme
22
+	 */
23
+	private $scheme;
24
+
25
+	/**
26
+	 * @var string $host
27
+	 */
28
+	private $host;
29
+
30
+	/**
31
+	 * @var string $path
32
+	 */
33
+	private $path;
34
+
35
+	/**
36
+	 * @var string $query
37
+	 */
38
+	private $query;
39
+
40
+	/**
41
+	 * @var string $fragment
42
+	 */
43
+	private $fragment;
44
+
45
+
46
+	/**
47
+	 * Url constructor.
48
+	 *
49
+	 * @param $url
50
+	 * @throws InvalidArgumentException
51
+	 */
52
+	public function __construct($url)
53
+	{
54
+		if (! filter_var(
55
+			$url,
56
+			FILTER_VALIDATE_URL
57
+		)) {
58
+			throw new InvalidArgumentException(
59
+				esc_html__(
60
+					'Invalid URL. Both the "Scheme" and "Host" are required.',
61
+					'event_espresso'
62
+				)
63
+			);
64
+		}
65
+		$url = parse_url($url);
66
+		$this->setScheme($url);
67
+		$this->setHost($url);
68
+		$this->setPath($url);
69
+		$this->setQuery($url);
70
+		$this->setFragment($url);
71
+	}
72
+
73
+
74
+	/**
75
+	 * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
76
+	 * will return a string like: 'abc://'
77
+	 *
78
+	 * @return string
79
+	 */
80
+	public function scheme()
81
+	{
82
+		return $this->scheme;
83
+	}
84
+
85
+
86
+	/**
87
+	 * @param array $url
88
+	 */
89
+	private function setScheme($url)
90
+	{
91
+		$this->scheme = $url['scheme'] . '://';
92
+	}
93
+
94
+
95
+	/**
96
+	 * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
97
+	 * will return a string like: 'example.com'
98
+	 *
99
+	 * @return string
100
+	 */
101
+	public function host()
102
+	{
103
+		return $this->host;
104
+	}
105
+
106
+
107
+	/**
108
+	 * @param array $url
109
+	 */
110
+	private function setHost($url)
111
+	{
112
+		$this->host = $url['host'];
113
+	}
114
+
115
+
116
+	/**
117
+	 * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
118
+	 * will return a string like: '/path/data'
119
+	 *
120
+	 * @return string
121
+	 */
122
+	public function path()
123
+	{
124
+		return $this->path;
125
+	}
126
+
127
+
128
+	/**
129
+	 * @param array $url
130
+	 */
131
+	private function setPath($url)
132
+	{
133
+		$this->path = isset($url['path']) ? $url['path'] : '';
134
+	}
135
+
136
+
137
+	/**
138
+	 * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
139
+	 * will return a string like: '?key=value'
140
+	 *
141
+	 * @return string
142
+	 */
143
+	public function queryString()
144
+	{
145
+		return $this->query !== '' ? '?' . $this->query : '';
146
+	}
147
+
148
+
149
+	/**
150
+	 * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
151
+	 * will return an array like: array('key' => 'value')
152
+	 *
153
+	 * @return array
154
+	 */
155
+	public function queryParams()
156
+	{
157
+		return wp_parse_args($this->query);
158
+	}
159
+
160
+
161
+	/**
162
+	 * @param array $url
163
+	 */
164
+	private function setQuery($url)
165
+	{
166
+		$this->query = isset($url['query']) ? $url['query'] : '';
167
+	}
168
+
169
+
170
+	/**
171
+	 * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
172
+	 * will return a string like: '#id'
173
+	 *
174
+	 * @return string
175
+	 */
176
+	public function fragment()
177
+	{
178
+		return $this->fragment !== '' ? '#' . $this->fragment : '';
179
+	}
180
+
181
+
182
+	/**
183
+	 * @param array $url
184
+	 */
185
+	private function setFragment($url)
186
+	{
187
+		$this->fragment = isset($url['fragment']) ? $url['fragment'] : '';
188
+	}
189
+
190
+
191
+	/**
192
+	 * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
193
+	 * will return a string like: 'abc://example.com/path/data?key=value#id'
194
+	 *
195
+	 * @return string
196
+	 */
197
+	public function getFullUrl()
198
+	{
199
+		return $this->scheme() . $this->host() . $this->path() . $this->queryString() . $this->fragment();
200
+	}
201
+
202
+
203
+	/**
204
+	 * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
205
+	 * will return a string like: 'abc://example.com/path/data?key=value#id'
206
+	 *
207
+	 * @return string
208
+	 */
209
+	public function __toString()
210
+	{
211
+		return $this->getFullUrl();
212
+	}
213 213
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      */
52 52
     public function __construct($url)
53 53
     {
54
-        if (! filter_var(
54
+        if ( ! filter_var(
55 55
             $url,
56 56
             FILTER_VALIDATE_URL
57 57
         )) {
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      */
89 89
     private function setScheme($url)
90 90
     {
91
-        $this->scheme = $url['scheme'] . '://';
91
+        $this->scheme = $url['scheme'].'://';
92 92
     }
93 93
 
94 94
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      */
143 143
     public function queryString()
144 144
     {
145
-        return $this->query !== '' ? '?' . $this->query : '';
145
+        return $this->query !== '' ? '?'.$this->query : '';
146 146
     }
147 147
 
148 148
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      */
176 176
     public function fragment()
177 177
     {
178
-        return $this->fragment !== '' ? '#' . $this->fragment : '';
178
+        return $this->fragment !== '' ? '#'.$this->fragment : '';
179 179
     }
180 180
 
181 181
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
      */
197 197
     public function getFullUrl()
198 198
     {
199
-        return $this->scheme() . $this->host() . $this->path() . $this->queryString() . $this->fragment();
199
+        return $this->scheme().$this->host().$this->path().$this->queryString().$this->fragment();
200 200
     }
201 201
 
202 202
 
Please login to merge, or discard this patch.
espresso.php 1 patch
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -38,103 +38,103 @@
 block discarded – undo
38 38
  * @since           4.0
39 39
  */
40 40
 if (function_exists('espresso_version')) {
41
-    if (! function_exists('espresso_duplicate_plugin_error')) {
42
-        /**
43
-         *    espresso_duplicate_plugin_error
44
-         *    displays if more than one version of EE is activated at the same time
45
-         */
46
-        function espresso_duplicate_plugin_error()
47
-        {
48
-            ?>
41
+	if (! function_exists('espresso_duplicate_plugin_error')) {
42
+		/**
43
+		 *    espresso_duplicate_plugin_error
44
+		 *    displays if more than one version of EE is activated at the same time
45
+		 */
46
+		function espresso_duplicate_plugin_error()
47
+		{
48
+			?>
49 49
             <div class="error">
50 50
                 <p>
51 51
                     <?php
52
-                    echo esc_html__(
53
-                        'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
-                        'event_espresso'
55
-                    ); ?>
52
+					echo esc_html__(
53
+						'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
+						'event_espresso'
55
+					); ?>
56 56
                 </p>
57 57
             </div>
58 58
             <?php
59
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
60
-        }
61
-    }
62
-    add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
59
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
60
+		}
61
+	}
62
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
63 63
 } else {
64
-    define('EE_MIN_PHP_VER_REQUIRED', '5.6.2');
65
-    if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
-        /**
67
-         * espresso_minimum_php_version_error
68
-         *
69
-         * @return void
70
-         */
71
-        function espresso_minimum_php_version_error()
72
-        {
73
-            ?>
64
+	define('EE_MIN_PHP_VER_REQUIRED', '5.6.2');
65
+	if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
+		/**
67
+		 * espresso_minimum_php_version_error
68
+		 *
69
+		 * @return void
70
+		 */
71
+		function espresso_minimum_php_version_error()
72
+		{
73
+			?>
74 74
             <div class="error">
75 75
                 <p>
76 76
                     <?php
77
-                    printf(
78
-                        esc_html__(
79
-                            'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
-                            'event_espresso'
81
-                        ),
82
-                        EE_MIN_PHP_VER_REQUIRED,
83
-                        PHP_VERSION,
84
-                        '<br/>',
85
-                        '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
-                    );
87
-                    ?>
77
+					printf(
78
+						esc_html__(
79
+							'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
+							'event_espresso'
81
+						),
82
+						EE_MIN_PHP_VER_REQUIRED,
83
+						PHP_VERSION,
84
+						'<br/>',
85
+						'<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
+					);
87
+					?>
88 88
                 </p>
89 89
             </div>
90 90
             <?php
91
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
92
-        }
91
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
92
+		}
93 93
 
94
-        add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
-    } else {
96
-        define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
97
-        /**
98
-         * espresso_version
99
-         * Returns the plugin version
100
-         *
101
-         * @return string
102
-         */
103
-        function espresso_version()
104
-        {
105
-            return apply_filters('FHEE__espresso__espresso_version', '4.10.12.rc.006');
106
-        }
94
+		add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
+	} else {
96
+		define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
97
+		/**
98
+		 * espresso_version
99
+		 * Returns the plugin version
100
+		 *
101
+		 * @return string
102
+		 */
103
+		function espresso_version()
104
+		{
105
+			return apply_filters('FHEE__espresso__espresso_version', '4.10.12.rc.006');
106
+		}
107 107
 
108
-        /**
109
-         * espresso_plugin_activation
110
-         * adds a wp-option to indicate that EE has been activated via the WP admin plugins page
111
-         */
112
-        function espresso_plugin_activation()
113
-        {
114
-            update_option('ee_espresso_activation', true);
115
-        }
108
+		/**
109
+		 * espresso_plugin_activation
110
+		 * adds a wp-option to indicate that EE has been activated via the WP admin plugins page
111
+		 */
112
+		function espresso_plugin_activation()
113
+		{
114
+			update_option('ee_espresso_activation', true);
115
+		}
116 116
 
117
-        register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
117
+		register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
118 118
 
119
-        require_once __DIR__ . '/core/bootstrap_espresso.php';
120
-        bootstrap_espresso();
121
-    }
119
+		require_once __DIR__ . '/core/bootstrap_espresso.php';
120
+		bootstrap_espresso();
121
+	}
122 122
 }
123 123
 if (! function_exists('espresso_deactivate_plugin')) {
124
-    /**
125
-     *    deactivate_plugin
126
-     * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
127
-     *
128
-     * @access public
129
-     * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
130
-     * @return    void
131
-     */
132
-    function espresso_deactivate_plugin($plugin_basename = '')
133
-    {
134
-        if (! function_exists('deactivate_plugins')) {
135
-            require_once ABSPATH . 'wp-admin/includes/plugin.php';
136
-        }
137
-        unset($_GET['activate'], $_REQUEST['activate']);
138
-        deactivate_plugins($plugin_basename);
139
-    }
124
+	/**
125
+	 *    deactivate_plugin
126
+	 * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
127
+	 *
128
+	 * @access public
129
+	 * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
130
+	 * @return    void
131
+	 */
132
+	function espresso_deactivate_plugin($plugin_basename = '')
133
+	{
134
+		if (! function_exists('deactivate_plugins')) {
135
+			require_once ABSPATH . 'wp-admin/includes/plugin.php';
136
+		}
137
+		unset($_GET['activate'], $_REQUEST['activate']);
138
+		deactivate_plugins($plugin_basename);
139
+	}
140 140
 }
Please login to merge, or discard this patch.