Skip to content

Commit

Permalink
Pass back reference to asset by reference
Browse files Browse the repository at this point in the history
  • Loading branch information
kolber committed Dec 1, 2009
1 parent e6c051f commit c6520d9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions app/asset-types/asset-factory.inc.php
Expand Up @@ -4,7 +4,7 @@

static $store;

static function create($file_path) {
static function &create($file_path) {

# if the file path isn't passed through as a string, return an empty data array
if(!is_string($file_path)) return array();
Expand Down Expand Up @@ -40,9 +40,9 @@ static function create($file_path) {
}
}

static function get($key) {
static function &get($key) {
# if object doesn't exist, create it
if(!isset(self::$store[$key])) self::$store[$key] = self::create($key);
if(!isset(self::$store[$key])) self::$store[$key] =& self::create($key);
return self::$store[$key];
}

Expand Down
4 changes: 2 additions & 2 deletions app/page-data.inc.php
Expand Up @@ -88,11 +88,11 @@ static function create_helper_vars($page) {
# @slug
$split_url = explode("/", $page->url_path);
$page->slug = $split_url[count($split_url) - 1];
# @name
# @page_name
$page->page_name = ucfirst(preg_replace('/[-_](.)/e', "' '.strtoupper('\\1')", $page->data['@slug']));
# @root_path
$page->root_path = Helpers::relative_root_path();
# @thumbnail
# @thumb
$page->thumb = self::get_thumbnail($page->file_path);
# @current_year
$page->current_year = date('Y');
Expand Down
2 changes: 1 addition & 1 deletion app/parsers/template-parser.inc.php
Expand Up @@ -59,7 +59,7 @@ static function parse_foreach($data, $template) {
if($pages) {
foreach($pages as $data_item) {
# transform data_item into its appropriate Object
$data_object = AssetFactory::get($data_item);
$data_object =& AssetFactory::get($data_item);
# recursively parse the inside part of the foreach loop
$template .= self::parse($data_object, $template_parts[3]);
}
Expand Down

0 comments on commit c6520d9

Please sign in to comment.