Skip to content

Commit

Permalink
Fixes EliW#15 - Makes Helper::wrap do a little programmer safety, cle…
Browse files Browse the repository at this point in the history
…ans up the tag passed in and ensures there is an ending tag on it.
  • Loading branch information
EliW committed Sep 14, 2012
1 parent ec1deed commit 3c422f1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions framework/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,10 @@ public static function protect()
**/
public static function wrap($text, $tag, $escape = TRUE)
{
// Do a little sanity check & cleanup on the tag:
$tag = trim($tag);
if (substr($tag,-1) != '>') { $tag .= '>'; }

// Determine the closing tag, based upon the opening one:
preg_match('/^<([^ >]+)/', $tag, $matches);
$closing = "</{$matches[1]}>";
Expand Down

0 comments on commit 3c422f1

Please sign in to comment.