本文整理汇总了PHP中get_plugin_info函数的典型用法代码示例。如果您正苦于以下问题:PHP get_plugin_info函数的具体用法?PHP get_plugin_info怎么用?PHP get_plugin_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_plugin_info函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: uploaded
function uploaded()
{
if (!is_admin()) {
return info_page(__('ADMIN_ONLY_LOGIN'));
}
if ($_FILES['pfile']['error'] != 0) {
return info_page(__('PLUGIN_UPLOAD_FILE_ERROR_RETRY'));
}
$tmp_name = $_FILES['pfile']['tmp_name'];
$tname = uid() . '-' . time();
$plug_path = c('plugin_path') . DS . $tname;
if (@mkdir($plug_path)) {
include_once AROOT . 'lib' . DS . 'dUnzip2.inc.php';
$zip = new dUnzip2($tmp_name);
$zip->debug = false;
$zip->unzipAll($plug_path);
@chmod($plug_path, 0755);
$info_file = $plug_path . DS . 'app.php';
if (file_exists($info_file)) {
if ($info = get_plugin_info(file_get_contents($info_file))) {
if (isset($info['folder_name'])) {
$folder_name = $info['folder_name'];
}
if (strlen($folder_name) < 1) {
$folder_name = reset(explode('.', basename($_FILES['pfile']['name'])));
}
if (strlen($folder_name) > 0) {
if (file_exists(c('plugin_path') . DS . $folder_name)) {
@rename(c('plugin_path') . DS . $folder_name . DS . 'app.php', c('plugin_path') . DS . $folder_name . DS . 'app.bak.php');
@rename(c('plugin_path') . DS . $folder_name, c('plugin_path') . DS . $folder_name . '_' . uid() . '_' . time());
}
rename($plug_path, c('plugin_path') . DS . $folder_name);
header("Location: ?c=pluglist");
return true;
} else {
return info_page(__('PLUGIN_GET_NAME_ERROR_RETRY', $tname));
}
}
} else {
// clear dir
}
return info_page(__('PLUGIN_PACKAGE_FORMAT_ERROR'));
} else {
return info_page(__('PLUGIN_CREATE_FOLDER_ERROR'));
}
}
开发者ID:xianliflc,项目名称:teamirr,代码行数:46,代码来源:pluglist.class.php
示例2: uploaded
function uploaded()
{
if (!is_admin()) {
return info_page('只有管理员才能进入此页面,<a href="?c=guest&a=logout">请先用管理员账户登入</a>');
}
if ($_FILES['pfile']['error'] != 0) {
return info_page('文件上传错误,请重新上传');
}
$tmp_name = $_FILES['pfile']['tmp_name'];
$tname = uid() . '-' . time();
$plug_path = c('plugin_path') . DS . $tname;
if (@mkdir($plug_path)) {
include_once AROOT . 'lib' . DS . 'dUnzip2.inc.php';
$zip = new dUnzip2($tmp_name);
$zip->debug = false;
$zip->unzipAll($plug_path);
@chmod($plug_path, 0755);
$info_file = $plug_path . DS . 'app.php';
if (file_exists($info_file)) {
if ($info = get_plugin_info(file_get_contents($info_file))) {
if (isset($info['folder_name'])) {
$folder_name = $info['folder_name'];
}
if (strlen($folder_name) < 1) {
$folder_name = reset(explode('.', basename($_FILES['pfile']['name'])));
}
if (strlen($folder_name) > 0) {
if (file_exists(c('plugin_path') . DS . $folder_name)) {
@rename(c('plugin_path') . DS . $folder_name . DS . 'app.php', c('plugin_path') . DS . $folder_name . DS . 'app.bak.php');
@rename(c('plugin_path') . DS . $folder_name, c('plugin_path') . DS . $folder_name . '_' . uid() . '_' . time());
}
rename($plug_path, c('plugin_path') . DS . $folder_name);
header("Location: ?c=pluglist");
return true;
} else {
return info_page('尝试获取插件名称失败,启用' . $tname . '作为临时名称,<a href="?c=pluglist">请点击继续</a>');
}
}
} else {
// clear dir
}
return info_page('找不到插件执行脚本-app.php文件,<a href="?c=pluglist">请重新上传格式正确的插件包</a>');
} else {
return info_page('创建插件目录失败,请将plugin目录设置为可写后<a href="?c=pluglist">重试</a>');
}
}
开发者ID:ramo01,项目名称:1kapp,代码行数:46,代码来源:pluglist.class.php
示例3: in
$error = true;
$sysmsg[] = $ids_arr[1];
} else {
$plugin_ids = $ids_arr[1];
}
if (!$error) {
$db->query_unbuffered("update {$tpf}plugins set actived=0 where plugin_name in({$plugin_ids})");
$sysmsg[] = __('plugins_inactived_success');
redirect($_SERVER['HTTP_REFERER'], $sysmsg);
} else {
redirect('back', $sysmsg);
}
} else {
syn_plugins();
$sql_do = "";
$perpage = 10;
$rs = $db->fetch_one_array("select count(*) as total_num from {$tpf}plugins {$sql_do}");
$total_num = $rs['total_num'];
$start_num = ($pg - 1) * $perpage;
$q = $db->query("select * from {$tpf}plugins {$sql_do} order by actived desc, plugin_name asc limit {$start_num},{$perpage}");
while ($rs = $db->fetch_array($q)) {
if (check_plugin($rs['plugin_name'])) {
$plugins_arr[] = get_plugin_info($rs['plugin_name']);
}
}
$db->free($q);
unset($rs);
$page_nav = multi($total_num, $perpage, $pg, urr(ADMINCP, "item={$item}&menu=plugin&action={$action}"));
require_once template_echo($item, $admin_tpl_dir, '', 1);
}
}
开发者ID:saintho,项目名称:phpdisk,代码行数:31,代码来源:plugins.inc.php
示例4: admin_page_plugins
/**
* Plugins admin page
*
* @param App $a
* @return string
*/
function admin_page_plugins(&$a)
{
/**
* Single plugin
*/
if ($a->argc == 3) {
$plugin = $a->argv[2];
if (!is_file("addon/{$plugin}/{$plugin}.php")) {
notice(t("Item not found."));
return '';
}
if (x($_GET, "a") && $_GET['a'] == "t") {
check_form_security_token_redirectOnErr('/admin/plugins', 'admin_themes', 't');
// Toggle plugin status
$idx = array_search($plugin, $a->plugins);
if ($idx !== false) {
unset($a->plugins[$idx]);
uninstall_plugin($plugin);
info(sprintf(t("Plugin %s disabled."), $plugin));
} else {
$a->plugins[] = $plugin;
install_plugin($plugin);
info(sprintf(t("Plugin %s enabled."), $plugin));
}
set_config("system", "addon", implode(", ", $a->plugins));
goaway($a->get_baseurl(true) . '/admin/plugins');
return '';
// NOTREACHED
}
// display plugin details
require_once 'library/markdown.php';
if (in_array($plugin, $a->plugins)) {
$status = "on";
$action = t("Disable");
} else {
$status = "off";
$action = t("Enable");
}
$readme = Null;
if (is_file("addon/{$plugin}/README.md")) {
$readme = file_get_contents("addon/{$plugin}/README.md");
$readme = Markdown($readme);
} else {
if (is_file("addon/{$plugin}/README")) {
$readme = "<pre>" . file_get_contents("addon/{$plugin}/README") . "</pre>";
}
}
$admin_form = "";
if (is_array($a->plugins_admin) && in_array($plugin, $a->plugins_admin)) {
@(require_once "addon/{$plugin}/{$plugin}.php");
$func = $plugin . '_plugin_admin';
$func($a, $admin_form);
}
$t = get_markup_template("admin_plugins_details.tpl");
return replace_macros($t, array('$title' => t('Administration'), '$page' => t('Plugins'), '$toggle' => t('Toggle'), '$settings' => t('Settings'), '$baseurl' => $a->get_baseurl(true), '$plugin' => $plugin, '$status' => $status, '$action' => $action, '$info' => get_plugin_info($plugin), '$str_author' => t('Author: '), '$str_maintainer' => t('Maintainer: '), '$admin_form' => $admin_form, '$function' => 'plugins', '$screenshot' => '', '$readme' => $readme, '$form_security_token' => get_form_security_token("admin_themes")));
}
/**
* List plugins
*/
$plugins = array();
$files = glob("addon/*/");
/* */
if ($files) {
foreach ($files as $file) {
if (is_dir($file)) {
list($tmp, $id) = array_map("trim", explode("/", $file));
$info = get_plugin_info($id);
$show_plugin = true;
// If the addon is unsupported, then only show it, when it is enabled
if (strtolower($info["status"]) == "unsupported" and !in_array($id, $a->plugins)) {
$show_plugin = false;
}
// Override the above szenario, when the admin really wants to see outdated stuff
if (get_config("system", "show_unsupported_addons")) {
$show_plugin = true;
}
if ($show_plugin) {
$plugins[] = array($id, in_array($id, $a->plugins) ? "on" : "off", $info);
}
}
}
}
$t = get_markup_template("admin_plugins.tpl");
return replace_macros($t, array('$title' => t('Administration'), '$page' => t('Plugins'), '$submit' => t('Save Settings'), '$baseurl' => $a->get_baseurl(true), '$function' => 'plugins', '$plugins' => $plugins, '$form_security_token' => get_form_security_token("admin_themes")));
}
开发者ID:strk,项目名称:friendica,代码行数:91,代码来源:admin.php
示例5: get_plugins
/**
+----------------------------------------------------------
* 读取插件
+----------------------------------------------------------
* @param string $path 插件目录
* @param string $app 所属项目名
+----------------------------------------------------------
* @return Array
+----------------------------------------------------------
*/
function get_plugins($path = PLUGIN_PATH, $app = APP_NAME, $ext = '.php')
{
static $plugins = array();
if (isset($plugins[$app])) {
return $plugins[$app];
}
// 如果插件目录为空 返回空数组
if (empty_dir($path)) {
return array();
}
$path = realpath($path);
// 缓存无效 重新读取插件文件
/*
$dir = glob ( $path . '/*' );
if($dir) {
foreach($dir as $val) {
if(is_dir($val)){
$subdir = glob($val.'/*'.$ext);
if($subdir) {
foreach($subdir as $file)
$plugin_files[] = $file;
}
}else{
if (strrchr($val, '.') == $ext)
$plugin_files[] = $val;
}
}
*/
$dir = dir($path);
if ($dir) {
$plugin_files = array();
while (false !== ($file = $dir->read())) {
if ($file == "." || $file == "..") {
continue;
}
if (is_dir($path . '/' . $file)) {
$subdir = dir($path . '/' . $file);
if ($subdir) {
while (($subfile = $subdir->read()) !== false) {
if ($subfile == "." || $subfile == "..") {
continue;
}
if (preg_match('/\\.php$/', $subfile)) {
$plugin_files[] = "{$file}/{$subfile}";
}
}
$subdir->close();
}
} else {
$plugin_files[] = $file;
}
}
$dir->close();
//对插件文件排序
if (count($plugin_files) > 1) {
sort($plugin_files);
}
$plugins[$app] = array();
foreach ($plugin_files as $plugin_file) {
if (!is_readable("{$path}/{$plugin_file}")) {
continue;
}
//取得插件文件的信息
$plugin_data = get_plugin_info("{$path}/{$plugin_file}");
if (empty($plugin_data['name'])) {
continue;
}
$plugins[$app][] = $plugin_data;
}
return $plugins[$app];
} else {
return array();
}
}
开发者ID:putera99,项目名称:iic-classified,代码行数:84,代码来源:plugin.php
示例6: admin_page_plugins
/**
* Plugins admin page
*
* @param App $a
* @return string
*/
function admin_page_plugins(&$a)
{
/*
* Single plugin
*/
if (\App::$argc == 3) {
$plugin = \App::$argv[2];
if (!is_file("addon/{$plugin}/{$plugin}.php")) {
notice(t("Item not found."));
return '';
}
$enabled = in_array($plugin, \App::$plugins);
$info = get_plugin_info($plugin);
$x = check_plugin_versions($info);
// disable plugins which are installed but incompatible versions
if ($enabled && !$x) {
$enabled = false;
$idz = array_search($plugin, \App::$plugins);
if ($idz !== false) {
unset(\App::$plugins[$idz]);
uninstall_plugin($plugin);
set_config("system", "addon", implode(", ", \App::$plugins));
}
}
$info['disabled'] = 1 - intval($x);
if (x($_GET, "a") && $_GET['a'] == "t") {
check_form_security_token_redirectOnErr('/admin/plugins', 'admin_plugins', 't');
// Toggle plugin status
$idx = array_search($plugin, \App::$plugins);
if ($idx !== false) {
unset(\App::$plugins[$idx]);
uninstall_plugin($plugin);
info(sprintf(t("Plugin %s disabled."), $plugin));
} else {
\App::$plugins[] = $plugin;
install_plugin($plugin);
info(sprintf(t("Plugin %s enabled."), $plugin));
}
set_config("system", "addon", implode(", ", \App::$plugins));
goaway(z_root() . '/admin/plugins');
}
// display plugin details
require_once 'library/markdown.php';
if (in_array($plugin, \App::$plugins)) {
$status = 'on';
$action = t('Disable');
} else {
$status = 'off';
$action = t('Enable');
}
$readme = null;
if (is_file("addon/{$plugin}/README.md")) {
$readme = file_get_contents("addon/{$plugin}/README.md");
$readme = Markdown($readme);
} else {
if (is_file("addon/{$plugin}/README")) {
$readme = "<pre>" . file_get_contents("addon/{$plugin}/README") . "</pre>";
}
}
$admin_form = '';
$r = q("select * from addon where plugin_admin = 1 and name = '%s' limit 1", dbesc($plugin));
if ($r) {
@(require_once "addon/{$plugin}/{$plugin}.php");
if (function_exists($plugin . '_plugin_admin')) {
$func = $plugin . '_plugin_admin';
$func($a, $admin_form);
}
}
$t = get_markup_template('admin_plugins_details.tpl');
return replace_macros($t, array('$title' => t('Administration'), '$page' => t('Plugins'), '$toggle' => t('Toggle'), '$settings' => t('Settings'), '$baseurl' => z_root(), '$plugin' => $plugin, '$status' => $status, '$action' => $action, '$info' => $info, '$str_author' => t('Author: '), '$str_maintainer' => t('Maintainer: '), '$str_minversion' => t('Minimum project version: '), '$str_maxversion' => t('Maximum project version: '), '$str_minphpversion' => t('Minimum PHP version: '), '$str_requires' => t('Requires: '), '$disabled' => t('Disabled - version incompatibility'), '$admin_form' => $admin_form, '$function' => 'plugins', '$screenshot' => '', '$readme' => $readme, '$form_security_token' => get_form_security_token('admin_plugins')));
}
/*
* List plugins
*/
$plugins = array();
$files = glob('addon/*/');
if ($files) {
foreach ($files as $file) {
if (is_dir($file)) {
list($tmp, $id) = array_map('trim', explode('/', $file));
$info = get_plugin_info($id);
$enabled = in_array($id, \App::$plugins);
$x = check_plugin_versions($info);
// disable plugins which are installed but incompatible versions
if ($enabled && !$x) {
$enabled = false;
$idz = array_search($id, \App::$plugins);
if ($idz !== false) {
unset(\App::$plugins[$idz]);
uninstall_plugin($id);
set_config("system", "addon", implode(", ", \App::$plugins));
}
}
$info['disabled'] = 1 - intval($x);
//.........这里部分代码省略.........
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:101,代码来源:Admin.php
示例7: run
//.........这里部分代码省略.........
} else {
$aPlugins = array_slice($aPlugins, $begin, $limit);
}
} elseif ($plugin != 'all') {
$file = $filepath . $plugin . '.php';
$confirm = in_array($file, $aPlugins);
if ($confirm === false) {
return '^' . tr('Plugin Manager error: %0%1 not found', $plugin, $type) . '^';
} else {
$aPlugins = array();
$aPlugins[] = $file;
}
}
} else {
if (!empty($start) || !empty($limit)) {
if (!empty($start) && !empty($limit)) {
$aPlugins = array_slice($aPlugins, $start-1, $limit);
} elseif (!empty($start)) {
$aPlugins = array_slice($aPlugins, $start-1);
} else {
$aPlugins = array_slice($aPlugins, 0, $limit);
}
}
}
//Set all data variables needed for separate code used to generate the display table
$aData=array();
if ($singletitle == 'table' || count($aPlugins) > 1) {
foreach ($aPlugins as $sPluginFile) {
global $sPlugin, $numparams;
if ($mod) {
$infoPlugin = get_module_params($sPluginFile);
$namepath = $sPlugin;
} else {
$infoPlugin = get_plugin_info($sPluginFile);
$namepath = ucfirst($sPlugin);
}
if (in_array('description', $info)) {
if (isset($infoPlugin['description'])) {
if ($numparams > 1) {
$aData[$sPlugin]['description']['onekey'] = $infoPlugin['description'];
} else {
$aData[$sPlugin]['description'] = $infoPlugin['description'];
}
} else {
$aData[$sPlugin]['description'] = ' --- ';
}
}
if (in_array('parameters', $info)) {
if ($numparams > 0) {
if ($aPrincipalField['field'] == 'plugin' && !in_array('options', $info) && $numparams > 1) {
$aData[$sPlugin][$aPrincipalField['field']]['rowspan'] = $numparams;
if (in_array('description', $info)) {
$aData[$sPlugin]['description']['rowspan'] = $numparams;
}
}
foreach ($infoPlugin['params'] as $paramname => $param) {
if (isset($infoPlugin['params'][$paramname]['description'])) {
$paramblock = '~np~' . $infoPlugin['params'][$paramname]['description'] . '~/np~';
}
if (isset($param['options']) && is_array($param['options'])) {
$paramblock .= '<br /><em>' . tra('Options:') . '</em> ';
$i = 0;
foreach ($param['options'] as $oplist => $opitem) {
if (isset($opitem['value'])) {
$paramblock .= $opitem['value'];
} else {
开发者ID:railfuture,项目名称:tiki-website,代码行数:67,代码来源:wikiplugin_pluginmanager.php
示例8: admin_page_plugins
/**
* Plugins admin page
*
* @param App $a
* @return string
*/
function admin_page_plugins(&$a)
{
/*
* Single plugin
*/
if ($a->argc == 3) {
$plugin = $a->argv[2];
if (!is_file("addon/{$plugin}/{$plugin}.php")) {
notice(t("Item not found."));
return '';
}
if (x($_GET, "a") && $_GET['a'] == "t") {
check_form_security_token_redirectOnErr('/admin/plugins', 'admin_plugins', 't');
// Toggle plugin status
$idx = array_search($plugin, $a->plugins);
if ($idx !== false) {
unset($a->plugins[$idx]);
uninstall_plugin($plugin);
info(sprintf(t("Plugin %s disabled."), $plugin));
} else {
$a->plugins[] = $plugin;
install_plugin($plugin);
info(sprintf(t("Plugin %s enabled."), $plugin));
}
set_config("system", "addon", implode(", ", $a->plugins));
goaway($a->get_baseurl(true) . '/admin/plugins');
}
// display plugin details
require_once 'library/markdown.php';
if (in_array($plugin, $a->plugins)) {
$status = 'on';
$action = t('Disable');
} else {
$status = 'off';
$action = t('Enable');
}
$readme = null;
if (is_file("addon/{$plugin}/README.md")) {
$readme = file_get_contents("addon/{$plugin}/README.md");
$readme = Markdown($readme);
} else {
if (is_file("addon/{$plugin}/README")) {
$readme = "<pre>" . file_get_contents("addon/{$plugin}/README") . "</pre>";
}
}
$admin_form = '';
if (is_array($a->plugins_admin) && in_array($plugin, $a->plugins_admin)) {
@(require_once "addon/{$plugin}/{$plugin}.php");
if (function_exists($plugin . '_plugin_admin')) {
$func = $plugin . '_plugin_admin';
$func($a, $admin_form);
}
}
$t = get_markup_template('admin_plugins_details.tpl');
return replace_macros($t, array('$title' => t('Administration'), '$page' => t('Plugins'), '$toggle' => t('Toggle'), '$settings' => t('Settings'), '$baseurl' => $a->get_baseurl(true), '$plugin' => $plugin, '$status' => $status, '$action' => $action, '$info' => get_plugin_info($plugin), '$str_author' => t('Author: '), '$str_maintainer' => t('Maintainer: '), '$admin_form' => $admin_form, '$function' => 'plugins', '$screenshot' => '', '$readme' => $readme, '$form_security_token' => get_form_security_token('admin_plugins')));
}
/*
* List plugins
*/
$plugins = array();
$files = glob('addon/*/');
if ($files) {
foreach ($files as $file) {
if (is_dir($file)) {
list($tmp, $id) = array_map('trim', explode('/', $file));
$info = get_plugin_info($id);
$plugins[] = array($id, in_array($id, $a->plugins) ? "on" : "off", $info);
}
}
}
$t = get_markup_template('admin_plugins.tpl');
return replace_macros($t, array('$title' => t('Administration'), '$page' => t('Plugins'), '$submit' => t('Submit'), '$baseurl' => $a->get_baseurl(true), '$function' => 'plugins', '$plugins' => $plugins, '$form_security_token' => get_form_security_token('admin_plugins')));
}
开发者ID:einervonvielen,项目名称:redmatrix,代码行数:79,代码来源:admin.php
示例9: scan_plugin_info
function scan_plugin_info()
{
if (file_exists(c('plugin_path'))) {
foreach (glob(c('plugin_path') . DS . "*", GLOB_ONLYDIR) as $pfold) {
$app_file = $pfold . DS . 'app.php';
if (file_exists($app_file)) {
if ($pinfo = get_plugin_info(file_get_contents($app_file))) {
$plist[] = $pinfo;
}
}
}
}
return isset($plist) ? $plist : false;
}
开发者ID:xianliflc,项目名称:teamirr,代码行数:14,代码来源:app.function.php
示例10: macro_admin
function macro_admin($formatter, $value = '', $options = array())
{
global $DBInfo;
if ($DBInfo->include_path) {
$dirs = explode(':', $DBInfo->include_path);
} else {
$dirs = array('.');
}
$arena = 'plugin';
$plcur = ' class="current"';
$prcur = '';
if ($options['arena'] == 'processor') {
$arena = 'processor';
$prcur = ' class="current"';
$plcur = '';
}
$pdir = $arena == 'plugin' ? 'plugin' : 'plugin/processor';
$tag = $arena == 'plugin' ? 'pl' : 'pr';
// make plugins list
foreach ($dirs as $dir) {
$handle = @opendir($dir . '/' . $pdir);
if (!$handle) {
continue;
}
while ($file = readdir($handle)) {
if (is_dir($dir . '/' . $pdir . '/' . $file)) {
continue;
}
if ($file[0] == '.') {
continue;
}
if (substr($file, -4) != '.php') {
continue;
}
$name = substr($file, 0, -4);
$plugins[strtolower($name)] = $name;
$pl_infos[strtolower($name)] = get_plugin_info($dir . '/' . $pdir . '/' . $file);
}
}
ksort($plugins);
//
$formatter->set_wordrule(array('#camelcase' => 0));
// get settings
$sc = new Cache_text('settings');
$pls = $sc->fetch($arena . 's');
#$pl="<tr><th colspan='3'>"._($arena)."</th></tr>\n";
$pl = '';
$i = 0;
foreach ($plugins as $p => $v) {
++$i;
$ck = isset($pls[$p]) ? 'checked="checked"' : '';
$disabled = empty($ck) ? ' disabled' : '';
$name = $pl_infos[$p]['Name'] ? $pl_infos[$p]['Name'] : $p;
$version = $pl_infos[$p]['Version'];
$author = $pl_infos[$p]['Author'];
$version = $pl_infos[$p]['Version'];
$license = $pl_infos[$p]['License'];
$depend = $pl_infos[$p]['Depend'];
$url = $pl_infos[$p]['URL'];
$desc = $pl_infos[$p]['Description'] ? $pl_infos[$p]['Description'] : '';
$pl .= "<tr><th class='info{$disabled}' width='10%'>" . $name . ' ' . $version . '</th><td>' . "{$v}</td><td width='2%'><input type='checkbox' name='{$tag}[{$p}]' value='{$v}' {$ck}/></td></tr>\n";
if ($author or $desc or $license) {
$msg = _("Description");
$pl .= "<tr><td colspan='3'><fieldset class='collapsible collapsed'><legend>{$msg}: </legend>";
if ($author) {
$pl .= '<strong>' . _("Author") . ': ' . $author . "</strong><br />\n";
}
if ($license) {
$pl .= '<strong>' . _("License") . ': ' . $license . "</strong><br />\n";
}
if ($depend) {
$pl .= '<strong>' . _("Depend") . ': ' . $depend . "</strong><br />\n";
}
if ($url) {
$url = preg_replace_callback("/(" . $formatter->wordrule . ")/", array(&$formatter, 'link_repl'), $url);
$pl .= '<strong>' . _("URL") . ': ' . $url . "</strong><br />\n";
}
if ($desc) {
$desc = preg_replace_callback("/(" . $formatter->wordrule . ")/", array(&$formatter, 'link_repl'), $desc);
$pl .= "<p><pre>{$desc}</pre></p>\n";
}
$pl .= "</fieldset></td></tr>\n";
}
}
$pl .= "<tr><td colspan='3'>Total <b>{$i}</b></td></tr>\n";
$out = <<<MENU
<ul id="admin-submenu">
<li><a href="?action=admin&arena=plugin"{$plcur}>Plugins</a></li>
<li><a href="?action=admin&arena=processor"{$prcur}>Processors</a></li>
</ul>
MENU;
$out .= "<form method='post' action=''><table algin='center'><tr valign='top'>" . $pl . "</table>";
if (is_array($DBInfo->owners) and in_array($options['id'], $DBInfo->owners)) {
$out .= '<input type="hidden" name="action" value="admin" />';
$out .= '<input type="submit" value="Update" />';
}
$out .= '</form>';
return $out;
}
开发者ID:ahastudio,项目名称:moniwiki,代码行数:99,代码来源:admin.php
示例11: admin_page_plugins
function admin_page_plugins(&$a)
{
/**
* Single plugin
*/
if ($a->argc == 3) {
$plugin = $a->argv[2];
if (!is_file("addon/{$plugin}/{$plugin}.php")) {
notice(t("Item not found."));
return;
}
if (x($_GET, "a") && $_GET['a'] == "t") {
// Toggle plugin status
$idx = array_search($plugin, $a->plugins);
if ($idx !== false) {
unset($a->plugins[$idx]);
uninstall_plugin($plugin);
info(sprintf(t("Plugin %s disabled."), $plugin));
} else {
$a->plugins[] = $plugin;
install_plugin($plugin);
info(sprintf(t("Plugin %s enabled."), $plugin));
}
set_config("system", "addon", implode(", ", $a->plugins));
goaway($a->get_baseurl() . '/admin/plugins');
return;
// NOTREACHED
}
// display plugin details
require_once 'library/markdown.php';
if (in_array($plugin, $a->plugins)) {
$status = "on";
$action = t("Disable");
} else {
$status = "off";
$action = t("Enable");
}
$readme = Null;
if (is_file("addon/{$plugin}/README.md")) {
$readme = file_get_contents("addon/{$plugin}/README.md");
$readme = Markdown($readme);
} else {
if (is_file("addon/{$plugin}/README")) {
$readme = "<pre>" . file_get_contents("addon/{$plugin}/README") . "</pre>";
}
}
$admin_form = "";
if (is_array($a->plugins_admin) && in_array($plugin, $a->plugins_admin)) {
@(require_once "addon/{$plugin}/{$plugin}.php");
$func = $plugin . '_plugin_admin';
$func($a, $admin_form);
}
$t = get_markup_template("admin_plugins_details.tpl");
return replace_macros($t, array('$title' => t('Administration'), '$page' => t('Plugins'), '$toggle' => t('Toggle'), '$settings' => t('Settings'), '$baseurl' => $a->get_baseurl(), '$plugin' => $plugin, '$status' => $status, '$action' => $action, '$info' => get_plugin_info($plugin), '$admin_form' => $admin_form, '$readme' => $readme));
}
/**
* List plugins
*/
$plugins = array();
$files = glob("addon/*/");
if ($files) {
foreach ($files as $file) {
if (is_dir($file)) {
list($tmp, $id) = array_map("trim", explode("/", $file));
$info = get_plugin_info($id);
$plugins[] = array($id, in_array($id, $a->plugins) ? "on" : "off", $info);
}
}
}
$t = get_markup_template("admin_plugins.tpl");
return replace_macros($t, array('$title' => t('Administration'), '$page' => t('Plugins'), '$submit' => t('Submit'), '$baseurl' => $a->get_baseurl(), '$plugins' => $plugins));
}
开发者ID:ryivhnn,项目名称:friendica,代码行数:72,代码来源:admin.php
示例12: plugins
//.........这里部分代码省略.........
die("Fatal Error");
}
$pagecontent = '';
$show = $ADMIN_CONF->get("plugins");
if (!is_array($show)) {
$show = array();
}
if (ROOT or in_array("plugin_-_manage", $show)) {
$multi_user = "";
if (defined('MULTI_USER') and MULTI_USER) {
$multi_user = "&multi=true";
}
$html_manage = "";
$plugin_manage = array();
$disabled = '';
if (!function_exists('gzopen')) {
$disabled = ' disabled="disabled"';
}
$plugin_install = array();
foreach (getDirAsArray(PLUGIN_DIR_REL, array(".zip")) as $zip_file) {
$plugin_install[] = '<option value="' . mo_rawurlencode($zip_file) . '">' . $zip_file . '</option>';
}
$plugin_install_html = "";
if (count($plugin_install) > 0) {
$plugin_install_html .= '<br /><select class="mo-install-select mo-select-div" name="plugin-install-select" size="1"' . $disabled . '>' . '<option value="">' . getLanguageValue("plugins_select", true) . '</option>' . implode("", $plugin_install) . '</select>';
}
$plugin_manage["plugins_title_manage"][] = '<form id="js-plugin-manage" action="index.php?nojs=true&action=plugins' . $multi_user . '" method="post" enctype="multipart/form-data">' . '<div class="mo-nowrap align-right ui-helper-clearfix">' . '<span class="align-left" style="float:left"><span class="mo-bold">' . getLanguageValue("plugins_text_filebutton") . '</span><br />' . getLanguageValue("plugins_text_fileinfo") . '</span>' . '<input type="file" id="js-plugin-install-file" name="plugin-install-file" class="mo-select-div"' . $disabled . ' />' . $plugin_install_html . '<input type="submit" id="js-plugin-install-submit" name="plugin-install" value="' . getLanguageValue("plugins_button_install", true) . '"' . $disabled . ' /><br />' . '<input type="submit" id="js-plugin-del-submit" value="' . getLanguageValue("plugins_button_delete", true) . '" class="mo-margin-top js-send-del-stop" />' . '</div></form>';
$plugin_manage["plugins_title_manage"]["toggle"] = true;
$html_manage = contend_template($plugin_manage);
$html_manage = str_replace("js-toggle", "js-toggle-manage", $html_manage);
# es wurde in der template verwaltung was gemacht dann soll die aufgeklapt bleiben
if ($plugin_manage_open) {
$html_manage = str_replace("display:none;", "", $html_manage);
}
$pagecontent .= $html_manage;
}
$pagecontent .= '<ul class="js-plugins mo-ul">';
$dircontent = getDirAsArray(PLUGIN_DIR_REL, "dir", "natcasesort");
foreach ($dircontent as $currentelement) {
$new_plugin_conf = false;
if (!ROOT and !in_array($currentelement, $show)) {
continue;
}
if (file_exists(PLUGIN_DIR_REL . $currentelement . "/index.php")) {
if (!is_file(PLUGIN_DIR_REL . $currentelement . "/plugin.conf.php")) {
if (false === newConf(PLUGIN_DIR_REL . $currentelement . "/plugin.conf.php")) {
die;
} else {
$new_plugin_conf = true;
}
}
require_once PLUGIN_DIR_REL . $currentelement . "/index.php";
# Enthält der Code eine Klasse mit dem Namen des Plugins und ist es auch der Dirname?
if (class_exists($currentelement) and in_array($currentelement, get_declared_classes())) {
$plugin = new $currentelement();
} else {
# Plugin Dirname stimt nicht mit Plugin Classnamen überein
continue;
}
# plugin.conf.php wurde neu erstelt.
# Wenn es die getDefaultSettings() gibt fühle die plugin.conf.php damit
if ($new_plugin_conf and method_exists($plugin, 'getDefaultSettings')) {
$plugin->settings->setFromArray($plugin->getDefaultSettings());
}
$plugin_css_li_error = NULL;
$plugin_error = false;
$plugin_info = $plugin->getInfo();
# Plugin Info Prüfen
if (isset($plugin_info) and count($plugin_info) > 0) {
$plugin_name = strip_tags($plugin_info[0], '<b>');
if (substr(strip_tags($plugin_name), 0, strlen($currentelement)) != $currentelement) {
$plugin_name = "<b>" . $currentelement . "</b> " . strip_tags($plugin_name);
}
$plugin_name = htmlentities($plugin_name, ENT_COMPAT, CHARSET);
$plugin_name = str_replace(array("<", ">", "\$"), array("<", ">", ""), $plugin_name);
} else {
$plugin_error = '<img class="mo-tool-icon mo-icons-icon mo-icons-error" src="' . ICON_URL_SLICE . '" alt="error" />' . getLanguageValue('plugins_error') . ' <b>' . $currentelement . '</b>';
$plugin_css_li_error = ' ui-state-error';
}
$pagecontent .= '<li class="js-plugin mo-li ui-widget-content ui-corner-all' . $plugin_css_li_error . '">' . '<div class="js-tools-show-hide mo-li-head-tag mo-li-head-tag-no-ul ui-state-active ui-corner-all ui-helper-clearfix">';
$check_show = ' style="display:none;"';
if ($plugin_manage_open) {
$check_show = '';
}
if ($plugin_error === false) {
$pagecontent .= '<span class="js-plugin-name mo-padding-left mo-middle">' . $plugin_name . '</span>' . '<div style="float:right;" class="mo-tag-height-from-icon mo-middle mo-nowrap">' . '<span class="js-plugin-active mo-staus">' . buildCheckBox($currentelement . '[active]', $plugin->settings->get("active") == "true", getLanguageValue("plugins_input_active")) . '</span>' . '<img class="js-tools-icon-show-hide js-toggle mo-tool-icon mo-icons-icon mo-icons-edit" src="' . ICON_URL_SLICE . '" alt="edit" />' . '<input type="checkbox" value="' . $currentelement . '" class="mo-checkbox mo-checkbox-del js-plugin-del"' . $check_show . ' />' . '</div>' . '</div>' . '<div class="js-toggle-content mo-in-ul-ul ui-helper-clearfix" style="display:none;">' . get_plugin_info($plugin_info);
# geändert damit getConfig() nicht 2mal ausgeführt wird
$config = $plugin->getConfig();
# Beschreibung und inputs der Konfiguration Bauen und ausgeben
$pagecontent .= get_plugin_config($plugin->settings, $config, $currentelement);
} else {
$pagecontent .= $plugin_error;
}
$pagecontent .= '</div></li>';
unset($plugin);
}
}
$pagecontent .= '</ul>';
return $pagecontent;
}
开发者ID:Novo1987,项目名称:mozilo2.0,代码行数:101,代码来源:plugins.php
示例13: macro_PluginInfo
function macro_PluginInfo($formatter = '', $value = '')
{
global $_revision, $_release;
$version = phpversion();
$uname = php_uname();
list($aversion, $dummy) = explode(" ", $_SERVER['SERVER_SOFTWARE'], 2);
if (!$value) {
$num = getPlugin(true);
return sprintf(_("Total %s plugin activated."), $num);
}
$file = getPlugin(strtolower($value));
if (empty($file)) {
if ($m = function_exists('macro_' . $value) or $m = function_exists('do_' . $value)) {
return sprintf(_("%s is internal plugin."), $value);
} else {
return sprintf(_("%s plugin is not found."), $value);
}
}
$info = get_plugin_info(dirname(__FILE__) . "/{$file}.php");
$name = !empty($info['Name']) ? $info['Name'] . ' (' . $value . ')' : $value;
$version = !empty($info['Version']) ? $info['Version'] : '';
$author = !empty($info['Author']) ? $info['Author'] : '';
$license = !empty($info['License']) ? $info['License'] : '';
$depend = !empty($info['Depend']) ? $info['Depend'] : '';
$url = !empty($info['URL']) ? $info['URL'] : '';
$desc = !empty($info['Description']) ? $info['Description'] : '';
$msg = _("Description");
$pl = "<tr><td colspan='3'><fieldset class='collapsible collapsed'><legend>{$msg}: </legend><div>";
$pl .= '<strong>' . _("Name") . ': ' . $name . "</strong><br />\n";
if ($version) {
$pl .= '<strong>' . _("Version") . ': ' . $version . "</strong><br />\n";
}
if ($author) {
$pl .= '<strong>' . _("Author") . ': ' . $author . "</strong><br />\n";
}
if ($license) {
$pl .= '<strong>' . _("License") . ': ' . $license . "</strong><br />\n";
}
if ($depend) {
$pl .= '<strong>' . _("Depend") . ': ' . $depend . "</strong><br />\n";
}
if (empty($formatter->wordrule)) {
$formatter->set_wordrule();
}
if ($url) {
$url = preg_replace_callback("/(" . $formatter->wordrule . ")/", array(&$formatter, 'link_repl'), $url);
$pl .= '<strong>' . _("URL") . ': ' . $url . "</strong><br />\n";
}
if ($desc) {
$desc = preg_replace_callback("/(" . $formatter->wordrule . ")/", array(&$formatter, 'link_repl'), $desc);
$pl .= "<p><pre>{$desc}</pre></p>\n";
}
$pl .= "</div></fieldset></td></tr>\n";
return <<<EOF
<div class='pluginInfo'>
<table border='0' cellpadding='5'>
{$pl}
</table>
</div>
EOF;
// vim:et:sts=4:sw=4:
}
开发者ID:ahastudio,项目名称:moniwiki,代码行数:62,代码来源:PluginInfo.php
示例14: plugin_latest_version
/**
* Returns the latest version for a plugin
*
* @return string
*/
function plugin_latest_version()
{
$version = '';
if (post_meta('plugin')) {
$version = get_plugin_info(post_meta('plugin'), 'version');
}
if (post_meta('download_id')) {
$version = get_post_meta(post_meta('download_id'), '_edd_sl_version', true);
}
return $version;
}
开发者ID:apsolut,项目名称:Yoast-theme-public,代码行数:16,代码来源:functions-helpers.php
|
请发表评论