From 7b9812d4f258a888629480e6388874a494006628 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 3 Nov 2010 22:03:46 +0100 Subject: [PATCH] pathinfo --- core/file_api.php | 19 +------------------ 1 files changed, 1 insertions(+), 18 deletions(-) diff --git a/core/file_api.php b/core/file_api.php index 3c61769..b5b2e43 100644 --- a/core/file_api.php +++ b/core/file_api.php @@ -834,22 +834,5 @@ function file_ensure_uploaded( $p_file ) { # Get extension given the filename or its full path. function file_get_extension( $p_filename ) { - $t_extension = ''; - $t_basename = $p_filename; - if( utf8_strpos( $t_basename, '/' ) !== false ) { - // Note that we can't use end(explode(...)) on a single line because - // end() expects a reference to a variable and thus we first need to - // copy the result of explode() into a variable that end() can modify. - $t_components = explode( '/', $t_basename ); - $t_basename = end( $t_components ); - } - if( utf8_strpos( $t_basename, '\\' ) !== false ) { - $t_components = explode( '\\', $t_basename ); - $t_basename = end( $t_components ); - } - if( utf8_strpos( $t_basename, '.' ) !== false ) { - $t_components = explode( '.', $t_basename ); - $t_extension = end( $t_components ); - } - return $t_extension; + return pathinfo($p_filename, PATHINFO_EXTENSION); } -- 1.6.2.msysgit.0.186.gf7512