Gdn_Plugin::getResource PHP Method

getResource() public method

Gets the path to a file within the plugin's folder (and optionally include it).
public getResource ( string $filePath, boolean $include = false, boolean $absolute = true ) : string
$filePath string A relative path to a file within the plugin's folder.
$include boolean Whether or not to immediately include() the file if it exists.
$absolute boolean Whether or not to prepend the full document root to the path.
return string path to the file
    public function getResource($filePath, $include = false, $absolute = true)
    {
        if ($this->addon === null) {
            return '';
        }
        $subPath = $this->addon->path($filePath, Addon::PATH_ADDON);
        $fullPath = PATH_ROOT . $subPath;
        if ($include && file_exists($fullPath)) {
            include $fullPath;
        }
        $RequiredFilename = implode(DS, array($this->getPluginFolder($absolute), $filePath));
        if ($include && file_exists($RequiredFilename)) {
            include $RequiredFilename;
        }
        return $absolute ? $fullPath : $subPath;
    }