@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @param string|array $args Optional. Will be passed to add() method. |
24 | 24 | */ |
25 | - public function __construct( $args = '' ) { |
|
26 | - if ( !empty($args) ) |
|
25 | + public function __construct($args = '') { |
|
26 | + if ( ! empty($args)) |
|
27 | 27 | $this->add($args); |
28 | 28 | } |
29 | 29 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * } |
63 | 63 | * @return string XML response. |
64 | 64 | */ |
65 | - public function add( $args = '' ) { |
|
65 | + public function add($args = '') { |
|
66 | 66 | $defaults = array( |
67 | 67 | 'what' => 'object', 'action' => false, |
68 | 68 | 'id' => '0', 'old_id' => false, |
@@ -70,39 +70,39 @@ discard block |
||
70 | 70 | 'data' => '', 'supplemental' => array() |
71 | 71 | ); |
72 | 72 | |
73 | - $r = wp_parse_args( $args, $defaults ); |
|
73 | + $r = wp_parse_args($args, $defaults); |
|
74 | 74 | |
75 | - $position = preg_replace( '/[^a-z0-9:_-]/i', '', $r['position'] ); |
|
75 | + $position = preg_replace('/[^a-z0-9:_-]/i', '', $r['position']); |
|
76 | 76 | $id = $r['id']; |
77 | 77 | $what = $r['what']; |
78 | 78 | $action = $r['action']; |
79 | 79 | $old_id = $r['old_id']; |
80 | 80 | $data = $r['data']; |
81 | 81 | |
82 | - if ( is_wp_error( $id ) ) { |
|
82 | + if (is_wp_error($id)) { |
|
83 | 83 | $data = $id; |
84 | 84 | $id = 0; |
85 | 85 | } |
86 | 86 | |
87 | 87 | $response = ''; |
88 | - if ( is_wp_error( $data ) ) { |
|
89 | - foreach ( (array) $data->get_error_codes() as $code ) { |
|
90 | - $response .= "<wp_error code='$code'><![CDATA[" . $data->get_error_message( $code ) . "]]></wp_error>"; |
|
91 | - if ( ! $error_data = $data->get_error_data( $code ) ) { |
|
88 | + if (is_wp_error($data)) { |
|
89 | + foreach ((array) $data->get_error_codes() as $code) { |
|
90 | + $response .= "<wp_error code='$code'><![CDATA[".$data->get_error_message($code)."]]></wp_error>"; |
|
91 | + if ( ! $error_data = $data->get_error_data($code)) { |
|
92 | 92 | continue; |
93 | 93 | } |
94 | 94 | $class = ''; |
95 | - if ( is_object( $error_data ) ) { |
|
96 | - $class = ' class="' . get_class( $error_data ) . '"'; |
|
97 | - $error_data = get_object_vars( $error_data ); |
|
95 | + if (is_object($error_data)) { |
|
96 | + $class = ' class="'.get_class($error_data).'"'; |
|
97 | + $error_data = get_object_vars($error_data); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | $response .= "<wp_error_data code='$code'$class>"; |
101 | 101 | |
102 | - if ( is_scalar( $error_data ) ) { |
|
102 | + if (is_scalar($error_data)) { |
|
103 | 103 | $response .= "<![CDATA[$error_data]]>"; |
104 | - } elseif ( is_array( $error_data ) ) { |
|
105 | - foreach ( $error_data as $k => $v ) { |
|
104 | + } elseif (is_array($error_data)) { |
|
105 | + foreach ($error_data as $k => $v) { |
|
106 | 106 | $response .= "<$k><![CDATA[$v]]></$k>"; |
107 | 107 | } |
108 | 108 | } |
@@ -114,22 +114,22 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | $s = ''; |
117 | - if ( is_array( $r['supplemental'] ) ) { |
|
118 | - foreach ( $r['supplemental'] as $k => $v ) { |
|
117 | + if (is_array($r['supplemental'])) { |
|
118 | + foreach ($r['supplemental'] as $k => $v) { |
|
119 | 119 | $s .= "<$k><![CDATA[$v]]></$k>"; |
120 | 120 | } |
121 | 121 | $s = "<supplemental>$s</supplemental>"; |
122 | 122 | } |
123 | 123 | |
124 | - if ( false === $action ) { |
|
124 | + if (false === $action) { |
|
125 | 125 | $action = $_POST['action']; |
126 | 126 | } |
127 | 127 | $x = ''; |
128 | 128 | $x .= "<response action='{$action}_$id'>"; // The action attribute in the xml output is formatted like a nonce action |
129 | - $x .= "<$what id='$id' " . ( false === $old_id ? '' : "old_id='$old_id' " ) . "position='$position'>"; |
|
130 | - $x .= $response; |
|
131 | - $x .= $s; |
|
132 | - $x .= "</$what>"; |
|
129 | + $x .= "<$what id='$id' ".(false === $old_id ? '' : "old_id='$old_id' ")."position='$position'>"; |
|
130 | + $x .= $response; |
|
131 | + $x .= $s; |
|
132 | + $x .= "</$what>"; |
|
133 | 133 | $x .= "</response>"; |
134 | 134 | |
135 | 135 | $this->responses[] = $x; |
@@ -144,12 +144,12 @@ discard block |
||
144 | 144 | * @since 2.1.0 |
145 | 145 | */ |
146 | 146 | public function send() { |
147 | - header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ) ); |
|
148 | - echo "<?xml version='1.0' encoding='" . get_option( 'blog_charset' ) . "' standalone='yes'?><wp_ajax>"; |
|
149 | - foreach ( (array) $this->responses as $response ) |
|
147 | + header('Content-Type: text/xml; charset='.get_option('blog_charset')); |
|
148 | + echo "<?xml version='1.0' encoding='".get_option('blog_charset')."' standalone='yes'?><wp_ajax>"; |
|
149 | + foreach ((array) $this->responses as $response) |
|
150 | 150 | echo $response; |
151 | 151 | echo '</wp_ajax>'; |
152 | - if ( wp_doing_ajax() ) |
|
152 | + if (wp_doing_ajax()) |
|
153 | 153 | wp_die(); |
154 | 154 | else |
155 | 155 | die(); |
@@ -23,8 +23,9 @@ discard block |
||
23 | 23 | * @param string|array $args Optional. Will be passed to add() method. |
24 | 24 | */ |
25 | 25 | public function __construct( $args = '' ) { |
26 | - if ( !empty($args) ) |
|
27 | - $this->add($args); |
|
26 | + if ( !empty($args) ) { |
|
27 | + $this->add($args); |
|
28 | + } |
|
28 | 29 | } |
29 | 30 | |
30 | 31 | /** |
@@ -146,12 +147,14 @@ discard block |
||
146 | 147 | public function send() { |
147 | 148 | header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ) ); |
148 | 149 | echo "<?xml version='1.0' encoding='" . get_option( 'blog_charset' ) . "' standalone='yes'?><wp_ajax>"; |
149 | - foreach ( (array) $this->responses as $response ) |
|
150 | - echo $response; |
|
150 | + foreach ( (array) $this->responses as $response ) { |
|
151 | + echo $response; |
|
152 | + } |
|
151 | 153 | echo '</wp_ajax>'; |
152 | - if ( wp_doing_ajax() ) |
|
153 | - wp_die(); |
|
154 | - else |
|
155 | - die(); |
|
154 | + if ( wp_doing_ajax() ) { |
|
155 | + wp_die(); |
|
156 | + } else { |
|
157 | + die(); |
|
158 | + } |
|
156 | 159 | } |
157 | 160 | } |
@@ -21,23 +21,23 @@ discard block |
||
21 | 21 | global $wpdb; |
22 | 22 | |
23 | 23 | // This filter is attached in ms-default-filters.php but that file is not included during SHORTINIT. |
24 | - add_filter( 'default_site_option_ms_files_rewriting', '__return_true' ); |
|
24 | + add_filter('default_site_option_ms_files_rewriting', '__return_true'); |
|
25 | 25 | |
26 | - if ( ! get_site_option( 'ms_files_rewriting' ) ) |
|
26 | + if ( ! get_site_option('ms_files_rewriting')) |
|
27 | 27 | return; |
28 | 28 | |
29 | 29 | // Base uploads dir relative to ABSPATH |
30 | - if ( !defined( 'UPLOADBLOGSDIR' ) ) |
|
31 | - define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' ); |
|
30 | + if ( ! defined('UPLOADBLOGSDIR')) |
|
31 | + define('UPLOADBLOGSDIR', 'wp-content/blogs.dir'); |
|
32 | 32 | |
33 | 33 | // Note, the main site in a post-MU network uses wp-content/uploads. |
34 | 34 | // This is handled in wp_upload_dir() by ignoring UPLOADS for this case. |
35 | - if ( ! defined( 'UPLOADS' ) ) { |
|
36 | - define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" ); |
|
35 | + if ( ! defined('UPLOADS')) { |
|
36 | + define('UPLOADS', UPLOADBLOGSDIR."/{$wpdb->blogid}/files/"); |
|
37 | 37 | |
38 | 38 | // Uploads dir relative to ABSPATH |
39 | - if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR && ! defined( 'BLOGUPLOADDIR' ) ) |
|
40 | - define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" ); |
|
39 | + if ('wp-content/blogs.dir' == UPLOADBLOGSDIR && ! defined('BLOGUPLOADDIR')) |
|
40 | + define('BLOGUPLOADDIR', WP_CONTENT_DIR."/blogs.dir/{$wpdb->blogid}/files/"); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
@@ -52,34 +52,34 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * @since 1.2.0 |
54 | 54 | */ |
55 | - if ( !defined( 'COOKIEPATH' ) ) |
|
56 | - define( 'COOKIEPATH', $current_network->path ); |
|
55 | + if ( ! defined('COOKIEPATH')) |
|
56 | + define('COOKIEPATH', $current_network->path); |
|
57 | 57 | |
58 | 58 | /** |
59 | 59 | * @since 1.5.0 |
60 | 60 | */ |
61 | - if ( !defined( 'SITECOOKIEPATH' ) ) |
|
62 | - define( 'SITECOOKIEPATH', $current_network->path ); |
|
61 | + if ( ! defined('SITECOOKIEPATH')) |
|
62 | + define('SITECOOKIEPATH', $current_network->path); |
|
63 | 63 | |
64 | 64 | /** |
65 | 65 | * @since 2.6.0 |
66 | 66 | */ |
67 | - if ( !defined( 'ADMIN_COOKIE_PATH' ) ) { |
|
68 | - if ( ! is_subdomain_install() || trim( parse_url( get_option( 'siteurl' ), PHP_URL_PATH ), '/' ) ) { |
|
69 | - define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH ); |
|
67 | + if ( ! defined('ADMIN_COOKIE_PATH')) { |
|
68 | + if ( ! is_subdomain_install() || trim(parse_url(get_option('siteurl'), PHP_URL_PATH), '/')) { |
|
69 | + define('ADMIN_COOKIE_PATH', SITECOOKIEPATH); |
|
70 | 70 | } else { |
71 | - define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' ); |
|
71 | + define('ADMIN_COOKIE_PATH', SITECOOKIEPATH.'wp-admin'); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
76 | 76 | * @since 2.0.0 |
77 | 77 | */ |
78 | - if ( !defined('COOKIE_DOMAIN') && is_subdomain_install() ) { |
|
79 | - if ( !empty( $current_network->cookie_domain ) ) |
|
80 | - define('COOKIE_DOMAIN', '.' . $current_network->cookie_domain); |
|
78 | + if ( ! defined('COOKIE_DOMAIN') && is_subdomain_install()) { |
|
79 | + if ( ! empty($current_network->cookie_domain)) |
|
80 | + define('COOKIE_DOMAIN', '.'.$current_network->cookie_domain); |
|
81 | 81 | else |
82 | - define('COOKIE_DOMAIN', '.' . $current_network->domain); |
|
82 | + define('COOKIE_DOMAIN', '.'.$current_network->domain); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
@@ -96,15 +96,15 @@ discard block |
||
96 | 96 | * Optional support for X-Sendfile header |
97 | 97 | * @since 3.0.0 |
98 | 98 | */ |
99 | - if ( !defined( 'WPMU_SENDFILE' ) ) |
|
100 | - define( 'WPMU_SENDFILE', false ); |
|
99 | + if ( ! defined('WPMU_SENDFILE')) |
|
100 | + define('WPMU_SENDFILE', false); |
|
101 | 101 | |
102 | 102 | /** |
103 | 103 | * Optional support for X-Accel-Redirect header |
104 | 104 | * @since 3.0.0 |
105 | 105 | */ |
106 | - if ( !defined( 'WPMU_ACCEL_REDIRECT' ) ) |
|
107 | - define( 'WPMU_ACCEL_REDIRECT', false ); |
|
106 | + if ( ! defined('WPMU_ACCEL_REDIRECT')) |
|
107 | + define('WPMU_ACCEL_REDIRECT', false); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -124,41 +124,41 @@ discard block |
||
124 | 124 | static $subdomain_error = null; |
125 | 125 | static $subdomain_error_warn = null; |
126 | 126 | |
127 | - if ( false === $subdomain_error ) { |
|
127 | + if (false === $subdomain_error) { |
|
128 | 128 | return; |
129 | 129 | } |
130 | 130 | |
131 | - if ( $subdomain_error ) { |
|
131 | + if ($subdomain_error) { |
|
132 | 132 | $vhost_deprecated = sprintf( |
133 | 133 | /* translators: 1: VHOST, 2: SUBDOMAIN_INSTALL, 3: wp-config.php, 4: is_subdomain_install() */ |
134 | - __( 'The constant %1$s <strong>is deprecated</strong>. Use the boolean constant %2$s in %3$s to enable a subdomain configuration. Use %4$s to check whether a subdomain configuration is enabled.' ), |
|
134 | + __('The constant %1$s <strong>is deprecated</strong>. Use the boolean constant %2$s in %3$s to enable a subdomain configuration. Use %4$s to check whether a subdomain configuration is enabled.'), |
|
135 | 135 | '<code>VHOST</code>', |
136 | 136 | '<code>SUBDOMAIN_INSTALL</code>', |
137 | 137 | '<code>wp-config.php</code>', |
138 | 138 | '<code>is_subdomain_install()</code>' |
139 | 139 | ); |
140 | - if ( $subdomain_error_warn ) { |
|
141 | - trigger_error( __( '<strong>Conflicting values for the constants VHOST and SUBDOMAIN_INSTALL.</strong> The value of SUBDOMAIN_INSTALL will be assumed to be your subdomain configuration setting.' ) . ' ' . $vhost_deprecated, E_USER_WARNING ); |
|
140 | + if ($subdomain_error_warn) { |
|
141 | + trigger_error(__('<strong>Conflicting values for the constants VHOST and SUBDOMAIN_INSTALL.</strong> The value of SUBDOMAIN_INSTALL will be assumed to be your subdomain configuration setting.').' '.$vhost_deprecated, E_USER_WARNING); |
|
142 | 142 | } else { |
143 | - _deprecated_argument( 'define()', '3.0.0', $vhost_deprecated ); |
|
143 | + _deprecated_argument('define()', '3.0.0', $vhost_deprecated); |
|
144 | 144 | } |
145 | 145 | return; |
146 | 146 | } |
147 | 147 | |
148 | - if ( defined( 'SUBDOMAIN_INSTALL' ) && defined( 'VHOST' ) ) { |
|
148 | + if (defined('SUBDOMAIN_INSTALL') && defined('VHOST')) { |
|
149 | 149 | $subdomain_error = true; |
150 | - if ( SUBDOMAIN_INSTALL !== ( 'yes' == VHOST ) ) { |
|
150 | + if (SUBDOMAIN_INSTALL !== ('yes' == VHOST)) { |
|
151 | 151 | $subdomain_error_warn = true; |
152 | 152 | } |
153 | - } elseif ( defined( 'SUBDOMAIN_INSTALL' ) ) { |
|
153 | + } elseif (defined('SUBDOMAIN_INSTALL')) { |
|
154 | 154 | $subdomain_error = false; |
155 | - define( 'VHOST', SUBDOMAIN_INSTALL ? 'yes' : 'no' ); |
|
156 | - } elseif ( defined( 'VHOST' ) ) { |
|
155 | + define('VHOST', SUBDOMAIN_INSTALL ? 'yes' : 'no'); |
|
156 | + } elseif (defined('VHOST')) { |
|
157 | 157 | $subdomain_error = true; |
158 | - define( 'SUBDOMAIN_INSTALL', 'yes' == VHOST ); |
|
158 | + define('SUBDOMAIN_INSTALL', 'yes' == VHOST); |
|
159 | 159 | } else { |
160 | 160 | $subdomain_error = false; |
161 | - define( 'SUBDOMAIN_INSTALL', false ); |
|
162 | - define( 'VHOST', 'no' ); |
|
161 | + define('SUBDOMAIN_INSTALL', false); |
|
162 | + define('VHOST', 'no'); |
|
163 | 163 | } |
164 | 164 | } |
@@ -23,12 +23,14 @@ discard block |
||
23 | 23 | // This filter is attached in ms-default-filters.php but that file is not included during SHORTINIT. |
24 | 24 | add_filter( 'default_site_option_ms_files_rewriting', '__return_true' ); |
25 | 25 | |
26 | - if ( ! get_site_option( 'ms_files_rewriting' ) ) |
|
27 | - return; |
|
26 | + if ( ! get_site_option( 'ms_files_rewriting' ) ) { |
|
27 | + return; |
|
28 | + } |
|
28 | 29 | |
29 | 30 | // Base uploads dir relative to ABSPATH |
30 | - if ( !defined( 'UPLOADBLOGSDIR' ) ) |
|
31 | - define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' ); |
|
31 | + if ( !defined( 'UPLOADBLOGSDIR' ) ) { |
|
32 | + define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' ); |
|
33 | + } |
|
32 | 34 | |
33 | 35 | // Note, the main site in a post-MU network uses wp-content/uploads. |
34 | 36 | // This is handled in wp_upload_dir() by ignoring UPLOADS for this case. |
@@ -36,8 +38,9 @@ discard block |
||
36 | 38 | define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" ); |
37 | 39 | |
38 | 40 | // Uploads dir relative to ABSPATH |
39 | - if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR && ! defined( 'BLOGUPLOADDIR' ) ) |
|
40 | - define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" ); |
|
41 | + if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR && ! defined( 'BLOGUPLOADDIR' ) ) { |
|
42 | + define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" ); |
|
43 | + } |
|
41 | 44 | } |
42 | 45 | } |
43 | 46 | |
@@ -52,14 +55,16 @@ discard block |
||
52 | 55 | /** |
53 | 56 | * @since 1.2.0 |
54 | 57 | */ |
55 | - if ( !defined( 'COOKIEPATH' ) ) |
|
56 | - define( 'COOKIEPATH', $current_network->path ); |
|
58 | + if ( !defined( 'COOKIEPATH' ) ) { |
|
59 | + define( 'COOKIEPATH', $current_network->path ); |
|
60 | + } |
|
57 | 61 | |
58 | 62 | /** |
59 | 63 | * @since 1.5.0 |
60 | 64 | */ |
61 | - if ( !defined( 'SITECOOKIEPATH' ) ) |
|
62 | - define( 'SITECOOKIEPATH', $current_network->path ); |
|
65 | + if ( !defined( 'SITECOOKIEPATH' ) ) { |
|
66 | + define( 'SITECOOKIEPATH', $current_network->path ); |
|
67 | + } |
|
63 | 68 | |
64 | 69 | /** |
65 | 70 | * @since 2.6.0 |
@@ -76,10 +81,11 @@ discard block |
||
76 | 81 | * @since 2.0.0 |
77 | 82 | */ |
78 | 83 | if ( !defined('COOKIE_DOMAIN') && is_subdomain_install() ) { |
79 | - if ( !empty( $current_network->cookie_domain ) ) |
|
80 | - define('COOKIE_DOMAIN', '.' . $current_network->cookie_domain); |
|
81 | - else |
|
82 | - define('COOKIE_DOMAIN', '.' . $current_network->domain); |
|
84 | + if ( !empty( $current_network->cookie_domain ) ) { |
|
85 | + define('COOKIE_DOMAIN', '.' . $current_network->cookie_domain); |
|
86 | + } else { |
|
87 | + define('COOKIE_DOMAIN', '.' . $current_network->domain); |
|
88 | + } |
|
83 | 89 | } |
84 | 90 | } |
85 | 91 | |
@@ -96,16 +102,18 @@ discard block |
||
96 | 102 | * Optional support for X-Sendfile header |
97 | 103 | * @since 3.0.0 |
98 | 104 | */ |
99 | - if ( !defined( 'WPMU_SENDFILE' ) ) |
|
100 | - define( 'WPMU_SENDFILE', false ); |
|
105 | + if ( !defined( 'WPMU_SENDFILE' ) ) { |
|
106 | + define( 'WPMU_SENDFILE', false ); |
|
107 | + } |
|
101 | 108 | |
102 | 109 | /** |
103 | 110 | * Optional support for X-Accel-Redirect header |
104 | 111 | * @since 3.0.0 |
105 | 112 | */ |
106 | - if ( !defined( 'WPMU_ACCEL_REDIRECT' ) ) |
|
107 | - define( 'WPMU_ACCEL_REDIRECT', false ); |
|
108 | -} |
|
113 | + if ( !defined( 'WPMU_ACCEL_REDIRECT' ) ) { |
|
114 | + define( 'WPMU_ACCEL_REDIRECT', false ); |
|
115 | + } |
|
116 | + } |
|
109 | 117 | |
110 | 118 | /** |
111 | 119 | * Defines Multisite subdomain constants and handles warnings and notices. |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @param int $user_id User whose session to manage. |
32 | 32 | */ |
33 | - protected function __construct( $user_id ) { |
|
33 | + protected function __construct($user_id) { |
|
34 | 34 | $this->user_id = $user_id; |
35 | 35 | } |
36 | 36 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @param int $user_id User whose session to manage. |
48 | 48 | */ |
49 | - final public static function get_instance( $user_id ) { |
|
49 | + final public static function get_instance($user_id) { |
|
50 | 50 | /** |
51 | 51 | * Filters the session token manager used. |
52 | 52 | * |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | * @param string $session Name of class to use as the manager. |
56 | 56 | * Default 'WP_User_Meta_Session_Tokens'. |
57 | 57 | */ |
58 | - $manager = apply_filters( 'session_token_manager', 'WP_User_Meta_Session_Tokens' ); |
|
59 | - return new $manager( $user_id ); |
|
58 | + $manager = apply_filters('session_token_manager', 'WP_User_Meta_Session_Tokens'); |
|
59 | + return new $manager($user_id); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | * @param string $token Session token to hash. |
69 | 69 | * @return string A hash of the session token (a verifier). |
70 | 70 | */ |
71 | - final private function hash_token( $token ) { |
|
71 | + final private function hash_token($token) { |
|
72 | 72 | // If ext/hash is not present, use sha1() instead. |
73 | - if ( function_exists( 'hash' ) ) { |
|
74 | - return hash( 'sha256', $token ); |
|
73 | + if (function_exists('hash')) { |
|
74 | + return hash('sha256', $token); |
|
75 | 75 | } else { |
76 | - return sha1( $token ); |
|
76 | + return sha1($token); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | * @param string $token Session token |
87 | 87 | * @return array User session |
88 | 88 | */ |
89 | - final public function get( $token ) { |
|
90 | - $verifier = $this->hash_token( $token ); |
|
91 | - return $this->get_session( $verifier ); |
|
89 | + final public function get($token) { |
|
90 | + $verifier = $this->hash_token($token); |
|
91 | + return $this->get_session($verifier); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | * @param string $token Token to verify. |
103 | 103 | * @return bool Whether the token is valid for the user. |
104 | 104 | */ |
105 | - final public function verify( $token ) { |
|
106 | - $verifier = $this->hash_token( $token ); |
|
107 | - return (bool) $this->get_session( $verifier ); |
|
105 | + final public function verify($token) { |
|
106 | + $verifier = $this->hash_token($token); |
|
107 | + return (bool) $this->get_session($verifier); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @param int $expiration Session expiration timestamp. |
125 | 125 | * @return string Session token. |
126 | 126 | */ |
127 | - final public function create( $expiration ) { |
|
127 | + final public function create($expiration) { |
|
128 | 128 | /** |
129 | 129 | * Filters the information attached to the newly created session. |
130 | 130 | * |
@@ -136,25 +136,25 @@ discard block |
||
136 | 136 | * @param array $session Array of extra data. |
137 | 137 | * @param int $user_id User ID. |
138 | 138 | */ |
139 | - $session = apply_filters( 'attach_session_information', array(), $this->user_id ); |
|
139 | + $session = apply_filters('attach_session_information', array(), $this->user_id); |
|
140 | 140 | $session['expiration'] = $expiration; |
141 | 141 | |
142 | 142 | // IP address. |
143 | - if ( !empty( $_SERVER['REMOTE_ADDR'] ) ) { |
|
143 | + if ( ! empty($_SERVER['REMOTE_ADDR'])) { |
|
144 | 144 | $session['ip'] = $_SERVER['REMOTE_ADDR']; |
145 | 145 | } |
146 | 146 | |
147 | 147 | // User-agent. |
148 | - if ( ! empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
149 | - $session['ua'] = wp_unslash( $_SERVER['HTTP_USER_AGENT'] ); |
|
148 | + if ( ! empty($_SERVER['HTTP_USER_AGENT'])) { |
|
149 | + $session['ua'] = wp_unslash($_SERVER['HTTP_USER_AGENT']); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | // Timestamp |
153 | 153 | $session['login'] = time(); |
154 | 154 | |
155 | - $token = wp_generate_password( 43, false, false ); |
|
155 | + $token = wp_generate_password(43, false, false); |
|
156 | 156 | |
157 | - $this->update( $token, $session ); |
|
157 | + $this->update($token, $session); |
|
158 | 158 | |
159 | 159 | return $token; |
160 | 160 | } |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | * @param string $token Session token to update. |
169 | 169 | * @param array $session Session information. |
170 | 170 | */ |
171 | - final public function update( $token, $session ) { |
|
172 | - $verifier = $this->hash_token( $token ); |
|
173 | - $this->update_session( $verifier, $session ); |
|
171 | + final public function update($token, $session) { |
|
172 | + $verifier = $this->hash_token($token); |
|
173 | + $this->update_session($verifier, $session); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @param string $token Session token to destroy. |
183 | 183 | */ |
184 | - final public function destroy( $token ) { |
|
185 | - $verifier = $this->hash_token( $token ); |
|
186 | - $this->update_session( $verifier, null ); |
|
184 | + final public function destroy($token) { |
|
185 | + $verifier = $this->hash_token($token); |
|
186 | + $this->update_session($verifier, null); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | * |
196 | 196 | * @param string $token_to_keep Session token to keep. |
197 | 197 | */ |
198 | - final public function destroy_others( $token_to_keep ) { |
|
199 | - $verifier = $this->hash_token( $token_to_keep ); |
|
200 | - $session = $this->get_session( $verifier ); |
|
201 | - if ( $session ) { |
|
202 | - $this->destroy_other_sessions( $verifier ); |
|
198 | + final public function destroy_others($token_to_keep) { |
|
199 | + $verifier = $this->hash_token($token_to_keep); |
|
200 | + $session = $this->get_session($verifier); |
|
201 | + if ($session) { |
|
202 | + $this->destroy_other_sessions($verifier); |
|
203 | 203 | } else { |
204 | 204 | $this->destroy_all_sessions(); |
205 | 205 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | * @param array $session Session to check. |
216 | 216 | * @return bool Whether session is valid. |
217 | 217 | */ |
218 | - final protected function is_still_valid( $session ) { |
|
218 | + final protected function is_still_valid($session) { |
|
219 | 219 | return $session['expiration'] >= time(); |
220 | 220 | } |
221 | 221 | |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | */ |
239 | 239 | final public static function destroy_all_for_all_users() { |
240 | 240 | /** This filter is documented in wp-includes/class-wp-session-tokens.php */ |
241 | - $manager = apply_filters( 'session_token_manager', 'WP_User_Meta_Session_Tokens' ); |
|
242 | - call_user_func( array( $manager, 'drop_sessions' ) ); |
|
241 | + $manager = apply_filters('session_token_manager', 'WP_User_Meta_Session_Tokens'); |
|
242 | + call_user_func(array($manager, 'drop_sessions')); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * @return array Sessions of a user. |
252 | 252 | */ |
253 | 253 | final public function get_all() { |
254 | - return array_values( $this->get_sessions() ); |
|
254 | + return array_values($this->get_sessions()); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @param string $verifier Verifier of the session to retrieve. |
274 | 274 | * @return array|null The session, or null if it does not exist. |
275 | 275 | */ |
276 | - abstract protected function get_session( $verifier ); |
|
276 | + abstract protected function get_session($verifier); |
|
277 | 277 | |
278 | 278 | /** |
279 | 279 | * This method should update a session by its verifier. |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | * @param string $verifier Verifier of the session to update. |
287 | 287 | * @param array $session Optional. Session. Omitting this argument destroys the session. |
288 | 288 | */ |
289 | - abstract protected function update_session( $verifier, $session = null ); |
|
289 | + abstract protected function update_session($verifier, $session = null); |
|
290 | 290 | |
291 | 291 | /** |
292 | 292 | * This method should destroy all session tokens for this user, |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * |
298 | 298 | * @param string $verifier Verifier of the session to keep. |
299 | 299 | */ |
300 | - abstract protected function destroy_other_sessions( $verifier ); |
|
300 | + abstract protected function destroy_other_sessions($verifier); |
|
301 | 301 | |
302 | 302 | /** |
303 | 303 | * This method should destroy all sessions for a user. |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @param string $url URL to request. |
36 | 36 | * @param array $request Request data in WP_Http format. |
37 | 37 | */ |
38 | - public function __construct( $url, $request ) { |
|
38 | + public function __construct($url, $request) { |
|
39 | 39 | $this->url = $url; |
40 | 40 | $this->request = $request; |
41 | 41 | } |
@@ -47,14 +47,14 @@ discard block |
||
47 | 47 | * @param array $parameters Parameters to pass to callbacks. |
48 | 48 | * @return boolean True if hooks were run, false if nothing was hooked. |
49 | 49 | */ |
50 | - public function dispatch( $hook, $parameters = array() ) { |
|
51 | - $result = parent::dispatch( $hook, $parameters ); |
|
50 | + public function dispatch($hook, $parameters = array()) { |
|
51 | + $result = parent::dispatch($hook, $parameters); |
|
52 | 52 | |
53 | 53 | // Handle back-compat actions |
54 | - switch ( $hook ) { |
|
54 | + switch ($hook) { |
|
55 | 55 | case 'curl.before_send': |
56 | 56 | /** This action is documented in wp-includes/class-wp-http-curl.php */ |
57 | - do_action_ref_array( 'http_api_curl', array( $parameters[0], $this->request, $this->url ) ); |
|
57 | + do_action_ref_array('http_api_curl', array($parameters[0], $this->request, $this->url)); |
|
58 | 58 | break; |
59 | 59 | } |
60 | 60 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @param array $request Request data in WP_Http format. |
70 | 70 | * @param string $url URL to request. |
71 | 71 | */ |
72 | - do_action_ref_array( "requests-{$hook}", $parameters, $this->request, $this->url ); |
|
72 | + do_action_ref_array("requests-{$hook}", $parameters, $this->request, $this->url); |
|
73 | 73 | |
74 | 74 | return $result; |
75 | 75 | } |
@@ -42,27 +42,27 @@ |
||
42 | 42 | |
43 | 43 | $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE; |
44 | 44 | |
45 | - if ( preg_match('/^http(s)?:\/\//i', $url) ) { |
|
45 | + if (preg_match('/^http(s)?:\/\//i', $url)) { |
|
46 | 46 | $args = array( |
47 | 47 | 'timeout' => $this->timeout, |
48 | 48 | 'redirection' => $this->redirects, |
49 | 49 | ); |
50 | 50 | |
51 | - if ( !empty($this->headers) ) |
|
51 | + if ( ! empty($this->headers)) |
|
52 | 52 | $args['headers'] = $this->headers; |
53 | 53 | |
54 | - if ( SIMPLEPIE_USERAGENT != $this->useragent ) //Use default WP user agent unless custom has been specified |
|
54 | + if (SIMPLEPIE_USERAGENT != $this->useragent) //Use default WP user agent unless custom has been specified |
|
55 | 55 | $args['user-agent'] = $this->useragent; |
56 | 56 | |
57 | 57 | $res = wp_safe_remote_request($url, $args); |
58 | 58 | |
59 | - if ( is_wp_error($res) ) { |
|
60 | - $this->error = 'WP HTTP Error: ' . $res->get_error_message(); |
|
59 | + if (is_wp_error($res)) { |
|
60 | + $this->error = 'WP HTTP Error: '.$res->get_error_message(); |
|
61 | 61 | $this->success = false; |
62 | 62 | } else { |
63 | - $this->headers = wp_remote_retrieve_headers( $res ); |
|
64 | - $this->body = wp_remote_retrieve_body( $res ); |
|
65 | - $this->status_code = wp_remote_retrieve_response_code( $res ); |
|
63 | + $this->headers = wp_remote_retrieve_headers($res); |
|
64 | + $this->body = wp_remote_retrieve_body($res); |
|
65 | + $this->status_code = wp_remote_retrieve_response_code($res); |
|
66 | 66 | } |
67 | 67 | } else { |
68 | 68 | $this->error = ''; |
@@ -48,11 +48,14 @@ |
||
48 | 48 | 'redirection' => $this->redirects, |
49 | 49 | ); |
50 | 50 | |
51 | - if ( !empty($this->headers) ) |
|
52 | - $args['headers'] = $this->headers; |
|
51 | + if ( !empty($this->headers) ) { |
|
52 | + $args['headers'] = $this->headers; |
|
53 | + } |
|
53 | 54 | |
54 | - if ( SIMPLEPIE_USERAGENT != $this->useragent ) //Use default WP user agent unless custom has been specified |
|
55 | + if ( SIMPLEPIE_USERAGENT != $this->useragent ) { |
|
56 | + //Use default WP user agent unless custom has been specified |
|
55 | 57 | $args['user-agent'] = $this->useragent; |
58 | + } |
|
56 | 59 | |
57 | 60 | $res = wp_safe_remote_request($url, $args); |
58 | 61 |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | * @param string $id Control ID. |
51 | 51 | * @param array $args Optional. Arguments to override class property defaults. |
52 | 52 | */ |
53 | - public function __construct( $manager, $id, $args = array() ) { |
|
54 | - $this->statuses = array( '' => __('Default') ); |
|
55 | - parent::__construct( $manager, $id, $args ); |
|
53 | + public function __construct($manager, $id, $args = array()) { |
|
54 | + $this->statuses = array('' => __('Default')); |
|
55 | + parent::__construct($manager, $id, $args); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | * @since 3.4.0 |
62 | 62 | */ |
63 | 63 | public function enqueue() { |
64 | - wp_enqueue_script( 'wp-color-picker' ); |
|
65 | - wp_enqueue_style( 'wp-color-picker' ); |
|
64 | + wp_enqueue_script('wp-color-picker'); |
|
65 | + wp_enqueue_style('wp-color-picker'); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | <# if ( isHueSlider ) { #> |
115 | 115 | <input class="color-picker-hue" type="text" data-type="hue" /> |
116 | 116 | <# } else { #> |
117 | - <input class="color-picker-hex" type="text" maxlength="7" placeholder="<?php esc_attr_e( 'Hex Value' ); ?>" {{ defaultValue }} /> |
|
117 | + <input class="color-picker-hex" type="text" maxlength="7" placeholder="<?php esc_attr_e('Hex Value'); ?>" {{ defaultValue }} /> |
|
118 | 118 | <# } #> |
119 | 119 | </div> |
120 | 120 | </label> |
@@ -42,19 +42,19 @@ discard block |
||
42 | 42 | public function content_template() { |
43 | 43 | $options = array( |
44 | 44 | array( |
45 | - 'left top' => array( 'label' => __( 'Top Left' ), 'icon' => 'dashicons dashicons-arrow-left-alt' ), |
|
46 | - 'center top' => array( 'label' => __( 'Top' ), 'icon' => 'dashicons dashicons-arrow-up-alt' ), |
|
47 | - 'right top' => array( 'label' => __( 'Top Right' ), 'icon' => 'dashicons dashicons-arrow-right-alt' ), |
|
45 | + 'left top' => array('label' => __('Top Left'), 'icon' => 'dashicons dashicons-arrow-left-alt'), |
|
46 | + 'center top' => array('label' => __('Top'), 'icon' => 'dashicons dashicons-arrow-up-alt'), |
|
47 | + 'right top' => array('label' => __('Top Right'), 'icon' => 'dashicons dashicons-arrow-right-alt'), |
|
48 | 48 | ), |
49 | 49 | array( |
50 | - 'left center' => array( 'label' => __( 'Left' ), 'icon' => 'dashicons dashicons-arrow-left-alt' ), |
|
51 | - 'center center' => array( 'label' => __( 'Center' ), 'icon' => 'background-position-center-icon' ), |
|
52 | - 'right center' => array( 'label' => __( 'Right' ), 'icon' => 'dashicons dashicons-arrow-right-alt' ), |
|
50 | + 'left center' => array('label' => __('Left'), 'icon' => 'dashicons dashicons-arrow-left-alt'), |
|
51 | + 'center center' => array('label' => __('Center'), 'icon' => 'background-position-center-icon'), |
|
52 | + 'right center' => array('label' => __('Right'), 'icon' => 'dashicons dashicons-arrow-right-alt'), |
|
53 | 53 | ), |
54 | 54 | array( |
55 | - 'left bottom' => array( 'label' => __( 'Bottom Left' ), 'icon' => 'dashicons dashicons-arrow-left-alt' ), |
|
56 | - 'center bottom' => array( 'label' => __( 'Bottom' ), 'icon' => 'dashicons dashicons-arrow-down-alt' ), |
|
57 | - 'right bottom' => array( 'label' => __( 'Bottom Right' ), 'icon' => 'dashicons dashicons-arrow-right-alt' ), |
|
55 | + 'left bottom' => array('label' => __('Bottom Left'), 'icon' => 'dashicons dashicons-arrow-left-alt'), |
|
56 | + 'center bottom' => array('label' => __('Bottom'), 'icon' => 'dashicons dashicons-arrow-down-alt'), |
|
57 | + 'right bottom' => array('label' => __('Bottom Right'), 'icon' => 'dashicons dashicons-arrow-right-alt'), |
|
58 | 58 | ), |
59 | 59 | ); |
60 | 60 | ?> |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | <# } #> |
67 | 67 | <div class="customize-control-content"> |
68 | 68 | <fieldset> |
69 | - <legend class="screen-reader-text"><span><?php _e( 'Image Position' ); ?></span></legend> |
|
69 | + <legend class="screen-reader-text"><span><?php _e('Image Position'); ?></span></legend> |
|
70 | 70 | <div class="background-position-control"> |
71 | - <?php foreach ( $options as $group ) : ?> |
|
71 | + <?php foreach ($options as $group) : ?> |
|
72 | 72 | <div class="button-group"> |
73 | - <?php foreach ( $group as $value => $input ) : ?> |
|
73 | + <?php foreach ($group as $value => $input) : ?> |
|
74 | 74 | <label> |
75 | - <input class="screen-reader-text" name="background-position" type="radio" value="<?php echo esc_attr( $value ); ?>"> |
|
76 | - <span class="button display-options position"><span class="<?php echo esc_attr( $input['icon'] ); ?>" aria-hidden="true"></span></span> |
|
75 | + <input class="screen-reader-text" name="background-position" type="radio" value="<?php echo esc_attr($value); ?>"> |
|
76 | + <span class="button display-options position"><span class="<?php echo esc_attr($input['icon']); ?>" aria-hidden="true"></span></span> |
|
77 | 77 | <span class="screen-reader-text"><?php echo $input['label']; ?></span> |
78 | 78 | </label> |
79 | 79 | <?php endforeach; ?> |
@@ -62,15 +62,15 @@ discard block |
||
62 | 62 | * @access public |
63 | 63 | */ |
64 | 64 | public function content_template() { |
65 | - $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); |
|
66 | - $active_url = esc_url( remove_query_arg( 'customize_theme', $current_url ) ); |
|
67 | - $preview_url = esc_url( add_query_arg( 'customize_theme', '__THEME__', $current_url ) ); // Token because esc_url() strips curly braces. |
|
68 | - $preview_url = str_replace( '__THEME__', '{{ data.theme.id }}', $preview_url ); |
|
65 | + $current_url = set_url_scheme('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); |
|
66 | + $active_url = esc_url(remove_query_arg('customize_theme', $current_url)); |
|
67 | + $preview_url = esc_url(add_query_arg('customize_theme', '__THEME__', $current_url)); // Token because esc_url() strips curly braces. |
|
68 | + $preview_url = str_replace('__THEME__', '{{ data.theme.id }}', $preview_url); |
|
69 | 69 | ?> |
70 | 70 | <# if ( data.theme.isActiveTheme ) { #> |
71 | - <div class="theme active" tabindex="0" data-preview-url="<?php echo esc_attr( $active_url ); ?>" aria-describedby="{{ data.theme.id }}-action {{ data.theme.id }}-name"> |
|
71 | + <div class="theme active" tabindex="0" data-preview-url="<?php echo esc_attr($active_url); ?>" aria-describedby="{{ data.theme.id }}-action {{ data.theme.id }}-name"> |
|
72 | 72 | <# } else { #> |
73 | - <div class="theme" tabindex="0" data-preview-url="<?php echo esc_attr( $preview_url ); ?>" aria-describedby="{{ data.theme.id }}-action {{ data.theme.id }}-name"> |
|
73 | + <div class="theme" tabindex="0" data-preview-url="<?php echo esc_attr($preview_url); ?>" aria-describedby="{{ data.theme.id }}-action {{ data.theme.id }}-name"> |
|
74 | 74 | <# } #> |
75 | 75 | |
76 | 76 | <# if ( data.theme.screenshot[0] ) { #> |
@@ -82,27 +82,27 @@ discard block |
||
82 | 82 | <# } #> |
83 | 83 | |
84 | 84 | <# if ( data.theme.isActiveTheme ) { #> |
85 | - <span class="more-details" id="{{ data.theme.id }}-action"><?php _e( 'Customize' ); ?></span> |
|
85 | + <span class="more-details" id="{{ data.theme.id }}-action"><?php _e('Customize'); ?></span> |
|
86 | 86 | <# } else { #> |
87 | - <span class="more-details" id="{{ data.theme.id }}-action"><?php _e( 'Live Preview' ); ?></span> |
|
87 | + <span class="more-details" id="{{ data.theme.id }}-action"><?php _e('Live Preview'); ?></span> |
|
88 | 88 | <# } #> |
89 | 89 | |
90 | 90 | <div class="theme-author"><?php |
91 | 91 | /* translators: Theme author name */ |
92 | - printf( _x( 'By %s', 'theme author' ), '{{ data.theme.author }}' ); |
|
92 | + printf(_x('By %s', 'theme author'), '{{ data.theme.author }}'); |
|
93 | 93 | ?></div> |
94 | 94 | |
95 | 95 | <# if ( data.theme.isActiveTheme ) { #> |
96 | 96 | <h3 class="theme-name" id="{{ data.theme.id }}-name"> |
97 | 97 | <?php |
98 | 98 | /* translators: %s: theme name */ |
99 | - printf( __( '<span>Active:</span> %s' ), '{{{ data.theme.name }}}' ); |
|
99 | + printf(__('<span>Active:</span> %s'), '{{{ data.theme.name }}}'); |
|
100 | 100 | ?> |
101 | 101 | </h3> |
102 | 102 | <# } else { #> |
103 | 103 | <h3 class="theme-name" id="{{ data.theme.id }}-name">{{{ data.theme.name }}}</h3> |
104 | 104 | <div class="theme-actions"> |
105 | - <button type="button" class="button theme-details"><?php _e( 'Theme Details' ); ?></button> |
|
105 | + <button type="button" class="button theme-details"><?php _e('Theme Details'); ?></button> |
|
106 | 106 | </div> |
107 | 107 | <# } #> |
108 | 108 | </div> |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @param WP_Customize_Manager $manager Customizer bootstrap instance. |
28 | 28 | */ |
29 | - public function __construct( $manager ) { |
|
30 | - parent::__construct( $manager, 'header_image', array( |
|
31 | - 'label' => __( 'Header Image' ), |
|
29 | + public function __construct($manager) { |
|
30 | + parent::__construct($manager, 'header_image', array( |
|
31 | + 'label' => __('Header Image'), |
|
32 | 32 | 'settings' => array( |
33 | 33 | 'default' => 'header_image', |
34 | 34 | 'data' => 'header_image_data', |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | 'section' => 'header_image', |
37 | 37 | 'removed' => 'remove-header', |
38 | 38 | 'get_url' => 'get_header_image', |
39 | - ) ); |
|
39 | + )); |
|
40 | 40 | |
41 | 41 | } |
42 | 42 | |
@@ -45,25 +45,25 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function enqueue() { |
47 | 47 | wp_enqueue_media(); |
48 | - wp_enqueue_script( 'customize-views' ); |
|
48 | + wp_enqueue_script('customize-views'); |
|
49 | 49 | |
50 | 50 | $this->prepare_control(); |
51 | 51 | |
52 | - wp_localize_script( 'customize-views', '_wpCustomizeHeader', array( |
|
52 | + wp_localize_script('customize-views', '_wpCustomizeHeader', array( |
|
53 | 53 | 'data' => array( |
54 | - 'width' => absint( get_theme_support( 'custom-header', 'width' ) ), |
|
55 | - 'height' => absint( get_theme_support( 'custom-header', 'height' ) ), |
|
56 | - 'flex-width' => absint( get_theme_support( 'custom-header', 'flex-width' ) ), |
|
57 | - 'flex-height' => absint( get_theme_support( 'custom-header', 'flex-height' ) ), |
|
54 | + 'width' => absint(get_theme_support('custom-header', 'width')), |
|
55 | + 'height' => absint(get_theme_support('custom-header', 'height')), |
|
56 | + 'flex-width' => absint(get_theme_support('custom-header', 'flex-width')), |
|
57 | + 'flex-height' => absint(get_theme_support('custom-header', 'flex-height')), |
|
58 | 58 | 'currentImgSrc' => $this->get_current_image_src(), |
59 | 59 | ), |
60 | 60 | 'nonces' => array( |
61 | - 'add' => wp_create_nonce( 'header-add' ), |
|
62 | - 'remove' => wp_create_nonce( 'header-remove' ), |
|
61 | + 'add' => wp_create_nonce('header-add'), |
|
62 | + 'remove' => wp_create_nonce('header-remove'), |
|
63 | 63 | ), |
64 | 64 | 'uploads' => $this->uploaded_headers, |
65 | 65 | 'defaults' => $this->default_headers |
66 | - ) ); |
|
66 | + )); |
|
67 | 67 | |
68 | 68 | parent::enqueue(); |
69 | 69 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function prepare_control() { |
76 | 76 | global $custom_image_header; |
77 | - if ( empty( $custom_image_header ) ) { |
|
77 | + if (empty($custom_image_header)) { |
|
78 | 78 | return; |
79 | 79 | } |
80 | 80 | |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | <button type="button" class="button display-options random"> |
95 | 95 | <span class="dashicons dashicons-randomize dice"></span> |
96 | 96 | <# if ( data.type === 'uploaded' ) { #> |
97 | - <?php _e( 'Randomize uploaded headers' ); ?> |
|
97 | + <?php _e('Randomize uploaded headers'); ?> |
|
98 | 98 | <# } else if ( data.type === 'default' ) { #> |
99 | - <?php _e( 'Randomize suggested headers' ); ?> |
|
99 | + <?php _e('Randomize suggested headers'); ?> |
|
100 | 100 | <# } #> |
101 | 101 | </button> |
102 | 102 | |
@@ -105,12 +105,12 @@ discard block |
||
105 | 105 | <button type="button" class="choice thumbnail" |
106 | 106 | data-customize-image-value="{{{data.header.url}}}" |
107 | 107 | data-customize-header-image-data="{{JSON.stringify(data.header)}}"> |
108 | - <span class="screen-reader-text"><?php _e( 'Set image' ); ?></span> |
|
108 | + <span class="screen-reader-text"><?php _e('Set image'); ?></span> |
|
109 | 109 | <img src="{{{data.header.thumbnail_url}}}" alt="{{{data.header.alt_text || data.header.description}}}"> |
110 | 110 | </button> |
111 | 111 | |
112 | 112 | <# if ( data.type === 'uploaded' ) { #> |
113 | - <button type="button" class="dashicons dashicons-no close"><span class="screen-reader-text"><?php _e( 'Remove image' ); ?></span></button> |
|
113 | + <button type="button" class="dashicons dashicons-no close"><span class="screen-reader-text"><?php _e('Remove image'); ?></span></button> |
|
114 | 114 | <# } #> |
115 | 115 | |
116 | 116 | <# } #> |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | <div class="placeholder"> |
124 | 124 | <span class="dashicons dashicons-randomize dice"></span> |
125 | 125 | <# if ( data.type === 'uploaded' ) { #> |
126 | - <?php _e( 'Randomizing uploaded headers' ); ?> |
|
126 | + <?php _e('Randomizing uploaded headers'); ?> |
|
127 | 127 | <# } else if ( data.type === 'default' ) { #> |
128 | - <?php _e( 'Randomizing suggested headers' ); ?> |
|
128 | + <?php _e('Randomizing suggested headers'); ?> |
|
129 | 129 | <# } #> |
130 | 130 | </div> |
131 | 131 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | <# } else { #> |
138 | 138 | |
139 | 139 | <div class="placeholder"> |
140 | - <?php _e( 'No image set' ); ?> |
|
140 | + <?php _e('No image set'); ?> |
|
141 | 141 | </div> |
142 | 142 | |
143 | 143 | <# } #> |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function get_current_image_src() { |
152 | 152 | $src = $this->value(); |
153 | - if ( isset( $this->get_url ) ) { |
|
154 | - $src = call_user_func( $this->get_url, $src ); |
|
153 | + if (isset($this->get_url)) { |
|
154 | + $src = call_user_func($this->get_url, $src); |
|
155 | 155 | return $src; |
156 | 156 | } |
157 | 157 | } |
@@ -162,32 +162,32 @@ discard block |
||
162 | 162 | public function render_content() { |
163 | 163 | $this->print_header_image_template(); |
164 | 164 | $visibility = $this->get_current_image_src() ? '' : ' style="display:none" '; |
165 | - $width = absint( get_theme_support( 'custom-header', 'width' ) ); |
|
166 | - $height = absint( get_theme_support( 'custom-header', 'height' ) ); |
|
165 | + $width = absint(get_theme_support('custom-header', 'width')); |
|
166 | + $height = absint(get_theme_support('custom-header', 'height')); |
|
167 | 167 | ?> |
168 | 168 | <div class="customize-control-content"> |
169 | - <?php if ( current_theme_supports( 'custom-header', 'video' ) ) { |
|
170 | - echo '<span class="customize-control-title">' . $this->label . '</span>'; |
|
169 | + <?php if (current_theme_supports('custom-header', 'video')) { |
|
170 | + echo '<span class="customize-control-title">'.$this->label.'</span>'; |
|
171 | 171 | } ?> |
172 | 172 | <div class="customize-control-notifications-container"></div> |
173 | 173 | <p class="customizer-section-intro customize-control-description"> |
174 | 174 | <?php |
175 | - if ( current_theme_supports( 'custom-header', 'video' ) ) { |
|
176 | - _e( 'While you can crop images to your liking after clicking <strong>Add new image</strong>, we recommend matching the size of your video.' ); |
|
177 | - } elseif ( $width && $height ) { |
|
175 | + if (current_theme_supports('custom-header', 'video')) { |
|
176 | + _e('While you can crop images to your liking after clicking <strong>Add new image</strong>, we recommend matching the size of your video.'); |
|
177 | + } elseif ($width && $height) { |
|
178 | 178 | /* translators: %s: header size in pixels */ |
179 | - printf( __( 'While you can crop images to your liking after clicking <strong>Add new image</strong>, your theme recommends a header size of %s pixels.' ), |
|
180 | - sprintf( '<strong>%s × %s</strong>', $width, $height ) |
|
179 | + printf(__('While you can crop images to your liking after clicking <strong>Add new image</strong>, your theme recommends a header size of %s pixels.'), |
|
180 | + sprintf('<strong>%s × %s</strong>', $width, $height) |
|
181 | 181 | ); |
182 | - } elseif ( $width ) { |
|
182 | + } elseif ($width) { |
|
183 | 183 | /* translators: %s: header width in pixels */ |
184 | - printf( __( 'While you can crop images to your liking after clicking <strong>Add new image</strong>, your theme recommends a header width of %s pixels.' ), |
|
185 | - sprintf( '<strong>%s</strong>', $width ) |
|
184 | + printf(__('While you can crop images to your liking after clicking <strong>Add new image</strong>, your theme recommends a header width of %s pixels.'), |
|
185 | + sprintf('<strong>%s</strong>', $width) |
|
186 | 186 | ); |
187 | 187 | } else { |
188 | 188 | /* translators: %s: header height in pixels */ |
189 | - printf( __( 'While you can crop images to your liking after clicking <strong>Add new image</strong>, your theme recommends a header height of %s pixels.' ), |
|
190 | - sprintf( '<strong>%s</strong>', $height ) |
|
189 | + printf(__('While you can crop images to your liking after clicking <strong>Add new image</strong>, your theme recommends a header height of %s pixels.'), |
|
190 | + sprintf('<strong>%s</strong>', $height) |
|
191 | 191 | ); |
192 | 192 | } |
193 | 193 | ?> |
@@ -195,29 +195,29 @@ discard block |
||
195 | 195 | <div class="current"> |
196 | 196 | <label for="header_image-button"> |
197 | 197 | <span class="customize-control-title"> |
198 | - <?php _e( 'Current header' ); ?> |
|
198 | + <?php _e('Current header'); ?> |
|
199 | 199 | </span> |
200 | 200 | </label> |
201 | 201 | <div class="container"> |
202 | 202 | </div> |
203 | 203 | </div> |
204 | 204 | <div class="actions"> |
205 | - <?php if ( current_user_can( 'upload_files' ) ): ?> |
|
206 | - <button type="button"<?php echo $visibility; ?> class="button remove" aria-label="<?php esc_attr_e( 'Hide header image' ); ?>"><?php _e( 'Hide image' ); ?></button> |
|
207 | - <button type="button" class="button new" id="header_image-button" aria-label="<?php esc_attr_e( 'Add new header image' ); ?>"><?php _e( 'Add new image' ); ?></button> |
|
205 | + <?php if (current_user_can('upload_files')): ?> |
|
206 | + <button type="button"<?php echo $visibility; ?> class="button remove" aria-label="<?php esc_attr_e('Hide header image'); ?>"><?php _e('Hide image'); ?></button> |
|
207 | + <button type="button" class="button new" id="header_image-button" aria-label="<?php esc_attr_e('Add new header image'); ?>"><?php _e('Add new image'); ?></button> |
|
208 | 208 | <div style="clear:both"></div> |
209 | 209 | <?php endif; ?> |
210 | 210 | </div> |
211 | 211 | <div class="choices"> |
212 | 212 | <span class="customize-control-title header-previously-uploaded"> |
213 | - <?php _ex( 'Previously uploaded', 'custom headers' ); ?> |
|
213 | + <?php _ex('Previously uploaded', 'custom headers'); ?> |
|
214 | 214 | </span> |
215 | 215 | <div class="uploaded"> |
216 | 216 | <div class="list"> |
217 | 217 | </div> |
218 | 218 | </div> |
219 | 219 | <span class="customize-control-title header-default"> |
220 | - <?php _ex( 'Suggested', 'custom headers' ); ?> |
|
220 | + <?php _ex('Suggested', 'custom headers'); ?> |
|
221 | 221 | </span> |
222 | 222 | <div class="default"> |
223 | 223 | <div class="list"> |