1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-17 07:10:48 +03:00

Описание плагинов переведено в XML формат.

This commit is contained in:
Alexey Kachayev 2010-02-07 17:01:38 +00:00
parent dddb5c39e2
commit b704c34caa
4 changed files with 34 additions and 35 deletions

View file

@ -31,13 +31,7 @@ class LsPlugin extends Module {
*
* @var string
*/
const PLUGIN_README_FILE = 'readme.txt';
/**
* Список параметров плагина в readme.txt файле
*
* @var array
*/
protected $aReadmeParams = array('name','author','homepage','version','requires','description','delegate');
const PLUGIN_README_FILE = 'plugin.xml';
/**
* Путь к директории с плагинами
*
@ -83,26 +77,16 @@ class LsPlugin extends Module {
foreach($aList as $sPlugin) {
$this->aPluginsList[$sPlugin] = array(
'code' => $sPlugin,
'is_active' => in_array($sPlugin,$aActivePlugins),
'name' => '',
'description' => '',
'author' => '',
'homepage' => '',
'version' => ''
'code' => $sPlugin,
'is_active' => in_array($sPlugin,$aActivePlugins)
);
$sReadme = $this->sPluginsDir.$sPlugin.'/'.self::PLUGIN_README_FILE;
if(is_file($sReadme)) {
$aInfo = file($sReadme);
foreach ($aInfo as $sParam) {
@list($sKey,$sValue) = explode(':',trim($sParam),2);
if($sKey and $sValue and in_array(strtolower($sKey),$this->aReadmeParams)) {
$sValue=$this->Text_Parser(trim($sValue));
$this->aPluginsList[$sPlugin][strtolower($sKey)]=$sValue;
}
}
/**
* Считываем данные из XML файла описания
*/
$sPluginXML = $this->sPluginsDir.$sPlugin.'/'.self::PLUGIN_README_FILE;
if($this->aPluginsList[$sPlugin]['property'] = @simplexml_load_file($sPluginXML)) {
$this->aPluginsList[$sPlugin]['property']->homepage=$this->Text_Parser($this->aPluginsList[$sPlugin]['property']->homepage);
}
}

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<name>Livestreet Profiler Plugin</name>
<author>LiveStreet Developers Team</author>
<homepage>http://livestreet.ru/</homepage>
<version>1.0.0</version>
<requires>
<livestreet>0.4.0</livestreet>
<plugins>
</plugins>
</requires>
<description>
Профилирование работы движка LiveStreet-движка.
</description>
<delegate>
<module></module>
<action></action>
<template></template>
<entity></entity>
</delegate>
</plugin>

View file

@ -1,7 +0,0 @@
Name: Livestreet Profiler Plugin
Author: LiveStreet Developers Team
Homepage: http://livestreet.ru/
Version: 1.0.0
Requires: 0.4.0
Description: Профилирование работы движка LiveStreet-движка.
Delegate:

View file

@ -18,9 +18,9 @@
{foreach from=$aPlugins item=aPlugin}
<tr>
<td><input type="checkbox" name="plugin_del[{$aPlugin.code}]" class="form_plugins_checkbox"></td>
<td class="name"><a class="title">{$aPlugin.name}</a><br />{$aPlugin.description}<br />{$aPlugin.homepage}</td>
<td class="version">{$aPlugin.version}</td>
<td class="author">{$aPlugin.author}</td>
<td class="name"><a class="title">{$aPlugin.property->name|escape:'html'}</a><br />{$aPlugin.property->description|escape:'html'}<br />{$aPlugin.property->homepage}</td>
<td class="version">{$aPlugin.property->version|escape:'html'}</td>
<td class="author">{$aPlugin.property->author|escape:'html'}</td>
<td class="{if $aPlugin.is_active}deactivate{else}activate{/if}"><strong>{if $aPlugin.is_active}<a href="{router page='admin'}plugins/?plugin={$aPlugin.code}&action=deactivate">{$aLang.plugins_plugin_deactivate}</a>{else}<a href="{router page='admin'}plugins/?plugin={$aPlugin.code}&action=activate">{$aLang.plugins_plugin_activate}</a>{/if}</strong></td>
</tr>
{/foreach}