mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-27 19:59:56 +03:00
plugin simplification: adding admin links does not require the plugin_id anymore...
git-svn-id: http://piwigo.org/svn/trunk@1731 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
e81260cdec
commit
4fb42505ec
4 changed files with 36 additions and 21 deletions
|
@ -70,13 +70,24 @@ function get_fs_plugins()
|
|||
|
||||
/**
|
||||
* Retrieves an url for a plugin page.
|
||||
* @param string plugin_id
|
||||
* @param string page - the php script file name (without .php extension)
|
||||
* @param string file - php script full name
|
||||
*/
|
||||
function get_admin_plugin_menu_link($plugin_id, $page)
|
||||
function get_admin_plugin_menu_link($file)
|
||||
{
|
||||
$url = get_root_url().'admin.php?page=plugin&section='
|
||||
.urlencode($plugin_id .'~'. $page);
|
||||
global $page;
|
||||
$real_file = realpath($file);
|
||||
$url = get_root_url().'admin.php?page=plugin';
|
||||
if (false!==$real_file)
|
||||
{
|
||||
$real_plugin_path = realpath(PHPWG_PLUGINS_PATH);
|
||||
$file = substr($real_file, strlen($real_plugin_path)+1);
|
||||
$file = str_replace('\\', '/', $file);//Windows
|
||||
$url .= '&section='.urlencode($file);
|
||||
}
|
||||
else if (isset($page['errors']))
|
||||
{
|
||||
array_push($page['errors'], 'PLUGIN ERROR: "'.$file.'" is not a valid file');
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue