Class Config¶
Common methods for Gila CMS
addLang ()¶
(static) Adds language translations from a json file.
Parameters
- $path:string Path to the folder/prefix of language json files
Example:
Config::addLang('mypackages/lang/');
addList ()¶
(static) Adds en element in a global array.
- string $list: Name of the list
- mixed $el: Value
widgets ()¶
(static) Register new widgets.
Parameters
- $list:Array
Example:
Config::widgets( [‘wdg’=>’my_package/widgets/wdg’] );
content ()¶
(static) Register new content type.
Parameters
- String $key Name of content type
- String $path Path to the table file
Example:
Config::content( 'mytable', 'package_name/content/mytable.php' );
contentInit ()¶
(static) Make changes on an existing content type.
Parameters
- String $key: Name of content type
- Function $init: Function to run when initializes the content type object
Example:
Config::contentInit( 'mytable', function(&$table){
// unlist a column from content administration
&$table['fields']['column1']['list] = false;
});
packages ()¶
(static) Returns an array with the active packages names.
get ()¶
(static) Gets the value of configuration/option element.
Parameters
- $key:string Index of the element.
set ()¶
(static) Sets the value of configuration/option element.
Parameters
- $key:string Index of the element.
- $value:mixed The value to set.
updateConfigFile ()¶
(static) Updates the config.php file.
hash ()¶
(static) Generates a hash password from a string. Returns hashed password.
- $pass:string The string to be hashed.
getArray ()¶
(static) Gets an option value in array form if it was saved in json format.
Parameters
- string $option: Option name.
dir ()¶
(static) Creates the folder if does not exist and returns the path.
Parameters
- $path:string Folder path.
url ()¶
(static) Generates a url. Return the url path to print.
Parameters
- $str:string The path.
- $args:Array (optional) The query parameters in array.
Examples:
$url = Config::url('blog/post',['id'=>1]);`` returns mysite.com/blog/post?id=1
base ()¶
(static) Generates a url. Returns the full url path to print.
Parameters
- $str:string The path.
Examples:
$url = Config::base('blog/post?id=1');`` returns https://mysite.com/blog/post?id=1
mt ()¶
(static) Returns modification times in seconds.
Parameters
- string/Array $arg: Names of keys. :returns: string/Array
Example:
Config::mt('my-table')
updateMt ()¶
(static) Updates modification time in seconds. You can use this function from your model classes. The cm controller runs updateMt() for any content type in update action.
Parameters
- string/Array $arg: Names of keys. :returns: string/Array
Example:
Config::updateMt('my-table')