build on PRs; nitpicks
[plcapi.git] / demo / server / _prepend.php
1 <?php
2 /**
3  * Hackish code used to make the demos both viewable as source, runnable, and viewable as html
4  */
5
6 // Make errors visible
7 ini_set('display_errors', true);
8 error_reporting(E_ALL);
9
10 if (isset($_GET['showSource']) && $_GET['showSource']) {
11     $file = debug_backtrace()[0]['file'];
12     highlight_file($file);
13     die();
14 }
15
16 // Use the custom class autoloader. These two lines not needed when the phpxmlrpc library is installed using Composer
17 include_once __DIR__ . '/../../src/Autoloader.php';
18 PhpXmlRpc\Autoloader::register();
19
20 // Out-of-band information: let the client manipulate the server operations.
21 // We do this to help the testsuite script: do not reproduce in production!
22 if (isset($_COOKIE['PHPUNIT_SELENIUM_TEST_ID']) && extension_loaded('xdebug')) {
23     $GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'] = '/tmp/phpxmlrpc_coverage';
24     if (!is_dir($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'])) {
25         mkdir($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY']);
26         chmod($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'], 0777);
27     }
28
29     include_once __DIR__ . "/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/prepend.php";
30 }