HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux WebLive 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/wpmuhibbah_err/wp-content/plugins/give/src/Helpers/Language.php
<?php

namespace Give\Helpers;

/**
 * @since 3.0.0
 */
class Language
{
    /**
     * @since 3.0.0
     */
    public static function load()
    {
        $giveRelativePath = self::getRelativePath();

        $locale = is_admin() && ! wp_doing_ajax() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
        $locale = apply_filters('plugin_locale', $locale, 'give'); // Traditional WordPress plugin locale filter.

        // Setup paths to current locale file.
        $moFile = sprintf('%1$s-%2$s.mo', 'give', $locale);
        $moFileLocal = trailingslashit(WP_PLUGIN_DIR) . $giveRelativePath . $moFile;
        $moFileGlobal = trailingslashit(WP_LANG_DIR) . 'plugins/' . $moFile;

        unload_textdomain('give');
        if (file_exists($moFileGlobal)) {
            load_textdomain('give', $moFileGlobal); // Look in global /wp-content/languages/plugins folder.
        } elseif (file_exists($moFileLocal)) {
            load_textdomain('give', $moFileLocal); // Look in local /wp-content/plugins/give/languages/ folder.
        } else {
            load_plugin_textdomain('give', false, $giveRelativePath); // Load the default language files.
        }
    }

    /**
     * @since 3.0.0
     */
    public static function setScriptTranslations($handle)
    {
        wp_set_script_translations($handle, 'give', trailingslashit(WP_PLUGIN_DIR) . self::getRelativePath());
    }

    /**
     * Return the plugin language dir relative path, e.g. "give/languages/"
     *
     * @since 3.0.0
     */
    public static function getRelativePath(): string
    {
        $giveRelativePath = dirname(plugin_basename(GIVE_PLUGIN_FILE)) . '/languages/';
        $giveRelativePath = ltrim(apply_filters('give_languages_directory', $giveRelativePath), '/\\');

        return trailingslashit($giveRelativePath);
    }

    /**
     * @since 3.22.0
     */
    public static function getLocale()
    {
        return apply_filters('givewp_locale', get_locale());
    }

    /**
     * @since 3.22.0
     */
    public static function switchToLocale(string $locale)
    {
        if (empty($locale) || $locale == get_locale()) {
            return;
        }

        switch_to_locale($locale);
    }
}