Permalink
Browse files

Merge pull request #412 from andrewmman/master

Fix issue with Behavior class name
  • Loading branch information...
2 parents ba052e0 + 2e5b259 commit b5e5540e3f018e6b5c134af29a5efae0f25eeb05 @mvdkleijn mvdkleijn committed Mar 6, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 wolf/app/models/Behavior.php
@@ -60,14 +60,15 @@ public static function remove($behavior_id) {
public static function load($behavior_id, &$page, $params) {
if ( ! empty(self::$behaviors[$behavior_id])) {
$file = CORE_ROOT.'/plugins/'.self::$behaviors[$behavior_id];
+ $behavior_class = Inflector::camelize($behavior_id);
if (isset(self::$loaded_files[$file]))
- return new $behavior_id($page, $params);
+ return new $behavior_class($page, $params);
if (file_exists($file)) {
include $file;
self::$loaded_files[$file] = true;
- return new $behavior_id($page, $params);
+ return new $behavior_class($page, $params);
}
else {
exit ("Behavior $behavior_id not found!");
@@ -83,7 +84,7 @@ public static function load($behavior_id, &$page, $params) {
* @return string class name of the page
*/
public static function loadPageHack($behavior_id) {
- $behavior_page_class = 'Page'.str_replace(' ','',ucwords(str_replace('_',' ', $behavior_id)));
+ $behavior_page_class = Inflector::camelize('page_'.$behavior_id);
if (class_exists($behavior_page_class, false))
return $behavior_page_class;

0 comments on commit b5e5540

Please sign in to comment.