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

Хранение информации о плагине в readme.txt и вывод ее на странице управления плагинами.

This commit is contained in:
Alexey Kachayev 2009-12-29 23:53:10 +00:00
parent ab0789fe82
commit 921886991b
4 changed files with 38 additions and 9 deletions

View file

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

View file

@ -23,8 +23,16 @@ class LsPlugin extends Module {
/**
* Файл содержащий информацию об активированных плагинах
*
* @var string
*/
const PLUGIN_ACTIVATION_FILE = 'plugins.dat';
/**
* Файл описания плагина
*
* @var string
*/
const PLUGIN_README_FILE = 'readme.txt';
/**
* Путь к директории с плагинами
*
@ -58,11 +66,26 @@ class LsPlugin extends Module {
foreach($aList as $sPlugin) {
$this->aPluginsList[$sPlugin] = array(
'code' => $sPlugin,
'is_active' => in_array($sPlugin,$aActivePlugins),
'name' => '',
'author' => '',
'code' => $sPlugin,
'is_active' => in_array($sPlugin,$aActivePlugins),
'name' => '',
'description' => '',
'author' => '',
'homepage' => '',
'version' => ''
);
$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);
$sKey=strtolower($sKey);
$sValue=$this->Text_Parser(trim($sValue));
$this->aPluginsList[$sPlugin][$sKey]=$sValue;
}
}
}
return $this->aPluginsList;

View file

@ -14,9 +14,9 @@
<tbody>
{foreach from=$aPlugins item=aPlugin}
<tr>
<td class="name"><a class="title">{$aPlugin.code}</a></td>
<td class="version">-</td>
<td class="author">-</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="{if $aPlugin.is_active}deactivate{else}activate{/if}"><strong>{if $aPlugin.is_active}<a href="{router page='plugins'}?plugin={$aPlugin.code}&action=deactivate">{$aLang.plugins_plugin_deactivate}</a>{else}<a href="{router page='plugins'}?plugin={$aPlugin.code}&action=activate">{$aLang.plugins_plugin_activate}</a>{/if}</strong></td>
</tr>
{/foreach}

View file

@ -721,12 +721,12 @@ a.profiler.active { background: #70aae0; color: white; }
.plugins thead td.name { padding-left: 32px; }
.plugins thead td.version, .plugins td.version { width: 40px; text-align: center; }
.plugins thead td.author, .plugins td.author, .plugins tbody td.action { width: 120px; text-align: center; }
.plugins tbody td { padding: 7px 0; }
.plugins tbody td { padding: 7px 0; vertical-align: top; }
.plugins td.name { overflow: hidden; }
.plugins td.name img { float: left; padding-bottom: 5px; margin-right: 7px; width: 24px; height: 24px; }
.plugins td.name a.title { font-size: 18px; line-height: 14px; }
.plugins td.name a.author { line-height: 18px; background:url(../images/icons.gif) no-repeat scroll 0 -108px; padding-left: 12px; color: #999; font-weight: bold; }
.plugins td.activate, .plugins td.deactivate { width: 120px; text-align: right; }
.plugins td.activate, .plugins td.deactivate { width: 120px; text-align: right; vertical-align: top; }
.plugins td.activate strong { background: #6ec80d; color: #fff; padding: 5px 10px; }
.plugins td.deactivate strong { background: #ff68cf; color: #fff; padding: 5px 10px; }
.plugins td.activate strong a, .plugins td.deactivate strong a { color: white; text-decoration: none; }