@@ -124,17 +124,35 @@ public function raiseEvent($event_name, $data, $return_data = false) {
124124 $ tmp_event = $ sub_events [2 ];
125125 if ($ this ->debug ) $ app ->log ("Called Event ' $ tmp_event' " , LOGLEVEL_DEBUG );
126126 $ tmpresult = $ this ->callPluginEvent ($ tmp_event , $ data , $ return_data );
127- if ($ return_data == true && $ tmpresult ) $ result .= $ tmpresult ;
127+ if ($ return_data == true && $ tmpresult ) {
128+ if (is_array ($ tmpresult ) && (!$ result || is_array ($ result ))) {
129+ $ result = array_merge ($ result , $ tmpresult );
130+ } elseif (!is_array ($ tmpresult )) {
131+ $ result .= $ tmpresult ;
132+ }
133+ }
128134
129135 $ tmp_event = $ sub_events [0 ].': ' .$ sub_events [2 ];
130136 if ($ this ->debug ) $ app ->log ("Called Event ' $ tmp_event' " , LOGLEVEL_DEBUG );
131137 $ tmpresult = $ this ->callPluginEvent ($ tmp_event , $ data , $ return_data );
132- if ($ return_data == true && $ tmpresult ) $ result .= $ tmpresult ;
138+ if ($ return_data == true && $ tmpresult ) {
139+ if (is_array ($ tmpresult ) && (!$ result || is_array ($ result ))) {
140+ $ result = array_merge ($ result , $ tmpresult );
141+ } elseif (!is_array ($ tmpresult )) {
142+ $ result .= $ tmpresult ;
143+ }
144+ }
133145
134146 $ tmp_event = $ sub_events [0 ].': ' .$ sub_events [1 ].': ' .$ sub_events [2 ];
135147 if ($ this ->debug ) $ app ->log ("Called Event ' $ tmp_event' " , LOGLEVEL_DEBUG );
136148 $ tmpresult = $ this ->callPluginEvent ($ tmp_event , $ data , $ return_data );
137- if ($ return_data == true && $ tmpresult ) $ result .= $ tmpresult ;
149+ if ($ return_data == true && $ tmpresult ) {
150+ if (is_array ($ tmpresult ) && (!$ result || is_array ($ result ))) {
151+ $ result = array_merge ($ result , $ tmpresult );
152+ } elseif (!is_array ($ tmpresult )) {
153+ $ result .= $ tmpresult ;
154+ }
155+ }
138156
139157 /*$sub_events = array_reverse($sub_events);
140158 $tmp_event = '';
@@ -147,7 +165,13 @@ public function raiseEvent($event_name, $data, $return_data = false) {
147165 } else {
148166 if ($ this ->debug ) $ app ->log ("Called Event ' $ sub_events [0 ]' " , LOGLEVEL_DEBUG );
149167 $ tmpresult = $ this ->callPluginEvent ($ sub_events [0 ], $ data , $ return_data );
150- if ($ return_data == true && $ tmpresult ) $ result .= $ tmpresult ;
168+ if ($ return_data == true && $ tmpresult ) {
169+ if (is_array ($ tmpresult ) && (!$ result || is_array ($ result ))) {
170+ $ result = array_merge ($ result , $ tmpresult );
171+ } elseif (!is_array ($ tmpresult )) {
172+ $ result .= $ tmpresult ;
173+ }
174+ }
151175 }
152176 }
153177
@@ -187,7 +211,13 @@ private function callPluginEvent($event_name, $data, $return_data = false) {
187211 // call_user_method($function_name,$app->loaded_plugins[$plugin_name],$event_name,$data);
188212
189213 $ tmpresult = call_user_func (array ($ app ->loaded_plugins [$ plugin_name ], $ function_name ), $ event_name , $ data );
190- if ($ return_data == true && $ tmpresult ) $ result .= $ tmpresult ;
214+ if ($ return_data == true && $ tmpresult ) {
215+ if (is_array ($ tmpresult ) && (!$ result || is_array ($ result ))) {
216+ $ result = array_merge ($ result , $ tmpresult );
217+ } elseif (!is_array ($ tmpresult )) {
218+ $ result .= $ tmpresult ;
219+ }
220+ }
191221 }
192222 }
193223
0 commit comments