Commit 80f2c919 authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith
Browse files

whitespace

parent f08b3dca
......@@ -509,6 +509,7 @@ function safe_require($plugintype, $pluginname, $filename='lib.php', $function='
}
/**
* This function returns the list of plugintypes we currently care about
* @return array of names
......@@ -521,14 +522,6 @@ function plugin_types() {
return $pluginstocheck;
}
/**
* Returns the list of site content pages
* @return array of names
*/
function site_content_pages() {
return array('about','home','loggedouthome','privacy','termsandconditions','uploadcopyright');
}
/**
* Helper to call a static method when you do not know the name of the class
* you want to call the method on. PHP5 does not support $class::method().
......@@ -540,25 +533,11 @@ function call_static_method($class, $method) {
return call_user_func_array(array($class, $method), $args);
}
/**
* Given a series of arguments, builds a Mahara coding style class name,
* prefixed with 'Plugin'.
*
* @todo perhaps this should be renamed? (plugin_class_name or similar)
* @param mixed A list of strings to be used in generating the class name
* @return string A mahara class name
*/
function generate_class_name() {
$args = func_get_args();
return 'Plugin' . implode('', array_map('ucfirst', $args));
}
/**
* Redirects a user to the given location. Once called, the script will exit.
*
* @param string $location The place to redirect the user to. Should be an
* absolute URL.
*/
function redirect($location) {
if (headers_sent()) {
throw new Exception('Headers already sent when redirect() was called');
......@@ -568,17 +547,9 @@ function redirect($location) {
exit;
}
/**
* Handles an internal system event
*
* @param string event name of event
* @param mixed data data to pass to the handle function
* eg new user object etc.
*
*/
function event_occured($event, $data) {
function handle_event($event) {
if (!$e = get_record('event_type','name',$event)) {
throw new Exception("Invalid event type $event");
throw new Exception("Invalid event");
}
$plugintypes = plugin_types();
foreach ($plugintypes as $name) {
......@@ -586,7 +557,7 @@ function event_occured($event, $data) {
foreach ($subs as $sub) {
$classname = 'Plugin' . ucfirst($name) . ucfirst($sub->plugin);
try {
call_static_method($classname, $sub->callfunction, $data);
call_static_method($classname, $sub->callfunction);
}
catch (Exception $e) {
log_warn("Event $event caused an exception from plugin $classname "
......@@ -648,6 +619,7 @@ function main_nav() {
$menu = array(
array(
'name' => 'home',
'section' => 'mahara',
'link' => $wwwroot,
),
);
......@@ -659,6 +631,7 @@ function main_nav() {
foreach ($plugin_menu as &$menu_item) {
$menu_item['link'] = $wwwroot . 'artefact/' . $plugin['name'] . '/' . $menu_item['link'];
$menu_item['section'] = 'artefact.' . $plugin['name'];
}
$menu = array_merge($menu, $plugin_menu);
......@@ -666,8 +639,9 @@ function main_nav() {
}
$menu[] = array(
'name' => 'mycontacts',
'link' => $wwwroot . 'contacts/',
'name' => 'mycontacts',
'link' => $wwwroot . 'contacts/',
'section' => 'mahara',
);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment