Skip to content

Chore #277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 27, 2024
Merged

Chore #277

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/translations.json

Large diffs are not rendered by default.

20 changes: 11 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@
"homepage": "http://msls.co",
"require": {
"php": ">=7.4",
"composer/installers": "~1.12.0"
"composer/installers": "~1.12.0",
"ext-json": "*"
},
"require-dev": {
"phpunit/phpunit": "~9.6",
"brain/monkey": "2.*",
"phpstan/phpstan": "^1.8",
"szepeviktor/phpstan-wordpress": "^1.1",
"phpstan/extension-installer": "^1.1",
"antecedent/patchwork": "~2.1.19",
"squizlabs/php_codesniffer": "^3.7",
"phpunit/phpunit": "^9.6",
"brain/monkey": "^2.6",
"phpstan/phpstan": "^1.10",
"szepeviktor/phpstan-wordpress": "^1.3",
"phpstan/extension-installer": "^1.3",
"antecedent/patchwork": "^2.1",
"squizlabs/php_codesniffer": "^3.9",
"phpcompatibility/php-compatibility": "^9.3"
},
"autoload": {
Expand All @@ -25,7 +26,7 @@
},
"autoload-dev": {
"psr-4": {
"lloc\\Msls\\": "tests/"
"lloc\\MslsTests\\": "tests/"
}
},
"scripts": {
Expand All @@ -34,6 +35,7 @@
"analyze": "vendor/bin/phpstan analyze",
"php74": "phpcs -p ./*.php includes/ --standard=vendor/phpcompatibility/php-compatibility/PHPCompatibility --runtime-set testVersion 7.4",
"php81": "phpcs -p ./*.php includes/ --standard=vendor/phpcompatibility/php-compatibility/PHPCompatibility --runtime-set testVersion 8.1",
"php82": "phpcs -p ./*.php includes/ --standard=vendor/phpcompatibility/php-compatibility/PHPCompatibility --runtime-set testVersion 8.2",
"prepare": "wget -O build/translations.json http://api.wordpress.org/translations/core/1.0/",
"flags-png": "php bin/flags-png.php > flags/flags.php",
"flags-svg": "php bin/flags-svg.php > css/flags.php"
Expand Down
38 changes: 19 additions & 19 deletions css/flags.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,40 +31,40 @@
'cs_CZ' => 'flag-icon-cz',
'cy' => 'flag-icon-gb-ls',
'da_DK' => 'flag-icon-dk',
'de_AT' => 'flag-icon-at',
'de_CH_informal' => 'flag-icon-ch',
'de_CH' => 'flag-icon-ch',
'de_DE' => 'flag-icon-de',
'de_DE_formal' => 'flag-icon-de',
'de_DE' => 'flag-icon-de',
'de_AT' => 'flag-icon-at',
'de_CH_informal' => 'flag-icon-ch',
'dzo' => 'flag-icon-bt',
'el' => 'flag-icon-gr',
'en_ZA' => 'flag-icon-za',
'en_GB' => 'flag-icon-gb',
'en_AU' => 'flag-icon-au',
'en_NZ' => 'flag-icon-nz',
'en_AU' => 'flag-icon-au',
'en_CA' => 'flag-icon-ca',
'en_GB' => 'flag-icon-gb',
'en_ZA' => 'flag-icon-za',
'eo' => 'flag-icon-eu',
'es_VE' => 'flag-icon-ve',
'es_MX' => 'flag-icon-mx',
'es_ES' => 'flag-icon-es',
'es_CR' => 'flag-icon-cr',
'es_CO' => 'flag-icon-co',
'es_CL' => 'flag-icon-cl',
'es_CR' => 'flag-icon-cr',
'es_VE' => 'flag-icon-ve',
'es_EC' => 'flag-icon-ec',
'es_PE' => 'flag-icon-pe',
'es_DO' => 'flag-icon-do',
'es_PE' => 'flag-icon-pe',
'es_UY' => 'flag-icon-uy',
'es_CL' => 'flag-icon-cl',
'es_PR' => 'flag-icon-pr',
'es_AR' => 'flag-icon-ar',
'es_GT' => 'flag-icon-gt',
'es_AR' => 'flag-icon-ar',
'et' => 'flag-icon-ee',
'eu' => 'flag-icon-es',
'fa_IR' => 'flag-icon-ir',
'fa_AF' => 'flag-icon-af',
'fa_IR' => 'flag-icon-ir',
'fi' => 'flag-icon-fi',
'fr_CA' => 'flag-icon-ca',
'fr_FR' => 'flag-icon-fr',
'fr_BE' => 'flag-icon-be',
'fr_FR' => 'flag-icon-fr',
'fr_CA' => 'flag-icon-ca',
'fur' => 'flag-icon-it',
'gd' => 'flag-icon-gb-sct',
'gl_ES' => 'flag-icon-es',
Expand Down Expand Up @@ -97,18 +97,18 @@
'my_MM' => 'flag-icon-mm',
'nb_NO' => 'flag-icon-no',
'ne_NP' => 'flag-icon-np',
'nl_NL_formal' => 'flag-icon-nl',
'nl_NL' => 'flag-icon-nl',
'nl_BE' => 'flag-icon-be',
'nl_NL_formal' => 'flag-icon-nl',
'nn_NO' => 'flag-icon-no',
'oci' => 'flag-icon-es-ca',
'pa_IN' => 'flag-icon-in',
'pl_PL' => 'flag-icon-pl',
'ps' => 'flag-icon-af',
'pt_AO' => 'flag-icon-ao',
'pt_PT' => 'flag-icon-pt',
'pt_BR' => 'flag-icon-br',
'pt_PT_ao90' => 'flag-icon-90',
'pt_BR' => 'flag-icon-br',
'pt_PT' => 'flag-icon-pt',
'pt_AO' => 'flag-icon-ao',
'ro_RO' => 'flag-icon-ro',
'ru_RU' => 'flag-icon-ru',
'sah' => 'flag-icon-ru',
Expand All @@ -133,9 +133,9 @@
'ur' => 'flag-icon-pk',
'uz_UZ' => 'flag-icon-uz',
'vi' => 'flag-icon-vn',
'zh_TW' => 'flag-icon-tw',
'zh_CN' => 'flag-icon-cn',
'zh_HK' => 'flag-icon-hk',
'zh_TW' => 'flag-icon-tw',
];

/**
Expand Down
38 changes: 19 additions & 19 deletions flags/flags.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,40 +31,40 @@
'cs_CZ' => 'cz.png',
'cy' => 'wales.png',
'da_DK' => 'dk.png',
'de_AT' => 'at.png',
'de_CH_informal' => 'ch.png',
'de_CH' => 'ch.png',
'de_DE' => 'de.png',
'de_DE_formal' => 'de.png',
'de_DE' => 'de.png',
'de_AT' => 'at.png',
'de_CH_informal' => 'ch.png',
'dzo' => 'bt.png',
'el' => 'gr.png',
'en_ZA' => 'za.png',
'en_GB' => 'gb.png',
'en_AU' => 'au.png',
'en_NZ' => 'nz.png',
'en_AU' => 'au.png',
'en_CA' => 'ca.png',
'en_GB' => 'gb.png',
'en_ZA' => 'za.png',
'eo' => 'europeanunion.png',
'es_VE' => 've.png',
'es_MX' => 'mx.png',
'es_ES' => 'es.png',
'es_CR' => 'cr.png',
'es_CO' => 'co.png',
'es_CL' => 'cl.png',
'es_CR' => 'cr.png',
'es_VE' => 've.png',
'es_EC' => 'ec.png',
'es_PE' => 'pe.png',
'es_DO' => 'do.png',
'es_PE' => 'pe.png',
'es_UY' => 'uy.png',
'es_CL' => 'cl.png',
'es_PR' => 'pr.png',
'es_AR' => 'ar.png',
'es_GT' => 'gt.png',
'es_AR' => 'ar.png',
'et' => 'ee.png',
'eu' => 'es.png',
'fa_IR' => 'ir.png',
'fa_AF' => 'af.png',
'fa_IR' => 'ir.png',
'fi' => 'fi.png',
'fr_CA' => 'ca.png',
'fr_FR' => 'fr.png',
'fr_BE' => 'be.png',
'fr_FR' => 'fr.png',
'fr_CA' => 'ca.png',
'fur' => 'it.png',
'gd' => 'scotland.png',
'gl_ES' => 'es.png',
Expand Down Expand Up @@ -97,18 +97,18 @@
'my_MM' => 'mm.png',
'nb_NO' => 'no.png',
'ne_NP' => 'np.png',
'nl_NL_formal' => 'nl.png',
'nl_NL' => 'nl.png',
'nl_BE' => 'be.png',
'nl_NL_formal' => 'nl.png',
'nn_NO' => 'no.png',
'oci' => 'catalonia.png',
'pa_IN' => 'in.png',
'pl_PL' => 'pl.png',
'ps' => 'af.png',
'pt_AO' => 'ao.png',
'pt_PT' => 'pt.png',
'pt_BR' => 'br.png',
'pt_PT_ao90' => '90.png',
'pt_BR' => 'br.png',
'pt_PT' => 'pt.png',
'pt_AO' => 'ao.png',
'ro_RO' => 'ro.png',
'ru_RU' => 'ru.png',
'sah' => 'ru.png',
Expand All @@ -133,9 +133,9 @@
'ur' => 'pk.png',
'uz_UZ' => 'uz.png',
'vi' => 'vn.png',
'zh_TW' => 'tw.png',
'zh_CN' => 'cn.png',
'zh_HK' => 'hk.png',
'zh_TW' => 'tw.png',
];

/**
Expand Down
2 changes: 1 addition & 1 deletion includes/Component/Icon.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ abstract class Icon {
* Icon constructor
*/
public function __construct() {
if( $this->get_include() ) {
if ( $this->get_include() ) {
$this->map = include $this->get_include();
}
}
Expand Down
2 changes: 1 addition & 1 deletion includes/Component/Icon/IconSvg.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected function get_include(): string {
* @return string
*/
public function get( string $language ): string {
return $this->map[ $language ] ?? $this->maybe( $language, 'flag-icon-' );
return $this->map[ $language ] ?? $this->maybe( $language, 'flag-icon-' );
}

}
6 changes: 4 additions & 2 deletions includes/Component/Input/Checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@ class Checkbox implements InputInterface {
* @param string $value
*/
public function __construct( string $key, ?string $value ) {
$this->key = esc_attr( $key );
$this->key = esc_attr( $key );
$this->selected = checked( 1, $value, false );
}

/**
* @return string
*/
public function render(): string {
return sprintf( '<input type="checkbox" id="%1$s" name="msls[%1$s]" value="1" %2$s/>', $this->key, $this->selected );
return sprintf( '<input type="checkbox" id="%1$s" name="msls[%1$s]" value="1" %2$s/>',
$this->key,
$this->selected );
}

}
1 change: 0 additions & 1 deletion includes/Component/Input/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public function render(): string {
$this->size,
$this->readonly
);

}

}
22 changes: 14 additions & 8 deletions includes/ContentImport/ContentImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function handle_import( array $data = [] ) {
$data = $this->import_content( $import_coordinates, $data );

if ( $this->has_created_post ) {
$this->update_inserted_blog_post_data($dest_blog_id, $dest_post_id, $data );
$this->update_inserted_blog_post_data( $dest_blog_id, $dest_post_id, $data );
$this->redirect_to_blog_post( $dest_blog_id, $dest_post_id );
}

Expand Down Expand Up @@ -238,7 +238,7 @@ public function handle( $handle ) {
/**
* Imports content according to the provided coordinates.
*
* @param ImportCoordinates $import_coordinates
* @param ImportCoordinates $import_coordinates
* @param array $post_fields An optional array of post fields; this can be
* left empty if the method is not called as a consequence
* of filtering the `wp_insert_post_data` filter.
Expand All @@ -260,10 +260,11 @@ public function import_content( ImportCoordinates $import_coordinates, array $po
/**
* Filters the data before the import runs.
*
* @since TBD
*
* @param array $post_fields
* @param ImportCoordinates $import_coordinates
*
* @since TBD
*
*/
$post_fields = apply_filters( 'msls_content_import_data_before_import', $post_fields, $import_coordinates );

Expand Down Expand Up @@ -305,11 +306,12 @@ public function import_content( ImportCoordinates $import_coordinates, array $po
/**
* Fires after the import ran.
*
* @since TBD
*
* @param ImportCoordinates $import_coordinates
* @param ImportLogger $logger
* @param Relations $relations
*
* @since TBD
*
*/
do_action( 'msls_content_import_after_import', $import_coordinates, $this->logger, $this->relations );

Expand All @@ -321,7 +323,11 @@ public function import_content( ImportCoordinates $import_coordinates, array $po
* @param ImportLogger $logger
* @param Relations $relations
*/
return apply_filters( 'msls_content_import_data_after_import', $post_fields, $import_coordinates, $this->logger, $this->relations );
return apply_filters( 'msls_content_import_data_after_import',
$post_fields,
$import_coordinates,
$this->logger,
$this->relations );
}

/**
Expand All @@ -330,7 +336,7 @@ public function import_content( ImportCoordinates $import_coordinates, array $po
*
* @return array
*/
protected function update_inserted_blog_post_data($blog_id, $post_id, array $data ) {
protected function update_inserted_blog_post_data( $blog_id, $post_id, array $data ) {
$data['ID'] = $post_id;
$data['post_status'] = empty( $data['post_status'] ) || $data['post_status'] === 'auto-draft'
? 'draft'
Expand Down
11 changes: 6 additions & 5 deletions includes/ContentImport/ImportLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function save() {
* Logs an error.
*
* @param string $where A location string using `/` as level format.
* @param mixed $what What should be stored in the log.
* @param mixed $what What should be stored in the log.
*/
public function log_error( $where, $what ) {
$this->log( $where, $what, 'error' );
Expand All @@ -91,8 +91,8 @@ public function log_error( $where, $what ) {
* Logs something.
*
* @param string $where A location string using `/` as level format.
* @param mixed $what What should be stored in the log.
* @param string $root Where to log the information.
* @param mixed $what What should be stored in the log.
* @param string $root Where to log the information.
*/
protected function log( $where, $what, $root = 'info' ) {
if ( ! isset( $this->data[ $root ] ) ) {
Expand All @@ -111,7 +111,8 @@ protected function build_nested_array( $path, $what = '' ) {
. '":' . json_encode( $what )
. implode(
'',
array_fill( 0, count( $path ),
array_fill( 0,
count( $path ),
'}' )
);
$data = json_decode( $json, true );
Expand Down Expand Up @@ -152,7 +153,7 @@ public function set_levels_delimiter( $levels_delimiter ) {
* Logs a success.
*
* @param string $where A location string using `/` as level format.
* @param mixed $what What should be stored in the log.
* @param mixed $what What should be stored in the log.
*/
public function log_success( $where, $what ) {
$this->log( $where, $what, 'success' );
Expand Down
Loading
Loading