Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Run some code only when debug is on. #1277

Merged
merged 1 commit into from

2 participants

@realityking
Collaborator

No description provided.

@ianmacl ianmacl merged commit c10d6fc into joomla:staging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 12, 2012
  1. @realityking
This page is out of date. Refresh to see the latest.
View
5 libraries/joomla/document/opensearch/opensearch.php
@@ -112,7 +112,10 @@ public function __construct($options = array())
public function render($cache = false, $params = array())
{
$xml = new DOMDocument('1.0', 'utf-8');
- $xml->formatOutput = true;
+ if (defined('JDEBUG') && JDEBUG)
+ {
+ $xml->formatOutput = true;
+ }
// The OpenSearch Namespace
$osns = 'http://a9.com/-/spec/opensearch/1.1/';
View
16 libraries/joomla/language/language.php
@@ -14,9 +14,6 @@
*/
define('_QQ_', '"');
-// Import some libraries
-jimport('joomla.filesystem.stream');
-
/**
* Languages/translation handler class
*
@@ -798,10 +795,13 @@ protected function loadLanguage($filename, $extension = 'unknown')
*/
protected function parse($filename)
{
- // Capture hidden PHP errors from the parsing.
- $php_errormsg = null;
- $track_errors = ini_get('track_errors');
- ini_set('track_errors', true);
+ if ($this->debug)
+ {
+ // Capture hidden PHP errors from the parsing.
+ $php_errormsg = null;
+ $track_errors = ini_get('track_errors');
+ ini_set('track_errors', true);
+ }
$contents = file_get_contents($filename);
$contents = str_replace('_QQ_', '"\""', $contents);
@@ -817,6 +817,8 @@ protected function parse($filename)
if ($this->debug)
{
+ jimport('joomla.filesystem.stream');
+
// Initialise variables for manually parsing the file for common errors.
$blacklist = array('YES', 'NO', 'NULL', 'FALSE', 'ON', 'OFF', 'NONE', 'TRUE');
$regex = '/^(|(\[[^\]]*\])|([A-Z][A-Z0-9_\-]*\s*=(\s*(("[^"]*")|(_QQ_)))+))\s*(;.*)?$/';
View
11 tests/suites/unit/joomla/document/opensearch/JDocumentOpensearchTest.php
@@ -66,16 +66,7 @@ public function testRender()
$this->assertThat(
$this->object->render(),
- $this->equalTo('<?xml version="1.0" encoding="utf-8"?>
-<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
- <ShortName>ShortName</ShortName>
- <Description>Description</Description>
- <InputEncoding>UTF-8</InputEncoding>
- <Url type="application/opensearchdescription+xml" rel="self" template=""/>
- <Url type="text/html" template="http://www.example.com"/>
- <Url type="application/rss+xml" rel="suggestions" template="http://www.example.com?format=feed"/>
-</OpenSearchDescription>
-')
+ $this->equalTo('<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"><ShortName>ShortName</ShortName><Description>Description</Description><InputEncoding>UTF-8</InputEncoding><Url type="application/opensearchdescription+xml" rel="self" template=""/><Url type="text/html" template="http://www.example.com"/><Url type="application/rss+xml" rel="suggestions" template="http://www.example.com?format=feed"/></OpenSearchDescription>')
);
Something went wrong with that request. Please try again.