Return the file extension
@param string $file Filename to get extension from
@return string
499713
public static function _getExtension ($file)
	{
		
		// Get Extension
		
		$base	= basename ($file);
		$arr	= explode ('.', $base);
		$ext	= strtolower (array_pop ($arr));
		
		// Return the extension
		
		return $ext;
		
	}
119324
protected function get_file( $file ) {

		$path_parts = $this->parse_path( $file );

		if ( '' === $path_parts[0] ) {
			$file = $this->root;
			unset( $path_parts[0] );
		} else {
			$file = $this->cwd;
		}

		foreach ( $path_parts as $part ) {

			if ( '' === $part ) {
				continue;
			}

			if ( 'dir' !== $file->type || false === isset( $file->contents->$part ) ) {
				return false;
			}

			$file = $file->contents->$part;
		}

		return $file;
	}
372359
public static function extension($file = false) {

        if ($file && self::isFile($file)) {

            return pathinfo($file, PATHINFO_EXTENSION);
        }

        return false;
    }
723159
protected function getExtension($file)
    {
        if (strpos($file, '.') !== false) {
            $tempExt = strtolower(substr($file, strrpos($file, '.') + 1, strlen($file) - strrpos($file, '.')));
            return strtolower(trim($tempExt,'/'));
        }
        return '';
    }
934406
public String getExtension(final File file) {
		if (file != null) {
			final String fileName = file.getName();
			final int i = fileName.lastIndexOf('.');
			if (i > 0 && i < fileName.length() - 1) {
				return fileName.substring(i + 1).toLowerCase(Locale.getDefault());
			}
		}
		return null;
	}
510628
public function checkFilename($file)
    {
        $newFilename  = $file;
        $parts        = pathinfo($file);
        $origFilename = $parts['filename'];
        $ext          = (isset($parts['extension']) && ($parts['extension'] != '')) ? '.' . $parts['extension'] : null;

        $i = 1;

        while (file_exists($this->uploadDir . DIRECTORY_SEPARATOR . $newFilename)) {
            $newFilename = $origFilename . '_' . $i . $ext;
            $i++;
        }

        return $newFilename;
    }
251070
public function rename_extension($file, $original)
    {
        $name = $file . $this->getFileExtension($original);
        rename($file, $name);
        return $name;
    }
1314733
public function realpath($file)
    {
        $prefix = preg_quote($this->_prefix, '~');
        $file = preg_replace("~^{$prefix}~", '', $file);
        if (!$this->_hasVolume) {
            return $file;
        }
        if (preg_match('~^[A-Z]+:~', $file)) {
            return $file;
        }
        $file = ltrim($file, DS);
        $pos = strpos($file, DS);
        if ($pos !== false) {
            $file = substr_replace($file, ':' . DS, $pos, 1);
        }
        return $file;
    }
1141470
public function getModeByFile($file, $extension = null)
    {
        if (!$extension) {
            $extension = strtolower(substr($file, strrpos($file, '.')));
        }
        if (strpos($extension, '.') !== false) {
            if ($extension == '.csv') {
                return DATA_MANIPULATION_CREATE_MODE_CSV;
            }
            if ($extension == '.xls') {
                return DATA_MANIPULATION_CREATE_MODE_XLS;
            }
            if ($extension == '.xlsx') {
                return DATA_MANIPULATION_CREATE_MODE_XLSX;
            }
            if ($extension == '.ods') {
                return DATA_MANIPULATION_CREATE_MODE_ODS;
            }
        }
    }
922799
public static function getFile($file) {
		if(is_file($file)) {
			return $file;
		}
		$vendor = dirname(dirname(dirname(__FILE__)));
		$file   = '/'. ltrim($file, '/');
		if (is_file($vendor.$file)) {
			return $vendor.$file;
		}
		$app = dirname(APP_DIR);
		if (is_file($app.$file)) {
			return $app.$file;
		}
		return null;
	}
377174
public function fetch($file) {
		$this->path = $this->path != '' ? $this->path : $this->basePath . '/' . $this->directory . '/' . $file . '.' . $this->fileExtension;
		
		extract($this->vars);			// Extract the vars to local namespace
		ob_start();						// Start output buffering
		include($this->path);					// Include the file
		$contents = ob_get_contents();	// Get the contents of the buffer
		ob_end_clean();					// End buffering and discard
		return $contents;				// Return the contents
	}
629624
public function getFileContent(File $file)
	{
		$filePath = $this->getFilesystemPath($file);
		$fileContent = file_get_contents($filePath);

		return $fileContent;
	}
295850
public function sanitizeFileName(string $file)
    {
        $file = preg_replace('/(\\\|\/)+/', DIRECTORY_SEPARATOR, $file);
        $file = ltrim($file, DIRECTORY_SEPARATOR);
        if (substr($file, -6) !== $this->extension) {
            $file .= $this->extension;
        }
        return $file;
    }
549580
protected function getMetaFilePath($file)
	{
		$parts = pathinfo($file);
		$metaFilename = sprintf($this->metaFileMask, $parts['basename']);
		return str_replace($parts['basename'], $metaFilename, $file);
	}
1374348
public static function addExtension(string $file, string $extension)
    {
        if (substr($file, strlen($extension) * -1) !== $extension) {
            $file .= $extension;
        }
        return $file;
    }
151793
public static String getFileExtension(File file) {

		String fileName = file.getName();
		String extension = null;

		int extensionIndex = fileName.lastIndexOf(".");
		if (extensionIndex > -1) {
			extension = fileName.substring(extensionIndex + 1);
		}

		return extension;
	}
1060732
public static function getMimeType($file)
    {
        $mimeType = new MimeTypeGuesser();
        $extension = self::getExtension($file);

        return $mimeType->getTypeByExtension($file);
    }