function testDebug() { $var1 = "Variable 1"; $var2 = "Variable 2"; Raxan::config('debug', true); Raxan::config('debug.output', 'embedded'); // for embedded/popup html output Raxan::debug($var1); Raxan::debug($var2); $out = htmlspecialchars(Raxan::debugOutut()); $this->compare($var1 . '<hr />' . $var2, $out, 'Embedded/Popup Debug output'); Raxan::config('debug.output', 'console'); // for console/alert non-html output $out = Raxan::debugOutut(); $this->compare($var1 . "\n" . $var2, $out, 'Console/Alert Debug output'); }
/** * Loads a language file based on locale settings * usage: loadLangFile($fl1,$fl2,$fl3,...) * @return boolean */ public static function loadLangFile($fl) { if (!self::$isLocaleLoaded) { self::setLocale(self::$config['site.locale']); } // init on first use $pth = self::$config['lang.path']; $args = func_get_args(); $rt = false; foreach ($args as $f) { try { $locale =& self::$locale; $rt = (include_once $pth . $f . '.php'); } catch (Exception $e) { if (self::$isDebug) { Raxan::debug('Error while loading Language File \'' . $f . '\' - ' . $e->getMessage()); } } } return $rt; }
/** * Return DOMNodeList query dom based on XPath * @param string $pth CSS selector * @param DOMNode $context Optional context node * @return DOMNodeList */ public function xQuery($pth, DOMNode $context = null) { if (!$this->init) { $this->initDOMDocument(); } // init dom on first query if (!$context) { $dl = $this->xPath->query($pth); } else { if (substr($pth, 0, 1) == '/') { $pth = '.' . $pth; } $dl = $this->xPath->query($pth, $context); } if (Raxan::$isDebug) { if (!$dl) { Raxan::debug('xQuery Error: Invalid XPath Expression: ' . $pth); } else { Raxan::debug("XPath: \t Found " . $dl->length . " \t {$pth} "); } } if (!$dl) { libxml_clear_errors(); } // clear libxml error return $dl; }