/** * @short Initializes the controller object. * @details Subclassers should not override this method. Do your specialized * initialization in the <tt>init</tt> method. */ protected function initialize() { $classname = get_class($this); $this->name = camel_case_to_joined_lower(substr($classname, 0, strpos($classname, 'Controller'))); if (isset($_REQUEST['action']) && !empty($_REQUEST['action'])) { $action = basename($_REQUEST['action']); if (is_callable(array($this, $action))) { $this->action = $action; } else { $this->unknown_action(); } } else { $this->action = 'index'; } $this->set_title('EmeRails'); }
function class_name_to_foreign_key($classname) { $fkey = camel_case_to_joined_lower($classname); $fkey .= "_id"; return $fkey; }