public function execute() { $sPath = Request::path(); foreach ($this->routes as $sKey => $sMethod) { if (preg_match('~' . $sKey . '~', $sPath)) { debug(get_class($this) . " -> {$sMethod}() [{$sPath} => {$sKey}]"); if ($sMethod[0] == '#') { $sMethod = substr($sMethod, 1); if (class_exists($sMethod)) { return Service::create($sMethod)->execute(); } else { debug('Service not found: ' . $sMethod); $this->error404(); } } else { if (method_exists($this, $sMethod)) { $this->catchAll(); $bReturn = $this->{$sMethod}(); P::mark(get_class($this) . '::' . $sMethod); Response::end(); return $bReturn; } else { debug('Method not found: ' . get_class($this) . '::' . $sMethod . '()'); $this->error404(); } } } } debug(get_class($this) . " -> NO MATCH"); return false; }
public static function evalString($s, $aContextVariables = [], $bFlushBuffer = true) { if (class_exists('P')) { P::mark('EVAL_BEGIN'); } ob_start(); extract($aContextVariables); if (eval('?>' . $s) === false) { $_ENV['EVAL_ERROR'] = true; $_ENV['EVALED_CODE'] = $s; // file_put_contents(M::PROJECT_ROOT() . '/server/logs/processor.log', $s); } $sResult = ob_get_contents(); ob_end_clean(); if (class_exists('P')) { P::mark('EVAL_END'); } if ($bFlushBuffer) { print $sResult; } else { return $sResult; } }
function shutdownHandler() { P::mark('END'); P::report(); if ($aError = error_get_last()) { errorHandler($aError['type'], $aError['message'], $aError['file'], $aError['line']); } // Flush debug $oPhpLogFile = fopen($_ENV['SETTINGS']['FILE_LOG_PHP'], 'a'); fwrite($oPhpLogFile, $_ENV['DEBUG']); fclose($oPhpLogFile); }