Skip to content

Commit b477253

Browse files
authored
Merge pull request #277 from lloc/chore
Chore
2 parents 773c43d + e0127e6 commit b477253

File tree

103 files changed

+855
-629
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+855
-629
lines changed

build/translations.json

+1-1
Large diffs are not rendered by default.

composer.json

+11-9
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66
"homepage": "http://msls.co",
77
"require": {
88
"php": ">=7.4",
9-
"composer/installers": "~1.12.0"
9+
"composer/installers": "~1.12.0",
10+
"ext-json": "*"
1011
},
1112
"require-dev": {
12-
"phpunit/phpunit": "~9.6",
13-
"brain/monkey": "2.*",
14-
"phpstan/phpstan": "^1.8",
15-
"szepeviktor/phpstan-wordpress": "^1.1",
16-
"phpstan/extension-installer": "^1.1",
17-
"antecedent/patchwork": "~2.1.19",
18-
"squizlabs/php_codesniffer": "^3.7",
13+
"phpunit/phpunit": "^9.6",
14+
"brain/monkey": "^2.6",
15+
"phpstan/phpstan": "^1.10",
16+
"szepeviktor/phpstan-wordpress": "^1.3",
17+
"phpstan/extension-installer": "^1.3",
18+
"antecedent/patchwork": "^2.1",
19+
"squizlabs/php_codesniffer": "^3.9",
1920
"phpcompatibility/php-compatibility": "^9.3"
2021
},
2122
"autoload": {
@@ -25,7 +26,7 @@
2526
},
2627
"autoload-dev": {
2728
"psr-4": {
28-
"lloc\\Msls\\": "tests/"
29+
"lloc\\MslsTests\\": "tests/"
2930
}
3031
},
3132
"scripts": {
@@ -34,6 +35,7 @@
3435
"analyze": "vendor/bin/phpstan analyze",
3536
"php74": "phpcs -p ./*.php includes/ --standard=vendor/phpcompatibility/php-compatibility/PHPCompatibility --runtime-set testVersion 7.4",
3637
"php81": "phpcs -p ./*.php includes/ --standard=vendor/phpcompatibility/php-compatibility/PHPCompatibility --runtime-set testVersion 8.1",
38+
"php82": "phpcs -p ./*.php includes/ --standard=vendor/phpcompatibility/php-compatibility/PHPCompatibility --runtime-set testVersion 8.2",
3739
"prepare": "wget -O build/translations.json http://api.wordpress.org/translations/core/1.0/",
3840
"flags-png": "php bin/flags-png.php > flags/flags.php",
3941
"flags-svg": "php bin/flags-svg.php > css/flags.php"

css/flags.php

+19-19
Original file line numberDiff line numberDiff line change
@@ -31,40 +31,40 @@
3131
'cs_CZ' => 'flag-icon-cz',
3232
'cy' => 'flag-icon-gb-ls',
3333
'da_DK' => 'flag-icon-dk',
34-
'de_AT' => 'flag-icon-at',
35-
'de_CH_informal' => 'flag-icon-ch',
3634
'de_CH' => 'flag-icon-ch',
37-
'de_DE' => 'flag-icon-de',
3835
'de_DE_formal' => 'flag-icon-de',
36+
'de_DE' => 'flag-icon-de',
37+
'de_AT' => 'flag-icon-at',
38+
'de_CH_informal' => 'flag-icon-ch',
3939
'dzo' => 'flag-icon-bt',
4040
'el' => 'flag-icon-gr',
41-
'en_ZA' => 'flag-icon-za',
42-
'en_GB' => 'flag-icon-gb',
43-
'en_AU' => 'flag-icon-au',
4441
'en_NZ' => 'flag-icon-nz',
42+
'en_AU' => 'flag-icon-au',
4543
'en_CA' => 'flag-icon-ca',
44+
'en_GB' => 'flag-icon-gb',
45+
'en_ZA' => 'flag-icon-za',
4646
'eo' => 'flag-icon-eu',
47-
'es_VE' => 'flag-icon-ve',
4847
'es_MX' => 'flag-icon-mx',
4948
'es_ES' => 'flag-icon-es',
50-
'es_CR' => 'flag-icon-cr',
5149
'es_CO' => 'flag-icon-co',
50+
'es_CL' => 'flag-icon-cl',
51+
'es_CR' => 'flag-icon-cr',
52+
'es_VE' => 'flag-icon-ve',
5253
'es_EC' => 'flag-icon-ec',
53-
'es_PE' => 'flag-icon-pe',
5454
'es_DO' => 'flag-icon-do',
55+
'es_PE' => 'flag-icon-pe',
5556
'es_UY' => 'flag-icon-uy',
56-
'es_CL' => 'flag-icon-cl',
5757
'es_PR' => 'flag-icon-pr',
58-
'es_AR' => 'flag-icon-ar',
5958
'es_GT' => 'flag-icon-gt',
59+
'es_AR' => 'flag-icon-ar',
6060
'et' => 'flag-icon-ee',
6161
'eu' => 'flag-icon-es',
62-
'fa_IR' => 'flag-icon-ir',
6362
'fa_AF' => 'flag-icon-af',
63+
'fa_IR' => 'flag-icon-ir',
6464
'fi' => 'flag-icon-fi',
65-
'fr_CA' => 'flag-icon-ca',
66-
'fr_FR' => 'flag-icon-fr',
6765
'fr_BE' => 'flag-icon-be',
66+
'fr_FR' => 'flag-icon-fr',
67+
'fr_CA' => 'flag-icon-ca',
6868
'fur' => 'flag-icon-it',
6969
'gd' => 'flag-icon-gb-sct',
7070
'gl_ES' => 'flag-icon-es',
@@ -97,18 +97,18 @@
9797
'my_MM' => 'flag-icon-mm',
9898
'nb_NO' => 'flag-icon-no',
9999
'ne_NP' => 'flag-icon-np',
100-
'nl_NL_formal' => 'flag-icon-nl',
101100
'nl_NL' => 'flag-icon-nl',
102101
'nl_BE' => 'flag-icon-be',
102+
'nl_NL_formal' => 'flag-icon-nl',
103103
'nn_NO' => 'flag-icon-no',
104104
'oci' => 'flag-icon-es-ca',
105105
'pa_IN' => 'flag-icon-in',
106106
'pl_PL' => 'flag-icon-pl',
107107
'ps' => 'flag-icon-af',
108-
'pt_AO' => 'flag-icon-ao',
109-
'pt_PT' => 'flag-icon-pt',
110-
'pt_BR' => 'flag-icon-br',
111108
'pt_PT_ao90' => 'flag-icon-90',
109+
'pt_BR' => 'flag-icon-br',
110+
'pt_PT' => 'flag-icon-pt',
111+
'pt_AO' => 'flag-icon-ao',
112112
'ro_RO' => 'flag-icon-ro',
113113
'ru_RU' => 'flag-icon-ru',
114114
'sah' => 'flag-icon-ru',
@@ -133,9 +133,9 @@
133133
'ur' => 'flag-icon-pk',
134134
'uz_UZ' => 'flag-icon-uz',
135135
'vi' => 'flag-icon-vn',
136-
'zh_TW' => 'flag-icon-tw',
137136
'zh_CN' => 'flag-icon-cn',
138137
'zh_HK' => 'flag-icon-hk',
138+
'zh_TW' => 'flag-icon-tw',
139139
];
140140

141141
/**

flags/flags.php

+19-19
Original file line numberDiff line numberDiff line change
@@ -31,40 +31,40 @@
3131
'cs_CZ' => 'cz.png',
3232
'cy' => 'wales.png',
3333
'da_DK' => 'dk.png',
34-
'de_AT' => 'at.png',
35-
'de_CH_informal' => 'ch.png',
3634
'de_CH' => 'ch.png',
37-
'de_DE' => 'de.png',
3835
'de_DE_formal' => 'de.png',
36+
'de_DE' => 'de.png',
37+
'de_AT' => 'at.png',
38+
'de_CH_informal' => 'ch.png',
3939
'dzo' => 'bt.png',
4040
'el' => 'gr.png',
41-
'en_ZA' => 'za.png',
42-
'en_GB' => 'gb.png',
43-
'en_AU' => 'au.png',
4441
'en_NZ' => 'nz.png',
42+
'en_AU' => 'au.png',
4543
'en_CA' => 'ca.png',
44+
'en_GB' => 'gb.png',
45+
'en_ZA' => 'za.png',
4646
'eo' => 'europeanunion.png',
47-
'es_VE' => 've.png',
4847
'es_MX' => 'mx.png',
4948
'es_ES' => 'es.png',
50-
'es_CR' => 'cr.png',
5149
'es_CO' => 'co.png',
50+
'es_CL' => 'cl.png',
51+
'es_CR' => 'cr.png',
52+
'es_VE' => 've.png',
5253
'es_EC' => 'ec.png',
53-
'es_PE' => 'pe.png',
5454
'es_DO' => 'do.png',
55+
'es_PE' => 'pe.png',
5556
'es_UY' => 'uy.png',
56-
'es_CL' => 'cl.png',
5757
'es_PR' => 'pr.png',
58-
'es_AR' => 'ar.png',
5958
'es_GT' => 'gt.png',
59+
'es_AR' => 'ar.png',
6060
'et' => 'ee.png',
6161
'eu' => 'es.png',
62-
'fa_IR' => 'ir.png',
6362
'fa_AF' => 'af.png',
63+
'fa_IR' => 'ir.png',
6464
'fi' => 'fi.png',
65-
'fr_CA' => 'ca.png',
66-
'fr_FR' => 'fr.png',
6765
'fr_BE' => 'be.png',
66+
'fr_FR' => 'fr.png',
67+
'fr_CA' => 'ca.png',
6868
'fur' => 'it.png',
6969
'gd' => 'scotland.png',
7070
'gl_ES' => 'es.png',
@@ -97,18 +97,18 @@
9797
'my_MM' => 'mm.png',
9898
'nb_NO' => 'no.png',
9999
'ne_NP' => 'np.png',
100-
'nl_NL_formal' => 'nl.png',
101100
'nl_NL' => 'nl.png',
102101
'nl_BE' => 'be.png',
102+
'nl_NL_formal' => 'nl.png',
103103
'nn_NO' => 'no.png',
104104
'oci' => 'catalonia.png',
105105
'pa_IN' => 'in.png',
106106
'pl_PL' => 'pl.png',
107107
'ps' => 'af.png',
108-
'pt_AO' => 'ao.png',
109-
'pt_PT' => 'pt.png',
110-
'pt_BR' => 'br.png',
111108
'pt_PT_ao90' => '90.png',
109+
'pt_BR' => 'br.png',
110+
'pt_PT' => 'pt.png',
111+
'pt_AO' => 'ao.png',
112112
'ro_RO' => 'ro.png',
113113
'ru_RU' => 'ru.png',
114114
'sah' => 'ru.png',
@@ -133,9 +133,9 @@
133133
'ur' => 'pk.png',
134134
'uz_UZ' => 'uz.png',
135135
'vi' => 'vn.png',
136-
'zh_TW' => 'tw.png',
137136
'zh_CN' => 'cn.png',
138137
'zh_HK' => 'hk.png',
138+
'zh_TW' => 'tw.png',
139139
];
140140

141141
/**

includes/Component/Icon.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ abstract class Icon {
1717
* Icon constructor
1818
*/
1919
public function __construct() {
20-
if( $this->get_include() ) {
20+
if ( $this->get_include() ) {
2121
$this->map = include $this->get_include();
2222
}
2323
}

includes/Component/Icon/IconSvg.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ protected function get_include(): string {
2626
* @return string
2727
*/
2828
public function get( string $language ): string {
29-
return $this->map[ $language ] ?? $this->maybe( $language, 'flag-icon-' );
29+
return $this->map[ $language ] ?? $this->maybe( $language, 'flag-icon-' );
3030
}
3131

3232
}

includes/Component/Input/Checkbox.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,17 @@ class Checkbox implements InputInterface {
2525
* @param string $value
2626
*/
2727
public function __construct( string $key, ?string $value ) {
28-
$this->key = esc_attr( $key );
28+
$this->key = esc_attr( $key );
2929
$this->selected = checked( 1, $value, false );
3030
}
3131

3232
/**
3333
* @return string
3434
*/
3535
public function render(): string {
36-
return sprintf( '<input type="checkbox" id="%1$s" name="msls[%1$s]" value="1" %2$s/>', $this->key, $this->selected );
36+
return sprintf( '<input type="checkbox" id="%1$s" name="msls[%1$s]" value="1" %2$s/>',
37+
$this->key,
38+
$this->selected );
3739
}
3840

3941
}

includes/Component/Input/Text.php

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ public function render(): string {
5252
$this->size,
5353
$this->readonly
5454
);
55-
5655
}
5756

5857
}

includes/ContentImport/ContentImporter.php

+14-8
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function handle_import( array $data = [] ) {
132132
$data = $this->import_content( $import_coordinates, $data );
133133

134134
if ( $this->has_created_post ) {
135-
$this->update_inserted_blog_post_data($dest_blog_id, $dest_post_id, $data );
135+
$this->update_inserted_blog_post_data( $dest_blog_id, $dest_post_id, $data );
136136
$this->redirect_to_blog_post( $dest_blog_id, $dest_post_id );
137137
}
138138

@@ -238,7 +238,7 @@ public function handle( $handle ) {
238238
/**
239239
* Imports content according to the provided coordinates.
240240
*
241-
* @param ImportCoordinates $import_coordinates
241+
* @param ImportCoordinates $import_coordinates
242242
* @param array $post_fields An optional array of post fields; this can be
243243
* left empty if the method is not called as a consequence
244244
* of filtering the `wp_insert_post_data` filter.
@@ -260,10 +260,11 @@ public function import_content( ImportCoordinates $import_coordinates, array $po
260260
/**
261261
* Filters the data before the import runs.
262262
*
263-
* @since TBD
264-
*
265263
* @param array $post_fields
266264
* @param ImportCoordinates $import_coordinates
265+
*
266+
* @since TBD
267+
*
267268
*/
268269
$post_fields = apply_filters( 'msls_content_import_data_before_import', $post_fields, $import_coordinates );
269270

@@ -305,11 +306,12 @@ public function import_content( ImportCoordinates $import_coordinates, array $po
305306
/**
306307
* Fires after the import ran.
307308
*
308-
* @since TBD
309-
*
310309
* @param ImportCoordinates $import_coordinates
311310
* @param ImportLogger $logger
312311
* @param Relations $relations
312+
*
313+
* @since TBD
314+
*
313315
*/
314316
do_action( 'msls_content_import_after_import', $import_coordinates, $this->logger, $this->relations );
315317

@@ -321,7 +323,11 @@ public function import_content( ImportCoordinates $import_coordinates, array $po
321323
* @param ImportLogger $logger
322324
* @param Relations $relations
323325
*/
324-
return apply_filters( 'msls_content_import_data_after_import', $post_fields, $import_coordinates, $this->logger, $this->relations );
326+
return apply_filters( 'msls_content_import_data_after_import',
327+
$post_fields,
328+
$import_coordinates,
329+
$this->logger,
330+
$this->relations );
325331
}
326332

327333
/**
@@ -330,7 +336,7 @@ public function import_content( ImportCoordinates $import_coordinates, array $po
330336
*
331337
* @return array
332338
*/
333-
protected function update_inserted_blog_post_data($blog_id, $post_id, array $data ) {
339+
protected function update_inserted_blog_post_data( $blog_id, $post_id, array $data ) {
334340
$data['ID'] = $post_id;
335341
$data['post_status'] = empty( $data['post_status'] ) || $data['post_status'] === 'auto-draft'
336342
? 'draft'

includes/ContentImport/ImportLogger.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function save() {
8181
* Logs an error.
8282
*
8383
* @param string $where A location string using `/` as level format.
84-
* @param mixed $what What should be stored in the log.
84+
* @param mixed $what What should be stored in the log.
8585
*/
8686
public function log_error( $where, $what ) {
8787
$this->log( $where, $what, 'error' );
@@ -91,8 +91,8 @@ public function log_error( $where, $what ) {
9191
* Logs something.
9292
*
9393
* @param string $where A location string using `/` as level format.
94-
* @param mixed $what What should be stored in the log.
95-
* @param string $root Where to log the information.
94+
* @param mixed $what What should be stored in the log.
95+
* @param string $root Where to log the information.
9696
*/
9797
protected function log( $where, $what, $root = 'info' ) {
9898
if ( ! isset( $this->data[ $root ] ) ) {
@@ -111,7 +111,8 @@ protected function build_nested_array( $path, $what = '' ) {
111111
. '":' . json_encode( $what )
112112
. implode(
113113
'',
114-
array_fill( 0, count( $path ),
114+
array_fill( 0,
115+
count( $path ),
115116
'}' )
116117
);
117118
$data = json_decode( $json, true );
@@ -152,7 +153,7 @@ public function set_levels_delimiter( $levels_delimiter ) {
152153
* Logs a success.
153154
*
154155
* @param string $where A location string using `/` as level format.
155-
* @param mixed $what What should be stored in the log.
156+
* @param mixed $what What should be stored in the log.
156157
*/
157158
public function log_success( $where, $what ) {
158159
$this->log( $where, $what, 'success' );

0 commit comments

Comments
 (0)