mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
add support for mac/dos formatted config files (fix newlines)
This commit is contained in:
@@ -60,6 +60,14 @@ class Config_File {
|
|||||||
*/
|
*/
|
||||||
var $read_hidden = true;
|
var $read_hidden = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controls whether or not to fix mac or dos formatted newlines.
|
||||||
|
* If set to true, \r or \r\n will be changed to \n.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
var $fix_newlines = true;
|
||||||
|
|
||||||
/* Private variables */
|
/* Private variables */
|
||||||
var $_config_path = "";
|
var $_config_path = "";
|
||||||
var $_config_data = array();
|
var $_config_data = array();
|
||||||
@@ -253,6 +261,11 @@ class Config_File {
|
|||||||
|
|
||||||
$contents = fread($fp, filesize($config_file));
|
$contents = fread($fp, filesize($config_file));
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
|
if($this->fix_newlines) {
|
||||||
|
// fix mac/dos formatted newlines
|
||||||
|
$contents = preg_replace('!\r\n?!',"\n",$contents);
|
||||||
|
}
|
||||||
|
|
||||||
$config_data = array();
|
$config_data = array();
|
||||||
|
|
||||||
|
@@ -60,6 +60,14 @@ class Config_File {
|
|||||||
*/
|
*/
|
||||||
var $read_hidden = true;
|
var $read_hidden = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controls whether or not to fix mac or dos formatted newlines.
|
||||||
|
* If set to true, \r or \r\n will be changed to \n.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
var $fix_newlines = true;
|
||||||
|
|
||||||
/* Private variables */
|
/* Private variables */
|
||||||
var $_config_path = "";
|
var $_config_path = "";
|
||||||
var $_config_data = array();
|
var $_config_data = array();
|
||||||
@@ -253,6 +261,11 @@ class Config_File {
|
|||||||
|
|
||||||
$contents = fread($fp, filesize($config_file));
|
$contents = fread($fp, filesize($config_file));
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
|
if($this->fix_newlines) {
|
||||||
|
// fix mac/dos formatted newlines
|
||||||
|
$contents = preg_replace('!\r\n?!',"\n",$contents);
|
||||||
|
}
|
||||||
|
|
||||||
$config_data = array();
|
$config_data = array();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user