|
22 | 22 | $action = 'list';
|
23 | 23 | }
|
24 | 24 |
|
25 |
| -// Path to the visual xmlrpc editing dialog's containing folder. Can be absolute, or relative to this debugger's folder. |
26 |
| -// We allow to easily configure this path via defines |
27 |
| -$editorpath = (defined('JSXMLRPC_PATH') ? JSXMLRPC_PATH : '../..') . '/jsxmlrpc/debugger/'; |
28 |
| -// In case the webserver is set up so that the url to that folder is different. We default to JSXMLRPC_PATH for BC |
29 |
| -$editorurlpath = defined('JSXMLRPC_BASEURL') ? JSXMLRPC_BASEURL : $editorpath; |
| 25 | +$haseditor = false; |
| 26 | +$editorurlpath = null; |
| 27 | +// @const JSXMLRPC_BASEURL Url to the visual xmlrpc editing dialog's containing folder. We allow to easily configure this |
30 | 28 | if (defined('JSXMLRPC_BASEURL')) {
|
| 29 | + $editorurlpath = JSXMLRPC_BASEURL; |
31 | 30 | $haseditor = true;
|
32 | 31 | } else {
|
33 |
| - if ($editorpath[0] !== '/') { |
34 |
| - $haseditor = is_file(realpath(__DIR__ . '/' . $editorpath . 'visualeditor.html')); |
| 32 | + /// @deprecated |
| 33 | + /// @const JSXMLRPC_PATH Path to the visual xmlrpc editing dialog's containing folder. Can be absolute, or |
| 34 | + /// relative to this debugger's folder. |
| 35 | + if (defined('JSXMLRPC_PATH')) { |
| 36 | + $editorpaths = array(JSXMLRPC_PATH[0] === '/' ? JSXMLRPC_PATH : (__DIR__ . '/' . JSXMLRPC_PATH)); |
35 | 37 | } else {
|
36 |
| - $haseditor = is_file(realpath($editorpath . 'visualeditor.html'));; |
| 38 | + $editorpaths = array( |
| 39 | + __DIR__ . '/vendor/phpxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via composer in debugger |
| 40 | + __DIR__ . '/node_modules/@jsxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via npm in debugger |
| 41 | + __DIR__ . '/../vendor/phpxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via composer |
| 42 | + __DIR__ . '/../node_modules/@jsxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via npm |
| 43 | + __DIR__ . '/../../jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc too |
| 44 | + ); |
37 | 45 | }
|
38 |
| -} |
| 46 | + foreach($editorpaths as $editorpath) { |
| 47 | + if (is_file(realpath($editorpath . 'visualeditor.html'))) { |
| 48 | + $haseditor = true; |
| 49 | + break; |
| 50 | + } |
| 51 | + } |
| 52 | + if ($haseditor) { |
| 53 | + $editorurlpath = preg_replace('|^' . preg_quote(__DIR__, '|') .'|', '', $editorpath); |
39 | 54 |
|
| 55 | + /// @todo for cases 3, 4 and 5 above, look at `parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)` and check if the |
| 56 | + /// web root is not pointing directly at this folder, as in that case the link to the visualeditor will not |
| 57 | + /// work, as it will be in the form http(s)://domain/../../jsxmlrpc/debugger/visualeditor.html |
| 58 | + } |
| 59 | +} |
40 | 60 | ?><!DOCTYPE html>
|
41 | 61 | <html lang="en">
|
42 | 62 | <head>
|
|
0 commit comments