'ogv', 'swf', 'webm', 'wmv', ]; case 'document': case 'documents': return [ 'doc', 'docm', 'docx', 'dotm', 'dotx', 'odb', 'odc', 'odf', 'odg', 'odi', 'odm', 'odp', 'ods', 'odt', 'onepkg', 'onetmp', 'onetoc', 'onetoc2', 'otg', 'oth', 'otp', 'ots', 'ott', 'oxt', 'pdf', 'potm', 'potx', 'ppam', 'pps', 'ppsm', 'ppsx', 'ppt', 'pptm', 'pptx', 'rtf', 'sldm', 'sldx', 'thmx', 'xla', 'xlam', 'xlc', 'xld', 'xll', 'xlm', 'xls', 'xlsb', 'xlsm', 'xlsx', 'xlt', 'xltm', 'xltx', 'xlw', ]; case 'other': case 'others': return [ 'css', 'csv', 'js', 'json', 'tar', 'txt', 'xml', 'zip', ]; default: case 'all': return array_merge( self::getFileTypes('images'), self::getFileTypes('audio'), self::getFileTypes('videos'), self::getFileTypes('documents'), self::getFileTypes('other') ); } } /** * Find a matching media file in the different possible extension media folders for given type * * @param string $type (css/js/...) * @param string $file * * @return bool|string */ public static function getMediaFile($type, $file) { // If http is present in filename if (strpos($file, 'http') === 0 || strpos($file, '//') === 0) { return $file; } $files = []; // Detect debug mode if (JFactory::getConfig()->get('debug') || JFactory::getApplication()->input->get('debug')) { $files[] = str_replace(['.min.', '-min.'], '.', $file); } $files[] = $file; /* * Loop on 1 or 2 files and break on first find. * Add the content of the MD5SUM file located in the same folder to url to ensure cache browser refresh * This MD5SUM file must represent the signature of the folder content */ foreach ($files as $check_file) { $file_found = self::findMediaFileByFile($check_file, $type); if ( ! $file_found) { continue; } return $file_found; } return false; } // some/url/to/a/file.ext // > some/url/to/a public static function isDocument($url) { return self::isMedia($url, self::getFileTypes('documents')); } // some/url/to/a/file.ext // > file.ext public static function isExternal($url) { if (strpos($url, '://') === false) { return false; } // hostname: give preference to SERVER_NAME, because this includes subdomains $hostname = ($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST']; return ! (strpos(RegEx::replace('^.*?://', '', $url), $hostname) === 0); } // some/url/to/a/file.ext // > file public static function isExternalVideo($url) { return (strpos($url, 'youtu.be') !== false || strpos($url, 'youtube.com') !== false || strpos($url, 'vimeo.com') !== false ); } // some/url/to/a/file.ext // > ext public static function isImage($url) { return self::isMedia($url, self::getFileTypes('images')); } public static function isInternal($url) { return ! self::isExternal($url); } public static function isMedia($url, $filetypes = []) { $filetype = self::getExtension($url); if ( ! $filetype) { return false; } if ( ! is_array($filetypes)) { $filetypes = [$filetypes]; } if (count($filetypes) == 1 && strpos($filetypes[0], ',') !== false) { $filetypes = ArrayHelper::toArray($filetypes[0]); } $filetypes = ($filetypes ?? null) ?: self::getFileTypes(); return in_array($filetype, $filetypes); } public static function isVideo($url) { return self::isMedia($url, self::getFileTypes('videos')); } public static function trimFolder($folder) { return trim(str_replace(['\\', '//'], '/', $folder), '/'); } /** * Find a matching media file in the different possible extension media folders for given type * * @param string $file * @param string $type (css/js/...) * * @return bool|string */ private static function findMediaFileByFile($file, $type) { $template = JFactory::getApplication()->getTemplate(); // If the file is in the template folder $file_found = self::getFileUrl('/templates/' . $template . '/' . $type . '/' . $file); if ($file_found) { return $file_found; } // Try to deal with system files in the media folder if (strpos($file, '/') === false) { $file_found = self::getFileUrl('/media/system/' . $type . '/' . $file); if ( ! $file_found) { return false; } return $file_found; } $paths = []; // If the file contains any /: it can be in a media extension subfolder // Divide the file extracting the extension as the first part before / [$extension, $file] = explode('/', $file, 2); $paths[] = '/media/' . $extension . '/' . $type; $paths[] = '/templates/' . $template . '/' . $type . '/system'; $paths[] = '/media/system/' . $type; $paths[] = ''; foreach ($paths as $path) { $file_found = self::getFileUrl($path . '/' . $file); if ( ! $file_found) { continue; } return $file_found; } return false; } /** * Get the url for the file * * @param string $path * * @return bool|string */ private static function getFileUrl($path) { if ( ! file_exists(JPATH_ROOT . $path)) { return false; } return JUri::root(true) . $path; } } 0 - Class 'RegularLabs\Library\File' not found
0 - Class 'RegularLabs\Library\File' not found

You may not be able to visit this page because of:

  1. an out-of-date bookmark/favourite
  2. a search engine that has an out-of-date listing for this site
  3. a mistyped address
  4. you have no access to this page
  5. The requested resource was not found.
  6. An error has occurred while processing your request.

Please try one of the following pages:

If difficulties persist, please contact the System Administrator of this site and report the error below.

Class 'RegularLabs\Library\File' not found