diff --git a/README.md b/README.md index 946e4f8..83f2b0c 100644 --- a/README.md +++ b/README.md @@ -177,4 +177,4 @@ $ gulp archive

-**Tags:** wpLingua, WP Lingua, WP-Lingua, Multilingual, Bilingual, Translation, Translate, Translated, Localization, Automatic translation, Machine translation, Languages, WordPress, WP, Plugin \ No newline at end of file +**Tags:** wpLingua, WP Lingua, WP-Lingua, Multilingual, Bilingual, Translation, Translate, Translated, Localization, Automatic translation, Machine translation, Languages, WordPress, WP, Plugin, Language switcher, Language selector, API, SEO, Custom flags diff --git a/data.php b/data.php index bad90af..603420b 100644 --- a/data.php +++ b/data.php @@ -37,7 +37,7 @@ function wplng_data_json_to_translate() { // Plugin : YITH array( 'yith_wcwl_l10n', 'labels', 'cookie_disabled' ), - + // Plugin : WF Cookie Consent array( 'wfCookieConsentSettings', 'wf_cookietext' ), array( 'wfCookieConsentSettings', 'wf_dismisstext' ), @@ -98,6 +98,7 @@ function wplng_data_excluded_selector_default() { 'iframe', 'code', 'address', + 'xml', // Link tag 'link[rel="EditURI"]', @@ -111,6 +112,8 @@ function wplng_data_excluded_selector_default() { // Wordpress '#wpadminbar', + '.wp-embed-share-input', + '[aria-label="HTML"]', // wpLingua 'link[hreflang]', @@ -155,6 +158,7 @@ function wplng_data_excluded_node_text() { 'link', 'script', 'code', + // Plugin: Contact Form 7 '.wpcf7-textarea', ) diff --git a/inc/admin/assets.php b/inc/admin/assets.php index ac15ae0..1921c53 100644 --- a/inc/admin/assets.php +++ b/inc/admin/assets.php @@ -114,7 +114,7 @@ function wplng_option_page_register_assets( $hook ) { /** * Register wpLingua assets for option page : Switcher * - * @param string $hook + * @param string $hook The current admin page hook. * @return void */ function wplng_option_page_switcher_assets( $hook ) { diff --git a/inc/admin/option-page-settings.php b/inc/admin/option-page-settings.php index dddd561..64f83ed 100644 --- a/inc/admin/option-page-settings.php +++ b/inc/admin/option-page-settings.php @@ -120,12 +120,22 @@ function wplng_settings_part_first_use() { ); if ( ! empty( $language_target ) ) { + + global $wplng_languages_target_simplified; + $wplng_languages_target_simplified = array( $language_target ); + update_option( 'wplng_target_languages', wp_json_encode( array( $language_target ) ) ); + + update_option( + 'wplng_flags_style', + 'rectangular' + ); + } else { return false; } @@ -278,16 +288,7 @@ function wplng_settings_part_language_website() { */ function wplng_settings_part_languages_target() { - $languages_target = wplng_get_languages_target_simplified(); - $languages_target_ids = array(); - - foreach ( $languages_target as $language_target ) { - if ( ! empty( $language_target['id'] ) ) { - $languages_target_ids[] = $language_target['id']; - } - } - - $languages_target = wplng_get_languages_by_ids( $languages_target_ids ); + $languages_target = wplng_get_languages_target_simplified(); ?>
diff --git a/inc/admin/option-page-switcher.php b/inc/admin/option-page-switcher.php index e47944a..a3e2cce 100644 --- a/inc/admin/option-page-switcher.php +++ b/inc/admin/option-page-switcher.php @@ -566,10 +566,11 @@ function wplng_options_switcher_update_flags_style( $old_flags_style, $new_flags } } - $target_languages_json = wp_json_encode( - $target_languages, - JSON_UNESCAPED_SLASHES + update_option( + 'wplng_target_languages', + wp_json_encode( + $target_languages, + JSON_UNESCAPED_SLASHES + ) ); - - update_option( 'wplng_target_languages', $target_languages_json ); } diff --git a/inc/admin/slug-cpt.php b/inc/admin/slug-cpt.php index a4c8992..23fd5ef 100644 --- a/inc/admin/slug-cpt.php +++ b/inc/admin/slug-cpt.php @@ -45,14 +45,19 @@ function wplng_register_post_type_slug() { /** - * Remove quick edit on wpLingua slugs list + * Remove quick edit on wpLingua slugs list. + * + * This function is a filter on post_row_actions and is used to remove the + * quick edit action from the list of actions on the slugs list page. + * + * @param array $actions An array of row action links. + * @param WP_Post $post The post object. * - * @param array $actions - * @param object $post * @return array */ function wplng_slug_remove_quick_edit( $actions, $post ) { + // Check if the post type is 'wplng_slug'. if ( $post->post_type != 'wplng_slug' ) { return $actions; } @@ -67,10 +72,14 @@ function wplng_slug_remove_quick_edit( $actions, $post ) { /** * Display 100 translations by default in admin area * + * This function is a filter on the posts_per_page option and is used to + * display 100 translations by default in the admin area. + * * @param mixed $result * @return mixed */ function wplng_slug_per_page( $result ) { + if ( false === $result ) { $result = '100'; } @@ -87,36 +96,52 @@ function wplng_slug_per_page( $result ) { */ function wplng_restrict_manage_posts_slug_status() { + // Check if we are on the right post type. if ( empty( $_GET['post_type'] ) || 'wplng_slug' !== $_GET['post_type'] ) { return; } + // Get languages target IDs. $languages_target = wplng_get_languages_target_ids(); - $options = array(); - $slug_status = ''; + + // Set default options for the select. + $options = array( + '' => __( 'All slug status', 'wplingua' ), + ); + + // Set slug status value from URL parameter if set. + $slug_status = ''; if ( ! empty( $_GET['slug_status'] ) ) { $slug_status = sanitize_title( $_GET['slug_status'] ); } + // If only one language target id, then use simple status options. if ( count( $languages_target ) === 1 ) { - $options = array( - '' => __( 'All slug status', 'wplingua' ), - 'reviewed' => __( 'Reviewed', 'wplingua' ), - 'unreviewed' => __( 'Unreviewed', 'wplingua' ), + $options = array_merge( + $options, + array( + 'reviewed' => __( 'Reviewed', 'wplingua' ), + 'unreviewed' => __( 'Unreviewed', 'wplingua' ), + ) ); } else { - $options = array( - '' => __( 'All slug status', 'wplingua' ), - 'full-reviewed' => __( 'Full reviewed', 'wplingua' ), - 'partially-reviewed' => __( 'Partially reviewed', 'wplingua' ), - 'reviewed' => __( 'Reviewed', 'wplingua' ), - 'unreviewed' => __( 'Full unreviewed', 'wplingua' ), + // If more than one language target id, + // then use full, partially and reviewed status options. + $options = array_merge( + $options, + array( + 'full-reviewed' => __( 'Full reviewed', 'wplingua' ), + 'partially-reviewed' => __( 'Partially reviewed', 'wplingua' ), + 'reviewed' => __( 'Reviewed', 'wplingua' ), + 'unreviewed' => __( 'Full unreviewed', 'wplingua' ), + ) ); } + // Display the select with options. $html = '