@@ -82,54 +82,54 @@ discard block |
||
82 | 82 | * @param string $requested_url The URL which the cookie was set on, used for default $domain |
83 | 83 | * and $port values. |
84 | 84 | */ |
85 | - public function __construct( $data, $requested_url = '' ) { |
|
86 | - if ( $requested_url ) |
|
87 | - $arrURL = @parse_url( $requested_url ); |
|
88 | - if ( isset( $arrURL['host'] ) ) |
|
85 | + public function __construct($data, $requested_url = '') { |
|
86 | + if ($requested_url) |
|
87 | + $arrURL = @parse_url($requested_url); |
|
88 | + if (isset($arrURL['host'])) |
|
89 | 89 | $this->domain = $arrURL['host']; |
90 | - $this->path = isset( $arrURL['path'] ) ? $arrURL['path'] : '/'; |
|
91 | - if ( '/' != substr( $this->path, -1 ) ) |
|
92 | - $this->path = dirname( $this->path ) . '/'; |
|
90 | + $this->path = isset($arrURL['path']) ? $arrURL['path'] : '/'; |
|
91 | + if ('/' != substr($this->path, -1)) |
|
92 | + $this->path = dirname($this->path).'/'; |
|
93 | 93 | |
94 | - if ( is_string( $data ) ) { |
|
94 | + if (is_string($data)) { |
|
95 | 95 | // Assume it's a header string direct from a previous request. |
96 | - $pairs = explode( ';', $data ); |
|
96 | + $pairs = explode(';', $data); |
|
97 | 97 | |
98 | 98 | // Special handling for first pair; name=value. Also be careful of "=" in value. |
99 | - $name = trim( substr( $pairs[0], 0, strpos( $pairs[0], '=' ) ) ); |
|
100 | - $value = substr( $pairs[0], strpos( $pairs[0], '=' ) + 1 ); |
|
99 | + $name = trim(substr($pairs[0], 0, strpos($pairs[0], '='))); |
|
100 | + $value = substr($pairs[0], strpos($pairs[0], '=') + 1); |
|
101 | 101 | $this->name = $name; |
102 | - $this->value = urldecode( $value ); |
|
102 | + $this->value = urldecode($value); |
|
103 | 103 | |
104 | 104 | // Removes name=value from items. |
105 | - array_shift( $pairs ); |
|
105 | + array_shift($pairs); |
|
106 | 106 | |
107 | 107 | // Set everything else as a property. |
108 | - foreach ( $pairs as $pair ) { |
|
108 | + foreach ($pairs as $pair) { |
|
109 | 109 | $pair = rtrim($pair); |
110 | 110 | |
111 | 111 | // Handle the cookie ending in ; which results in a empty final pair. |
112 | - if ( empty($pair) ) |
|
112 | + if (empty($pair)) |
|
113 | 113 | continue; |
114 | 114 | |
115 | - list( $key, $val ) = strpos( $pair, '=' ) ? explode( '=', $pair ) : array( $pair, '' ); |
|
116 | - $key = strtolower( trim( $key ) ); |
|
117 | - if ( 'expires' == $key ) |
|
118 | - $val = strtotime( $val ); |
|
115 | + list($key, $val) = strpos($pair, '=') ? explode('=', $pair) : array($pair, ''); |
|
116 | + $key = strtolower(trim($key)); |
|
117 | + if ('expires' == $key) |
|
118 | + $val = strtotime($val); |
|
119 | 119 | $this->$key = $val; |
120 | 120 | } |
121 | 121 | } else { |
122 | - if ( !isset( $data['name'] ) ) |
|
122 | + if ( ! isset($data['name'])) |
|
123 | 123 | return; |
124 | 124 | |
125 | 125 | // Set properties based directly on parameters. |
126 | - foreach ( array( 'name', 'value', 'path', 'domain', 'port' ) as $field ) { |
|
127 | - if ( isset( $data[ $field ] ) ) |
|
128 | - $this->$field = $data[ $field ]; |
|
126 | + foreach (array('name', 'value', 'path', 'domain', 'port') as $field) { |
|
127 | + if (isset($data[$field])) |
|
128 | + $this->$field = $data[$field]; |
|
129 | 129 | } |
130 | 130 | |
131 | - if ( isset( $data['expires'] ) ) |
|
132 | - $this->expires = is_int( $data['expires'] ) ? $data['expires'] : strtotime( $data['expires'] ); |
|
131 | + if (isset($data['expires'])) |
|
132 | + $this->expires = is_int($data['expires']) ? $data['expires'] : strtotime($data['expires']); |
|
133 | 133 | else |
134 | 134 | $this->expires = null; |
135 | 135 | } |
@@ -146,37 +146,37 @@ discard block |
||
146 | 146 | * @param string $url URL you intend to send this cookie to |
147 | 147 | * @return bool true if allowed, false otherwise. |
148 | 148 | */ |
149 | - public function test( $url ) { |
|
150 | - if ( is_null( $this->name ) ) |
|
149 | + public function test($url) { |
|
150 | + if (is_null($this->name)) |
|
151 | 151 | return false; |
152 | 152 | |
153 | 153 | // Expires - if expired then nothing else matters. |
154 | - if ( isset( $this->expires ) && time() > $this->expires ) |
|
154 | + if (isset($this->expires) && time() > $this->expires) |
|
155 | 155 | return false; |
156 | 156 | |
157 | 157 | // Get details on the URL we're thinking about sending to. |
158 | - $url = parse_url( $url ); |
|
159 | - $url['port'] = isset( $url['port'] ) ? $url['port'] : ( 'https' == $url['scheme'] ? 443 : 80 ); |
|
160 | - $url['path'] = isset( $url['path'] ) ? $url['path'] : '/'; |
|
158 | + $url = parse_url($url); |
|
159 | + $url['port'] = isset($url['port']) ? $url['port'] : ('https' == $url['scheme'] ? 443 : 80); |
|
160 | + $url['path'] = isset($url['path']) ? $url['path'] : '/'; |
|
161 | 161 | |
162 | 162 | // Values to use for comparison against the URL. |
163 | - $path = isset( $this->path ) ? $this->path : '/'; |
|
164 | - $port = isset( $this->port ) ? $this->port : null; |
|
165 | - $domain = isset( $this->domain ) ? strtolower( $this->domain ) : strtolower( $url['host'] ); |
|
166 | - if ( false === stripos( $domain, '.' ) ) |
|
163 | + $path = isset($this->path) ? $this->path : '/'; |
|
164 | + $port = isset($this->port) ? $this->port : null; |
|
165 | + $domain = isset($this->domain) ? strtolower($this->domain) : strtolower($url['host']); |
|
166 | + if (false === stripos($domain, '.')) |
|
167 | 167 | $domain .= '.local'; |
168 | 168 | |
169 | 169 | // Host - very basic check that the request URL ends with the domain restriction (minus leading dot). |
170 | - $domain = substr( $domain, 0, 1 ) == '.' ? substr( $domain, 1 ) : $domain; |
|
171 | - if ( substr( $url['host'], -strlen( $domain ) ) != $domain ) |
|
170 | + $domain = substr($domain, 0, 1) == '.' ? substr($domain, 1) : $domain; |
|
171 | + if (substr($url['host'], -strlen($domain)) != $domain) |
|
172 | 172 | return false; |
173 | 173 | |
174 | 174 | // Port - supports "port-lists" in the format: "80,8000,8080". |
175 | - if ( !empty( $port ) && !in_array( $url['port'], explode( ',', $port) ) ) |
|
175 | + if ( ! empty($port) && ! in_array($url['port'], explode(',', $port))) |
|
176 | 176 | return false; |
177 | 177 | |
178 | 178 | // Path - request path must start with path restriction. |
179 | - if ( substr( $url['path'], 0, strlen( $path ) ) != $path ) |
|
179 | + if (substr($url['path'], 0, strlen($path)) != $path) |
|
180 | 180 | return false; |
181 | 181 | |
182 | 182 | return true; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * @return string Header encoded cookie name and value. |
192 | 192 | */ |
193 | 193 | public function getHeaderValue() { |
194 | - if ( ! isset( $this->name ) || ! isset( $this->value ) ) |
|
194 | + if ( ! isset($this->name) || ! isset($this->value)) |
|
195 | 195 | return ''; |
196 | 196 | |
197 | 197 | /** |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @param string $value The cookie value. |
203 | 203 | * @param string $name The cookie name. |
204 | 204 | */ |
205 | - return $this->name . '=' . apply_filters( 'wp_http_cookie_value', $this->value, $this->name ); |
|
205 | + return $this->name.'='.apply_filters('wp_http_cookie_value', $this->value, $this->name); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
@@ -214,6 +214,6 @@ discard block |
||
214 | 214 | * @return string |
215 | 215 | */ |
216 | 216 | public function getFullHeader() { |
217 | - return 'Cookie: ' . $this->getHeaderValue(); |
|
217 | + return 'Cookie: '.$this->getHeaderValue(); |
|
218 | 218 | } |
219 | 219 | } |
@@ -83,13 +83,16 @@ discard block |
||
83 | 83 | * and $port values. |
84 | 84 | */ |
85 | 85 | public function __construct( $data, $requested_url = '' ) { |
86 | - if ( $requested_url ) |
|
87 | - $arrURL = @parse_url( $requested_url ); |
|
88 | - if ( isset( $arrURL['host'] ) ) |
|
89 | - $this->domain = $arrURL['host']; |
|
86 | + if ( $requested_url ) { |
|
87 | + $arrURL = @parse_url( $requested_url ); |
|
88 | + } |
|
89 | + if ( isset( $arrURL['host'] ) ) { |
|
90 | + $this->domain = $arrURL['host']; |
|
91 | + } |
|
90 | 92 | $this->path = isset( $arrURL['path'] ) ? $arrURL['path'] : '/'; |
91 | - if ( '/' != substr( $this->path, -1 ) ) |
|
92 | - $this->path = dirname( $this->path ) . '/'; |
|
93 | + if ( '/' != substr( $this->path, -1 ) ) { |
|
94 | + $this->path = dirname( $this->path ) . '/'; |
|
95 | + } |
|
93 | 96 | |
94 | 97 | if ( is_string( $data ) ) { |
95 | 98 | // Assume it's a header string direct from a previous request. |
@@ -109,29 +112,34 @@ discard block |
||
109 | 112 | $pair = rtrim($pair); |
110 | 113 | |
111 | 114 | // Handle the cookie ending in ; which results in a empty final pair. |
112 | - if ( empty($pair) ) |
|
113 | - continue; |
|
115 | + if ( empty($pair) ) { |
|
116 | + continue; |
|
117 | + } |
|
114 | 118 | |
115 | 119 | list( $key, $val ) = strpos( $pair, '=' ) ? explode( '=', $pair ) : array( $pair, '' ); |
116 | 120 | $key = strtolower( trim( $key ) ); |
117 | - if ( 'expires' == $key ) |
|
118 | - $val = strtotime( $val ); |
|
121 | + if ( 'expires' == $key ) { |
|
122 | + $val = strtotime( $val ); |
|
123 | + } |
|
119 | 124 | $this->$key = $val; |
120 | 125 | } |
121 | 126 | } else { |
122 | - if ( !isset( $data['name'] ) ) |
|
123 | - return; |
|
127 | + if ( !isset( $data['name'] ) ) { |
|
128 | + return; |
|
129 | + } |
|
124 | 130 | |
125 | 131 | // Set properties based directly on parameters. |
126 | 132 | foreach ( array( 'name', 'value', 'path', 'domain', 'port' ) as $field ) { |
127 | - if ( isset( $data[ $field ] ) ) |
|
128 | - $this->$field = $data[ $field ]; |
|
133 | + if ( isset( $data[ $field ] ) ) { |
|
134 | + $this->$field = $data[ $field ]; |
|
135 | + } |
|
129 | 136 | } |
130 | 137 | |
131 | - if ( isset( $data['expires'] ) ) |
|
132 | - $this->expires = is_int( $data['expires'] ) ? $data['expires'] : strtotime( $data['expires'] ); |
|
133 | - else |
|
134 | - $this->expires = null; |
|
138 | + if ( isset( $data['expires'] ) ) { |
|
139 | + $this->expires = is_int( $data['expires'] ) ? $data['expires'] : strtotime( $data['expires'] ); |
|
140 | + } else { |
|
141 | + $this->expires = null; |
|
142 | + } |
|
135 | 143 | } |
136 | 144 | } |
137 | 145 | |
@@ -147,12 +155,14 @@ discard block |
||
147 | 155 | * @return bool true if allowed, false otherwise. |
148 | 156 | */ |
149 | 157 | public function test( $url ) { |
150 | - if ( is_null( $this->name ) ) |
|
151 | - return false; |
|
158 | + if ( is_null( $this->name ) ) { |
|
159 | + return false; |
|
160 | + } |
|
152 | 161 | |
153 | 162 | // Expires - if expired then nothing else matters. |
154 | - if ( isset( $this->expires ) && time() > $this->expires ) |
|
155 | - return false; |
|
163 | + if ( isset( $this->expires ) && time() > $this->expires ) { |
|
164 | + return false; |
|
165 | + } |
|
156 | 166 | |
157 | 167 | // Get details on the URL we're thinking about sending to. |
158 | 168 | $url = parse_url( $url ); |
@@ -163,21 +173,25 @@ discard block |
||
163 | 173 | $path = isset( $this->path ) ? $this->path : '/'; |
164 | 174 | $port = isset( $this->port ) ? $this->port : null; |
165 | 175 | $domain = isset( $this->domain ) ? strtolower( $this->domain ) : strtolower( $url['host'] ); |
166 | - if ( false === stripos( $domain, '.' ) ) |
|
167 | - $domain .= '.local'; |
|
176 | + if ( false === stripos( $domain, '.' ) ) { |
|
177 | + $domain .= '.local'; |
|
178 | + } |
|
168 | 179 | |
169 | 180 | // Host - very basic check that the request URL ends with the domain restriction (minus leading dot). |
170 | 181 | $domain = substr( $domain, 0, 1 ) == '.' ? substr( $domain, 1 ) : $domain; |
171 | - if ( substr( $url['host'], -strlen( $domain ) ) != $domain ) |
|
172 | - return false; |
|
182 | + if ( substr( $url['host'], -strlen( $domain ) ) != $domain ) { |
|
183 | + return false; |
|
184 | + } |
|
173 | 185 | |
174 | 186 | // Port - supports "port-lists" in the format: "80,8000,8080". |
175 | - if ( !empty( $port ) && !in_array( $url['port'], explode( ',', $port) ) ) |
|
176 | - return false; |
|
187 | + if ( !empty( $port ) && !in_array( $url['port'], explode( ',', $port) ) ) { |
|
188 | + return false; |
|
189 | + } |
|
177 | 190 | |
178 | 191 | // Path - request path must start with path restriction. |
179 | - if ( substr( $url['path'], 0, strlen( $path ) ) != $path ) |
|
180 | - return false; |
|
192 | + if ( substr( $url['path'], 0, strlen( $path ) ) != $path ) { |
|
193 | + return false; |
|
194 | + } |
|
181 | 195 | |
182 | 196 | return true; |
183 | 197 | } |
@@ -191,8 +205,9 @@ discard block |
||
191 | 205 | * @return string Header encoded cookie name and value. |
192 | 206 | */ |
193 | 207 | public function getHeaderValue() { |
194 | - if ( ! isset( $this->name ) || ! isset( $this->value ) ) |
|
195 | - return ''; |
|
208 | + if ( ! isset( $this->name ) || ! isset( $this->value ) ) { |
|
209 | + return ''; |
|
210 | + } |
|
196 | 211 | |
197 | 212 | /** |
198 | 213 | * Filter the header-encoded cookie value. |
@@ -29,12 +29,12 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @param int $maxwidth Maximum allowed width. Default 600. |
31 | 31 | */ |
32 | - $maxwidth = apply_filters( 'oembed_default_width', 600 ); |
|
32 | + $maxwidth = apply_filters('oembed_default_width', 600); |
|
33 | 33 | |
34 | - register_rest_route( 'oembed/1.0', '/embed', array( |
|
34 | + register_rest_route('oembed/1.0', '/embed', array( |
|
35 | 35 | array( |
36 | 36 | 'methods' => WP_REST_Server::READABLE, |
37 | - 'callback' => array( $this, 'get_item' ), |
|
37 | + 'callback' => array($this, 'get_item'), |
|
38 | 38 | 'args' => array( |
39 | 39 | 'url' => array( |
40 | 40 | 'required' => true, |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | ), |
51 | 51 | ), |
52 | 52 | ), |
53 | - ) ); |
|
53 | + )); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | * @param WP_REST_Request $request Full data about the request. |
64 | 64 | * @return WP_Error|array oEmbed response data or WP_Error on failure. |
65 | 65 | */ |
66 | - public function get_item( $request ) { |
|
67 | - $post_id = url_to_postid( $request['url'] ); |
|
66 | + public function get_item($request) { |
|
67 | + $post_id = url_to_postid($request['url']); |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Filter the determined post ID. |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | * @param int $post_id The post ID. |
75 | 75 | * @param string $url The requested URL. |
76 | 76 | */ |
77 | - $post_id = apply_filters( 'oembed_request_post_id', $post_id, $request['url'] ); |
|
77 | + $post_id = apply_filters('oembed_request_post_id', $post_id, $request['url']); |
|
78 | 78 | |
79 | - $data = get_oembed_response_data( $post_id, $request['maxwidth'] ); |
|
79 | + $data = get_oembed_response_data($post_id, $request['maxwidth']); |
|
80 | 80 | |
81 | - if ( ! $data ) { |
|
82 | - return new WP_Error( 'oembed_invalid_url', get_status_header_desc( 404 ), array( 'status' => 404 ) ); |
|
81 | + if ( ! $data) { |
|
82 | + return new WP_Error('oembed_invalid_url', get_status_header_desc(404), array('status' => 404)); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | return $data; |
@@ -151,32 +151,32 @@ discard block |
||
151 | 151 | * @type array|string $settings All settings IDs tied to the partial. If undefined, `$id` will be used. |
152 | 152 | * } |
153 | 153 | */ |
154 | - public function __construct( WP_Customize_Selective_Refresh $component, $id, $args = array() ) { |
|
155 | - $keys = array_keys( get_object_vars( $this ) ); |
|
156 | - foreach ( $keys as $key ) { |
|
157 | - if ( isset( $args[ $key ] ) ) { |
|
158 | - $this->$key = $args[ $key ]; |
|
154 | + public function __construct(WP_Customize_Selective_Refresh $component, $id, $args = array()) { |
|
155 | + $keys = array_keys(get_object_vars($this)); |
|
156 | + foreach ($keys as $key) { |
|
157 | + if (isset($args[$key])) { |
|
158 | + $this->$key = $args[$key]; |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
162 | 162 | $this->component = $component; |
163 | 163 | $this->id = $id; |
164 | - $this->id_data['keys'] = preg_split( '/\[/', str_replace( ']', '', $this->id ) ); |
|
165 | - $this->id_data['base'] = array_shift( $this->id_data['keys'] ); |
|
164 | + $this->id_data['keys'] = preg_split('/\[/', str_replace(']', '', $this->id)); |
|
165 | + $this->id_data['base'] = array_shift($this->id_data['keys']); |
|
166 | 166 | |
167 | - if ( empty( $this->render_callback ) ) { |
|
168 | - $this->render_callback = array( $this, 'render_callback' ); |
|
167 | + if (empty($this->render_callback)) { |
|
168 | + $this->render_callback = array($this, 'render_callback'); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | // Process settings. |
172 | - if ( ! isset( $this->settings ) ) { |
|
173 | - $this->settings = array( $id ); |
|
174 | - } else if ( is_string( $this->settings ) ) { |
|
175 | - $this->settings = array( $this->settings ); |
|
172 | + if ( ! isset($this->settings)) { |
|
173 | + $this->settings = array($id); |
|
174 | + } else if (is_string($this->settings)) { |
|
175 | + $this->settings = array($this->settings); |
|
176 | 176 | } |
177 | 177 | |
178 | - if ( empty( $this->primary_setting ) ) { |
|
179 | - $this->primary_setting = current( $this->settings ); |
|
178 | + if (empty($this->primary_setting)) { |
|
179 | + $this->primary_setting = current($this->settings); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | |
@@ -208,17 +208,17 @@ discard block |
||
208 | 208 | * @return string|array|false The rendered partial as a string, raw data array (for client-side JS template), |
209 | 209 | * or false if no render applied. |
210 | 210 | */ |
211 | - final public function render( $container_context = array() ) { |
|
211 | + final public function render($container_context = array()) { |
|
212 | 212 | $partial = $this; |
213 | 213 | $rendered = false; |
214 | 214 | |
215 | - if ( ! empty( $this->render_callback ) ) { |
|
215 | + if ( ! empty($this->render_callback)) { |
|
216 | 216 | ob_start(); |
217 | - $return_render = call_user_func( $this->render_callback, $this, $container_context ); |
|
217 | + $return_render = call_user_func($this->render_callback, $this, $container_context); |
|
218 | 218 | $ob_render = ob_get_clean(); |
219 | 219 | |
220 | - if ( null !== $return_render && '' !== $ob_render ) { |
|
221 | - _doing_it_wrong( __FUNCTION__, __( 'Partial render must echo the content or return the content string (or array), but not both.' ), '4.5.0' ); |
|
220 | + if (null !== $return_render && '' !== $ob_render) { |
|
221 | + _doing_it_wrong(__FUNCTION__, __('Partial render must echo the content or return the content string (or array), but not both.'), '4.5.0'); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | /* |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * @param array $container_context Optional array of context data associated with |
239 | 239 | * the target container. |
240 | 240 | */ |
241 | - $rendered = apply_filters( 'customize_partial_render', $rendered, $partial, $container_context ); |
|
241 | + $rendered = apply_filters('customize_partial_render', $rendered, $partial, $container_context); |
|
242 | 242 | |
243 | 243 | /** |
244 | 244 | * Filters partial rendering for a specific partial. |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * @param array $container_context Optional array of context data associated with |
253 | 253 | * the target container. |
254 | 254 | */ |
255 | - $rendered = apply_filters( "customize_partial_render_{$partial->id}", $rendered, $partial, $container_context ); |
|
255 | + $rendered = apply_filters("customize_partial_render_{$partial->id}", $rendered, $partial, $container_context); |
|
256 | 256 | |
257 | 257 | return $rendered; |
258 | 258 | } |
@@ -276,8 +276,8 @@ discard block |
||
276 | 276 | * @param array $context Context. |
277 | 277 | * @return string|array|false |
278 | 278 | */ |
279 | - public function render_callback( WP_Customize_Partial $partial, $context = array() ) { |
|
280 | - unset( $partial, $context ); |
|
279 | + public function render_callback(WP_Customize_Partial $partial, $context = array()) { |
|
280 | + unset($partial, $context); |
|
281 | 281 | return false; |
282 | 282 | } |
283 | 283 | |
@@ -314,12 +314,12 @@ discard block |
||
314 | 314 | * or if one of the associated settings does not exist. |
315 | 315 | */ |
316 | 316 | final public function check_capabilities() { |
317 | - if ( ! empty( $this->capability ) && ! current_user_can( $this->capability ) ) { |
|
317 | + if ( ! empty($this->capability) && ! current_user_can($this->capability)) { |
|
318 | 318 | return false; |
319 | 319 | } |
320 | - foreach ( $this->settings as $setting_id ) { |
|
321 | - $setting = $this->component->manager->get_setting( $setting_id ); |
|
322 | - if ( ! $setting || ! $setting->check_capabilities() ) { |
|
320 | + foreach ($this->settings as $setting_id) { |
|
321 | + $setting = $this->component->manager->get_setting($setting_id); |
|
322 | + if ( ! $setting || ! $setting->check_capabilities()) { |
|
323 | 323 | return false; |
324 | 324 | } |
325 | 325 | } |
@@ -33,16 +33,16 @@ discard block |
||
33 | 33 | global $wp_registered_widgets; |
34 | 34 | |
35 | 35 | parent::to_json(); |
36 | - $exported_properties = array( 'widget_id', 'widget_id_base', 'sidebar_id', 'width', 'height', 'is_wide' ); |
|
37 | - foreach ( $exported_properties as $key ) { |
|
38 | - $this->json[ $key ] = $this->$key; |
|
36 | + $exported_properties = array('widget_id', 'widget_id_base', 'sidebar_id', 'width', 'height', 'is_wide'); |
|
37 | + foreach ($exported_properties as $key) { |
|
38 | + $this->json[$key] = $this->$key; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | // Get the widget_control and widget_content. |
42 | - require_once ABSPATH . '/wp-admin/includes/widgets.php'; |
|
42 | + require_once ABSPATH.'/wp-admin/includes/widgets.php'; |
|
43 | 43 | |
44 | - $widget = $wp_registered_widgets[ $this->widget_id ]; |
|
45 | - if ( ! isset( $widget['params'][0] ) ) { |
|
44 | + $widget = $wp_registered_widgets[$this->widget_id]; |
|
45 | + if ( ! isset($widget['params'][0])) { |
|
46 | 46 | $widget['params'][0] = array(); |
47 | 47 | } |
48 | 48 | |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | 'widget_name' => $widget['name'], |
52 | 52 | ); |
53 | 53 | |
54 | - $args = wp_list_widget_controls_dynamic_sidebar( array( 0 => $args, 1 => $widget['params'][0] ) ); |
|
55 | - $widget_control_parts = $this->manager->widgets->get_widget_control_parts( $args ); |
|
54 | + $args = wp_list_widget_controls_dynamic_sidebar(array(0 => $args, 1 => $widget['params'][0])); |
|
55 | + $widget_control_parts = $this->manager->widgets->get_widget_control_parts($args); |
|
56 | 56 | |
57 | 57 | $this->json['widget_control'] = $widget_control_parts['control']; |
58 | 58 | $this->json['widget_content'] = $widget_control_parts['content']; |
@@ -72,6 +72,6 @@ discard block |
||
72 | 72 | * @return bool Whether the widget is rendered. |
73 | 73 | */ |
74 | 74 | public function active_callback() { |
75 | - return $this->manager->widgets->is_widget_rendered( $this->widget_id ); |
|
75 | + return $this->manager->widgets->is_widget_rendered($this->widget_id); |
|
76 | 76 | } |
77 | 77 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | * |
23 | 23 | * @param $value |
24 | 24 | */ |
25 | - public function update( $value ) { |
|
26 | - remove_theme_mod( 'background_image_thumb' ); |
|
25 | + public function update($value) { |
|
26 | + remove_theme_mod('background_image_thumb'); |
|
27 | 27 | } |
28 | 28 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | */ |
34 | 34 | public function render_content() { |
35 | 35 | ?> |
36 | - <button type="button" class="button button-primary" id="create-new-menu-submit"><?php _e( 'Create Menu' ); ?></button> |
|
36 | + <button type="button" class="button button-primary" id="create-new-menu-submit"><?php _e('Create Menu'); ?></button> |
|
37 | 37 | <span class="spinner"></span> |
38 | 38 | <?php |
39 | 39 | } |
@@ -34,46 +34,46 @@ |
||
34 | 34 | * @access protected |
35 | 35 | */ |
36 | 36 | protected function render() { |
37 | - $classes = 'accordion-section control-section control-section-' . $this->type; |
|
37 | + $classes = 'accordion-section control-section control-section-'.$this->type; |
|
38 | 38 | ?> |
39 | - <li id="accordion-section-<?php echo esc_attr( $this->id ); ?>" class="<?php echo esc_attr( $classes ); ?>"> |
|
39 | + <li id="accordion-section-<?php echo esc_attr($this->id); ?>" class="<?php echo esc_attr($classes); ?>"> |
|
40 | 40 | <h3 class="accordion-section-title"> |
41 | 41 | <?php |
42 | - if ( $this->manager->is_theme_active() ) { |
|
43 | - echo '<span class="customize-action">' . __( 'Active theme' ) . '</span> ' . $this->title; |
|
42 | + if ($this->manager->is_theme_active()) { |
|
43 | + echo '<span class="customize-action">'.__('Active theme').'</span> '.$this->title; |
|
44 | 44 | } else { |
45 | - echo '<span class="customize-action">' . __( 'Previewing theme' ) . '</span> ' . $this->title; |
|
45 | + echo '<span class="customize-action">'.__('Previewing theme').'</span> '.$this->title; |
|
46 | 46 | } |
47 | 47 | ?> |
48 | 48 | |
49 | - <?php if ( count( $this->controls ) > 0 ) : ?> |
|
50 | - <button type="button" class="button change-theme" tabindex="0"><?php _ex( 'Change', 'theme' ); ?></button> |
|
49 | + <?php if (count($this->controls) > 0) : ?> |
|
50 | + <button type="button" class="button change-theme" tabindex="0"><?php _ex('Change', 'theme'); ?></button> |
|
51 | 51 | <?php endif; ?> |
52 | 52 | </h3> |
53 | 53 | <div class="customize-themes-panel control-panel-content themes-php"> |
54 | 54 | <h3 class="accordion-section-title customize-section-title"> |
55 | - <span class="customize-action"><?php _e( 'Customizing' ); ?></span> |
|
56 | - <?php _e( 'Themes' ); ?> |
|
57 | - <span class="title-count theme-count"><?php echo count( $this->controls ) + 1 /* Active theme */; ?></span> |
|
55 | + <span class="customize-action"><?php _e('Customizing'); ?></span> |
|
56 | + <?php _e('Themes'); ?> |
|
57 | + <span class="title-count theme-count"><?php echo count($this->controls) + 1 /* Active theme */; ?></span> |
|
58 | 58 | </h3> |
59 | 59 | <h3 class="accordion-section-title customize-section-title"> |
60 | 60 | <?php |
61 | - if ( $this->manager->is_theme_active() ) { |
|
62 | - echo '<span class="customize-action">' . __( 'Active theme' ) . '</span> ' . $this->title; |
|
61 | + if ($this->manager->is_theme_active()) { |
|
62 | + echo '<span class="customize-action">'.__('Active theme').'</span> '.$this->title; |
|
63 | 63 | } else { |
64 | - echo '<span class="customize-action">' . __( 'Previewing theme' ) . '</span> ' . $this->title; |
|
64 | + echo '<span class="customize-action">'.__('Previewing theme').'</span> '.$this->title; |
|
65 | 65 | } |
66 | 66 | ?> |
67 | - <button type="button" class="button customize-theme"><?php _e( 'Customize' ); ?></button> |
|
67 | + <button type="button" class="button customize-theme"><?php _e('Customize'); ?></button> |
|
68 | 68 | </h3> |
69 | 69 | |
70 | - <div class="theme-overlay" tabindex="0" role="dialog" aria-label="<?php esc_attr_e( 'Theme Details' ); ?>"></div> |
|
70 | + <div class="theme-overlay" tabindex="0" role="dialog" aria-label="<?php esc_attr_e('Theme Details'); ?>"></div> |
|
71 | 71 | |
72 | 72 | <div id="customize-container"></div> |
73 | - <?php if ( count( $this->controls ) > 4 ) : ?> |
|
73 | + <?php if (count($this->controls) > 4) : ?> |
|
74 | 74 | <p><label for="themes-filter"> |
75 | - <span class="screen-reader-text"><?php _e( 'Search installed themes…' ); ?></span> |
|
76 | - <input type="text" id="themes-filter" placeholder="<?php esc_attr_e( 'Search installed themes…' ); ?>" /> |
|
75 | + <span class="screen-reader-text"><?php _e('Search installed themes…'); ?></span> |
|
76 | + <input type="text" id="themes-filter" placeholder="<?php esc_attr_e('Search installed themes…'); ?>" /> |
|
77 | 77 | </label></p> |
78 | 78 | <?php endif; ?> |
79 | 79 | <div class="theme-browser rendered"> |
@@ -31,12 +31,14 @@ |
||
31 | 31 | |
32 | 32 | // If the value doesn't exist (removed or random), |
33 | 33 | // use the header_image value. |
34 | - if ( ! $value ) |
|
35 | - $value = $this->manager->get_setting('header_image')->post_value(); |
|
34 | + if ( ! $value ) { |
|
35 | + $value = $this->manager->get_setting('header_image')->post_value(); |
|
36 | + } |
|
36 | 37 | |
37 | - if ( is_array( $value ) && isset( $value['choice'] ) ) |
|
38 | - $custom_image_header->set_header_image( $value['choice'] ); |
|
39 | - else |
|
40 | - $custom_image_header->set_header_image( $value ); |
|
38 | + if ( is_array( $value ) && isset( $value['choice'] ) ) { |
|
39 | + $custom_image_header->set_header_image( $value['choice'] ); |
|
40 | + } else { |
|
41 | + $custom_image_header->set_header_image( $value ); |
|
42 | + } |
|
41 | 43 | } |
42 | 44 | } |
@@ -26,26 +26,26 @@ |
||
26 | 26 | * |
27 | 27 | * @param $value |
28 | 28 | */ |
29 | - public function update( $value ) { |
|
29 | + public function update($value) { |
|
30 | 30 | global $custom_image_header; |
31 | 31 | |
32 | 32 | // If _custom_header_background_just_in_time() fails to initialize $custom_image_header when not is_admin(). |
33 | - if ( empty( $custom_image_header ) ) { |
|
34 | - require_once( ABSPATH . 'wp-admin/custom-header.php' ); |
|
35 | - $args = get_theme_support( 'custom-header' ); |
|
36 | - $admin_head_callback = isset( $args[0]['admin-head-callback'] ) ? $args[0]['admin-head-callback'] : null; |
|
37 | - $admin_preview_callback = isset( $args[0]['admin-preview-callback'] ) ? $args[0]['admin-preview-callback'] : null; |
|
38 | - $custom_image_header = new Custom_Image_Header( $admin_head_callback, $admin_preview_callback ); |
|
33 | + if (empty($custom_image_header)) { |
|
34 | + require_once(ABSPATH.'wp-admin/custom-header.php'); |
|
35 | + $args = get_theme_support('custom-header'); |
|
36 | + $admin_head_callback = isset($args[0]['admin-head-callback']) ? $args[0]['admin-head-callback'] : null; |
|
37 | + $admin_preview_callback = isset($args[0]['admin-preview-callback']) ? $args[0]['admin-preview-callback'] : null; |
|
38 | + $custom_image_header = new Custom_Image_Header($admin_head_callback, $admin_preview_callback); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | // If the value doesn't exist (removed or random), |
42 | 42 | // use the header_image value. |
43 | - if ( ! $value ) |
|
43 | + if ( ! $value) |
|
44 | 44 | $value = $this->manager->get_setting('header_image')->post_value(); |
45 | 45 | |
46 | - if ( is_array( $value ) && isset( $value['choice'] ) ) |
|
47 | - $custom_image_header->set_header_image( $value['choice'] ); |
|
46 | + if (is_array($value) && isset($value['choice'])) |
|
47 | + $custom_image_header->set_header_image($value['choice']); |
|
48 | 48 | else |
49 | - $custom_image_header->set_header_image( $value ); |
|
49 | + $custom_image_header->set_header_image($value); |
|
50 | 50 | } |
51 | 51 | } |
@@ -35,9 +35,9 @@ |
||
35 | 35 | */ |
36 | 36 | protected function render() { |
37 | 37 | ?> |
38 | - <li id="accordion-section-<?php echo esc_attr( $this->id ); ?>" class="accordion-section-new-menu"> |
|
38 | + <li id="accordion-section-<?php echo esc_attr($this->id); ?>" class="accordion-section-new-menu"> |
|
39 | 39 | <button type="button" class="button-secondary add-new-menu-item add-menu-toggle" aria-expanded="false"> |
40 | - <?php echo esc_html( $this->title ); ?> |
|
40 | + <?php echo esc_html($this->title); ?> |
|
41 | 41 | </button> |
42 | 42 | <ul class="new-menu-section-content"></ul> |
43 | 43 | </li> |