Plugin Directory

Changeset 3809580


Ignore:
Timestamp:
11/18/2026 03:06:20 PM (12 days ago)
Author:
florinlivada
Message:

Release 1.1.11: new Livada brand (menu icon, colour, plugin icons and banners), og:locale follows the page language

Location:
livada-seo-lite
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • livada-seo-lite/trunk/assets/css/admin.css

    r3719638 r3809580  
    7171
    7272.livada-mv-pill.is-info {
    73         background: #eef1ff;
    74         color: #2c3a9e;
     73        background: #e8f5f7;
     74        color: #0c5566;
    7575}
    7676
  • livada-seo-lite/trunk/includes/admin/class-admin.php

    r3755306 r3809580  
    4747        // ── Menu ──────────────────────────────────────────────────────────────────
    4848
     49        /**
     50         * Livada logo for the admin menu, as a data URI (WordPress sizes SVG menu
     51         * icons to 20 px). Falls back to a dashicon if the file is missing.
     52         */
     53        public static function menu_icon(): string {
     54                $file = LIVADA_SEO_LITE_PATH . 'assets/img/menu-icon.svg';
     55                if ( ! is_readable( $file ) ) {
     56                        return 'dashicons-chart-area';
     57                }
     58                $svg = (string) file_get_contents( $file ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- local plugin file.
     59                return '' === $svg ? 'dashicons-chart-area' : 'data:image/svg+xml;base64,' . base64_encode( $svg ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode -- data URI for the menu icon.
     60        }
     61
    4962        public static function register_menus(): void {
    5063                add_menu_page(
    … …  
    5467                        'livada-seo-lite',
    5568                        [ self::class, 'render_page' ],
    56                         'dashicons-chart-area',
     69                        self::menu_icon(),
    5770                        80
    5871                );
  • livada-seo-lite/trunk/includes/class-opengraph.php

    r3717730 r3809580  
    5050                $url         = self::get_url();
    5151                $type        = is_front_page() ? 'website' : 'article';
    52                 $locale      = get_locale();
     52                $locale      = self::current_locale();
    5353                $site_name   = self::get_site_name();
    5454
    … …  
    395395
    396396        /**
     397         * Language of the page in Open Graph form (`en_GB`), read from what the
     398         * page itself declares in `<html lang>`: WordPress's language, switched by
     399         * a multilingual plugin on a translated page, or set by the theme. A bare
     400         * language (`fr`) gets its usual region. Filter: `livada_seo_og_locale`.
     401         *
     402         * @return string
     403         */
     404        public static function current_locale(): string {
     405                $declared = '';
     406                if ( function_exists( 'get_language_attributes' ) && preg_match( '/\blang="([^"]+)"/i', get_language_attributes( 'html' ), $m ) ) {
     407                        $declared = $m[1];
     408                }
     409                if ( '' === $declared ) {
     410                        $declared = function_exists( 'determine_locale' ) ? determine_locale() : get_locale();
     411                }
     412                $locale = self::to_og_locale( $declared );
     413                if ( '' === $locale ) {
     414                        $locale = self::to_og_locale( function_exists( 'determine_locale' ) ? determine_locale() : get_locale() );
     415                }
     416                return (string) apply_filters( 'livada_seo_og_locale', '' !== $locale ? $locale : get_locale() );
     417        }
     418
     419        /**
     420         * `en-GB`, `en_gb`, `EN` → Open Graph `ll_CC`. A language without a
     421         * region gets the region it is most often published with. Empty when the
     422         * code is not a language (`x-default`).
     423         *
     424         * @param  string $code
     425         * @return string
     426         */
     427        public static function to_og_locale( string $code ): string {
     428                // language [_Script] [_Region]: zh-Hant-TW, sr-Latn, en-GB, es-419.
     429                $parts = array_values( array_filter( explode( '_', trim( str_replace( '-', '_', $code ) ) ), 'strlen' ) );
     430                $lang  = strtolower( (string) ( $parts[0] ?? '' ) );
     431                if ( ! preg_match( '/^[a-z]{2,3}$/', $lang ) || 'x' === $lang ) {
     432                        return '';
     433                }
     434                foreach ( array_slice( $parts, 1 ) as $sub ) {
     435                        if ( preg_match( '/^[a-zA-Z]{2}$/', $sub ) ) {
     436                                return $lang . '_' . strtoupper( $sub );
     437                        }
     438                }
     439                $regions = [
     440                        'fr' => 'FR', 'en' => 'GB', 'de' => 'DE', 'es' => 'ES', 'it' => 'IT', 'nl' => 'NL',
     441                        'pt' => 'PT', 'ca' => 'ES', 'eu' => 'ES', 'gl' => 'ES', 'pl' => 'PL', 'ro' => 'RO',
     442                        'sv' => 'SE', 'da' => 'DK', 'nb' => 'NO', 'nn' => 'NO', 'no' => 'NO', 'fi' => 'FI',
     443                        'is' => 'IS', 'ja' => 'JP', 'ko' => 'KR', 'zh' => 'CN', 'ru' => 'RU', 'uk' => 'UA',
     444                        'el' => 'GR', 'cs' => 'CZ', 'sk' => 'SK', 'sl' => 'SI', 'hr' => 'HR', 'sr' => 'RS',
     445                        'bg' => 'BG', 'hu' => 'HU', 'et' => 'EE', 'lv' => 'LV', 'lt' => 'LT', 'tr' => 'TR',
     446                        'he' => 'IL', 'ar' => 'AR', 'fa' => 'IR', 'hi' => 'IN', 'th' => 'TH', 'vi' => 'VN',
     447                        'id' => 'ID', 'ms' => 'MY', 'af' => 'ZA', 'ga' => 'IE', 'cy' => 'GB', 'lb' => 'LU',
     448                ];
     449                // No invented region ("ko_KO"): an unknown bare language gives nothing
     450                // and the caller keeps its fallback.
     451                return isset( $regions[ $lang ] ) ? $lang . '_' . $regions[ $lang ] : '';
     452        }
     453
     454        /**
    397455         * Echoes a single <meta> tag with proper escaping.
    398456         *
  • livada-seo-lite/trunk/livada-seo-lite.php

    r3791368 r3809580  
    44 * Plugin URI:        https://livada.io/livada-seo
    55 * Description:       Free SEO plugin for campgrounds, hotels, B&Bs & restaurants: meta tags, XML sitemap, Schema.org (WebSite/Article/business), Open Graph, on-page analysis, robots.txt, breadcrumbs, redirects & 404 monitor, llms.txt (AEO), Migration Verify, optional AI suggestions (bring your own API key), and a Yoast/Rank Math/AIOSEO/SEOPress importer. Adds no JavaScript to your pages.
    6  * Version:           1.1.10
     6 * Version:           1.1.11
    77 * Requires at least: 6.0
    88 * Requires PHP:      7.4
    … …  
    2121// ── Constants ─────────────────────────────────────────────────────────────────
    2222
    23 define( 'LIVADA_SEO_LITE_VERSION', '1.1.10' );
     23define( 'LIVADA_SEO_LITE_VERSION', '1.1.11' );
    2424define( 'LIVADA_SEO_LITE_PATH',    plugin_dir_path( __FILE__ ) );
    2525define( 'LIVADA_SEO_LITE_URL',     plugin_dir_url( __FILE__ ) );
  • livada-seo-lite/trunk/readme.txt

    r3791368 r3809580  
    55Tested up to: 7.1.2
    66Requires PHP: 7.4
    7 Stable tag: 1.1.10
     7Stable tag: 1.1.11
    88License: GPL-2.0-or-later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    198198
    199199== Changelog ==
     200
     201= 1.1.11 =
     202* Changed: new Livada brand identity. The Livada "L" (in white, with its gold wave) is now the icon of the Livada SEO menu in the WordPress admin, and the Migration Verify information labels use the new Livada colours.
     203* Fixed: og:locale follows the language the page declares (an English page on a French site now says en_GB), not only the WordPress language.
    200204
    201205= 1.1.10 =
    … …  
    285289== Upgrade Notice ==
    286290
     291= 1.1.11 =
     292New Livada logo in the admin menu, and og:locale now follows the language of each page.
     293
    287294= 1.1.10 =
    288295The business review rating is no longer published, as Google's review rules ask. Pattern redirects now build their target from what they capture: end a pattern with (.*)$ and add $1 to the target to keep the end of the address.
Note: See TracChangeset for help on using the changeset viewer.