| 1 |
<?php |
| 2 |
|
| 3 |
class TestXDebugSettings { |
| 4 |
public $_ideKey; |
| 5 |
public $_zendDebuggerLoaded; |
| 6 |
public $_xdebugLoaded; |
| 7 |
public $_remoteConnectBack; |
| 8 |
public $_remoteEnable; |
| 9 |
public $_remoteHost; |
| 10 |
public $_remotePort; |
| 11 |
|
| 12 |
public function __construct(){ |
| 13 |
$this->_zendDebuggerLoaded = "0"; |
| 14 |
$this->_xdebugLoaded = "0"; |
| 15 |
$this->_ideKey = ""; |
| 16 |
$this->_remoteConnectBack = "0"; |
| 17 |
$this->_remoteEnable = "0"; |
| 18 |
$this->_remoteHost = ""; |
| 19 |
$this->_remotePort = "0"; |
| 20 |
} |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
private function readIni($directive, $defaultValue){ |
| 30 |
$val = get_cfg_var($directive); |
| 31 |
if($val === false){ |
| 32 |
return $defaultValue; |
| 33 |
} |
| 34 |
return (string)$val; |
| 35 |
} |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
private function TestDirectives(){ |
| 41 |
$this->_remoteConnectBack = $this->readIni("xdebug.remote_connect_back", "0"); |
| 42 |
$this->_ideKey = $this->readIni("xdebug.ide_key", ""); |
| 43 |
$this->_remoteEnable = $this->readIni("xdebug.remote_enable", "0"); |
| 44 |
$this->_remoteHost = $this->readIni("xdebug.remote_host", ""); |
| 45 |
$this->_remotePort = $this->readIni("xdebug.remote_port", ""); |
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
private function TestZendDebuggerLoaded(){ |
| 52 |
$loadedModules = get_loaded_extensions(true); |
| 53 |
|
| 54 |
foreach($loadedModules as $module){ |
| 55 |
if(strtolower($module)== "zend debugger"){ |
| 56 |
$this->_zendDebuggerLoaded = "1"; |
| 57 |
return; |
| 58 |
} |
| 59 |
} |
| 60 |
} |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
private function TestXDebugLoaded(){ |
| 66 |
$loadedModules = get_loaded_extensions(true); |
| 67 |
|
| 68 |
foreach($loadedModules as $module){ |
| 69 |
if(strtolower($module)== "xdebug"){ |
| 70 |
$this->_xdebugLoaded = "1"; |
| 71 |
return; |
| 72 |
} |
| 73 |
} |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
public function Test(){ |
| 81 |
|
| 82 |
$this->TestZendDebuggerLoaded(); |
| 83 |
|
| 84 |
$this->TestXDebugLoaded(); |
| 85 |
|
| 86 |
$this->TestDirectives(); |
| 87 |
|
| 88 |
echo json_encode($this); |
| 89 |
} |
| 90 |
} |
| 91 |
$tester = new TestXDebugSettings(); |
| 92 |
$tester->Test(); |