Skip to content

Commit e797d01

Browse files
author
Marius Burkard
committed
- Fixed some hook handling problems
1 parent 1b9d2f3 commit e797d01

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

interface/lib/classes/plugin.inc.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ private function loadPluginCache() {
4545
if(isset($_SESSION['s']['plugin_cache'])) unset($_SESSION['s']['plugin_cache']);
4646

4747
$plugin_dirs = array();
48-
$plugin_dirs[] = ISPC_LIB_PATH.FS_DIV.'plugins'.FS_DIV;
48+
$plugin_dirs[] = ISPC_LIB_PATH.FS_DIV.'plugins';
4949

5050
if(is_dir(ISPC_WEB_PATH)) {
5151
if($dh = opendir(ISPC_WEB_PATH)) {
5252
while(($file = readdir($dh)) !== false) {
53-
if($file !== '.' && $file !== '..' && is_dir($file) && is_dir(ISPC_WEB_PATH . FS_DIV . $file . FS_DIV . 'lib' . FS_DIV . 'plugin.d')) $plugin_dirs[] = ISPC_WEB_PATH . FS_DIV . $file . FS_DIV . 'lib' . FS_DIV . 'plugin.d';
53+
if($file !== '.' && $file !== '..' && is_dir(ISPC_WEB_PATH . FS_DIV . $file) && is_dir(ISPC_WEB_PATH . FS_DIV . $file . FS_DIV . 'lib' . FS_DIV . 'plugin.d')) $plugin_dirs[] = ISPC_WEB_PATH . FS_DIV . $file . FS_DIV . 'lib' . FS_DIV . 'plugin.d';
5454
}
5555
closedir($dh);
5656
}
@@ -63,6 +63,7 @@ private function loadPluginCache() {
6363
$plugins_dir = $plugin_dirs[$d];
6464
if (is_dir($plugins_dir)) {
6565
if ($dh = opendir($plugins_dir)) {
66+
$tmp_plugins = array();
6667
//** Go trough all files in the plugin dir
6768
while (($file = readdir($dh)) !== false) {
6869
if($file !== '.' && $file !== '..' && substr($file, -8, 8) == '.inc.php') {
@@ -76,7 +77,7 @@ private function loadPluginCache() {
7677

7778
//** load the plugins
7879
foreach($tmp_plugins as $plugin_name => $file) {
79-
include_once $plugins_dir.$file;
80+
require $plugins_dir . FS_DIV . $file;
8081
if($this->debug) $app->log('Loading plugin: '.$plugin_name, LOGLEVEL_DEBUG);
8182
$app->loaded_plugins[$plugin_name] = new $plugin_name;
8283
$app->loaded_plugins[$plugin_name]->onLoad();
@@ -187,7 +188,6 @@ private function callPluginEvent($event_name, $data, $return_data = false) {
187188

188189
$tmpresult = call_user_func(array($app->loaded_plugins[$plugin_name], $function_name), $event_name, $data);
189190
if($return_data == true && $tmpresult) $result .= $tmpresult;
190-
191191
}
192192
}
193193

interface/lib/classes/tpl.inc.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1078,14 +1078,15 @@ private function _parseHook ($type, $name)
10781078
global $app;
10791079

10801080
$module_name = '';
1081-
if(strpos($name, ':') !== false) list($name, $module_name) = explode(':', $name, 2);
1081+
if(strpos($name, ':') !== false) list($module_name, $name) = explode(':', $name, 2);
10821082

10831083
$result = $app->plugin->raiseEvent('on_template_content_hook', array(
10841084
'type' => $type,
10851085
'name' => $name,
10861086
'module' => $module_name
10871087
), true);
10881088
if(!$result) $result = '';
1089+
else $result = $this->_getData($result, false, true);
10891090

10901091
return $result;
10911092
}

interface/web/sites/templates/web_vhost_domain_edit.htm

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ <h1><tmpl_var name="list_head_txt"></h1>
1313
</tmpl_if>
1414

1515

16-
{tmpl_hook name="begin_form"}
16+
{tmpl_hook name="begin_form" value="web_vhost_domain_edit"}
1717
<tmpl_if name="vhostdomain_type" value="domain">
1818
<tmpl_if name="is_admin">
1919
<div class="form-group">
@@ -222,32 +222,32 @@ <h1><tmpl_var name="list_head_txt"></h1>
222222
{tmpl_var name='php'}
223223
</select></div>
224224
</div>
225-
{tmpl_hook name="begin_field" value="fastcgi_php_version"}
225+
{tmpl_hook name="begin_field" value="web_vhost_domain_edit:fastcgi_php_version"}
226226
<div class="form-group fastcgi_php_version">
227227
<label for="fastcgi_php_version" class="col-sm-3 control-label">{tmpl_var name='fastcgi_php_version_txt'}</label>
228228
<div class="col-sm-9"><select name="fastcgi_php_version" id="fastcgi_php_version" class="form-control">
229229
{tmpl_var name='fastcgi_php_version'}
230230
</select></div>
231231
</div>
232-
{tmpl_hook name="end_field" value="fastcgi_php_version"}
232+
{tmpl_hook name="end_field" value="web_vhost_domain_edit:fastcgi_php_version"}
233233
{tmpl_var name="directive_snippets_id"}
234-
{tmpl_hook name="begin_field" value="enable_pagespeed"}
234+
{tmpl_hook name="begin_field" value="web_vhost_domain_edit:enable_pagespeed"}
235235
<div class="form-group nginx pagespeed">
236236
<label class="col-sm-3 control-label">{tmpl_var name='enable_pagespeed_txt'}</label>
237237
<div class="col-sm-9">
238238
{tmpl_var name="enable_pagespeed"}
239239
</div>
240240
</div>
241-
{tmpl_hook name="end_field" value="enable_pagespeed"}
242-
{tmpl_hook name="begin_field" value="active"}
241+
{tmpl_hook name="end_field" value="web_vhost_domain_edit:enable_pagespeed"}
242+
{tmpl_hook name="begin_field" value="web_vhost_domain_edit:active"}
243243
<div class="form-group">
244244
<label class="col-sm-3 control-label">{tmpl_var name='active_txt'}</label>
245245
<div class="col-sm-9">
246246
{tmpl_var name='active'}
247247
</div>
248248
</div>
249-
{tmpl_hook name="end_field" value="active"}
250-
{tmpl_hook name="end_form"}
249+
{tmpl_hook name="end_field" value="web_vhost_domain_edit:active"}
250+
{tmpl_hook name="end_form" value="web_vhost_domain_edit"}
251251

252252
<input type="hidden" name="id" value="{tmpl_var name='id'}">
253253

0 commit comments

Comments
 (0)