From 0ccb18c27adffd763099032067691459d8964a8d Mon Sep 17 00:00:00 2001 From: strarsis Date: Thu, 25 Jan 2018 15:02:55 +0100 Subject: [PATCH] Fix file extension stripping code. --- src/helpers.php | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/helpers.php b/src/helpers.php index 827bee4..31ff544 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -47,18 +47,6 @@ function get_icon_path_abs($icon) { return trailingslashit(get_svg_path()) . $icon . '.svg'; } -/** - * Returns a path without file extension - * - * @param string $icon - * @return string - */ -function strip_file_ext($path) -{ - $parts = pathinfo($path); - return trailingslashit($parts['dirname']) . $parts['filename']; -} - /** * Returns path to icon in a sage theme * @@ -83,7 +71,7 @@ function get_icon_sage_path($icon) $icon_path_rel = RelPath::getRelativePath($icon_path_abs, get_svg_path()); // 6. Final icon path without extension expected - $icon_imgpath_noext = strip_file_ext($icon_path_rel); + $icon_imgpath_noext = pathinfo($icon_path_rel, PATHINFO_FILENAME); return $icon_imgpath_noext; }