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/wpyourdayfloraldesign/wp-content/plugins/wp-rollback/src/PluginSetup/Language.php
<?php

/**
 * Language setup.
 *
 * This class is used to manage the application language.
 *
 * @package WpRollback\PluginSetup
 * @since 3.0.0
 */

declare(strict_types=1);

namespace WpRollback\Free\PluginSetup;

use WpRollback\Free\Core\Constants;
use WpRollback\SharedCore\Core\SharedCore;

/**
 * Class Language.
 *
 * @since 3.0.0
 */
class Language
{
    /**
     * @since 3.0.0
     */
    public static function load(): void
    {
        $constants = SharedCore::container()->make(Constants::class);
        $pluginRelativePath = self::getRelativePath($constants);

        $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
        // Traditional WordPress plugin locale filter.
        $locale = apply_filters('plugin_locale', $locale, $constants->getTextDomain());

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

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

    /**
     * Return the plugin language dir relative path, e.g. "wp-rollback/languages/"
     *
     * @since 3.0.0
     */
    public static function getRelativePath(Constants $constants): string
    {
        $pluginRelativePath = dirname(plugin_basename($constants->getPluginFile())) . '/languages/';
        $pluginRelativePath = ltrim(apply_filters('wprollback_languages_directory', $pluginRelativePath), '/\\');

        return trailingslashit($pluginRelativePath);
    }
}