mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-26 19:29:58 +03:00
- plugins admin menu appear now in the admin page menubar
- plugins are loaded immediately after loading the config (allow them to hack more of pwg like user init, template init etc...) - trigger event format_exif_data (for picture display only) git-svn-id: http://piwigo.org/svn/trunk@1655 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
51e56e9c1f
commit
f7960e7e72
10 changed files with 53 additions and 65 deletions
32
admin.php
32
admin.php
|
@ -31,6 +31,7 @@ define('IN_ADMIN', true);
|
|||
include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
|
||||
|
||||
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
||||
include_once(PHPWG_ROOT_PATH.'admin/include/functions_plugins.inc.php');
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Check Access and exit when user status is not ok |
|
||||
|
@ -58,6 +59,9 @@ else
|
|||
$page['page'] = 'intro';
|
||||
}
|
||||
|
||||
$page['errors'] = array();
|
||||
$page['infos'] = array();
|
||||
|
||||
$link_start = PHPWG_ROOT_PATH.'admin.php?page=';
|
||||
$conf_link = $link_start.'configuration&section=';
|
||||
$opt_link = $link_start.'cat_options&section=';
|
||||
|
@ -114,19 +118,38 @@ if ($conf['allow_random_representative'])
|
|||
);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------- content display
|
||||
$page['errors'] = array();
|
||||
$page['infos'] = array();
|
||||
// required before plugin page inclusion
|
||||
trigger_action('plugin_admin_menu');
|
||||
|
||||
include(PHPWG_ROOT_PATH.'admin/'.$page['page'].'.php');
|
||||
|
||||
//------------------------------------------------------------- content display
|
||||
$template->assign_block_vars('plugin_menu.menu_item',
|
||||
array(
|
||||
'NAME' => l10n('admin'),
|
||||
'URL' => $link_start.'plugins'
|
||||
)
|
||||
);
|
||||
if ( isset($page['plugin_admin_menu']) )
|
||||
{
|
||||
$plug_base_url = $link_start.'plugin&section=';
|
||||
foreach ($page['plugin_admin_menu'] as $menu)
|
||||
{
|
||||
$template->assign_block_vars('plugin_menu.menu_item',
|
||||
array(
|
||||
'NAME' => $menu['title'],
|
||||
'URL' => $plug_base_url.$menu['uid']
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | errors & infos |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
if (count($page['errors']) != 0)
|
||||
{
|
||||
$template->assign_block_vars('errors',array());
|
||||
foreach ($page['errors'] as $error)
|
||||
{
|
||||
$template->assign_block_vars('errors.error',array('ERROR'=>$error));
|
||||
|
@ -135,7 +158,6 @@ if (count($page['errors']) != 0)
|
|||
|
||||
if (count($page['infos']) != 0)
|
||||
{
|
||||
$template->assign_block_vars('infos',array());
|
||||
foreach ($page['infos'] as $info)
|
||||
{
|
||||
$template->assign_block_vars('infos.info',array('INFO'=>$info));
|
||||
|
|
|
@ -31,40 +31,25 @@ if( !defined("PHPWG_ROOT_PATH") )
|
|||
}
|
||||
|
||||
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
||||
include_once(PHPWG_ROOT_PATH.'admin/include/functions_plugins.inc.php');
|
||||
check_status(ACCESS_ADMINISTRATOR);
|
||||
|
||||
$template->set_filenames(array('plugin' => 'admin/plugin.tpl'));
|
||||
|
||||
trigger_action('plugin_admin_menu');
|
||||
|
||||
|
||||
if ( isset($page['plugin_admin_menu']) )
|
||||
{
|
||||
$template->assign_block_vars('plugin_menu.menu_item',
|
||||
array(
|
||||
'NAME' => l10n('Plugins'),
|
||||
'URL' => PHPWG_ROOT_PATH.'admin.php?page=plugins'
|
||||
)
|
||||
);
|
||||
|
||||
$plug_base_url = PHPWG_ROOT_PATH.'admin.php?page=plugin&section=';
|
||||
foreach ($page['plugin_admin_menu'] as $menu)
|
||||
{
|
||||
if (isset($_GET['section']) and $menu['uid']==$_GET['section'])
|
||||
{
|
||||
$found_menu=$menu;
|
||||
break;
|
||||
}
|
||||
$template->assign_block_vars('plugin_menu.menu_item',
|
||||
array(
|
||||
'NAME' => $menu['title'],
|
||||
'URL' => $plug_base_url.$menu['uid']
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset($found_menu) )
|
||||
{
|
||||
$template->assign_var('PLUGIN_TITLE', $found_menu['title'] );
|
||||
call_user_func(
|
||||
$found_menu['function'],
|
||||
PHPWG_ROOT_PATH.'admin.php?page=plugin&section='.$found_menu['uid'] );
|
||||
|
|
|
@ -31,7 +31,6 @@ if( !defined("PHPWG_ROOT_PATH") )
|
|||
}
|
||||
|
||||
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
||||
include_once(PHPWG_ROOT_PATH.'admin/include/functions_plugins.inc.php');
|
||||
check_status(ACCESS_ADMINISTRATOR);
|
||||
|
||||
$my_base_url = PHPWG_ROOT_PATH.'admin.php?page=plugins';
|
||||
|
@ -162,29 +161,6 @@ foreach ($db_plugins as $db_plugin)
|
|||
|
||||
$template->set_filenames(array('plugins' => 'admin/plugins.tpl'));
|
||||
|
||||
trigger_action('plugin_admin_menu');
|
||||
|
||||
$template->assign_block_vars('plugin_menu.menu_item',
|
||||
array(
|
||||
'NAME' => l10n('Plugins'),
|
||||
'URL' => PHPWG_ROOT_PATH.'admin.php?page=plugins'
|
||||
)
|
||||
);
|
||||
|
||||
if ( isset($page['plugin_admin_menu']) )
|
||||
{
|
||||
$plug_base_url = PHPWG_ROOT_PATH.'admin.php?page=plugin&section=';
|
||||
foreach ($page['plugin_admin_menu'] as $menu)
|
||||
{
|
||||
$template->assign_block_vars('plugin_menu.menu_item',
|
||||
array(
|
||||
'NAME' => $menu['title'],
|
||||
'URL' => $plug_base_url.$menu['uid']
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$num=0;
|
||||
foreach( $fs_plugins as $plugin_id => $fs_plugin )
|
||||
{
|
||||
|
|
|
@ -137,6 +137,7 @@ or die ( "Could not connect to database" );
|
|||
// since basic gallery information is not available
|
||||
//
|
||||
load_conf_from_db();
|
||||
load_plugins();
|
||||
|
||||
include(PHPWG_ROOT_PATH.'include/user.inc.php');
|
||||
|
||||
|
@ -158,8 +159,6 @@ if ($user['is_the_guest'])
|
|||
// template instance
|
||||
$template = new Template(PHPWG_ROOT_PATH.'template/'.$user['template'], $user['theme'] );
|
||||
|
||||
load_plugins();
|
||||
|
||||
if ($conf['gallery_locked'])
|
||||
{
|
||||
$header_msgs[] = $lang['gallery_locked_message'];
|
||||
|
|
|
@ -41,6 +41,7 @@ if ($conf['show_exif'])
|
|||
|
||||
if ($exif = @read_exif_data($picture['current']['image_path']))
|
||||
{
|
||||
$exif = trigger_event('format_exif_data', $exif, $picture['current'] );
|
||||
$template->assign_block_vars(
|
||||
'metadata.headline',
|
||||
array('TITLE' => 'EXIF Metadata')
|
||||
|
|
|
@ -352,8 +352,8 @@ if (isset($page['comment']) and $page['comment'] != '')
|
|||
//------------------------------------------------------------ log informations
|
||||
pwg_log('category', $page['title']);
|
||||
|
||||
trigger_action('loc_end_index');
|
||||
include(PHPWG_ROOT_PATH.'include/page_header.php');
|
||||
trigger_action('loc_end_index');
|
||||
$template->parse('index');
|
||||
include(PHPWG_ROOT_PATH.'include/page_tail.php');
|
||||
?>
|
||||
|
|
|
@ -9,7 +9,11 @@ if ( isset($_POST['eventTracer_filters']) )
|
|||
$v = $_POST['eventTracer_filters'];
|
||||
$v = str_replace( "\r\n", "\n", $v );
|
||||
$v = str_replace( "\n\n", "\n", $v );
|
||||
$this->my_config['filters'] = explode("\n", $v);
|
||||
$v = stripslashes($v);
|
||||
if (!empty($v))
|
||||
$this->my_config['filters'] = explode("\n", $v);
|
||||
else
|
||||
$this->my_config['filters'] = array();
|
||||
$this->my_config['show_args'] = isset($_POST['eventTracer_show_args']);
|
||||
$this->save_config();
|
||||
global $page;
|
||||
|
|
|
@ -71,6 +71,18 @@
|
|||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang:Plugins}</dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<!-- BEGIN plugin_menu -->
|
||||
<!-- BEGIN menu_item -->
|
||||
<li><a href="{plugin_menu.menu_item.URL}">{plugin_menu.menu_item.NAME}</a></li>
|
||||
<!-- END menu_item -->
|
||||
<!-- END plugin_menu -->
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
</div> <!-- menubar -->
|
||||
|
||||
<div id="content">
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
<div class="titrePage">
|
||||
<h2>
|
||||
<!-- BEGIN plugin_menu -->
|
||||
<!-- BEGIN menu_item -->
|
||||
<span style="margin-left:2px;"><a href="{plugin_menu.menu_item.URL}">{plugin_menu.menu_item.NAME}</a></span>
|
||||
<!-- END menu_item -->
|
||||
<!-- END plugin_menu -->
|
||||
</h2>
|
||||
<h2>{PLUGIN_TITLE}</h2>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<div class="titrePage">
|
||||
<h2>
|
||||
<!-- BEGIN plugin_menu -->
|
||||
<!-- BEGIN menu_item -->
|
||||
<span style="margin-left:2px;"><a href="{plugin_menu.menu_item.URL}">{plugin_menu.menu_item.NAME}</a></span>
|
||||
<!-- END menu_item -->
|
||||
<!-- END plugin_menu -->
|
||||
<h2>{lang:Plugins}
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
|
@ -24,7 +19,7 @@
|
|||
<td>{plugins.plugin.DESCRIPTION}</td>
|
||||
<td>
|
||||
<!-- BEGIN action -->
|
||||
<a href="{plugins.plugin.action.U_ACTION}">{plugins.plugin.action.L_ACTION}</a>
|
||||
<a href="{plugins.plugin.action.U_ACTION}" {TAG_INPUT_ENABLED}>{plugins.plugin.action.L_ACTION}</a>
|
||||
<!-- END action -->
|
||||
</td>
|
||||
</tr>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue