Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/laminas/laminas-i18n/src/Translator/Loader/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/laminas/laminas-i18n/src/Translator/Loader/AbstractFileLoader.php
<?php

namespace Laminas\I18n\Translator\Loader;

use function is_file;
use function is_readable;
use function stream_resolve_include_path;

/**
 * Abstract file loader implementation; provides facilities around resolving
 * files via the include_path.
 */
abstract class AbstractFileLoader implements FileLoaderInterface
{
    /**
     * Whether or not to consult the include_path when locating files
     *
     * @var bool
     */
    protected $useIncludePath = false;

    /**
     * Indicate whether or not to use the include_path to resolve translation files
     *
     * @param bool $flag
     * @return self
     */
    public function setUseIncludePath($flag = true)
    {
        $this->useIncludePath = (bool) $flag;
        return $this;
    }

    /**
     * Are we using the include_path to resolve translation files?
     *
     * @return bool
     */
    public function useIncludePath()
    {
        return $this->useIncludePath;
    }

    /**
     * Resolve a translation file
     *
     * Checks if the file exists and is readable, returning a boolean false if not; if the "useIncludePath"
     * flag is enabled, it will attempt to resolve the file from the
     * include_path if the file does not exist on the current working path.
     *
     * @param string $filename
     * @return string|false
     */
    protected function resolveFile($filename)
    {
        if (! is_file($filename) || ! is_readable($filename)) {
            if (! $this->useIncludePath()) {
                return false;
            }
            return $this->resolveViaIncludePath($filename);
        }
        return $filename;
    }

    /**
     * Resolve a translation file via the include_path
     *
     * @param string $filename
     * @return string|false
     */
    protected function resolveViaIncludePath($filename)
    {
        $resolvedIncludePath = stream_resolve_include_path($filename);
        if (! $resolvedIncludePath || ! is_file($resolvedIncludePath) || ! is_readable($resolvedIncludePath)) {
            return false;
        }
        return $resolvedIncludePath;
    }
}

Spamworldpro Mini