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broken-link-checker / config-manager.php
broken-link-checker Last commit date
images 17 years ago languages 16 years ago JSON.php 17 years ago broken-link-checker.php 16 years ago config-manager.php 16 years ago core.php 16 years ago highlighter-class.php 16 years ago instance-classes.php 16 years ago link-classes.php 16 years ago readme.txt 16 years ago uninstall.php 16 years ago utility-class.php 16 years ago
config-manager.php
88 lines
1 <?php
2
3 /**
4 * @author W-Shadow
5 * @copyright 2009
6 */
7
8 if ( !class_exists('blcConfigurationManager') ){
9
10 class blcConfigurationManager {
11
12 var $option_name;
13
14 var $options;
15 var $defaults;
16 var $loaded_values;
17
18 function blcConfigurationManager( $option_name = '', $default_settings = null ){
19 $this->option_name = $option_name;
20
21 if ( is_array($default_settings) ){
22 $this->defaults = $default_settings;
23 } else {
24 $this->defaults = array();
25 }
26 $this->loaded_values = array();
27
28 $this->options = $this->defaults;
29
30 if ( !empty( $this->option_name ) )
31 $this->load_options();
32 }
33
34 function set_defaults( $default_settings = null ){
35 if ( is_array($default_settings) ){
36 $this->defaults = array();
37 } else {
38 $this->defaults = $default_settings;
39 }
40 $this->options = array_merge($this->defaults, $this->loaded_values);
41 }
42
43 /**
44 * blcOptionManager::load_options()
45 * Load plugin options from the database. The current $options values are not affected
46 * if this function fails.
47 *
48 * @param string $option_name
49 * @return bool True if options were loaded, false otherwise.
50 */
51 function load_options( $option_name = '' ){
52 if ( !empty($option_name) ){
53 $this->option_name = $option_name;
54 }
55
56 if ( empty($this->option_name) ) return false;
57
58 $new_options = get_option($this->option_name);
59 if( !is_array( $new_options ) ){
60 return false;
61 } else {
62 $this->loaded_values = $new_options;
63 $this->options = array_merge( $this->defaults, $this->loaded_values );
64 return true;
65 }
66 }
67
68 /**
69 * blcOptionManager::save_options()
70 * Save plugin options to the databse.
71 *
72 * @param string $option_name (Optional) Save the options under this name
73 * @return bool True on success, false on failure
74 */
75 function save_options( $option_name = '' ){
76 if ( !empty($option_name) ){
77 $this->option_name = $option_name;
78 }
79
80 if ( empty($this->option_name) ) return false;
81
82 update_option( $this->option_name, $this->options );
83 return true;
84 }
85 }
86
87 }
88 ?>