mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-20 08:33:03 +02:00
move event_tracer plugin from core to extensions
git-svn-id: http://piwigo.org/svn/trunk@5490 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -1,90 +0,0 @@
|
||||
<?php
|
||||
if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
|
||||
|
||||
function get_php_files($path, $to_ignore=array(), $recursive=true )
|
||||
{
|
||||
$files = array();
|
||||
if (is_dir($path))
|
||||
{
|
||||
if ($contents = opendir($path))
|
||||
{
|
||||
while (($node = readdir($contents)) !== false)
|
||||
{
|
||||
if ($node != '.' and $node != '..' and $node != '.svn'
|
||||
and !in_array($node, $to_ignore) )
|
||||
{
|
||||
if ( $recursive and is_dir($path.'/'.$node) )
|
||||
{
|
||||
$files = array_merge($files, get_php_files($path.'/'.$node, $to_ignore));
|
||||
|
||||
}
|
||||
if ( is_file($path.'/'.$node) )
|
||||
{
|
||||
$files[] = $path.'/'.$node;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($contents);
|
||||
}
|
||||
}
|
||||
return $files;
|
||||
}
|
||||
|
||||
$files = array();
|
||||
$files = array_merge( $files, get_php_files('.', array(), false) );
|
||||
$files = array_merge( $files, get_php_files('./include') );
|
||||
$files = array_merge( $files, get_php_files('./admin') );
|
||||
$files = array_unique($files);
|
||||
|
||||
$events = array();
|
||||
foreach ($files as $file)
|
||||
{
|
||||
$code = file_get_contents($file);
|
||||
$code = preg_replace( '#\?'.'>.*<\?php#m', '', $code);
|
||||
$code = preg_replace( '#\/\*.*\*\/#m', '', $code);
|
||||
$code = preg_replace( '#\/\/.*#', '', $code);
|
||||
|
||||
$count = preg_match_all(
|
||||
'#[^a-zA-Z_$-]trigger_(action|event)\s*\(\s*([^,)]+)#m',
|
||||
$code, $matches
|
||||
);
|
||||
|
||||
for ($i=0; $i<$count; $i++)
|
||||
{
|
||||
$type = $matches[1][$i];
|
||||
$name = preg_replace( '#^[\'"]?([^\'"]*)[\'"]?$#', '$1', $matches[2][$i]);
|
||||
array_push($events, array($type,$name,$file) );
|
||||
}
|
||||
}
|
||||
|
||||
$sort= isset($_GET['sort']) ? (int)$_GET['sort'] : 1;
|
||||
usort(
|
||||
$events,
|
||||
create_function( '$a,$b', 'return $a['.$sort.']>$b['.$sort.'];' )
|
||||
);
|
||||
|
||||
global $template;
|
||||
|
||||
$url = get_admin_plugin_menu_link(__FILE__);
|
||||
|
||||
$template->assign( array(
|
||||
'NB_EVENTS' => count($events),
|
||||
'U_SORT0' => add_url_params($url, array('sort'=>0) ),
|
||||
'U_SORT1' => add_url_params($url, array('sort'=>1) ),
|
||||
'U_SORT2' => add_url_params($url, array('sort'=>2) ),
|
||||
) );
|
||||
|
||||
$template->assign('events', array());
|
||||
foreach ($events as $e)
|
||||
{
|
||||
$template->append( 'events', array(
|
||||
'TYPE' => $e[0],
|
||||
'NAME' => $e[1],
|
||||
'FILE' => $e[2],
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$template->set_filenames( array('event_list' => dirname(__FILE__).'/event_list.tpl' ) );
|
||||
$template->assign_var_from_handle( 'ADMIN_CONTENT', 'event_list');
|
||||
?>
|
||||
@@ -1,16 +0,0 @@
|
||||
There are {$NB_EVENTS} calls to triger_event or triger_action.
|
||||
|
||||
<table width="99%" class="table2">
|
||||
<tr class="throw">
|
||||
<th><a href="{$U_SORT0}">Type</a></th>
|
||||
<th><a href="{$U_SORT1}">Name</a></th>
|
||||
<th><a href="{$U_SORT2}">File</a></th>
|
||||
</tr>
|
||||
{foreach from=$events item=event}
|
||||
<tr>
|
||||
<td>{$event.TYPE}</td>
|
||||
<td>{$event.NAME}</td>
|
||||
<td>{$event.FILE}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Piwigo - a PHP based picture gallery |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org |
|
||||
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
||||
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | This program is free software; you can redistribute it and/or modify |
|
||||
// | it under the terms of the GNU General Public License as published by |
|
||||
// | the Free Software Foundation |
|
||||
// | |
|
||||
// | This program is distributed in the hope that it will be useful, but |
|
||||
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||
// | General Public License for more details. |
|
||||
// | |
|
||||
// | You should have received a copy of the GNU General Public License |
|
||||
// | along with this program; if not, write to the Free Software |
|
||||
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
// Recursive call
|
||||
$url = '../';
|
||||
header( 'Request-URI: '.$url );
|
||||
header( 'Content-Location: '.$url );
|
||||
header( 'Location: '.$url );
|
||||
exit();
|
||||
?>
|
||||
@@ -1 +0,0 @@
|
||||
Für Entwickler. Zeigt Aufrufe für trigger_event
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Piwigo - a PHP based picture gallery |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org |
|
||||
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
||||
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | This program is free software; you can redistribute it and/or modify |
|
||||
// | it under the terms of the GNU General Public License as published by |
|
||||
// | the Free Software Foundation |
|
||||
// | |
|
||||
// | This program is distributed in the hope that it will be useful, but |
|
||||
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||
// | General Public License for more details. |
|
||||
// | |
|
||||
// | You should have received a copy of the GNU General Public License |
|
||||
// | along with this program; if not, write to the Free Software |
|
||||
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
// Recursive call
|
||||
$url = '../';
|
||||
header( 'Request-URI: '.$url );
|
||||
header( 'Content-Location: '.$url );
|
||||
header( 'Location: '.$url );
|
||||
exit();
|
||||
?>
|
||||
@@ -1 +0,0 @@
|
||||
For developers. Shows all calls to trigger_event.
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Piwigo - a PHP based picture gallery |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org |
|
||||
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
||||
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | This program is free software; you can redistribute it and/or modify |
|
||||
// | it under the terms of the GNU General Public License as published by |
|
||||
// | the Free Software Foundation |
|
||||
// | |
|
||||
// | This program is distributed in the hope that it will be useful, but |
|
||||
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||
// | General Public License for more details. |
|
||||
// | |
|
||||
// | You should have received a copy of the GNU General Public License |
|
||||
// | along with this program; if not, write to the Free Software |
|
||||
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
// Recursive call
|
||||
$url = '../';
|
||||
header( 'Request-URI: '.$url );
|
||||
header( 'Content-Location: '.$url );
|
||||
header( 'Location: '.$url );
|
||||
exit();
|
||||
?>
|
||||
@@ -1 +0,0 @@
|
||||
Para los desarrolladores. Muestra todas las llamadas trigger_event.
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Piwigo - a PHP based picture gallery |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org |
|
||||
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
||||
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | This program is free software; you can redistribute it and/or modify |
|
||||
// | it under the terms of the GNU General Public License as published by |
|
||||
// | the Free Software Foundation |
|
||||
// | |
|
||||
// | This program is distributed in the hope that it will be useful, but |
|
||||
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||
// | General Public License for more details. |
|
||||
// | |
|
||||
// | You should have received a copy of the GNU General Public License |
|
||||
// | along with this program; if not, write to the Free Software |
|
||||
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
// Recursive call
|
||||
$url = '../';
|
||||
header( 'Request-URI: '.$url );
|
||||
header( 'Content-Location: '.$url );
|
||||
header( 'Location: '.$url );
|
||||
exit();
|
||||
?>
|
||||
@@ -1 +0,0 @@
|
||||
Pour les développeurs. Montre tous les appels vers trigger_event.
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Piwigo - a PHP based picture gallery |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org |
|
||||
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
||||
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | This program is free software; you can redistribute it and/or modify |
|
||||
// | it under the terms of the GNU General Public License as published by |
|
||||
// | the Free Software Foundation |
|
||||
// | |
|
||||
// | This program is distributed in the hope that it will be useful, but |
|
||||
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||
// | General Public License for more details. |
|
||||
// | |
|
||||
// | You should have received a copy of the GNU General Public License |
|
||||
// | along with this program; if not, write to the Free Software |
|
||||
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
// Recursive call
|
||||
$url = '../';
|
||||
header( 'Request-URI: '.$url );
|
||||
header( 'Content-Location: '.$url );
|
||||
header( 'Location: '.$url );
|
||||
exit();
|
||||
?>
|
||||
@@ -1 +0,0 @@
|
||||
Fejlesztőknek. Megmutat minden hívást kiváltó eseményt.
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Piwigo - a PHP based picture gallery |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org |
|
||||
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
||||
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | This program is free software; you can redistribute it and/or modify |
|
||||
// | it under the terms of the GNU General Public License as published by |
|
||||
// | the Free Software Foundation |
|
||||
// | |
|
||||
// | This program is distributed in the hope that it will be useful, but |
|
||||
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||
// | General Public License for more details. |
|
||||
// | |
|
||||
// | You should have received a copy of the GNU General Public License |
|
||||
// | along with this program; if not, write to the Free Software |
|
||||
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
// Recursive call
|
||||
$url = '../';
|
||||
header( 'Request-URI: '.$url );
|
||||
header( 'Content-Location: '.$url );
|
||||
header( 'Location: '.$url );
|
||||
exit();
|
||||
?>
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Piwigo - a PHP based picture gallery |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org |
|
||||
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
||||
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | This program is free software; you can redistribute it and/or modify |
|
||||
// | it under the terms of the GNU General Public License as published by |
|
||||
// | the Free Software Foundation |
|
||||
// | |
|
||||
// | This program is distributed in the hope that it will be useful, but |
|
||||
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||
// | General Public License for more details. |
|
||||
// | |
|
||||
// | You should have received a copy of the GNU General Public License |
|
||||
// | along with this program; if not, write to the Free Software |
|
||||
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
// Recursive call
|
||||
$url = '../';
|
||||
header( 'Request-URI: '.$url );
|
||||
header( 'Content-Location: '.$url );
|
||||
header( 'Location: '.$url );
|
||||
exit();
|
||||
?>
|
||||
@@ -1 +0,0 @@
|
||||
Per gli sviluppatori. Mostra tutti gli appelli ai trigger_event.
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Piwigo - a PHP based picture gallery |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org |
|
||||
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
||||
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | This program is free software; you can redistribute it and/or modify |
|
||||
// | it under the terms of the GNU General Public License as published by |
|
||||
// | the Free Software Foundation |
|
||||
// | |
|
||||
// | This program is distributed in the hope that it will be useful, but |
|
||||
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||
// | General Public License for more details. |
|
||||
// | |
|
||||
// | You should have received a copy of the GNU General Public License |
|
||||
// | along with this program; if not, write to the Free Software |
|
||||
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
// Recursive call
|
||||
$url = '../';
|
||||
header( 'Request-URI: '.$url );
|
||||
header( 'Content-Location: '.$url );
|
||||
header( 'Location: '.$url );
|
||||
exit();
|
||||
?>
|
||||
@@ -1 +0,0 @@
|
||||
開発者対象。エベントを開始するために、全てのクエリを表示
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Piwigo - a PHP based picture gallery |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org |
|
||||
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
||||
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | This program is free software; you can redistribute it and/or modify |
|
||||
// | it under the terms of the GNU General Public License as published by |
|
||||
// | the Free Software Foundation |
|
||||
// | |
|
||||
// | This program is distributed in the hope that it will be useful, but |
|
||||
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||
// | General Public License for more details. |
|
||||
// | |
|
||||
// | You should have received a copy of the GNU General Public License |
|
||||
// | along with this program; if not, write to the Free Software |
|
||||
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
// Recursive call
|
||||
$url = '../';
|
||||
header( 'Request-URI: '.$url );
|
||||
header( 'Content-Location: '.$url );
|
||||
header( 'Location: '.$url );
|
||||
exit();
|
||||
?>
|
||||
@@ -1 +0,0 @@
|
||||
Voor ontwikkelaars. Geef alle calls naar het trigger_event weer.
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Piwigo - a PHP based picture gallery |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org |
|
||||
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
||||
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | This program is free software; you can redistribute it and/or modify |
|
||||
// | it under the terms of the GNU General Public License as published by |
|
||||
// | the Free Software Foundation |
|
||||
// | |
|
||||
// | This program is distributed in the hope that it will be useful, but |
|
||||
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||
// | General Public License for more details. |
|
||||
// | |
|
||||
// | You should have received a copy of the GNU General Public License |
|
||||
// | along with this program; if not, write to the Free Software |
|
||||
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
// Recursive call
|
||||
$url = '../';
|
||||
header( 'Request-URI: '.$url );
|
||||
header( 'Content-Location: '.$url );
|
||||
header( 'Location: '.$url );
|
||||
exit();
|
||||
?>
|
||||
@@ -1 +0,0 @@
|
||||
Dla deweloperów. Wyświetla wszystkie wywołania trigger_event
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Piwigo - a PHP based picture gallery |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org |
|
||||
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
||||
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | This program is free software; you can redistribute it and/or modify |
|
||||
// | it under the terms of the GNU General Public License as published by |
|
||||
// | the Free Software Foundation |
|
||||
// | |
|
||||
// | This program is distributed in the hope that it will be useful, but |
|
||||
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||
// | General Public License for more details. |
|
||||
// | |
|
||||
// | You should have received a copy of the GNU General Public License |
|
||||
// | along with this program; if not, write to the Free Software |
|
||||
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
// Recursive call
|
||||
$url = '../';
|
||||
header( 'Request-URI: '.$url );
|
||||
header( 'Content-Location: '.$url );
|
||||
header( 'Location: '.$url );
|
||||
exit();
|
||||
?>
|
||||
@@ -1,162 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Piwigo - a PHP based picture gallery |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org |
|
||||
// | Copyright(C) 2003-2008 Piwigo team http://phpwebgallery.net |
|
||||
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | This program is free software; you can redistribute it and/or modify |
|
||||
// | it under the terms of the GNU General Public License as published by |
|
||||
// | the Free Software Foundation |
|
||||
// | |
|
||||
// | This program is distributed in the hope that it will be useful, but |
|
||||
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||
// | General Public License for more details. |
|
||||
// | |
|
||||
// | You should have received a copy of the GNU General Public License |
|
||||
// | along with this program; if not, write to the Free Software |
|
||||
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
/*
|
||||
Plugin Name: Event tracer
|
||||
Version: 2.0.3
|
||||
Description: For developers. Shows all calls to trigger_event.
|
||||
Plugin URI: http://piwigo.org/ext/extension_view.php?eid=288
|
||||
Author: Piwigo team
|
||||
Author URI: http://piwigo.org
|
||||
*/
|
||||
|
||||
if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
|
||||
|
||||
class EventTracer
|
||||
{
|
||||
var $my_config;
|
||||
var $trigger_counts = array();
|
||||
|
||||
function EventTracer()
|
||||
{
|
||||
}
|
||||
|
||||
function get_config_file_dir()
|
||||
{
|
||||
global $conf;
|
||||
return $conf['local_data_dir'].'/plugins/';
|
||||
}
|
||||
|
||||
function get_config_file_name()
|
||||
{
|
||||
return basename(dirname(__FILE__)).'.dat';
|
||||
}
|
||||
|
||||
function load_config()
|
||||
{
|
||||
$x = @file_get_contents( $this->get_config_file_dir().$this->get_config_file_name() );
|
||||
if ($x!==false)
|
||||
{
|
||||
$c = unserialize($x);
|
||||
// do some more tests here
|
||||
$this->my_config = $c;
|
||||
}
|
||||
if ( !isset($this->my_config)
|
||||
or empty($this->my_config['filters']) )
|
||||
{
|
||||
$this->my_config['filters'] = array( '.*' );
|
||||
$this->my_config['show_registered'] = true;
|
||||
$this->save_config();
|
||||
}
|
||||
}
|
||||
|
||||
function save_config()
|
||||
{
|
||||
$dir = $this->get_config_file_dir();
|
||||
@mkgetdir($dir);
|
||||
$file = fopen( $dir.$this->get_config_file_name(), 'w' );
|
||||
fwrite($file, serialize($this->my_config) );
|
||||
fclose( $file );
|
||||
}
|
||||
|
||||
function on_page_tail()
|
||||
{
|
||||
global $debug;
|
||||
if (@$this->my_config['show_registered'])
|
||||
{
|
||||
global $pwg_event_handlers;
|
||||
$out = '';
|
||||
foreach ($pwg_event_handlers as $event => $prio_array)
|
||||
{
|
||||
$out .= $event.' '.intval(@$this->trigger_counts[$event])." calls\n";
|
||||
foreach ($prio_array as $prio => $handlers)
|
||||
{
|
||||
foreach ($handlers as $handler)
|
||||
{
|
||||
$out .= "\t$prio ";
|
||||
if ( is_array($handler['function']) )
|
||||
{
|
||||
if ( is_string($handler['function'][0]) )
|
||||
$out .= $handler['function'][0].'::';
|
||||
else
|
||||
$out .= @get_class($handler['function'][0]).'->';
|
||||
$out .= $handler['function'][1];
|
||||
}
|
||||
else
|
||||
$out .= $handler['function'];
|
||||
$out .= "\n";
|
||||
}
|
||||
}
|
||||
$out .= "\n";
|
||||
}
|
||||
$debug .= '<pre>'.$out.'</pre>';
|
||||
}
|
||||
if (@$this->my_config['show_included_files'])
|
||||
{
|
||||
$debug .= "<pre><em>Included files</em>\n".var_export( get_included_files(), true ).'</pre>';
|
||||
}
|
||||
}
|
||||
|
||||
function on_trigger($event_info)
|
||||
{
|
||||
if ($event_info['type']!='post_event')
|
||||
@$this->trigger_counts[$event_info['event']]++;
|
||||
|
||||
foreach( $this->my_config['filters'] as $filter)
|
||||
{
|
||||
if ( preg_match( '/'.$filter.'/', $event_info['event'] ) )
|
||||
{
|
||||
if (@$this->my_config['show_args'])
|
||||
{
|
||||
$s = '<pre>';
|
||||
$s .= htmlspecialchars( var_export( $event_info['data'], true ) );
|
||||
$s .= '</pre>';
|
||||
}
|
||||
else
|
||||
$s = '';
|
||||
pwg_debug($event_info['type'].' "'.$event_info['event'].'" '.($this->trigger_counts[$event_info['event']]).' calls '.($s) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function plugin_admin_menu($menu)
|
||||
{
|
||||
array_push($menu,
|
||||
array(
|
||||
'NAME' => 'Event Tracer',
|
||||
'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/tracer_admin.php')
|
||||
)
|
||||
);
|
||||
return $menu;
|
||||
}
|
||||
}
|
||||
|
||||
$obj = new EventTracer();
|
||||
$obj->load_config();
|
||||
|
||||
add_event_handler('get_admin_plugin_menu_links', array(&$obj, 'plugin_admin_menu') );
|
||||
add_event_handler('loc_begin_page_tail', array(&$obj, 'on_page_tail') );
|
||||
add_event_handler('trigger', array(&$obj, 'on_trigger') );
|
||||
set_plugin_data($plugin['id'], $obj);
|
||||
?>
|
||||
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
|
||||
|
||||
function plugin_uninstall($plugin_id)
|
||||
{
|
||||
global $conf;
|
||||
@unlink( $conf['local_data_dir'].'/plugins/'.$plugin_id.'.dat' );
|
||||
}
|
||||
?>
|
||||
@@ -1,38 +0,0 @@
|
||||
<?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') );
|
||||
|
||||
if ( isset($_POST['eventTracer_filters']) )
|
||||
{
|
||||
$v = $_POST['eventTracer_filters'];
|
||||
$v = str_replace( "\r\n", "\n", $v );
|
||||
$v = str_replace( "\n\n", "\n", $v );
|
||||
$v = stripslashes($v);
|
||||
if (!empty($v))
|
||||
$me->my_config['filters'] = explode("\n", $v);
|
||||
else
|
||||
$me->my_config['filters'] = array();
|
||||
$me->my_config['show_args'] = isset($_POST['eventTracer_show_args']);
|
||||
$me->my_config['show_registered'] = isset($_POST['eventTracer_show_registered']);
|
||||
if (isset($_POST['eventTracer_show_included_files']) )
|
||||
$me->my_config['show_included_files'] = true;
|
||||
else
|
||||
unset($me->my_config['show_included_files']);
|
||||
$me->save_config();
|
||||
global $page;
|
||||
array_push($page['infos'], 'event tracer options saved');
|
||||
}
|
||||
$template->assign('EVENT_TRACER_FILTERS', implode("\n", $me->my_config['filters'] ) );
|
||||
$template->assign('EVENT_TRACER_SHOW_ARGS', @$me->my_config['show_args'] ? 'checked="checked"' : '' );
|
||||
$template->assign('U_LIST_EVENTS', get_admin_plugin_menu_link(dirname(__FILE__).'/event_list.php'));
|
||||
$template->assign('EVENT_TRACER_SHOW_REGISTERED', @$me->my_config['show_registered'] ? 'checked="checked"' : '' );
|
||||
$template->assign('EVENT_TRACER_SHOW_INCLUDED_FILES', @$me->my_config['show_included_files'] ? 'checked="checked"' : '' );
|
||||
|
||||
//$template->assign_var('EVENT_TRACER_F_ACTION', $my_url);
|
||||
|
||||
$template->assign_var_from_handle( 'ADMIN_CONTENT', 'plugin_admin_content');
|
||||
?>
|
||||
@@ -1,40 +0,0 @@
|
||||
<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 Piwigo calling.
|
||||
<b>Note that $conf['show_queries'] must be true.</b>
|
||||
</p>
|
||||
<form method="post" action="" class="general">
|
||||
<fieldset>
|
||||
<legend>Event Tracer</legend>
|
||||
|
||||
<label>Show event arguments
|
||||
<input type="checkbox" name="eventTracer_show_args" {$EVENT_TRACER_SHOW_ARGS} />
|
||||
</label>
|
||||
|
||||
<br/>
|
||||
|
||||
<label>Fill below a list of regular expressions (one per line).
|
||||
An event will be logged if its name matches at least one expression in the list.
|
||||
<textarea name="eventTracer_filters" id="eventTracer_filters"rows="10" cols="80">{$EVENT_TRACER_FILTERS}</textarea>
|
||||
</label>
|
||||
|
||||
<br/>
|
||||
|
||||
<label>Show all registered handlers
|
||||
<input type="checkbox" name="eventTracer_show_registered" {$EVENT_TRACER_SHOW_REGISTERED} />
|
||||
</label>
|
||||
|
||||
<label>Show all included php files
|
||||
<input type="checkbox" name="eventTracer_show_included_files" {$EVENT_TRACER_SHOW_INCLUDED_FILES} />
|
||||
</label>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<p><input class="submit" type="submit" value="Submit" /></p>
|
||||
|
||||
<p><a href="{$U_LIST_EVENTS}">Click here to see a complete list of actions and events trigered by this PWG version</a>.</p>
|
||||
</form>
|
||||
Reference in New Issue
Block a user