Smarty


Smarty\Config_File
Config_File.class.php at line 38

Class Config_File

Config_File

public class Config_File

Config file reading class


Field Summary
mixed

$booleanize

Controls whether config values of on/true/yes and off/false/no get converted to boolean values automatically.

mixed

$fix_newlines

Controls whether or not to fix mac or dos formatted newlines.

boolean

$overwrite

Controls whether variables with the same name overwrite each other.

mixed

$read_hidden

Controls whether hidden config sections/vars are read from the file.

Constructor Summary

Config_File(string config_path)

Constructs a new config file class.

Method Summary
void

clear(string file_name)

Clear loaded config data for a certain file or all files.

string|array

get(string file_name, string section_name, string var_name)

Retrieves config info based on the file, section, and variable name.

array

get_file_names()

Get all loaded config file names.

string|array

get_key(mixed config_key, $file_name string)

Retrieves config info based on the key.

array

get_section_names(string file_name)

Get all section names from a loaded file.

array

get_var_names(string file_name, mixed section, string section_name)

Get all global or section variable names.

void

load_file(string file_name, boolean prepend_path)

Load a configuration file manually.

void

parse_contents(string contents)

parse the source of a configuration file manually.

void

set_file_contents(string config_file, string contents)

Store the contents of a file manually.

void

set_path(string config_path)

Set the path where configuration files can be found.

Field Detail

Config_File.class.php at line 52

booleanize

public mixed $booleanize = true

Controls whether config values of on/true/yes and off/false/no get converted to boolean values automatically.


Config_File.class.php at line 63

fix_newlines

public mixed $fix_newlines = 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.


Config_File.class.php at line 46

overwrite

public boolean $overwrite = true

Controls whether variables with the same name overwrite each other.


Config_File.class.php at line 57

read_hidden

public mixed $read_hidden = true

Controls whether hidden config sections/vars are read from the file.


Constructor Detail

Config_File.class.php at line 76

Config_File

public Config_File(string config_path)

Constructs a new config file class.

Parameters:
config_path - (optional) path to the config files

Method Detail

Config_File.class.php at line 217

clear

public void clear(string file_name)

Clear loaded config data for a certain file or all files.

Parameters:
file_name - file to clear config data for

Config_File.class.php at line 112

get

public string|array get(string file_name, string section_name, string var_name)

Retrieves config info based on the file, section, and variable name.

Parameters:
file_name - config file to get info for
section_name - (optional) section to get info for
var_name - (optional) variable to get info for
Returns:
a value or array of values

Config_File.class.php at line 164

get_file_names

public array get_file_names()

Get all loaded config file names.

Returns:
an array of loaded config file names

Config_File.class.php at line 152

get_key

public string|array get_key(mixed config_key, $file_name string)

Retrieves config info based on the key.

Parameters:
string - config key (filename/section/var)
Returns:
same as get()
Uses:
get() retrieves information from config file and returns it

Config_File.class.php at line 176

get_section_names

public array get_section_names(string file_name)

Get all section names from a loaded file.

Parameters:
file_name - config file to get section names from
Returns:
an array of section names from the specified file

Config_File.class.php at line 195

get_var_names

public array get_var_names(string file_name, mixed section, string section_name)

Get all global or section variable names.

Parameters:
file_name - config file to get info for
section_name - (optional) section to get info for
Returns:
an array of variables names from the specified file/section

Config_File.class.php at line 233

load_file

public void load_file(string file_name, boolean prepend_path)

Load a configuration file manually.

Parameters:
file_name - file name to load
prepend_path - whether current config path should be prepended to the filename

Config_File.class.php at line 271

parse_contents

public void parse_contents(string contents)

parse the source of a configuration file manually.

Parameters:
contents - the file-contents to parse

Config_File.class.php at line 260

set_file_contents

public void set_file_contents(string config_file, string contents)

Store the contents of a file manually.

Parameters:
config_file - file name of the related contents
contents - the file-contents to parse

Config_File.class.php at line 88

set_path

public void set_path(string config_path)

Set the path where configuration files can be found.

Parameters:
config_path - path to the config files

Smarty