aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2007-01-09 11:38:54 +0000
committerrvelices <rv-github@modusoptimus.com>2007-01-09 11:38:54 +0000
commitb910549db2dc6e5b62750ac6faa68ea406d7b142 (patch)
treecb0e93aac7fc6d54adedc8230a8e7d16f4a20fb7 /plugins
parentc841c568f6d6f098fc097b7d8ee06c8602aa03d4 (diff)
Plugins: new way of adding links and content to administration pages...
git-svn-id: http://piwigo.org/svn/trunk@1705 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'plugins')
-rw-r--r--plugins/add_index/admin/admin_menu.php4
-rw-r--r--plugins/add_index/admin/admin_menu.tpl4
-rw-r--r--plugins/add_index/main.admin.inc.php24
-rw-r--r--plugins/add_index/main.inc.php1
-rw-r--r--plugins/admin_advices/main.inc.php33
-rw-r--r--plugins/event_tracer/main.inc.php35
-rw-r--r--plugins/event_tracer/tracer_admin.php18
-rw-r--r--plugins/event_tracer/tracer_admin.tpl4
8 files changed, 69 insertions, 54 deletions
diff --git a/plugins/add_index/admin/admin_menu.php b/plugins/add_index/admin/admin_menu.php
index 2ab250119..62a12bab4 100644
--- a/plugins/add_index/admin/admin_menu.php
+++ b/plugins/add_index/admin/admin_menu.php
@@ -66,11 +66,11 @@ $template->assign_var('EVENT_TRACER_FILTERS', implode("\n", $this->my_config['fi
$template->assign_var('EVENT_TRACER_SHOW_ARGS', $this->my_config['show_args'] ? 'checked="checked"' : '' );*/
$template->assign_var('filename', $conf['add_index_filename']);
$template->assign_var('source_directory_path', $conf['add_index_source_directory_path']);
-$template->assign_var('F_ACTION', $my_url);
+//$template->assign_var('F_ACTION', $my_url);
// +-----------------------------------------------------------------------+
// | Sending html code |
// +-----------------------------------------------------------------------+
-$template->assign_var_from_handle('PLUGIN_ADMIN_CONTENT', 'plugin_admin_content');
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
?> \ No newline at end of file
diff --git a/plugins/add_index/admin/admin_menu.tpl b/plugins/add_index/admin/admin_menu.tpl
index b365e312f..22104d270 100644
--- a/plugins/add_index/admin/admin_menu.tpl
+++ b/plugins/add_index/admin/admin_menu.tpl
@@ -1,4 +1,8 @@
<!-- $Id: admin_menu.tpl Ruben ARNAUD -->
+<div class="titrePage">
+ <h2>{lang:Add_Index}</h2>
+</div>
+
<p>{lang:add_index_Description_1}</p>
<p>{lang:add_index_Description_2}</p>
diff --git a/plugins/add_index/main.admin.inc.php b/plugins/add_index/main.admin.inc.php
index 24cfa1dc5..457ea760a 100644
--- a/plugins/add_index/main.admin.inc.php
+++ b/plugins/add_index/main.admin.inc.php
@@ -33,6 +33,7 @@ if ((!defined('PHPWG_ROOT_PATH')) or (!(defined('IN_ADMIN') and IN_ADMIN)))
class AdminAddIndex extends AddIndex
{
+ var $my_id;
function load_params()
{
global $conf;
@@ -62,7 +63,7 @@ class AdminAddIndex extends AddIndex
array
(
'CAPTION' => l10n('Advanced_Add_Index'),
- 'URL' => get_root_url().'admin.php?page=main_page&amp;page_type=plugin&amp;plugin_id=add_index&amp;overwrite'
+ 'URL' => get_admin_plugin_menu_link($this->my_id, 'admin/main_page').'&amp;overwrite'
));
return $advanced_features;
@@ -75,7 +76,7 @@ class AdminAddIndex extends AddIndex
array_push($site_manager_plugin_links,
array
(
- 'U_HREF' => get_root_url().'admin.php?page=main_page&amp;page_type=plugin&amp;plugin_id=add_index&amp;site_id='.$site_id,
+ 'U_HREF' => get_admin_plugin_menu_link($this->my_id, 'admin/main_page').'&amp;site_id='.$site_id,
'U_CAPTION' => l10n('Manager_Add_Index'),
'U_HINT' => l10n('Add_Index')
));
@@ -84,20 +85,21 @@ class AdminAddIndex extends AddIndex
return $site_manager_plugin_links;
}
- function plugin_admin_menu()
+ function plugin_admin_menu($menu)
{
- add_plugin_admin_menu(l10n('Menu_Add_Index'), array(&$this, 'do_plugin_admin_menu'));
+ array_push($menu,
+ array(
+ 'NAME' => l10n('Menu_Add_Index'),
+ 'URL' => get_admin_plugin_menu_link($this->my_id, 'admin/admin_menu')
+ )
+ );
+ return $menu;
}
-
- function do_plugin_admin_menu($my_url)
- {
- include_once(dirname(__FILE__).'/admin/'.'admin_menu.php');
- }
-
}
// Create object
$add_index = new AdminAddIndex();
+$add_index->my_id = $plugin['id'];
// Load Add Index parameters
$add_index->load_params();
@@ -106,6 +108,6 @@ $add_index->load_params();
add_event_handler('loading_lang', array(&$add_index, 'loading_lang'));
add_event_handler('get_admin_advanced_features_links', array(&$add_index, 'get_admin_advanced_features_links'));
add_event_handler('get_admins_site_links', array(&$add_index, 'get_admins_site_links'), EVENT_HANDLER_PRIORITY_NEUTRAL, 3);
-add_event_handler('plugin_admin_menu', array(&$add_index, 'plugin_admin_menu') );
+add_event_handler('get_admin_plugin_menu_links', array(&$add_index, 'plugin_admin_menu') );
?> \ No newline at end of file
diff --git a/plugins/add_index/main.inc.php b/plugins/add_index/main.inc.php
index 1f6346486..07ade8e10 100644
--- a/plugins/add_index/main.inc.php
+++ b/plugins/add_index/main.inc.php
@@ -49,6 +49,7 @@ if (in_array(script_basename(), array('popuphelp', 'admin')))
include_once(dirname(__FILE__).'/'.'main.base.inc.php');
include_once(dirname(__FILE__).'/'.'main.normal.inc.php');
}
+ set_plugin_data($plugin['id'], $add_index);
}
?> \ No newline at end of file
diff --git a/plugins/admin_advices/main.inc.php b/plugins/admin_advices/main.inc.php
index a17f5a658..172cdf489 100644
--- a/plugins/admin_advices/main.inc.php
+++ b/plugins/admin_advices/main.inc.php
@@ -10,16 +10,15 @@ add_event_handler('loc_begin_page_tail', 'set_admin_advice' );
function set_admin_advice()
{
- global $page, $user, $template, $conf;
+ global $page, $user, $template, $conf;
// This Plugin works only on the Admin page
if ( isset($page['body_id']) and $page['body_id']=='theAdminPage'
- and isset($page['page']['name']) and $page['page']['name'] == 'intro'
- and isset($page['page']['type']) and $page['page']['type'] == 'standard'
+ and $page['page'] == 'intro'
)
{
- // Setup Advice Language (Maybe there is already a variable)
- $advlang = ( isset($user['language']) ) ?
+ // Setup Advice Language (Maybe there is already a variable)
+ $advlang = ( isset($user['language']) ) ?
$user['language'] : $conf['default_language']; // en_UK.iso-8859-1
$adv = array();
@@ -30,22 +29,22 @@ function set_admin_advice()
// If there is an advice
if ( $cond )
- {
-// $template->set_filenames( array( 'advice' => 'admin_advices.tpl' ));
+ {
+// $template->set_filenames( array( 'advice' => 'admin_advices.tpl' ));
$template->set_filenames(array(
- 'admin_advice' =>
+ 'admin_advice' =>
PHPWG_ROOT_PATH.'/plugins/admin_advices/admin_advices.tpl')
);
-
+
// Random Thumbnail
$query = '
SELECT *
FROM '.IMAGES_TABLE.'
ORDER BY RAND(NOW())
LIMIT 0, 1
-;';
- $result = pwg_query($query);
- $row = mysql_fetch_assoc($result);
+;';
+ $result = pwg_query($query);
+ $row = mysql_fetch_assoc($result);
if ( is_array($row) )
{
$template->assign_block_vars(
@@ -56,12 +55,12 @@ SELECT *
'IMAGE_TITLE' => $row['name'],
)
);
- }
+ }
$advice_text = array_shift($adv);
$template->assign_vars(
array(
- 'ADVICE_ABOUT' => '$conf[' . "'$confk'] ",
- 'ADVICE_TEXT' => $advice_text,
+ 'ADVICE_ABOUT' => '$conf[' . "'$confk'] ",
+ 'ADVICE_TEXT' => $advice_text,
)
);
foreach ($adv as $advice)
@@ -71,8 +70,8 @@ SELECT *
array(
'ADVICE' => $advice
)
- );
- }
+ );
+ }
$template->parse('admin_advice');
}
}
diff --git a/plugins/event_tracer/main.inc.php b/plugins/event_tracer/main.inc.php
index fef23296a..1eb89f094 100644
--- a/plugins/event_tracer/main.inc.php
+++ b/plugins/event_tracer/main.inc.php
@@ -11,10 +11,12 @@ class EventTracer
{
var $me_working;
var $my_config;
-
- function EventTracer()
+ var $my_id;
+
+ function EventTracer($id)
{
$this->me_working=0;
+ $this->my_id=$id;
}
function load_config()
@@ -76,23 +78,24 @@ class EventTracer
}
}
- function plugin_admin_menu()
+ function plugin_admin_menu($menu)
{
- add_plugin_admin_menu( "Event Tracer", array(&$this, 'do_admin') );
+ array_push($menu,
+ array(
+ 'NAME' => 'Event Tracer',
+ 'URL' => get_admin_plugin_menu_link($this->my_id, 'tracer_admin')
+ )
+ );
+ return $menu;
}
-
- function do_admin($my_url)
- {
- include( dirname(__FILE__).'/tracer_admin.php' );
- }
-
}
-$eventTracer = new EventTracer();
-$eventTracer->load_config();
+$obj = new EventTracer($plugin['id']);
+$obj->load_config();
-add_event_handler('plugin_admin_menu', array(&$eventTracer, 'plugin_admin_menu') );
-add_event_handler('pre_trigger_event', array(&$eventTracer, 'on_pre_trigger_event') );
-add_event_handler('post_trigger_event', array(&$eventTracer, 'on_post_trigger_event') );
-add_event_handler('trigger_action', array(&$eventTracer, 'on_trigger_action') );
+add_event_handler('get_admin_plugin_menu_links', array(&$obj, 'plugin_admin_menu') );
+add_event_handler('pre_trigger_event', array(&$obj, 'on_pre_trigger_event') );
+add_event_handler('post_trigger_event', array(&$obj, 'on_post_trigger_event') );
+add_event_handler('trigger_action', array(&$obj, 'on_trigger_action') );
+set_plugin_data($plugin['id'], $obj);
?> \ No newline at end of file
diff --git a/plugins/event_tracer/tracer_admin.php b/plugins/event_tracer/tracer_admin.php
index 7371d2531..2495c0dc0 100644
--- a/plugins/event_tracer/tracer_admin.php
+++ b/plugins/event_tracer/tracer_admin.php
@@ -1,6 +1,8 @@
<?php
if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+$me = get_plugin_data($plugin_id);
+
global $template;
$template->set_filenames( array('plugin_admin_content' => dirname(__FILE__).'/tracer_admin.tpl') );
@@ -11,17 +13,17 @@ if ( isset($_POST['eventTracer_filters']) )
$v = str_replace( "\n\n", "\n", $v );
$v = stripslashes($v);
if (!empty($v))
- $this->my_config['filters'] = explode("\n", $v);
+ $me->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();
+ $me->my_config['filters'] = array();
+ $me->my_config['show_args'] = isset($_POST['eventTracer_show_args']);
+ $me->save_config();
global $page;
array_push($page['infos'], 'event tracer options saved');
}
-$template->assign_var('EVENT_TRACER_FILTERS', implode("\n", $this->my_config['filters'] ) );
-$template->assign_var('EVENT_TRACER_SHOW_ARGS', $this->my_config['show_args'] ? 'checked="checked"' : '' );
-$template->assign_var('EVENT_TRACER_F_ACTION', $my_url);
+$template->assign_var('EVENT_TRACER_FILTERS', implode("\n", $me->my_config['filters'] ) );
+$template->assign_var('EVENT_TRACER_SHOW_ARGS', $me->my_config['show_args'] ? 'checked="checked"' : '' );
+//$template->assign_var('EVENT_TRACER_F_ACTION', $my_url);
-$template->assign_var_from_handle( 'PLUGIN_ADMIN_CONTENT', 'plugin_admin_content');
+$template->assign_var_from_handle( 'ADMIN_CONTENT', 'plugin_admin_content');
?> \ No newline at end of file
diff --git a/plugins/event_tracer/tracer_admin.tpl b/plugins/event_tracer/tracer_admin.tpl
index 95ee65907..93deee3b0 100644
--- a/plugins/event_tracer/tracer_admin.tpl
+++ b/plugins/event_tracer/tracer_admin.tpl
@@ -1,3 +1,7 @@
+<div class="titrePage">
+ <h2>Event Tracer</h2>
+</div>
+
<p>
The event tracer is a developer tool that logs in the footer of the window all calls to trigger_event method.
You can use this plugin to see what events is PhpWebGallery calling.