Баг :Multihooks support for plugins
Статус :Исправлено
Серьёзность :Улучшение
Репортер :Antony 17-10-12 02:44
Обновил :Amro 17-10-12 14:02
КатегорияDefault plugins
Версия :172
Частота :Постоянно
Пофиксено в :173
Детали :

Поддержка подключения кода сразу к нескольким перехватам, пример

[BEGIN_SED_EXTPLUGIN]
Code=recentitems
Part=main
File=recentitems
Hooks=index.tags,page.tags,list.tags
Tags=index.tpl:{PLUGIN_LATESTPAGES},{PLUGIN_LATESTTOPICS},{PLUGIN_LATESTPOLL}
Minlevel=0
Order=10
[END_SED_EXTPLUGIN]
Затронутые части :fubctions.admin.php

История и комментарии :

30-10-12 00:11   Kaan

Thenk you amro

18-10-12 18:12   Amro

+ multiorder

				//Multihooks New v 173
				$mhooks = explode(",", $info_part['Hooks']);
				foreach ($mhooks as $k => $hook)
				{
					$morder = explode(",", $info_part['Order']);
					$order = array_key_exists($k, $morder) ? $morder[$k] : $morder[0];
					
					$sql = sed_sql_query("INSERT into $db_plugins (pl_hook, pl_code, pl_part, pl_title, pl_file, pl_order, pl_active ) VALUES ('".trim($hook)."', '".$info_part['Code']."', '".sed_sql_prep($info_part['Part'])."', '".sed_sql_prep($info['Name'])."', '".$info_part['File']."',  ".(int)$order.", 1)");				
				}

17-10-12 02:47   Amro

In function.admin.php, function sed_plug_install()

replace:

$sql = sed_sql_query("INSERT into $db_plugins (pl_hook, pl_code, pl_part, pl_title, pl_file, pl_order, pl_active ) VALUES ('".$info_part['Hooks']."', '".$info_part['Code']."', '".sed_sql_prep($info_part['Part'])."', '".sed_sql_prep($info['Name'])."', '".$info_part['File']."',  ".(int)$info_part['Order'].", 1)");

on:

$mhooks = explode(",", $info_part['Hooks']);
foreach ($mhooks as $k => $hook)
{
$sql = sed_sql_query("INSERT into $db_plugins (pl_hook, pl_code, pl_part, pl_title, pl_file, pl_order, pl_active ) VALUES ('".trim($hook)."', '".$info_part['Code']."',' ".sed_sql_prep($info_part['Part'])."', '".sed_sql_prep($info['Name'])."', '".$info_part['File']."',  ".(int)$info_part['Order'].", 1)");				
}