Skip to content

Commit

Permalink
Merge pull request #46 from kvakes/stacey
Browse files Browse the repository at this point in the history
Absolute path for your media files, woohoo!
  • Loading branch information
kolber committed Apr 27, 2012
2 parents 1517c6c + fe228dd commit dfd30f6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions extensions/twig-extensions.inc.php
Expand Up @@ -16,6 +16,7 @@ public function getName() {
public function getFilters() {
# custom twig filters
return array(
'absolute' => new Twig_Filter_Method($this, 'absolute'),
'context' => new Twig_Filter_Method($this, 'context')
);
}
Expand Down Expand Up @@ -130,6 +131,14 @@ function sortby($object, $value) {
uasort($sorted, array($this, 'custom_str_sort'));
return $sorted;
}

#
# transforms relative path to absolute
#
function absolute($relative_path) {
# assume that all content lies in http://something.com/content/
return (($_SERVER['HTTPS'] ? 'https://' : 'http://')).$_SERVER['HTTP_HOST'].strstr($relative_path, '/content');
}

}

Expand Down

0 comments on commit dfd30f6

Please sign in to comment.