• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
    • Help
      • Online help
      • Learn Git
      • Welcome to Bitbucket
      • Keyboard shortcuts
    • Log In
    Blackrock
    1. Blackrock

    main

    Public
    Actions
    • Clone

    Learn more about cloning repositories

    You have read-only access

    Navigation
    • Source
    • Commits
    • Branches
    • All Branches Graph
    • Graphs
    • Forks
    1. Blackrock
    2. main

    Source

    main/wp-content/plugins/seo-by-rank-math/includes/helpers/class-locale.php
    Артем ШиряевАртем Ширяев committed 554847ddcb906 Apr 2021
    Raw file
    Source viewDiff to previous
     
    1
    <?php
    2
    /**
    3
     * The Locale helpers.
    4
     *
    5
     * @since      1.0.9
    6
     * @package    RankMath
    7
     * @subpackage RankMath\Helpers
    8
     * @author     Rank Math <support@rankmath.com>
    9
     */
    10
    ​
    11
    namespace RankMath\Helpers;
    12
    ​
    13
    defined( 'ABSPATH' ) || exit;
    14
    ​
    15
    /**
    16
     * Locale class.
    17
     */
    18
    class Locale {
    19
    ​
    20
        /**
    21
         * Returns the user locale for the language to be used in the admin.
    22
         *
    23
         * @return string The locale.
    24
         */
    25
        public static function get_user_locale() {
    26
            if ( function_exists( 'get_user_locale' ) ) {
    27
                return get_user_locale();
    28
            }
    29
    ​
    30
            return get_locale();
    31
        }
    32
    ​
    33
        /**
    34
         * Get site language.
    35
         *
    36
         * @return string
    37
         */
    38
        public static function get_site_language() {
    39
            return self::get_language( get_locale() );
    40
        }
    41
    ​
    42
        /**
    43
         * Get the language part of a given locale, defaults to english when the $locale is empty.
    44
         *
    45
         * @param string $locale The locale to get the language of.
    46
         *
    47
         * @return string The language part of the locale.
    48
         */
    49
        public static function get_language( $locale = null ) {
    50
            $language = 'en';
    51
    ​
    52
            if ( empty( $locale ) || ! is_string( $locale ) ) {
    53
                return $language;
    54
            }
    55
    ​
    56
            $locale_parts = explode( '_', $locale );
    57
    ​
    58
            if ( ! empty( $locale_parts[0] ) ) {
    59
                $language = $locale_parts[0];
    60
            }
    61
    ​
    62
            return $language;
    63
        }
    64
    }
    • Git repository management for enterprise teams powered by Atlassian Bitbucket
    • Atlassian Bitbucket v5.10.1
    • Documentation
    • Contact Support
    • Request a feature
    • About
    • Contact Atlassian
    Atlassian

    Everything looks good. Well let you know here if theres anything you should know about.