mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-24 09:03:48 +00:00
Tools directory for ticket #1
This commit is contained in:
parent
ecfd936095
commit
8337cad7ee
207 changed files with 25761 additions and 0 deletions
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
// Turn foo/../bar/../baz/ into baz/
|
||||
function smarty_modifier_collapse_path($p)
|
||||
{
|
||||
$p=explode('/', $p);
|
||||
$o=array();
|
||||
for ($i=0; $i<sizeof($p); $i++)
|
||||
{
|
||||
// Skip meaningless . or empty terms.
|
||||
if (''==$p[$i] || '.'==$p[$i])
|
||||
continue;
|
||||
|
||||
// Consider if we can pop something off the list.
|
||||
if ('..'==$p[$i] && $i>0 && '..'!=$o[sizeof($o)-1])
|
||||
{
|
||||
array_pop($o);
|
||||
continue;
|
||||
}
|
||||
array_push($o, $p[$i]);
|
||||
}
|
||||
return implode('/', $o);
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue