Skip to content

Commit

Permalink
some more
Browse files Browse the repository at this point in the history
  • Loading branch information
andrepereiradasilva committed Dec 30, 2016
1 parent e7a6577 commit a3cc397
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions libraries/joomla/language/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -384,13 +384,14 @@ public static function getContentLanguages($checkPublished = true, $checkInstall
/**
* Parse strings from a language file.
*
* @param string $filename The language ini file path.
* @param string $filename The language ini file path.
* @param boolean $debug If set to true debug language ini file.
*
* @return boolean True if saved, false otherwise.
*
* @since __DEPLOY_VERSION__
*/
public static function parseIniFile($filename)
public static function parseIniFile($filename, $debug = false)
{
// Check if file exists.
if (!file_exists($filename))
Expand All @@ -404,8 +405,28 @@ public static function parseIniFile($filename)
define('_QQ_', '"');
}

// Capture hidden PHP errors from the parsing.
if ($debug === true)
{
// See https://secure.php.net/manual/en/reserved.variables.phperrormsg.php
$php_errormsg = null;

$trackErrors = ini_get('track_errors');
ini_set('track_errors', true);
}

$strings = @parse_ini_file($filename);

// Restore error tracking to what it was before.
if ($debug === true)
{
ini_set('track_errors', $trackErrors);

// @todo: the debug language should use the main debug like any other object
JFactory::getLanguage()->debugFile($filename);
}

return is_array($strings) ? $strings : array();
}
}

0 comments on commit a3cc397

Please sign in to comment.