diff --git a/e107_admin/cpage.php b/e107_admin/cpage.php index d64881ff0..c31f89801 100644 --- a/e107_admin/cpage.php +++ b/e107_admin/cpage.php @@ -671,6 +671,7 @@ class page_admin_ui extends e_admin_ui //triggerHook + $data = array( 'method' =>'form', 'table' =>'page', @@ -679,37 +680,12 @@ class page_admin_ui extends e_admin_ui 'function' => 'createPage' ); - $hooks = $e_event->triggerHook($data); - if(!empty($hooks)) - { - $text .= " - - - -
- ".LAN_HOOKS." - - - - - - "; - - foreach($hooks as $hook) - { - if(!empty($hook)) - { - $text .= " - - - - "; - } - } - } - + + $text .= $frm->renderHooks($data); + } + $text .= "
".$hook['caption']."".$hook['text']."
diff --git a/e107_admin/newspost.php b/e107_admin/newspost.php index c4e4bf19d..9e7b061b5 100644 --- a/e107_admin/newspost.php +++ b/e107_admin/newspost.php @@ -2254,30 +2254,13 @@ class admin_newspost "; } + + //triggerHook - $data = array('method'=>'form', 'table'=>'news', 'id'=>$id, 'plugin'=>'news', 'function'=>'create_item'); - $hooks = e107::getEvent()->triggerHook($data); - if(!empty($hooks)) - { - $text .= " - - ".LAN_HOOKS." - - "; - foreach($hooks as $hook) - { - if(!empty($hook)) - { - $text .= " - - ".$hook['caption']." - ".$hook['text']." - - "; - } - } - } - + + $data = array('method'=>'form', 'table'=>'news', 'id'=>$id, 'plugin'=>'news', 'function'=>'create_item'); + $text .= $frm->renderHooks($data); + $text .= " diff --git a/e107_handlers/event_class.php b/e107_handlers/event_class.php index 6e6063496..842b653b1 100644 --- a/e107_handlers/event_class.php +++ b/e107_handlers/event_class.php @@ -184,7 +184,18 @@ class e107_event case 'form': if(method_exists($class, "event_{$data['method']}")) { - $text[] = $class->event_form($data); + $ret = $class->event_form($data); + + if(!isset($ret[0])) + { + $text[$hook][0] = $ret; + } + else + { + $text[$hook] = $ret; + } + + } break; //returns string message diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 55bc4ef2b..235b095ba 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -1551,6 +1551,47 @@ class e_form } + + /** + * Render Table cells from hooks. + * @param array $data + * @return string + */ + function renderHooks($data) + { + $hooks = e107::getEvent()->triggerHook($data); + + $text = ""; + + if(!empty($hooks)) + { + foreach($hooks as $plugin => $hk) + { + $text .= "\n\n\n"; + + if(!empty($hk)) + { + foreach($hk as $hook) + { + $text .= "\t\t\t\n"; + $text .= "\t\t\t".$hook['caption']."\n"; + $text .= "\t\t\t".$hook['html'].""; + $text .= (varset($hook['help'])) ? "\n".$hook['help']."" : ""; + $text .= "\n\t\t\t\n"; + } + + + } + } + } + + return $text; + } + + + + + /** * Render Table cells from field listing. * @param array $fieldarray - eg. $this->fields diff --git a/e107_plugins/calendar_menu/event.php b/e107_plugins/calendar_menu/event.php index 633582a57..a649bab3e 100644 --- a/e107_plugins/calendar_menu/event.php +++ b/e107_plugins/calendar_menu/event.php @@ -724,22 +724,8 @@ if ($action == 'ne' || $action == 'ed') //triggerHook $hid = ($action=='ed' ? intval($qs[1]) : ''); $data = array('method'=>'form', 'table'=>'event', 'id'=>$hid, 'plugin'=>'calendar_menu', 'function'=>'CalendarCreate'); - $hooks = $e_event->triggerHook($data); - if(!empty($hooks)) - { - $text .= "".LAN_HOOKS." "; - foreach($hooks as $hook) - { - if(!empty($hook)) - { - $text .= " - - ".$hook['caption']." - ".$hook['text']." - "; - } - } - } + $text .= $frm->renderHooks($data); + $text .= " diff --git a/e107_plugins/download/handlers/adminDownload_class.php b/e107_plugins/download/handlers/adminDownload_class.php index 5d746999e..08bba984e 100644 --- a/e107_plugins/download/handlers/adminDownload_class.php +++ b/e107_plugins/download/handlers/adminDownload_class.php @@ -921,23 +921,7 @@ class adminDownload extends download //triggerHook $data = array('method'=>'form', 'table'=>'download', 'id'=>$id, 'plugin'=>'download', 'function'=>'create_download'); $hooks = $e107->e_event->triggerHook($data); - if(!empty($hooks)) - { - $text .= " - ".LAN_HOOKS." - - "; - foreach($hooks as $hook) - { - if(!empty($hook)) - { - $text .= " - ".$hook['caption']." - ".$hook['text']." - "; - } - } - } + $text .= " "; diff --git a/e107_plugins/download/includes/admin.php b/e107_plugins/download/includes/admin.php index f9c21fe43..68c42dca4 100644 --- a/e107_plugins/download/includes/admin.php +++ b/e107_plugins/download/includes/admin.php @@ -935,24 +935,9 @@ $columnInfo = array( //triggerHook $data = array('method'=>'form', 'table'=>'download', 'id'=>$id, 'plugin'=>'download', 'function'=>'create_download'); - $hooks = $e107->e_event->triggerHook($data); - if(!empty($hooks)) - { - $text .= " - ".LAN_HOOKS." - - "; - foreach($hooks as $hook) - { - if(!empty($hook)) - { - $text .= " - ".$hook['caption']." - ".$hook['text']." - "; - } - } - } + $text .= $frm->renderHooks($data); + + $text .= " diff --git a/e107_plugins/forum/forum_admin_class.php b/e107_plugins/forum/forum_admin_class.php index d9b1775df..f8331d78e 100755 --- a/e107_plugins/forum/forum_admin_class.php +++ b/e107_plugins/forum/forum_admin_class.php @@ -287,7 +287,7 @@ class forumAdmin $text = "
"; } $text .= " - +
@@ -424,7 +424,7 @@ class forumAdmin $text = "
-
".FORLAN_28." ".FORLAN_80."
+
diff --git a/e107_plugins/links_page/link_class.php b/e107_plugins/links_page/link_class.php index 866873fa3..a3cc90ee2 100644 --- a/e107_plugins/links_page/link_class.php +++ b/e107_plugins/links_page/link_class.php @@ -804,22 +804,9 @@ class linkclass //triggerHook $data = array('method'=>'form', 'table'=>'links_page', 'id'=>$row['link_id'], 'plugin'=>'links_page', 'function'=>'show_link_create'); - $hooks = $e_event->triggerHook($data); - if(!empty($hooks)) - { - $text .= ""; - foreach($hooks as $hook) - { - if(!empty($hook)) - { - $text .= " - - - - "; - } - } - } + + $text .= e107::getForm()->renderHooks($data); + $text .= " diff --git a/e107_plugins/page/plugin.xml b/e107_plugins/page/plugin.xml index ad6a7484f..8c2dc1834 100644 --- a/e107_plugins/page/plugin.xml +++ b/e107_plugins/page/plugin.xml @@ -1,5 +1,4 @@ - menu \ No newline at end of file diff --git a/e107_plugins/tagwords/tagwords_class.php b/e107_plugins/tagwords/tagwords_class.php index df278e45d..5e53a5f2d 100644 --- a/e107_plugins/tagwords/tagwords_class.php +++ b/e107_plugins/tagwords/tagwords_class.php @@ -161,7 +161,7 @@ class tagwords } $caption = $this->e107->tp->parseTemplate($this->template['caption'], true, $this->shortcodes); $text = $this->e107->tp->parseTemplate($this->template['form'], true, $this->shortcodes); - return array('caption'=>$caption, 'text'=>$text); + return array('caption'=>$caption, 'html'=>$text); } /*
".FORLAN_31.":
".LAN_HOOKS."
".$hook['caption']."".$hook['text']."