1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-19 12:11:55 +02:00

Now processing e_tohtml files, old method deprecated. Linkwords updated to use new method. More plugin.xml supporting changes

This commit is contained in:
mcfly 2008-02-01 18:09:02 +00:00
parent 1dd0fbadf8
commit 76c552459a
4 changed files with 90 additions and 42 deletions

View File

@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/e_parse_class.php,v $
| $Revision: 1.27 $
| $Date: 2008-01-04 19:54:16 $
| $Author: e107steved $
| $Revision: 1.28 $
| $Date: 2008-02-01 18:09:01 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
@ -657,6 +657,7 @@ class e_parse
//Run any hooked in parsers
if (!$opts['no_hook'] && varset($pref['tohtml_hook']))
{
//Process the older tohtml_hook pref (depricated)
foreach(explode(",",$pref['tohtml_hook']) as $hook)
{
if (!is_object($this->e_hook[$hook]))
@ -665,8 +666,24 @@ class e_parse
$hook_class = "e_".$hook;
$this->e_hook[$hook] = new $hook_class;
}
$text = $this->e_hook[$hook]->$hook($text,$opts['context']);
$text = $this->e_hook[$hook]->$hook($text,$opts['context']);
}
if(isset($pref['e_tohtml_list']) && is_array($pref['e_tohtml_list']))
{
foreach($pref['e_tohtml_list'] as $hook)
{
if (!is_object($this->e_hook[$hook]))
{
require_once(e_PLUGIN.$hook."/e_tohtml.php");
$hook_class = "e_tohtml_".$hook;
$this->e_hook[$hook] = new $hook_class;
}
$text = $this->e_hook[$hook]->to_html($text, $opts['context']);
}
}
}

View File

@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $
| $Revision: 1.23 $
| $Date: 2008-02-01 14:11:27 $
| $Revision: 1.24 $
| $Date: 2008-02-01 18:09:01 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
@ -706,28 +706,7 @@ class e107plugin
{
if(isset($plug_vars['mainPrefs']['pref']))
{
if(!is_array($plug_vars['mainPrefs']['pref']))
{
$pref_list = array($plug_vars['mainPrefs']['pref']);
}
else
{
$pref_list = $plug_vars['mainPrefs']['pref'];
}
$list = array();
foreach($pref_list as $_pref)
{
$attrib = $_pref['@attributes'];
$list['all'][$attrib['name']] = $attrib['value'];
if(!isset($attrib['active']) || $attrib['active'] == 'true')
{
$list['active'][$attrib['name']] = $attrib['value'];
}
if(isset($attrib['active']) && $attrib['active'] == 'false')
{
$list['inactive'][$attrib['name']] = $attrib['value'];
}
}
$list = $this->parse_prefs($plug_vars['mainPrefs']['pref']);
switch($function)
{
case 'install':
@ -764,7 +743,7 @@ class e107plugin
{
if(isset($plug_vars['userclasses']['userclass']))
{
if(!is_array($plug_vars['userclasses']['userclass']))
if(!isset($plug_vars['userclasses']['userclass'][0]))
{
$uclass_list = array($plug_vars['userclasses']['userclass']);
}
@ -772,11 +751,8 @@ class e107plugin
{
$uclass_list = $plug_vars['userclasses']['userclass'];
}
print_a($uclass_list);
foreach($uclass_list as $uclass)
{
print_a($uclass);
$attrib = $uclass['@attributes'];
switch($function)
{
@ -809,6 +785,25 @@ class e107plugin
$this -> manage_search($function, $plug_vars['folder']);
$this -> manage_notify($function, $plug_vars['folder']);
// Let's call any custom functions defined in <management> section
if(isset($plug_vars['management'][$function]))
{
$manage = $plug_vars['management'][$function]['@attributes'];
if(is_readable($path.$manage['file']))
{
include($path.$manage['file']);
if($manage['type'] == 'fileFunction')
{
$result = call_user_func($manage['function'], $plug_vars);
}
elseif($manage['type'] == 'classFunction')
{
$_tmp = new $manage['class'];
$result = call_user_func(array($_tmp, $manage['function']), $plug_vars);
}
}
}
if($function == 'install' || $functon = 'upgrade')
{
@ -830,6 +825,40 @@ class e107plugin
}
function parse_prefs($pref_array)
{
$ret = array();
if(!isset($pref_array[0]))
{
$pref_array = array($pref_array);
}
foreach($pref_array as $k => $p)
{
$attrib = $p['@attributes'];
if(isset($attrib['type']) && $attrib['type'] == 'array')
{
$name = $attrib['name'];
$tmp = $this->parse_prefs($pref_array[$k]['key']);
$ret['all'][$name] = $tmp['all'];
$ret['active'][$name] = $tmp['active'];
$ret['inactive'][$name] = $tmp['inactive'];
}
else
{
$ret['all'][$attrib['name']] = $attrib['value'];
if(!isset($attrib['active']) || $attrib['active'] == 'true')
{
$ret['active'][$attrib['name']] = $attrib['value'];
}
else
{
$ret['inactive'][$attrib['name']] = $attrib['value'];
}
}
}
return $ret;
}
function install_plugin_php($id)
{
global $sql;
@ -998,9 +1027,9 @@ class e107plugin
if ($is_installed)
{
foreach($this->plugin_addons as $val)
foreach($tmp as $val)
{
if(in_array($val,$tmp))
if(strpos($val, 'e_') === 0)
{
$pref[$val."_list"][$path] = $path;
}
@ -1219,6 +1248,7 @@ class e107plugin
require_once(e_HANDLER.'xml_class.php');
$xml = new xmlClass;
$this->plug_vars = $xml->loadXMLfile($path.'plugin.xml', true, true);
// print_a($this->plug_vars);
// $xml->loadXMLfile($path.'plugin.xml', true, true);
// $xml->xmlFileContents = $tp->replaceConstants($xml->xmlFileContents, '', true);
// $this->plug_vars = $xml->parseXml();

View File

@ -29,6 +29,11 @@
<pref name="forum_postspage" value="10" />
<pref name="forum_hilightsticky" value="1" />
<pref name="forum_obsolete_pref" value="1" active="false"/>
<pref name="forum_tmp" type="array">
<key name="pref1" value="val1" active="false" />
<key name="pref2" value="val2" />
<key name="pref3" value="val3" />
</pref>
</mainPrefs>
<userclasses>
<userclass name="forum_moderator" description="Moderator of all forums" />

View File

@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/linkwords/plugin.php,v $
| $Revision: 1.3 $
| $Date: 2007-07-28 16:47:55 $
| $Author: e107steved $
| $Revision: 1.4 $
| $Date: 2008-02-01 18:09:02 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
@ -24,7 +24,7 @@ if (!defined('e107_INIT')) { exit; }
// Plugin info -------------------------------------------------------------------------------------------------------
$eplug_name = "LWLANINS_1";
$eplug_version = "1.1";
$eplug_version = "1.2";
$eplug_author = "jalist";
$eplug_url = "http://e107.org";
$eplug_email = "jalist@e107.org";
@ -116,8 +116,4 @@ $upgrade_alter_tables = "";
$eplug_upgrade_done = "";
?>