Skip to content

Commit

Permalink
[+FEATURE] Path Utility
Browse files Browse the repository at this point in the history
New Path Utility class to resolve paths based on TS format.

Change-Id: Ie1614903c2e8308987506dfb1ce7d7e58da5b3bc
  • Loading branch information
Claus Due committed Oct 15, 2011
1 parent 3351298 commit 6bb585e
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions Classes/Utility/Path.php
@@ -0,0 +1,52 @@
<?php
/***************************************************************
* Copyright notice
*
* (c) 2010 Claus Due <claus@wildside.dk>, Wildside A/S
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/

/**
*
* @author Claus Due, Wildside A/S
* @version $Id$
* @copyright Copyright belongs to the respective authors
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
* @package Fed
* @subpackage Utility
*/
class Tx_Fed_Utility_Path implements t3lib_Singleton {

/**
* Translates a path which may contain EXT: into a proper path
*
* @param string $path
* @return string
*/
public static function translatePath($path) {
if (strpos($path, 'EXT:') === 0) {
$slice = strpos($path, '/');
$extKey = array_pop(explode(':', substr($path, 0, $slice)));
$path = t3lib_extMgm::extPath($extKey, substr($path, $slice));
}
return $path;
}
}
?>

0 comments on commit 6bb585e

Please sign in to comment.