@@ -2,6 +2,6 @@ |
||
2 | 2 | |
3 | 3 | // autoload.php @generated by Composer |
4 | 4 | |
5 | -require_once __DIR__ . '/composer/autoload_real.php'; |
|
5 | +require_once __DIR__.'/composer/autoload_real.php'; |
|
6 | 6 | |
7 | 7 | return ComposerAutoloaderInit30c84c47a44576eaa4b38cc478d5e11b::getLoader(); |
@@ -18,42 +18,42 @@ |
||
18 | 18 | */ |
19 | 19 | class Wordlift_Url_Property_Storage extends Wordlift_Storage { |
20 | 20 | |
21 | - /** |
|
22 | - * The {@link Wordlift_Property_Getter} instance. |
|
23 | - * |
|
24 | - * @since 3.15.0 |
|
25 | - * @access private |
|
26 | - * @var \Wordlift_Property_Getter The {@link Wordlift_Property_Getter} |
|
27 | - * instance. |
|
28 | - */ |
|
29 | - private $property_getter; |
|
30 | - |
|
31 | - /** |
|
32 | - * Create a {@link Wordlift_Property_Storage} instance. |
|
33 | - * |
|
34 | - * @since 3.15.0 |
|
35 | - * |
|
36 | - * @param \Wordlift_Property_Getter $property_getter The {@link Wordlift_Property_Getter} |
|
37 | - * instance. |
|
38 | - */ |
|
39 | - public function __construct( $property_getter ) { |
|
40 | - |
|
41 | - $this->property_getter = $property_getter; |
|
42 | - |
|
43 | - } |
|
44 | - |
|
45 | - /** |
|
46 | - * Get the values for the property of the {@link WP_Post}. |
|
47 | - * |
|
48 | - * @since 3.15.0 |
|
49 | - * |
|
50 | - * @param int $post_id The {@link WP_Post}'s id. |
|
51 | - * |
|
52 | - * @return array |
|
53 | - */ |
|
54 | - public function get( $post_id ) { |
|
55 | - |
|
56 | - return $this->property_getter->get( $post_id, Wordlift_Schema_Url_Property_Service::META_KEY, Object_Type_Enum::POST ); |
|
57 | - } |
|
21 | + /** |
|
22 | + * The {@link Wordlift_Property_Getter} instance. |
|
23 | + * |
|
24 | + * @since 3.15.0 |
|
25 | + * @access private |
|
26 | + * @var \Wordlift_Property_Getter The {@link Wordlift_Property_Getter} |
|
27 | + * instance. |
|
28 | + */ |
|
29 | + private $property_getter; |
|
30 | + |
|
31 | + /** |
|
32 | + * Create a {@link Wordlift_Property_Storage} instance. |
|
33 | + * |
|
34 | + * @since 3.15.0 |
|
35 | + * |
|
36 | + * @param \Wordlift_Property_Getter $property_getter The {@link Wordlift_Property_Getter} |
|
37 | + * instance. |
|
38 | + */ |
|
39 | + public function __construct( $property_getter ) { |
|
40 | + |
|
41 | + $this->property_getter = $property_getter; |
|
42 | + |
|
43 | + } |
|
44 | + |
|
45 | + /** |
|
46 | + * Get the values for the property of the {@link WP_Post}. |
|
47 | + * |
|
48 | + * @since 3.15.0 |
|
49 | + * |
|
50 | + * @param int $post_id The {@link WP_Post}'s id. |
|
51 | + * |
|
52 | + * @return array |
|
53 | + */ |
|
54 | + public function get( $post_id ) { |
|
55 | + |
|
56 | + return $this->property_getter->get( $post_id, Wordlift_Schema_Url_Property_Service::META_KEY, Object_Type_Enum::POST ); |
|
57 | + } |
|
58 | 58 | |
59 | 59 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @param \Wordlift_Property_Getter $property_getter The {@link Wordlift_Property_Getter} |
37 | 37 | * instance. |
38 | 38 | */ |
39 | - public function __construct( $property_getter ) { |
|
39 | + public function __construct($property_getter) { |
|
40 | 40 | |
41 | 41 | $this->property_getter = $property_getter; |
42 | 42 | |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @return array |
53 | 53 | */ |
54 | - public function get( $post_id ) { |
|
54 | + public function get($post_id) { |
|
55 | 55 | |
56 | - return $this->property_getter->get( $post_id, Wordlift_Schema_Url_Property_Service::META_KEY, Object_Type_Enum::POST ); |
|
56 | + return $this->property_getter->get($post_id, Wordlift_Schema_Url_Property_Service::META_KEY, Object_Type_Enum::POST); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @since 3.9.0 |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -85,15 +85,15 @@ discard block |
||
85 | 85 | public static function get_languages() { |
86 | 86 | |
87 | 87 | // Lazily load the languages. |
88 | - if ( null === self::$languages ) { |
|
88 | + if (null === self::$languages) { |
|
89 | 89 | |
90 | 90 | // Get the language names from WP's own (multisite) function. |
91 | - foreach ( self::$codes as $key ) { |
|
92 | - self::$languages[ $key ] = self::get_language_name( $key ); |
|
91 | + foreach (self::$codes as $key) { |
|
92 | + self::$languages[$key] = self::get_language_name($key); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | // Sort by language name. |
96 | - asort( self::$languages ); |
|
96 | + asort(self::$languages); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | return self::$languages; |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | * @return string The language corresponding to $code if it exists. If it does not exist, |
110 | 110 | * then the first two letters of $code is returned. |
111 | 111 | */ |
112 | - public static function get_language_name( $code = '' ) { |
|
113 | - $code = strtolower( substr( $code, 0, 2 ) ); |
|
112 | + public static function get_language_name($code = '') { |
|
113 | + $code = strtolower(substr($code, 0, 2)); |
|
114 | 114 | $lang_codes = array( |
115 | 115 | 'aa' => 'Afar', |
116 | 116 | 'ab' => 'Abkhazian', |
@@ -307,9 +307,9 @@ discard block |
||
307 | 307 | * @param array $lang_codes Key/value pair of language codes where key is the short version. |
308 | 308 | * @param string $code A two-letter designation of the language. |
309 | 309 | */ |
310 | - $lang_codes = apply_filters( 'lang_codes', $lang_codes, $code ); |
|
310 | + $lang_codes = apply_filters('lang_codes', $lang_codes, $code); |
|
311 | 311 | |
312 | - return strtr( $code, $lang_codes ); |
|
312 | + return strtr($code, $lang_codes); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | if ( ! defined( 'ABSPATH' ) ) { |
14 | - exit; |
|
14 | + exit; |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | /** |
@@ -21,295 +21,295 @@ discard block |
||
21 | 21 | */ |
22 | 22 | class Wordlift_Languages { |
23 | 23 | |
24 | - /** |
|
25 | - * An array that will contain language codes => language names pairs. It gets lazily loaded the first time by the |
|
26 | - * `get_languages` function. |
|
27 | - * |
|
28 | - * @since 3.9.0 |
|
29 | - * @var array|null An array of language codes => language names pairs or NULL if not initialized yet. |
|
30 | - */ |
|
31 | - private static $languages = null; |
|
24 | + /** |
|
25 | + * An array that will contain language codes => language names pairs. It gets lazily loaded the first time by the |
|
26 | + * `get_languages` function. |
|
27 | + * |
|
28 | + * @since 3.9.0 |
|
29 | + * @var array|null An array of language codes => language names pairs or NULL if not initialized yet. |
|
30 | + */ |
|
31 | + private static $languages = null; |
|
32 | 32 | |
33 | - /** |
|
34 | - * The list of supported language codes. |
|
35 | - * |
|
36 | - * @since 3.9.0 |
|
37 | - * |
|
38 | - * @var array An array of language codes. |
|
39 | - */ |
|
40 | - private static $codes = array( |
|
41 | - 'ar', |
|
42 | - 'be', |
|
43 | - 'bg', |
|
44 | - 'ca', |
|
45 | - 'cs', |
|
46 | - 'da', |
|
47 | - 'de', |
|
48 | - 'el', |
|
49 | - 'en', |
|
50 | - 'es', |
|
51 | - 'et', |
|
52 | - 'fi', |
|
53 | - 'fr', |
|
54 | - 'he', |
|
55 | - 'hr', |
|
56 | - 'hu', |
|
57 | - 'id', |
|
58 | - 'is', |
|
59 | - 'it', |
|
60 | - 'lt', |
|
61 | - 'lv', |
|
62 | - 'nl', |
|
63 | - 'no', |
|
64 | - 'pl', |
|
65 | - 'pt', |
|
66 | - 'ro', |
|
67 | - 'ru', |
|
68 | - 'sk', |
|
69 | - 'sl', |
|
70 | - 'sq', |
|
71 | - 'sr', |
|
72 | - 'sv', |
|
73 | - 'tr', |
|
74 | - 'uk', |
|
75 | - 'zh-cn', |
|
76 | - ); |
|
33 | + /** |
|
34 | + * The list of supported language codes. |
|
35 | + * |
|
36 | + * @since 3.9.0 |
|
37 | + * |
|
38 | + * @var array An array of language codes. |
|
39 | + */ |
|
40 | + private static $codes = array( |
|
41 | + 'ar', |
|
42 | + 'be', |
|
43 | + 'bg', |
|
44 | + 'ca', |
|
45 | + 'cs', |
|
46 | + 'da', |
|
47 | + 'de', |
|
48 | + 'el', |
|
49 | + 'en', |
|
50 | + 'es', |
|
51 | + 'et', |
|
52 | + 'fi', |
|
53 | + 'fr', |
|
54 | + 'he', |
|
55 | + 'hr', |
|
56 | + 'hu', |
|
57 | + 'id', |
|
58 | + 'is', |
|
59 | + 'it', |
|
60 | + 'lt', |
|
61 | + 'lv', |
|
62 | + 'nl', |
|
63 | + 'no', |
|
64 | + 'pl', |
|
65 | + 'pt', |
|
66 | + 'ro', |
|
67 | + 'ru', |
|
68 | + 'sk', |
|
69 | + 'sl', |
|
70 | + 'sq', |
|
71 | + 'sr', |
|
72 | + 'sv', |
|
73 | + 'tr', |
|
74 | + 'uk', |
|
75 | + 'zh-cn', |
|
76 | + ); |
|
77 | 77 | |
78 | - /** |
|
79 | - * Get the list of WordLift's supported languages in an array with language code => language name pairs. |
|
80 | - * |
|
81 | - * @since 3.9.0 |
|
82 | - * |
|
83 | - * @return array An array with language code => language name pairs. |
|
84 | - */ |
|
85 | - public static function get_languages() { |
|
78 | + /** |
|
79 | + * Get the list of WordLift's supported languages in an array with language code => language name pairs. |
|
80 | + * |
|
81 | + * @since 3.9.0 |
|
82 | + * |
|
83 | + * @return array An array with language code => language name pairs. |
|
84 | + */ |
|
85 | + public static function get_languages() { |
|
86 | 86 | |
87 | - // Lazily load the languages. |
|
88 | - if ( null === self::$languages ) { |
|
87 | + // Lazily load the languages. |
|
88 | + if ( null === self::$languages ) { |
|
89 | 89 | |
90 | - // Get the language names from WP's own (multisite) function. |
|
91 | - foreach ( self::$codes as $key ) { |
|
92 | - self::$languages[ $key ] = self::get_language_name( $key ); |
|
93 | - } |
|
90 | + // Get the language names from WP's own (multisite) function. |
|
91 | + foreach ( self::$codes as $key ) { |
|
92 | + self::$languages[ $key ] = self::get_language_name( $key ); |
|
93 | + } |
|
94 | 94 | |
95 | - // Sort by language name. |
|
96 | - asort( self::$languages ); |
|
97 | - } |
|
95 | + // Sort by language name. |
|
96 | + asort( self::$languages ); |
|
97 | + } |
|
98 | 98 | |
99 | - return self::$languages; |
|
100 | - } |
|
99 | + return self::$languages; |
|
100 | + } |
|
101 | 101 | |
102 | - /** |
|
103 | - * Returns the language for a language code. This function is a clone of WP's function provided in `ms.php`. |
|
104 | - * |
|
105 | - * @since 3.9.3 |
|
106 | - * |
|
107 | - * @param string $code Optional. The two-letter language code. Default empty. |
|
108 | - * |
|
109 | - * @return string The language corresponding to $code if it exists. If it does not exist, |
|
110 | - * then the first two letters of $code is returned. |
|
111 | - */ |
|
112 | - public static function get_language_name( $code = '' ) { |
|
113 | - $code = strtolower( substr( $code, 0, 2 ) ); |
|
114 | - $lang_codes = array( |
|
115 | - 'aa' => 'Afar', |
|
116 | - 'ab' => 'Abkhazian', |
|
117 | - 'af' => 'Afrikaans', |
|
118 | - 'ak' => 'Akan', |
|
119 | - 'sq' => 'Albanian', |
|
120 | - 'am' => 'Amharic', |
|
121 | - 'ar' => 'Arabic', |
|
122 | - 'an' => 'Aragonese', |
|
123 | - 'hy' => 'Armenian', |
|
124 | - 'as' => 'Assamese', |
|
125 | - 'av' => 'Avaric', |
|
126 | - 'ae' => 'Avestan', |
|
127 | - 'ay' => 'Aymara', |
|
128 | - 'az' => 'Azerbaijani', |
|
129 | - 'ba' => 'Bashkir', |
|
130 | - 'bm' => 'Bambara', |
|
131 | - 'eu' => 'Basque', |
|
132 | - 'be' => 'Belarusian', |
|
133 | - 'bn' => 'Bengali', |
|
134 | - 'bh' => 'Bihari', |
|
135 | - 'bi' => 'Bislama', |
|
136 | - 'bs' => 'Bosnian', |
|
137 | - 'br' => 'Breton', |
|
138 | - 'bg' => 'Bulgarian', |
|
139 | - 'my' => 'Burmese', |
|
140 | - 'ca' => 'Catalan; Valencian', |
|
141 | - 'ch' => 'Chamorro', |
|
142 | - 'ce' => 'Chechen', |
|
143 | - 'zh' => 'Chinese', |
|
144 | - 'cu' => 'Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic', |
|
145 | - 'cv' => 'Chuvash', |
|
146 | - 'kw' => 'Cornish', |
|
147 | - 'co' => 'Corsican', |
|
148 | - 'cr' => 'Cree', |
|
149 | - 'cs' => 'Czech', |
|
150 | - 'da' => 'Danish', |
|
151 | - 'dv' => 'Divehi; Dhivehi; Maldivian', |
|
152 | - 'nl' => 'Dutch; Flemish', |
|
153 | - 'dz' => 'Dzongkha', |
|
154 | - 'en' => 'English', |
|
155 | - 'eo' => 'Esperanto', |
|
156 | - 'et' => 'Estonian', |
|
157 | - 'ee' => 'Ewe', |
|
158 | - 'fo' => 'Faroese', |
|
159 | - 'fj' => 'Fijjian', |
|
160 | - 'fi' => 'Finnish', |
|
161 | - 'fr' => 'French', |
|
162 | - 'fy' => 'Western Frisian', |
|
163 | - 'ff' => 'Fulah', |
|
164 | - 'ka' => 'Georgian', |
|
165 | - 'de' => 'German', |
|
166 | - 'gd' => 'Gaelic; Scottish Gaelic', |
|
167 | - 'ga' => 'Irish', |
|
168 | - 'gl' => 'Galician', |
|
169 | - 'gv' => 'Manx', |
|
170 | - 'el' => 'Greek, Modern', |
|
171 | - 'gn' => 'Guarani', |
|
172 | - 'gu' => 'Gujarati', |
|
173 | - 'ht' => 'Haitian; Haitian Creole', |
|
174 | - 'ha' => 'Hausa', |
|
175 | - 'he' => 'Hebrew', |
|
176 | - 'hz' => 'Herero', |
|
177 | - 'hi' => 'Hindi', |
|
178 | - 'ho' => 'Hiri Motu', |
|
179 | - 'hu' => 'Hungarian', |
|
180 | - 'ig' => 'Igbo', |
|
181 | - 'is' => 'Icelandic', |
|
182 | - 'io' => 'Ido', |
|
183 | - 'ii' => 'Sichuan Yi', |
|
184 | - 'iu' => 'Inuktitut', |
|
185 | - 'ie' => 'Interlingue', |
|
186 | - 'ia' => 'Interlingua (International Auxiliary Language Association)', |
|
187 | - 'id' => 'Indonesian', |
|
188 | - 'ik' => 'Inupiaq', |
|
189 | - 'it' => 'Italian', |
|
190 | - 'jv' => 'Javanese', |
|
191 | - 'ja' => 'Japanese', |
|
192 | - 'kl' => 'Kalaallisut; Greenlandic', |
|
193 | - 'kn' => 'Kannada', |
|
194 | - 'ks' => 'Kashmiri', |
|
195 | - 'kr' => 'Kanuri', |
|
196 | - 'kk' => 'Kazakh', |
|
197 | - 'km' => 'Central Khmer', |
|
198 | - 'ki' => 'Kikuyu; Gikuyu', |
|
199 | - 'rw' => 'Kinyarwanda', |
|
200 | - 'ky' => 'Kirghiz; Kyrgyz', |
|
201 | - 'kv' => 'Komi', |
|
202 | - 'kg' => 'Kongo', |
|
203 | - 'ko' => 'Korean', |
|
204 | - 'kj' => 'Kuanyama; Kwanyama', |
|
205 | - 'ku' => 'Kurdish', |
|
206 | - 'lo' => 'Lao', |
|
207 | - 'la' => 'Latin', |
|
208 | - 'lv' => 'Latvian', |
|
209 | - 'li' => 'Limburgan; Limburger; Limburgish', |
|
210 | - 'ln' => 'Lingala', |
|
211 | - 'lt' => 'Lithuanian', |
|
212 | - 'lb' => 'Luxembourgish; Letzeburgesch', |
|
213 | - 'lu' => 'Luba-Katanga', |
|
214 | - 'lg' => 'Ganda', |
|
215 | - 'mk' => 'Macedonian', |
|
216 | - 'mh' => 'Marshallese', |
|
217 | - 'ml' => 'Malayalam', |
|
218 | - 'mi' => 'Maori', |
|
219 | - 'mr' => 'Marathi', |
|
220 | - 'ms' => 'Malay', |
|
221 | - 'mg' => 'Malagasy', |
|
222 | - 'mt' => 'Maltese', |
|
223 | - 'mo' => 'Moldavian', |
|
224 | - 'mn' => 'Mongolian', |
|
225 | - 'na' => 'Nauru', |
|
226 | - 'nv' => 'Navajo; Navaho', |
|
227 | - 'nr' => 'Ndebele, South; South Ndebele', |
|
228 | - 'nd' => 'Ndebele, North; North Ndebele', |
|
229 | - 'ng' => 'Ndonga', |
|
230 | - 'ne' => 'Nepali', |
|
231 | - 'nn' => 'Norwegian Nynorsk; Nynorsk, Norwegian', |
|
232 | - 'nb' => 'Bokmål, Norwegian, Norwegian Bokmål', |
|
233 | - 'no' => 'Norwegian', |
|
234 | - 'ny' => 'Chichewa; Chewa; Nyanja', |
|
235 | - 'oc' => 'Occitan, Provençal', |
|
236 | - 'oj' => 'Ojibwa', |
|
237 | - 'or' => 'Oriya', |
|
238 | - 'om' => 'Oromo', |
|
239 | - 'os' => 'Ossetian; Ossetic', |
|
240 | - 'pa' => 'Panjabi; Punjabi', |
|
241 | - 'fa' => 'Persian', |
|
242 | - 'pi' => 'Pali', |
|
243 | - 'pl' => 'Polish', |
|
244 | - 'pt' => 'Portuguese', |
|
245 | - 'ps' => 'Pushto', |
|
246 | - 'qu' => 'Quechua', |
|
247 | - 'rm' => 'Romansh', |
|
248 | - 'ro' => 'Romanian', |
|
249 | - 'rn' => 'Rundi', |
|
250 | - 'ru' => 'Russian', |
|
251 | - 'sg' => 'Sango', |
|
252 | - 'sa' => 'Sanskrit', |
|
253 | - 'sr' => 'Serbian', |
|
254 | - 'hr' => 'Croatian', |
|
255 | - 'si' => 'Sinhala; Sinhalese', |
|
256 | - 'sk' => 'Slovak', |
|
257 | - 'sl' => 'Slovenian', |
|
258 | - 'se' => 'Northern Sami', |
|
259 | - 'sm' => 'Samoan', |
|
260 | - 'sn' => 'Shona', |
|
261 | - 'sd' => 'Sindhi', |
|
262 | - 'so' => 'Somali', |
|
263 | - 'st' => 'Sotho, Southern', |
|
264 | - 'es' => 'Spanish; Castilian', |
|
265 | - 'sc' => 'Sardinian', |
|
266 | - 'ss' => 'Swati', |
|
267 | - 'su' => 'Sundanese', |
|
268 | - 'sw' => 'Swahili', |
|
269 | - 'sv' => 'Swedish', |
|
270 | - 'ty' => 'Tahitian', |
|
271 | - 'ta' => 'Tamil', |
|
272 | - 'tt' => 'Tatar', |
|
273 | - 'te' => 'Telugu', |
|
274 | - 'tg' => 'Tajik', |
|
275 | - 'tl' => 'Tagalog', |
|
276 | - 'th' => 'Thai', |
|
277 | - 'bo' => 'Tibetan', |
|
278 | - 'ti' => 'Tigrinya', |
|
279 | - 'to' => 'Tonga (Tonga Islands)', |
|
280 | - 'tn' => 'Tswana', |
|
281 | - 'ts' => 'Tsonga', |
|
282 | - 'tk' => 'Turkmen', |
|
283 | - 'tr' => 'Turkish', |
|
284 | - 'tw' => 'Twi', |
|
285 | - 'ug' => 'Uighur; Uyghur', |
|
286 | - 'uk' => 'Ukrainian', |
|
287 | - 'ur' => 'Urdu', |
|
288 | - 'uz' => 'Uzbek', |
|
289 | - 've' => 'Venda', |
|
290 | - 'vi' => 'Vietnamese', |
|
291 | - 'vo' => 'Volapük', |
|
292 | - 'cy' => 'Welsh', |
|
293 | - 'wa' => 'Walloon', |
|
294 | - 'wo' => 'Wolof', |
|
295 | - 'xh' => 'Xhosa', |
|
296 | - 'yi' => 'Yiddish', |
|
297 | - 'yo' => 'Yoruba', |
|
298 | - 'za' => 'Zhuang; Chuang', |
|
299 | - 'zu' => 'Zulu', |
|
300 | - ); |
|
102 | + /** |
|
103 | + * Returns the language for a language code. This function is a clone of WP's function provided in `ms.php`. |
|
104 | + * |
|
105 | + * @since 3.9.3 |
|
106 | + * |
|
107 | + * @param string $code Optional. The two-letter language code. Default empty. |
|
108 | + * |
|
109 | + * @return string The language corresponding to $code if it exists. If it does not exist, |
|
110 | + * then the first two letters of $code is returned. |
|
111 | + */ |
|
112 | + public static function get_language_name( $code = '' ) { |
|
113 | + $code = strtolower( substr( $code, 0, 2 ) ); |
|
114 | + $lang_codes = array( |
|
115 | + 'aa' => 'Afar', |
|
116 | + 'ab' => 'Abkhazian', |
|
117 | + 'af' => 'Afrikaans', |
|
118 | + 'ak' => 'Akan', |
|
119 | + 'sq' => 'Albanian', |
|
120 | + 'am' => 'Amharic', |
|
121 | + 'ar' => 'Arabic', |
|
122 | + 'an' => 'Aragonese', |
|
123 | + 'hy' => 'Armenian', |
|
124 | + 'as' => 'Assamese', |
|
125 | + 'av' => 'Avaric', |
|
126 | + 'ae' => 'Avestan', |
|
127 | + 'ay' => 'Aymara', |
|
128 | + 'az' => 'Azerbaijani', |
|
129 | + 'ba' => 'Bashkir', |
|
130 | + 'bm' => 'Bambara', |
|
131 | + 'eu' => 'Basque', |
|
132 | + 'be' => 'Belarusian', |
|
133 | + 'bn' => 'Bengali', |
|
134 | + 'bh' => 'Bihari', |
|
135 | + 'bi' => 'Bislama', |
|
136 | + 'bs' => 'Bosnian', |
|
137 | + 'br' => 'Breton', |
|
138 | + 'bg' => 'Bulgarian', |
|
139 | + 'my' => 'Burmese', |
|
140 | + 'ca' => 'Catalan; Valencian', |
|
141 | + 'ch' => 'Chamorro', |
|
142 | + 'ce' => 'Chechen', |
|
143 | + 'zh' => 'Chinese', |
|
144 | + 'cu' => 'Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic', |
|
145 | + 'cv' => 'Chuvash', |
|
146 | + 'kw' => 'Cornish', |
|
147 | + 'co' => 'Corsican', |
|
148 | + 'cr' => 'Cree', |
|
149 | + 'cs' => 'Czech', |
|
150 | + 'da' => 'Danish', |
|
151 | + 'dv' => 'Divehi; Dhivehi; Maldivian', |
|
152 | + 'nl' => 'Dutch; Flemish', |
|
153 | + 'dz' => 'Dzongkha', |
|
154 | + 'en' => 'English', |
|
155 | + 'eo' => 'Esperanto', |
|
156 | + 'et' => 'Estonian', |
|
157 | + 'ee' => 'Ewe', |
|
158 | + 'fo' => 'Faroese', |
|
159 | + 'fj' => 'Fijjian', |
|
160 | + 'fi' => 'Finnish', |
|
161 | + 'fr' => 'French', |
|
162 | + 'fy' => 'Western Frisian', |
|
163 | + 'ff' => 'Fulah', |
|
164 | + 'ka' => 'Georgian', |
|
165 | + 'de' => 'German', |
|
166 | + 'gd' => 'Gaelic; Scottish Gaelic', |
|
167 | + 'ga' => 'Irish', |
|
168 | + 'gl' => 'Galician', |
|
169 | + 'gv' => 'Manx', |
|
170 | + 'el' => 'Greek, Modern', |
|
171 | + 'gn' => 'Guarani', |
|
172 | + 'gu' => 'Gujarati', |
|
173 | + 'ht' => 'Haitian; Haitian Creole', |
|
174 | + 'ha' => 'Hausa', |
|
175 | + 'he' => 'Hebrew', |
|
176 | + 'hz' => 'Herero', |
|
177 | + 'hi' => 'Hindi', |
|
178 | + 'ho' => 'Hiri Motu', |
|
179 | + 'hu' => 'Hungarian', |
|
180 | + 'ig' => 'Igbo', |
|
181 | + 'is' => 'Icelandic', |
|
182 | + 'io' => 'Ido', |
|
183 | + 'ii' => 'Sichuan Yi', |
|
184 | + 'iu' => 'Inuktitut', |
|
185 | + 'ie' => 'Interlingue', |
|
186 | + 'ia' => 'Interlingua (International Auxiliary Language Association)', |
|
187 | + 'id' => 'Indonesian', |
|
188 | + 'ik' => 'Inupiaq', |
|
189 | + 'it' => 'Italian', |
|
190 | + 'jv' => 'Javanese', |
|
191 | + 'ja' => 'Japanese', |
|
192 | + 'kl' => 'Kalaallisut; Greenlandic', |
|
193 | + 'kn' => 'Kannada', |
|
194 | + 'ks' => 'Kashmiri', |
|
195 | + 'kr' => 'Kanuri', |
|
196 | + 'kk' => 'Kazakh', |
|
197 | + 'km' => 'Central Khmer', |
|
198 | + 'ki' => 'Kikuyu; Gikuyu', |
|
199 | + 'rw' => 'Kinyarwanda', |
|
200 | + 'ky' => 'Kirghiz; Kyrgyz', |
|
201 | + 'kv' => 'Komi', |
|
202 | + 'kg' => 'Kongo', |
|
203 | + 'ko' => 'Korean', |
|
204 | + 'kj' => 'Kuanyama; Kwanyama', |
|
205 | + 'ku' => 'Kurdish', |
|
206 | + 'lo' => 'Lao', |
|
207 | + 'la' => 'Latin', |
|
208 | + 'lv' => 'Latvian', |
|
209 | + 'li' => 'Limburgan; Limburger; Limburgish', |
|
210 | + 'ln' => 'Lingala', |
|
211 | + 'lt' => 'Lithuanian', |
|
212 | + 'lb' => 'Luxembourgish; Letzeburgesch', |
|
213 | + 'lu' => 'Luba-Katanga', |
|
214 | + 'lg' => 'Ganda', |
|
215 | + 'mk' => 'Macedonian', |
|
216 | + 'mh' => 'Marshallese', |
|
217 | + 'ml' => 'Malayalam', |
|
218 | + 'mi' => 'Maori', |
|
219 | + 'mr' => 'Marathi', |
|
220 | + 'ms' => 'Malay', |
|
221 | + 'mg' => 'Malagasy', |
|
222 | + 'mt' => 'Maltese', |
|
223 | + 'mo' => 'Moldavian', |
|
224 | + 'mn' => 'Mongolian', |
|
225 | + 'na' => 'Nauru', |
|
226 | + 'nv' => 'Navajo; Navaho', |
|
227 | + 'nr' => 'Ndebele, South; South Ndebele', |
|
228 | + 'nd' => 'Ndebele, North; North Ndebele', |
|
229 | + 'ng' => 'Ndonga', |
|
230 | + 'ne' => 'Nepali', |
|
231 | + 'nn' => 'Norwegian Nynorsk; Nynorsk, Norwegian', |
|
232 | + 'nb' => 'Bokmål, Norwegian, Norwegian Bokmål', |
|
233 | + 'no' => 'Norwegian', |
|
234 | + 'ny' => 'Chichewa; Chewa; Nyanja', |
|
235 | + 'oc' => 'Occitan, Provençal', |
|
236 | + 'oj' => 'Ojibwa', |
|
237 | + 'or' => 'Oriya', |
|
238 | + 'om' => 'Oromo', |
|
239 | + 'os' => 'Ossetian; Ossetic', |
|
240 | + 'pa' => 'Panjabi; Punjabi', |
|
241 | + 'fa' => 'Persian', |
|
242 | + 'pi' => 'Pali', |
|
243 | + 'pl' => 'Polish', |
|
244 | + 'pt' => 'Portuguese', |
|
245 | + 'ps' => 'Pushto', |
|
246 | + 'qu' => 'Quechua', |
|
247 | + 'rm' => 'Romansh', |
|
248 | + 'ro' => 'Romanian', |
|
249 | + 'rn' => 'Rundi', |
|
250 | + 'ru' => 'Russian', |
|
251 | + 'sg' => 'Sango', |
|
252 | + 'sa' => 'Sanskrit', |
|
253 | + 'sr' => 'Serbian', |
|
254 | + 'hr' => 'Croatian', |
|
255 | + 'si' => 'Sinhala; Sinhalese', |
|
256 | + 'sk' => 'Slovak', |
|
257 | + 'sl' => 'Slovenian', |
|
258 | + 'se' => 'Northern Sami', |
|
259 | + 'sm' => 'Samoan', |
|
260 | + 'sn' => 'Shona', |
|
261 | + 'sd' => 'Sindhi', |
|
262 | + 'so' => 'Somali', |
|
263 | + 'st' => 'Sotho, Southern', |
|
264 | + 'es' => 'Spanish; Castilian', |
|
265 | + 'sc' => 'Sardinian', |
|
266 | + 'ss' => 'Swati', |
|
267 | + 'su' => 'Sundanese', |
|
268 | + 'sw' => 'Swahili', |
|
269 | + 'sv' => 'Swedish', |
|
270 | + 'ty' => 'Tahitian', |
|
271 | + 'ta' => 'Tamil', |
|
272 | + 'tt' => 'Tatar', |
|
273 | + 'te' => 'Telugu', |
|
274 | + 'tg' => 'Tajik', |
|
275 | + 'tl' => 'Tagalog', |
|
276 | + 'th' => 'Thai', |
|
277 | + 'bo' => 'Tibetan', |
|
278 | + 'ti' => 'Tigrinya', |
|
279 | + 'to' => 'Tonga (Tonga Islands)', |
|
280 | + 'tn' => 'Tswana', |
|
281 | + 'ts' => 'Tsonga', |
|
282 | + 'tk' => 'Turkmen', |
|
283 | + 'tr' => 'Turkish', |
|
284 | + 'tw' => 'Twi', |
|
285 | + 'ug' => 'Uighur; Uyghur', |
|
286 | + 'uk' => 'Ukrainian', |
|
287 | + 'ur' => 'Urdu', |
|
288 | + 'uz' => 'Uzbek', |
|
289 | + 've' => 'Venda', |
|
290 | + 'vi' => 'Vietnamese', |
|
291 | + 'vo' => 'Volapük', |
|
292 | + 'cy' => 'Welsh', |
|
293 | + 'wa' => 'Walloon', |
|
294 | + 'wo' => 'Wolof', |
|
295 | + 'xh' => 'Xhosa', |
|
296 | + 'yi' => 'Yiddish', |
|
297 | + 'yo' => 'Yoruba', |
|
298 | + 'za' => 'Zhuang; Chuang', |
|
299 | + 'zu' => 'Zulu', |
|
300 | + ); |
|
301 | 301 | |
302 | - /** |
|
303 | - * Filters the language codes. |
|
304 | - * |
|
305 | - * @since MU |
|
306 | - * |
|
307 | - * @param array $lang_codes Key/value pair of language codes where key is the short version. |
|
308 | - * @param string $code A two-letter designation of the language. |
|
309 | - */ |
|
310 | - $lang_codes = apply_filters( 'lang_codes', $lang_codes, $code ); |
|
302 | + /** |
|
303 | + * Filters the language codes. |
|
304 | + * |
|
305 | + * @since MU |
|
306 | + * |
|
307 | + * @param array $lang_codes Key/value pair of language codes where key is the short version. |
|
308 | + * @param string $code A two-letter designation of the language. |
|
309 | + */ |
|
310 | + $lang_codes = apply_filters( 'lang_codes', $lang_codes, $code ); |
|
311 | 311 | |
312 | - return strtr( $code, $lang_codes ); |
|
313 | - } |
|
312 | + return strtr( $code, $lang_codes ); |
|
313 | + } |
|
314 | 314 | |
315 | 315 | } |
@@ -8,8 +8,8 @@ |
||
8 | 8 | ?> |
9 | 9 | <form method="post" action="options.php"> |
10 | 10 | <?php |
11 | - settings_fields( 'wl_settings__webhooks' ); |
|
12 | - do_settings_sections( 'wl_settings__webhooks' ); |
|
13 | - submit_button( 'Save Settings' ); |
|
14 | - ?> |
|
11 | + settings_fields( 'wl_settings__webhooks' ); |
|
12 | + do_settings_sections( 'wl_settings__webhooks' ); |
|
13 | + submit_button( 'Save Settings' ); |
|
14 | + ?> |
|
15 | 15 | </form> |
@@ -3,12 +3,12 @@ |
||
3 | 3 | * HTML for Webhook Settings Tab. |
4 | 4 | * Added for feature request 1496 |
5 | 5 | */ |
6 | -settings_errors( 'wl_webhook_error' ); |
|
6 | +settings_errors('wl_webhook_error'); |
|
7 | 7 | ?> |
8 | 8 | <form method="post" action="options.php"> |
9 | 9 | <?php |
10 | - settings_fields( 'wl_settings__webhooks' ); |
|
11 | - do_settings_sections( 'wl_settings__webhooks' ); |
|
12 | - submit_button( 'Save Settings' ); |
|
10 | + settings_fields('wl_settings__webhooks'); |
|
11 | + do_settings_sections('wl_settings__webhooks'); |
|
12 | + submit_button('Save Settings'); |
|
13 | 13 | ?> |
14 | 14 | </form> |
@@ -14,88 +14,88 @@ |
||
14 | 14 | */ |
15 | 15 | class Wordlift_Analytics_Connect { |
16 | 16 | |
17 | - const HANDLE = 'wordlift'; |
|
17 | + const HANDLE = 'wordlift'; |
|
18 | 18 | |
19 | - /** |
|
20 | - * Gets an array of related entities with their post IDs and titles. |
|
21 | - * |
|
22 | - * @method get_analytics_event_data |
|
23 | - * @since 3.21.0 |
|
24 | - * |
|
25 | - * @param int $post_id post id we want related data for. |
|
26 | - * |
|
27 | - * @return array |
|
28 | - */ |
|
29 | - public static function get_analytics_event_data( $post_id ) { |
|
30 | - // If no ID was passed get current ID. |
|
31 | - if ( ! $post_id ) { |
|
32 | - $post_id = get_queried_object_id(); |
|
33 | - } |
|
34 | - /** |
|
35 | - * TODO: set/get this from cache. |
|
36 | - */ |
|
37 | - $related_items = array(); |
|
38 | - $related_ids = wl_core_get_related_entity_ids( $post_id ); |
|
19 | + /** |
|
20 | + * Gets an array of related entities with their post IDs and titles. |
|
21 | + * |
|
22 | + * @method get_analytics_event_data |
|
23 | + * @since 3.21.0 |
|
24 | + * |
|
25 | + * @param int $post_id post id we want related data for. |
|
26 | + * |
|
27 | + * @return array |
|
28 | + */ |
|
29 | + public static function get_analytics_event_data( $post_id ) { |
|
30 | + // If no ID was passed get current ID. |
|
31 | + if ( ! $post_id ) { |
|
32 | + $post_id = get_queried_object_id(); |
|
33 | + } |
|
34 | + /** |
|
35 | + * TODO: set/get this from cache. |
|
36 | + */ |
|
37 | + $related_items = array(); |
|
38 | + $related_ids = wl_core_get_related_entity_ids( $post_id ); |
|
39 | 39 | |
40 | - $entity_service = Wordlift_Entity_Service::get_instance(); |
|
41 | - // If the current item is also an entity then add it to the list of IDs. |
|
42 | - if ( $entity_service->is_entity( $post_id ) ) { |
|
43 | - $related_ids[] = $post_id; |
|
44 | - } |
|
45 | - $entity_type_service = Wordlift_Entity_Type_Service::get_instance(); |
|
46 | - // Get the post titles of related items and connect them in an array. |
|
47 | - foreach ( $related_ids as $related_id ) { |
|
48 | - $type = $entity_type_service->get( $related_id ); |
|
49 | - $type = isset( $type['uri'] ) ? $type['uri'] : 'unknown'; |
|
50 | - $label = $entity_service->get_labels( $related_id ); |
|
51 | - $label = $label[0]; |
|
40 | + $entity_service = Wordlift_Entity_Service::get_instance(); |
|
41 | + // If the current item is also an entity then add it to the list of IDs. |
|
42 | + if ( $entity_service->is_entity( $post_id ) ) { |
|
43 | + $related_ids[] = $post_id; |
|
44 | + } |
|
45 | + $entity_type_service = Wordlift_Entity_Type_Service::get_instance(); |
|
46 | + // Get the post titles of related items and connect them in an array. |
|
47 | + foreach ( $related_ids as $related_id ) { |
|
48 | + $type = $entity_type_service->get( $related_id ); |
|
49 | + $type = isset( $type['uri'] ) ? $type['uri'] : 'unknown'; |
|
50 | + $label = $entity_service->get_labels( $related_id ); |
|
51 | + $label = $label[0]; |
|
52 | 52 | |
53 | - $related_items[ $related_id ] = array( |
|
54 | - 'uri' => $entity_service->get_uri( $related_id ), |
|
55 | - 'type' => $type, |
|
56 | - 'label' => $label, |
|
57 | - ); |
|
58 | - } |
|
53 | + $related_items[ $related_id ] = array( |
|
54 | + 'uri' => $entity_service->get_uri( $related_id ), |
|
55 | + 'type' => $type, |
|
56 | + 'label' => $label, |
|
57 | + ); |
|
58 | + } |
|
59 | 59 | |
60 | - return $related_items; |
|
61 | - } |
|
60 | + return $related_items; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Gets the configuration data assosiated with the analytics settings. For |
|
65 | - * frontend script use primarily. |
|
66 | - * |
|
67 | - * @method get_analytics_config_data |
|
68 | - * @since 3.21.0 |
|
69 | - * @return array |
|
70 | - */ |
|
71 | - public static function get_analytics_config_data() { |
|
72 | - $configuration_service = Wordlift_Configuration_Service::get_instance(); |
|
73 | - // get some values from the config service. |
|
74 | - $config = array( |
|
75 | - 'entity_uri_dimension' => $configuration_service->get_analytics_entity_uri_dimension(), |
|
76 | - 'entity_type_dimension' => $configuration_service->get_analytics_entity_type_dimension(), |
|
77 | - ); |
|
63 | + /** |
|
64 | + * Gets the configuration data assosiated with the analytics settings. For |
|
65 | + * frontend script use primarily. |
|
66 | + * |
|
67 | + * @method get_analytics_config_data |
|
68 | + * @since 3.21.0 |
|
69 | + * @return array |
|
70 | + */ |
|
71 | + public static function get_analytics_config_data() { |
|
72 | + $configuration_service = Wordlift_Configuration_Service::get_instance(); |
|
73 | + // get some values from the config service. |
|
74 | + $config = array( |
|
75 | + 'entity_uri_dimension' => $configuration_service->get_analytics_entity_uri_dimension(), |
|
76 | + 'entity_type_dimension' => $configuration_service->get_analytics_entity_type_dimension(), |
|
77 | + ); |
|
78 | 78 | |
79 | - return $config; |
|
80 | - } |
|
79 | + return $config; |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * Enqueues our scripts for the frontend analytics handling and attaches |
|
84 | - * any data we will want to use there. |
|
85 | - * |
|
86 | - * @method enqueue_scripts |
|
87 | - * @since 3.21.0 |
|
88 | - */ |
|
89 | - public function enqueue_scripts() { |
|
90 | - $entity_data = self::get_analytics_event_data( get_the_ID() ); |
|
91 | - // Bail early if there is no event data that we would send. |
|
92 | - if ( ! $entity_data ) { |
|
93 | - return; |
|
94 | - } |
|
95 | - $data = self::get_analytics_config_data(); |
|
82 | + /** |
|
83 | + * Enqueues our scripts for the frontend analytics handling and attaches |
|
84 | + * any data we will want to use there. |
|
85 | + * |
|
86 | + * @method enqueue_scripts |
|
87 | + * @since 3.21.0 |
|
88 | + */ |
|
89 | + public function enqueue_scripts() { |
|
90 | + $entity_data = self::get_analytics_event_data( get_the_ID() ); |
|
91 | + // Bail early if there is no event data that we would send. |
|
92 | + if ( ! $entity_data ) { |
|
93 | + return; |
|
94 | + } |
|
95 | + $data = self::get_analytics_config_data(); |
|
96 | 96 | |
97 | - // Uses the analytics code in the main WordLift plugin. |
|
98 | - wp_localize_script( self::HANDLE, 'wordliftAnalyticsConfigData', $data ); |
|
99 | - wp_localize_script( self::HANDLE, 'wordliftAnalyticsEntityData', $entity_data ); |
|
100 | - } |
|
97 | + // Uses the analytics code in the main WordLift plugin. |
|
98 | + wp_localize_script( self::HANDLE, 'wordliftAnalyticsConfigData', $data ); |
|
99 | + wp_localize_script( self::HANDLE, 'wordliftAnalyticsEntityData', $entity_data ); |
|
100 | + } |
|
101 | 101 | } |
@@ -26,32 +26,32 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return array |
28 | 28 | */ |
29 | - public static function get_analytics_event_data( $post_id ) { |
|
29 | + public static function get_analytics_event_data($post_id) { |
|
30 | 30 | // If no ID was passed get current ID. |
31 | - if ( ! $post_id ) { |
|
31 | + if ( ! $post_id) { |
|
32 | 32 | $post_id = get_queried_object_id(); |
33 | 33 | } |
34 | 34 | /** |
35 | 35 | * TODO: set/get this from cache. |
36 | 36 | */ |
37 | 37 | $related_items = array(); |
38 | - $related_ids = wl_core_get_related_entity_ids( $post_id ); |
|
38 | + $related_ids = wl_core_get_related_entity_ids($post_id); |
|
39 | 39 | |
40 | 40 | $entity_service = Wordlift_Entity_Service::get_instance(); |
41 | 41 | // If the current item is also an entity then add it to the list of IDs. |
42 | - if ( $entity_service->is_entity( $post_id ) ) { |
|
42 | + if ($entity_service->is_entity($post_id)) { |
|
43 | 43 | $related_ids[] = $post_id; |
44 | 44 | } |
45 | 45 | $entity_type_service = Wordlift_Entity_Type_Service::get_instance(); |
46 | 46 | // Get the post titles of related items and connect them in an array. |
47 | - foreach ( $related_ids as $related_id ) { |
|
48 | - $type = $entity_type_service->get( $related_id ); |
|
49 | - $type = isset( $type['uri'] ) ? $type['uri'] : 'unknown'; |
|
50 | - $label = $entity_service->get_labels( $related_id ); |
|
47 | + foreach ($related_ids as $related_id) { |
|
48 | + $type = $entity_type_service->get($related_id); |
|
49 | + $type = isset($type['uri']) ? $type['uri'] : 'unknown'; |
|
50 | + $label = $entity_service->get_labels($related_id); |
|
51 | 51 | $label = $label[0]; |
52 | 52 | |
53 | - $related_items[ $related_id ] = array( |
|
54 | - 'uri' => $entity_service->get_uri( $related_id ), |
|
53 | + $related_items[$related_id] = array( |
|
54 | + 'uri' => $entity_service->get_uri($related_id), |
|
55 | 55 | 'type' => $type, |
56 | 56 | 'label' => $label, |
57 | 57 | ); |
@@ -87,15 +87,15 @@ discard block |
||
87 | 87 | * @since 3.21.0 |
88 | 88 | */ |
89 | 89 | public function enqueue_scripts() { |
90 | - $entity_data = self::get_analytics_event_data( get_the_ID() ); |
|
90 | + $entity_data = self::get_analytics_event_data(get_the_ID()); |
|
91 | 91 | // Bail early if there is no event data that we would send. |
92 | - if ( ! $entity_data ) { |
|
92 | + if ( ! $entity_data) { |
|
93 | 93 | return; |
94 | 94 | } |
95 | 95 | $data = self::get_analytics_config_data(); |
96 | 96 | |
97 | 97 | // Uses the analytics code in the main WordLift plugin. |
98 | - wp_localize_script( self::HANDLE, 'wordliftAnalyticsConfigData', $data ); |
|
99 | - wp_localize_script( self::HANDLE, 'wordliftAnalyticsEntityData', $entity_data ); |
|
98 | + wp_localize_script(self::HANDLE, 'wordliftAnalyticsConfigData', $data); |
|
99 | + wp_localize_script(self::HANDLE, 'wordliftAnalyticsEntityData', $entity_data); |
|
100 | 100 | } |
101 | 101 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function checkPatches(Event $event) |
88 | 88 | { |
89 | - if (!$this->isPatchingEnabled()) { |
|
89 | + if ( ! $this->isPatchingEnabled()) { |
|
90 | 90 | return; |
91 | 91 | } |
92 | 92 | try { |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | // Remove packages for which the patch set has changed. |
120 | 120 | $promises = array(); |
121 | 121 | foreach ($packages as $package) { |
122 | - if (!$package instanceof AliasPackage) { |
|
122 | + if ( ! $package instanceof AliasPackage) { |
|
123 | 123 | $package_name = $package->getName(); |
124 | 124 | $extra = $package->getExtra(); |
125 | 125 | $has_patches = isset($tmp_patches[$package_name]); |
126 | 126 | $has_applied_patches = isset($extra['patches_applied']) && \count($extra['patches_applied']) > 0; |
127 | - if ($has_patches && !$has_applied_patches || !$has_patches && $has_applied_patches || $has_patches && $has_applied_patches && $tmp_patches[$package_name] !== $extra['patches_applied']) { |
|
127 | + if ($has_patches && ! $has_applied_patches || ! $has_patches && $has_applied_patches || $has_patches && $has_applied_patches && $tmp_patches[$package_name] !== $extra['patches_applied']) { |
|
128 | 128 | $uninstallOperation = new UninstallOperation($package, 'Removing package so it can be re-installed and re-patched.'); |
129 | - $this->io->write('<info>Removing package ' . $package_name . ' so that it can be re-installed and re-patched.</info>'); |
|
129 | + $this->io->write('<info>Removing package '.$package_name.' so that it can be re-installed and re-patched.</info>'); |
|
130 | 130 | $promises[] = $installationManager->uninstall($localRepository, $uninstallOperation); |
131 | 131 | } |
132 | 132 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | if (isset($this->patches['_patchesGathered'])) { |
151 | 151 | $this->io->write('<info>Patches already gathered. Skipping</info>', \TRUE, IOInterface::VERBOSE); |
152 | 152 | return; |
153 | - } elseif (!$this->isPatchingEnabled()) { |
|
153 | + } elseif ( ! $this->isPatchingEnabled()) { |
|
154 | 154 | $this->io->write('<info>Patching is disabled. Skipping.</info>', \TRUE, IOInterface::VERBOSE); |
155 | 155 | return; |
156 | 156 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | if ($this->io->isVerbose()) { |
192 | 192 | foreach ($this->patches as $package => $patches) { |
193 | 193 | $number = \count($patches); |
194 | - $this->io->write('<info>Found ' . $number . ' patches for ' . $package . '.</info>'); |
|
194 | + $this->io->write('<info>Found '.$number.' patches for '.$package.'.</info>'); |
|
195 | 195 | } |
196 | 196 | } |
197 | 197 | // Make sure we don't gather patches again. Extra keys in $this->patches |
@@ -237,12 +237,12 @@ discard block |
||
237 | 237 | $msg = ' - Unknown error'; |
238 | 238 | break; |
239 | 239 | } |
240 | - throw new \Exception('There was an error in the supplied patches file:' . $msg); |
|
240 | + throw new \Exception('There was an error in the supplied patches file:'.$msg); |
|
241 | 241 | } |
242 | 242 | if (isset($patches['patches'])) { |
243 | 243 | $patches = $patches['patches']; |
244 | 244 | return $patches; |
245 | - } elseif (!$patches) { |
|
245 | + } elseif ( ! $patches) { |
|
246 | 246 | throw new \Exception('There was an error in the supplied patch file'); |
247 | 247 | } |
248 | 248 | } else { |
@@ -257,20 +257,20 @@ discard block |
||
257 | 257 | { |
258 | 258 | // Check if we should exit in failure. |
259 | 259 | $extra = $this->composer->getPackage()->getExtra(); |
260 | - $exitOnFailure = \getenv('COMPOSER_EXIT_ON_PATCH_FAILURE') || !empty($extra['composer-exit-on-patch-failure']); |
|
261 | - $skipReporting = \getenv('COMPOSER_PATCHES_SKIP_REPORTING') || !empty($extra['composer-patches-skip-reporting']); |
|
260 | + $exitOnFailure = \getenv('COMPOSER_EXIT_ON_PATCH_FAILURE') || ! empty($extra['composer-exit-on-patch-failure']); |
|
261 | + $skipReporting = \getenv('COMPOSER_PATCHES_SKIP_REPORTING') || ! empty($extra['composer-patches-skip-reporting']); |
|
262 | 262 | // Get the package object for the current operation. |
263 | 263 | $operation = $event->getOperation(); |
264 | 264 | /** @var PackageInterface $package */ |
265 | 265 | $package = $this->getPackageFromOperation($operation); |
266 | 266 | $package_name = $package->getName(); |
267 | - if (!isset($this->patches[$package_name])) { |
|
267 | + if ( ! isset($this->patches[$package_name])) { |
|
268 | 268 | if ($this->io->isVerbose()) { |
269 | - $this->io->write('<info>No patches found for ' . $package_name . '.</info>'); |
|
269 | + $this->io->write('<info>No patches found for '.$package_name.'.</info>'); |
|
270 | 270 | } |
271 | 271 | return; |
272 | 272 | } |
273 | - $this->io->write(' - Applying patches for <info>' . $package_name . '</info>'); |
|
273 | + $this->io->write(' - Applying patches for <info>'.$package_name.'</info>'); |
|
274 | 274 | // Get the install path from the package object. |
275 | 275 | $manager = $event->getComposer()->getInstallationManager(); |
276 | 276 | $install_path = $manager->getInstaller($package->getType())->getInstallPath($package); |
@@ -282,14 +282,14 @@ discard block |
||
282 | 282 | $extra = $localPackage->getExtra(); |
283 | 283 | $extra['patches_applied'] = array(); |
284 | 284 | foreach ($this->patches[$package_name] as $description => $url) { |
285 | - $this->io->write(' <info>' . $url . '</info> (<comment>' . $description . '</comment>)'); |
|
285 | + $this->io->write(' <info>'.$url.'</info> (<comment>'.$description.'</comment>)'); |
|
286 | 286 | try { |
287 | 287 | $this->eventDispatcher->dispatch(NULL, new PatchEvent(PatchEvents::PRE_PATCH_APPLY, $package, $url, $description)); |
288 | 288 | $this->getAndApplyPatch($downloader, $install_path, $url, $package); |
289 | 289 | $this->eventDispatcher->dispatch(NULL, new PatchEvent(PatchEvents::POST_PATCH_APPLY, $package, $url, $description)); |
290 | 290 | $extra['patches_applied'][$description] = $url; |
291 | 291 | } catch (\Exception $e) { |
292 | - $this->io->write(' <error>Could not apply patch! Skipping. The error was: ' . $e->getMessage() . '</error>'); |
|
292 | + $this->io->write(' <error>Could not apply patch! Skipping. The error was: '.$e->getMessage().'</error>'); |
|
293 | 293 | if ($exitOnFailure) { |
294 | 294 | throw new \Exception("Cannot apply patch {$description} ({$url})!"); |
295 | 295 | } |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | } elseif ($operation instanceof UpdateOperation) { |
316 | 316 | $package = $operation->getTargetPackage(); |
317 | 317 | } else { |
318 | - throw new \Exception('Unknown operation: ' . \get_class($operation)); |
|
318 | + throw new \Exception('Unknown operation: '.\get_class($operation)); |
|
319 | 319 | } |
320 | 320 | return $package; |
321 | 321 | } |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | $filename = \realpath($patch_url); |
336 | 336 | } else { |
337 | 337 | // Generate random (but not cryptographically so) filename. |
338 | - $filename = \uniqid(\sys_get_temp_dir() . '/') . ".patch"; |
|
338 | + $filename = \uniqid(\sys_get_temp_dir().'/').".patch"; |
|
339 | 339 | // Download file from remote filesystem to this location. |
340 | 340 | $hostname = \parse_url($patch_url, \PHP_URL_HOST); |
341 | 341 | try { |
@@ -352,14 +352,14 @@ discard block |
||
352 | 352 | $patch_levels = array('-p1', '-p0', '-p2', '-p4'); |
353 | 353 | // Check for specified patch level for this package. |
354 | 354 | $extra = $this->composer->getPackage()->getExtra(); |
355 | - if (!empty($extra['patchLevel'][$package->getName()])) { |
|
355 | + if ( ! empty($extra['patchLevel'][$package->getName()])) { |
|
356 | 356 | $patch_levels = array($extra['patchLevel'][$package->getName()]); |
357 | 357 | } |
358 | 358 | // Attempt to apply with git apply. |
359 | 359 | $patched = $this->applyPatchWithGit($install_path, $patch_levels, $filename); |
360 | 360 | // In some rare cases, git will fail to apply a patch, fallback to using |
361 | 361 | // the 'patch' command. |
362 | - if (!$patched) { |
|
362 | + if ( ! $patched) { |
|
363 | 363 | foreach ($patch_levels as $patch_level) { |
364 | 364 | // --no-backup-if-mismatch here is a hack that fixes some |
365 | 365 | // differences between how patch works on windows and unix. |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | } |
375 | 375 | // If the patch *still* isn't applied, then give up and throw an Exception. |
376 | 376 | // Otherwise, let the user know it worked. |
377 | - if (!$patched) { |
|
377 | + if ( ! $patched) { |
|
378 | 378 | throw new \Exception("Cannot apply patch {$patch_url}"); |
379 | 379 | } |
380 | 380 | } |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | protected function isPatchingEnabled() |
388 | 388 | { |
389 | 389 | $extra = $this->composer->getPackage()->getExtra(); |
390 | - if (empty($extra['patches']) && empty($extra['patches-ignore']) && !isset($extra['patches-file'])) { |
|
390 | + if (empty($extra['patches']) && empty($extra['patches-ignore']) && ! isset($extra['patches-file'])) { |
|
391 | 391 | // The root package has no patches of its own, so only allow patching if |
392 | 392 | // it has specifically opted in. |
393 | 393 | return isset($extra['enable-patching']) ? $extra['enable-patching'] : \FALSE; |
@@ -406,10 +406,10 @@ discard block |
||
406 | 406 | $output = "This file was automatically generated by Composer Patches (https://github.com/cweagans/composer-patches)\n"; |
407 | 407 | $output .= "Patches applied to this directory:\n\n"; |
408 | 408 | foreach ($patches as $description => $url) { |
409 | - $output .= $description . "\n"; |
|
410 | - $output .= 'Source: ' . $url . "\n\n\n"; |
|
409 | + $output .= $description."\n"; |
|
410 | + $output .= 'Source: '.$url."\n\n\n"; |
|
411 | 411 | } |
412 | - \file_put_contents($directory . "/PATCHES.txt", $output); |
|
412 | + \file_put_contents($directory."/PATCHES.txt", $output); |
|
413 | 413 | } |
414 | 414 | /** |
415 | 415 | * Executes a shell command with escaping. |
@@ -430,13 +430,13 @@ discard block |
||
430 | 430 | $command = \call_user_func_array('sprintf', $args); |
431 | 431 | $output = ''; |
432 | 432 | if ($this->io->isVerbose()) { |
433 | - $this->io->write('<comment>' . $command . '</comment>'); |
|
433 | + $this->io->write('<comment>'.$command.'</comment>'); |
|
434 | 434 | $io = $this->io; |
435 | - $output = function ($type, $data) use($io) { |
|
435 | + $output = function($type, $data) use($io) { |
|
436 | 436 | if ($type == Process::ERR) { |
437 | - $io->write('<error>' . $data . '</error>'); |
|
437 | + $io->write('<error>'.$data.'</error>'); |
|
438 | 438 | } else { |
439 | - $io->write('<comment>' . $data . '</comment>'); |
|
439 | + $io->write('<comment>'.$data.'</comment>'); |
|
440 | 440 | } |
441 | 441 | }; |
442 | 442 | } |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | { |
485 | 485 | // Do not use git apply unless the install path is itself a git repo |
486 | 486 | // @see https://stackoverflow.com/a/27283285 |
487 | - if (!\is_dir($install_path . '/.git')) { |
|
487 | + if ( ! \is_dir($install_path.'/.git')) { |
|
488 | 488 | return \FALSE; |
489 | 489 | } |
490 | 490 | $patched = \FALSE; |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | if ($this->io->isVerbose()) { |
493 | 493 | $comment = 'Testing ability to patch with git apply.'; |
494 | 494 | $comment .= ' This command may produce errors that can be safely ignored.'; |
495 | - $this->io->write('<comment>' . $comment . '</comment>'); |
|
495 | + $this->io->write('<comment>'.$comment.'</comment>'); |
|
496 | 496 | } |
497 | 497 | $checked = $this->executeCommand('git -C %s apply --check -v %s %s', $install_path, $patch_level, $filename); |
498 | 498 | $output = $this->executor->getErrorOutput(); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | throw new \InvalidArgumentException('An empty file name is not valid to be located.'); |
36 | 36 | } |
37 | 37 | if ($this->isAbsolutePath($name)) { |
38 | - if (!\file_exists($name)) { |
|
38 | + if ( ! \file_exists($name)) { |
|
39 | 39 | throw new FileLocatorFileNotFoundException(\sprintf('The file "%s" does not exist.', $name), 0, null, [$name]); |
40 | 40 | } |
41 | 41 | return $name; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $paths = \array_unique($paths); |
48 | 48 | $filepaths = $notfound = []; |
49 | 49 | foreach ($paths as $path) { |
50 | - if (@\file_exists($file = $path . \DIRECTORY_SEPARATOR . $name)) { |
|
50 | + if (@\file_exists($file = $path.\DIRECTORY_SEPARATOR.$name)) { |
|
51 | 51 | if (\true === $first) { |
52 | 52 | return $file; |
53 | 53 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $notfound[] = $file; |
57 | 57 | } |
58 | 58 | } |
59 | - if (!$filepaths) { |
|
59 | + if ( ! $filepaths) { |
|
60 | 60 | throw new FileLocatorFileNotFoundException(\sprintf('The file "%s" does not exist (in: "%s").', $name, \implode('", "', $paths)), 0, null, $notfound); |
61 | 61 | } |
62 | 62 | return $filepaths; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | $this->resource = \realpath($resource) ?: (\file_exists($resource) ? $resource : \false); |
31 | 31 | $this->pattern = $pattern; |
32 | - if (\false === $this->resource || !\is_dir($this->resource)) { |
|
32 | + if (\false === $this->resource || ! \is_dir($this->resource)) { |
|
33 | 33 | throw new \InvalidArgumentException(\sprintf('The directory "%s" does not exist.', $resource)); |
34 | 34 | } |
35 | 35 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function isFresh($timestamp) |
63 | 63 | { |
64 | - if (!\is_dir($this->resource)) { |
|
64 | + if ( ! \is_dir($this->resource)) { |
|
65 | 65 | return \false; |
66 | 66 | } |
67 | 67 | if ($timestamp < \filemtime($this->resource)) { |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->resource), \RecursiveIteratorIterator::SELF_FIRST) as $file) { |
71 | 71 | // if regex filtering is enabled only check matching files |
72 | - if ($this->pattern && $file->isFile() && !\preg_match($this->pattern, $file->getBasename())) { |
|
72 | + if ($this->pattern && $file->isFile() && ! \preg_match($this->pattern, $file->getBasename())) { |
|
73 | 73 | continue; |
74 | 74 | } |
75 | 75 | // always monitor directories for changes, except the .. entries |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | } |
47 | 47 | public function __toString() |
48 | 48 | { |
49 | - return 'reflection.' . $this->className; |
|
49 | + return 'reflection.'.$this->className; |
|
50 | 50 | } |
51 | 51 | /** |
52 | 52 | * @internal |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $file = $class->getFileName(); |
76 | 76 | if (\false !== $file && \file_exists($file)) { |
77 | 77 | foreach ($this->excludedVendors as $vendor) { |
78 | - if (0 === \strpos($file, $vendor) && \false !== \strpbrk(\substr($file, \strlen($vendor), 1), '/' . \DIRECTORY_SEPARATOR)) { |
|
78 | + if (0 === \strpos($file, $vendor) && \false !== \strpbrk(\substr($file, \strlen($vendor), 1), '/'.\DIRECTORY_SEPARATOR)) { |
|
79 | 79 | $file = \false; |
80 | 80 | break; |
81 | 81 | } |
@@ -117,15 +117,15 @@ discard block |
||
117 | 117 | (yield \print_r(\class_implements($class->name), \true)); |
118 | 118 | (yield \print_r($class->getConstants(), \true)); |
119 | 119 | } |
120 | - if (!$class->isInterface()) { |
|
120 | + if ( ! $class->isInterface()) { |
|
121 | 121 | $defaults = $class->getDefaultProperties(); |
122 | 122 | foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED) as $p) { |
123 | 123 | (yield $p->getDocComment()); |
124 | 124 | (yield $p->isDefault() ? '<default>' : ''); |
125 | 125 | (yield $p->isPublic() ? 'public' : 'protected'); |
126 | 126 | (yield $p->isStatic() ? 'static' : ''); |
127 | - (yield '$' . $p->name); |
|
128 | - (yield \print_r(isset($defaults[$p->name]) && !\is_object($defaults[$p->name]) ? $defaults[$p->name] : null, \true)); |
|
127 | + (yield '$'.$p->name); |
|
128 | + (yield \print_r(isset($defaults[$p->name]) && ! \is_object($defaults[$p->name]) ? $defaults[$p->name] : null, \true)); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | if (\defined('Wordlift\\Modules\\Common\\HHVM_VERSION')) { |
@@ -138,29 +138,29 @@ discard block |
||
138 | 138 | $defaults = []; |
139 | 139 | $parametersWithUndefinedConstants = []; |
140 | 140 | foreach ($m->getParameters() as $p) { |
141 | - if (!$p->isDefaultValueAvailable()) { |
|
141 | + if ( ! $p->isDefaultValueAvailable()) { |
|
142 | 142 | $defaults[$p->name] = null; |
143 | 143 | continue; |
144 | 144 | } |
145 | - if (!$p->isDefaultValueConstant() || \defined($p->getDefaultValueConstantName())) { |
|
145 | + if ( ! $p->isDefaultValueConstant() || \defined($p->getDefaultValueConstantName())) { |
|
146 | 146 | $defaults[$p->name] = $p->getDefaultValue(); |
147 | 147 | continue; |
148 | 148 | } |
149 | 149 | $defaults[$p->name] = $p->getDefaultValueConstantName(); |
150 | 150 | $parametersWithUndefinedConstants[$p->name] = \true; |
151 | 151 | } |
152 | - if (!$parametersWithUndefinedConstants) { |
|
152 | + if ( ! $parametersWithUndefinedConstants) { |
|
153 | 153 | (yield \preg_replace('/^ @@.*/m', '', $m)); |
154 | 154 | } else { |
155 | 155 | $t = \PHP_VERSION_ID >= 70000 ? $m->getReturnType() : ''; |
156 | - $stack = [$m->getDocComment(), $m->getName(), $m->isAbstract(), $m->isFinal(), $m->isStatic(), $m->isPublic(), $m->isPrivate(), $m->isProtected(), $m->returnsReference(), $t instanceof \ReflectionNamedType ? (string) $t->allowsNull() . $t->getName() : (string) $t]; |
|
156 | + $stack = [$m->getDocComment(), $m->getName(), $m->isAbstract(), $m->isFinal(), $m->isStatic(), $m->isPublic(), $m->isPrivate(), $m->isProtected(), $m->returnsReference(), $t instanceof \ReflectionNamedType ? (string) $t->allowsNull().$t->getName() : (string) $t]; |
|
157 | 157 | foreach ($m->getParameters() as $p) { |
158 | - if (!isset($parametersWithUndefinedConstants[$p->name])) { |
|
158 | + if ( ! isset($parametersWithUndefinedConstants[$p->name])) { |
|
159 | 159 | $stack[] = (string) $p; |
160 | 160 | } else { |
161 | 161 | $t = \PHP_VERSION_ID >= 70000 ? $p->getType() : ''; |
162 | 162 | $stack[] = $p->isOptional(); |
163 | - $stack[] = $t instanceof \ReflectionNamedType ? (string) $t->allowsNull() . $t->getName() : (string) $t; |
|
163 | + $stack[] = $t instanceof \ReflectionNamedType ? (string) $t->allowsNull().$t->getName() : (string) $t; |
|
164 | 164 | $stack[] = $p->isPassedByReference(); |
165 | 165 | $stack[] = \PHP_VERSION_ID >= 50600 ? $p->isVariadic() : ''; |
166 | 166 | $stack[] = $p->getName(); |