Changeset 1731 for trunk/admin/include


Ignore:
Timestamp:
Jan 18, 2007, 3:09:31 AM (17 years ago)
Author:
rvelices
Message:

plugin simplification: adding admin links does not require the plugin_id anymore...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions_plugins.inc.php

    r1705 r1731  
    7171/**
    7272 * Retrieves an url for a plugin page.
    73  * @param string plugin_id
    74  * @param string page - the php script file name (without .php extension)
     73 * @param string file - php script full name
    7574 */
    76 function get_admin_plugin_menu_link($plugin_id, $page)
     75function get_admin_plugin_menu_link($file)
    7776{
    78   $url = get_root_url().'admin.php?page=plugin&section='
    79     .urlencode($plugin_id .'~'. $page);
     77  global $page;
     78  $real_file = realpath($file);
     79  $url = get_root_url().'admin.php?page=plugin';
     80  if (false!==$real_file)
     81  {
     82    $real_plugin_path = realpath(PHPWG_PLUGINS_PATH);
     83    $file = substr($real_file, strlen($real_plugin_path)+1);
     84    $file = str_replace('\\', '/', $file);//Windows
     85    $url .= '&section='.urlencode($file);
     86  }
     87  else if (isset($page['errors']))
     88  {
     89    array_push($page['errors'], 'PLUGIN ERROR: "'.$file.'" is not a valid file');
     90  }
    8091  return $url;
    8192}
Note: See TracChangeset for help on using the changeset viewer.