Skip to content

Commit

Permalink
Added ability to look trough an array when replacing placeholders in …
Browse files Browse the repository at this point in the history
…MY_Model
  • Loading branch information
David McReynolds committed Oct 6, 2014
1 parent 09ebe43 commit f80675b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions fuel/modules/fuel/core/MY_Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -4137,7 +4137,7 @@ protected function _is_nested_array($record)
* @param mixed
* @return boolean
*/
protected function _replace_placeholders($str, $values)
protected function _replace_placeholders($str, $values)
{
if (is_string($str))
{
Expand All @@ -4156,8 +4156,20 @@ protected function _replace_placeholders($str, $values)
$str = '';
}
}
$return = $str;
}
return $str;
elseif (is_array($str))
{
$return = array();
foreach($str as $key => $val)
{
if (isset($values[$key]))
{
$return[$key] = str_replace('{'.$key.'}', $values[$key], $val);
}
}
}
return $return;
}

// --------------------------------------------------------------------
Expand Down

0 comments on commit f80675b

Please sign in to comment.