/** * getFileObject * Return the file object depending of its type. * For example is the path is a directory, return a PDir object. * * @param string $strFilePath, the full path to the file * @return the file object PPage, PDir .... */ function getFileObject($strFilePath) { $objFile = new PFile($strFilePath); if (is_dir($objFile->path)) { return $objFile->is_dircategory() ? new PDirCategory($strFilePath) : new PDir($strFilePath); } if (is_dir($newpath = utf8_decode($objFile->path))) { return $objFile->is_dircategory() ? new PDirCategory($newpath) : new PDir($newpath); } if ($objFile->is_link()) { return new PLink($strFilePath); } if ($objFile->is_configfile()) { return new PConfigFile($strFilePath, basename($strFilePath) != basename(CONFIG_FILE) ? CONFIG_FILE : false); } if ($objFile->is_image()) { return new PImage($strFilePath); } //if($objFile->is_video()) $objFile = new PVideo($file); if ($objFile->is_page_model()) { require SITE_PATH . 'core/lib/ppagemodel.php'; return new PPageModel($strFilePath); } if ($objFile->is_page()) { return new PPage($strFilePath); } if ($objFile->is_texteditable()) { return new PTextFile($strFilePath); } return $objFile; }