Skip to content
This repository has been archived by the owner on Jan 10, 2021. It is now read-only.

Commit

Permalink
Cleaning up a class definition.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Glasl committed Apr 20, 2015
1 parent 49b35cb commit a114bb5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion code/dataobjects/MediaAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,13 @@ public function getTemplateClass() {

public function forTemplate() {

return ltrim(preg_replace('/[A-Z]+[^A-Z]/', ' $0', $this->Title)) . ": {$this->Content}";
// Add spaces between words, other characters and numbers.

return ltrim(preg_replace(array(
'/([A-Z][a-z]+)/',
'/([A-Z]{2,})/',
'/([_.0-9]+)/'
), ' $0', $this->Title)) . ": {$this->Content}";
}

}

0 comments on commit a114bb5

Please sign in to comment.