ultimix
package_settings.php
Go to the documentation of this file.
1 <?php
2 
3  /*
4  * This source code is a part of the Ultimix Project.
5  * It is distributed under BSD license. All other third side source code (like tinyMCE) is distributed under
6  * it's own license wich could be found from the corresponding files or sources.
7  * This source code is provided "as is" without any warranties or garanties.
8  *
9  * Have a nice day!
10  *
11  * @url http://ultimix.sorceforge.net
12  *
13  * @author Alexey "gdever" Dodonov
14  */
15 
27 
38  var $CachedMultyFS = false;
39 
54  function __construct()
55  {
56  try
57  {
58  }
59  catch( Exception $e )
60  {
61  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
62  }
63  }
64 
99  function get_package_setting( $PackageName , $PackageVersion , $FileName ,
100  $SettingName , $DefaultValue = '_throw_exception' )
101  {
102  try
103  {
104  $S = get_package_object( 'settings::settings' , 'last' , __FILE__ );
105 
106  $S->load_package_settings( $PackageName , $PackageVersion , $FileName );
107 
108  return( $S->get_setting( $SettingName , $DefaultValue ) );
109  }
110  catch( Exception $e )
111  {
112  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
113  }
114  }
115 
150  function set_package_setting( $PackageName , $PackageVersion , $FileName , $SettingName , $Value )
151  {
152  try
153  {
154  $S = get_package_object( 'settings::settings' , 'last' , __FILE__ );
155 
156  $S->load_package_settings( $PackageName , $PackageVersion , $FileName );
157 
158  $S->set_setting( $SettingName , $Value );
159 
160  $PackagePath = _get_package_path_ex( $PackageName , $PackageVersion );
161 
162  if( $this->CachedMultyFS === false )
163  {
164  $this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
165  }
166 
167  $this->CachedMultyFS->file_put_contents( "$PackagePath/conf/$FileName" , $S->get_all_settings() );
168  }
169  catch( Exception $e )
170  {
171  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
172  }
173  }
174  }
175 
176 ?>