ElggPlugin::includeFile PHP Method

includeFile() protected method

Includes one of the plugins files
protected includeFile ( string $filename ) : mixed
$filename string The name of the file
return mixed The return value of the included file (or 1 if there is none)
    protected function includeFile($filename)
    {
        $filepath = "{$this->path}/{$filename}";
        if (!$this->canReadFile($filename)) {
            $msg = _elgg_services()->translator->translate('ElggPlugin:Exception:CannotIncludeFile', array($filename, $this->getID(), $this->guid, $this->path));
            throw new \PluginException($msg);
        }
        try {
            $ret = (include $filepath);
        } catch (Exception $e) {
            $msg = _elgg_services()->translator->translate('ElggPlugin:Exception:IncludeFileThrew', array($filename, $this->getID(), $this->guid, $this->path));
            throw new \PluginException($msg, 0, $e);
        }
        return $ret;
    }