/** * Renders and returns the html output * @return string Returns the html of the content */ function Render() { $templateDir = Path::Combine(__DIR__, 'Templates'); $templateFile = Path::AddExtension(Path::Filename($this->ClassFile()), 'phtml', true); ob_start(); require Path::Combine($templateDir, $templateFile); return ob_get_clean(); }
/** * * @copyright Thanks to "Unsigned", posted on stackoverflow, * from BSD-licensed SoloAdmin * @param string $path * @return int|string Gets the file size in bytes as string or integer */ static function GetSize($path) { // If the platform is Windows... if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { // Try using the NT substition modifier %~z $size = trim(exec("for %F in (\"" . $path . "\") do @echo %~zF")); // If the return is blank, zero, or not a number if (!$size || !ctype_digit($size)) { // Use the Windows COM interface $fsobj = new COM('Scripting.FileSystemObject'); if (dirname($path) == '.') { $path = Path::Combine(getcwd(), Path::Filename($path)); } $f = $fsobj->GetFile($path); return $f->Size; } // Otherwise, return the result of the 'for' command return $size; } // If the platform is not Windows, use the stat command (should work for *nix and MacOS) return trim(exec("stat -c%s {$path}")); }