72 $this->CachedMultyFS =
get_package(
'cached_multy_fs' ,
'last' , __FILE__ );
73 $this->DBSettings =
get_package(
'settings::db_settings' ,
'last' , __FILE__ );
74 $this->PackageSettings =
get_package(
'settings::package_settings' ,
'last' , __FILE__ );
75 $this->PageComposerUtilities =
get_package(
'page::page_composer_utilities' ,
'last' , __FILE__ );
76 $this->Security =
get_package(
'security' ,
'last' , __FILE__ );
78 $this->String =
get_package(
'string' ,
'last' , __FILE__ );
112 $SettingName = $Manifest->get_setting(
'setting_name' );
113 $DefaultValue = $Manifest->get_setting(
'default_value' ,
'' );
115 $SettingValue = $this->DBSettings->get_setting( $SettingName , $DefaultValue );
117 $SettingValue = $this->Security->get( $SettingValue ,
'script' );
119 return( array( $SettingName , $SettingValue , $Manifest->get_setting(
'label' ) ) );
121 catch( Exception $e )
153 $PackageName = $Manifest->get_setting(
'package_name' );
154 $PackageVersion = $Manifest->get_setting(
'package_version' ,
'last' );
155 list( $ConfigFileName , $SettingName ) = $Manifest->get_settings(
'config_file_name,setting_name' );
156 $DefaultValue = $Manifest->get_setting(
'default_value' ,
'' );
158 $SettingValue = $this->PackageSettings->get_package_setting(
159 $PackageName , $PackageVersion , $ConfigFileName , $SettingName , $DefaultValue
162 $SettingValue = $this->Security->get( $SettingValue ,
'script' );
164 return( array( $SettingName , $SettingValue , $Manifest->get_setting(
'label' ) ) );
166 catch( Exception $e )
198 $PackageName = $Manifest->get_setting(
'package_name' ,
false );
200 if( $PackageName ===
false )
209 catch( Exception $e )
249 $Template = $this->CachedMultyFS->get_template( __FILE__ ,
'input_setting.tpl' );
251 $PlaceHolders = array(
'{name}' ,
'{value}' ,
'{label}' );
252 $Data = array( $SettingName , $SettingValue , $Label );
254 $Template = str_replace( $PlaceHolders , $Data , $Template );
258 catch( Exception $e )
298 $Template = $this->CachedMultyFS->get_template( __FILE__ ,
'checkbox_setting.tpl' );
300 $PlaceHolders = array(
'{name}' ,
'{value}' ,
'{label}' );
301 $Data = array( $SettingName , intval( $SettingValue ) ?
'checked' :
'' , $Label );
303 $Template = str_replace( $PlaceHolders , $Data , $Template );
307 catch( Exception $e )
347 $Template = $this->CachedMultyFS->get_template( __FILE__ ,
'textarea_setting.tpl' );
349 $PlaceHolders = array(
'{name}' ,
'{value}' ,
'{label}' );
350 $Data = array( $SettingName , $SettingValue , $Label );
352 $Template = str_replace( $PlaceHolders , $Data , $Template );
356 catch( Exception $e )
392 private function compile_controllers( $SettingName , $SettingValue , $Label )
396 switch( $this->Settings->get_setting(
'type' ,
'input' ) )
405 $this->PageComposerUtilities->add_error_message(
'illegal_setting_type' );
409 catch( Exception $e )
441 $this->Settings->load_settings( $ConfigLine );
443 list( $SettingName , $SettingValue , $Label ) = $this->
get_setting( $this->Settings );
445 return( $this->compile_controllers( $SettingName , $SettingValue , $Label ) );
447 catch( Exception $e )
475 private function compile_settings_form( $FormName , $ConfigPath )
479 $this->Output = $this->CachedMultyFS->get_template( __FILE__ ,
'settings_form_header.tpl' );
480 $this->Output = str_replace(
'{name}' , $FormName , $this->Output );
482 $Config = $this->CachedMultyFS->file_get_contents( $ConfigPath ,
'exploded' );
483 foreach( $Config as $i => $ConfigLine )
488 $this->Output .= $this->CachedMultyFS->get_template( __FILE__ ,
'settings_form_footer.tpl' );
490 catch( Exception $e )
518 $FormName = $Options->get_setting(
'form_name' );
520 $ConfigPath = dirname( __FILE__ ).
"/conf/cf_$FormName";
521 if( $this->CachedMultyFS->file_exists( $ConfigPath ) )
523 $this->compile_settings_form( $FormName , $ConfigPath );
527 $this->Output =
'{lang:tab_manifest_was_not_found}';
530 catch( Exception $e )
562 $ContextSet =
get_package(
'gui::context_set' ,
'last' , __FILE__ );
564 $ContextSet->add_context( dirname( __FILE__ ).
'/conf/cfcx_settings_form' );
566 if( $ContextSet->execute( $Options , $this ) )
return( $this->Output );
570 catch( Exception $e )
603 $this->PackageSettings->get_package_setting(
604 $Settings->get_setting(
'package_name' ) ,
605 $Settings->get_setting(
'package_version' ,
'last' ) ,
606 $Settings->get_setting(
'config_file_name' ) ,
611 catch( Exception $e )
643 $SettingName =
$Settings->get_setting(
'name' );
644 $DefaultValue =
$Settings->get_setting(
'default' ,
'' );
646 return( $this->DBSettings->get_setting( $SettingName , $DefaultValue ) );
648 catch( Exception $e )