File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 14
14
* per accedere alle opzioni, invece di dover fare
15
15
* $sezione_x = get_option('sezione_x)
16
16
* $opzione_y = $sezione_x['opzione_y]
17
+ *
18
+ * Estendi la classe per definire dei valori di default
19
+ * e per definire un prefisso a database.
17
20
*/
18
21
abstract class config
19
22
{
@@ -78,14 +81,14 @@ public static function config( string $query, $default = null )
78
81
throw new Exception ( 'Passato valore vuoto o invalido a config ' , 1 );
79
82
}
80
83
81
- $ default = $ default ?? self ::getDefaultValue ( $ query );
84
+ $ default = $ default ?? static ::getDefaultValue ( $ query );
82
85
83
86
$ option_key = $ option_name ;
84
87
85
- if ( self ::$ db_prefix ) {
86
- $ option_key = self ::$ db_prefix . $ option_key ;
88
+ if ( static ::$ db_prefix ) {
89
+ $ option_key = static ::$ db_prefix . $ option_key ;
87
90
}
88
-
91
+
89
92
$ option_value = get_option ( $ option_key , $ default );
90
93
91
94
if ( count ( $ tokens ) === 1 ) {
@@ -101,7 +104,7 @@ public static function config( string $query, $default = null )
101
104
*/
102
105
public static function getDefaultValue ( string $ query )
103
106
{
104
- $ defaults = self ::getDefaults ();
107
+ $ defaults = static ::getDefaults ();
105
108
106
109
return $ defaults [ $ query ] ?? null ;
107
110
}
You can’t perform that action at this time.
0 commit comments