'0.0.0', 't' => time(), ); $defaults_app = self::load_php_config( STATS4WP_PATH . 'assets/options.php' ); return array_merge( $defaults_sys, $defaults_app ); } /** * Get options from static array() * * @since 1.0.0 * @return array Return array of options. */ public static function get_options() { if ( empty( self::$db_options ) ) { self::refresh(); } return self::$db_options; } /** * Get specific option * * @since 1.0.0 * @return array Return array of options. */ public static function get_option( $opt ) { if ( empty( self::$db_options ) ) { self::refresh(); } return self::$db_options[ $opt ]; } /** * Update static option array. * * @since 1.0.0 */ public static function refresh() { self::$db_options = wp_parse_args( self::get_db_options(), self::defaults() ); } /** * Get options from static array() from database * * @since 1.0.0 * @return array Return array of options from database. */ public static function get_db_options() { self::$db_options_no_defaults = get_option( STATS4WP_NAME . '_plugin' ); return self::$db_options_no_defaults; } /** * Set option to database * * @since 1.0.0 * @return true/false */ public static function set_option( $name, $value ) { if ( empty( self::$db_options ) ) { self::refresh(); } self::$db_options[ $name ] = $value; self::$db_options['t'] = time(); update_option( STATS4WP_NAME . '_plugin', self::$db_options ); return true; } /** * Delete option to database * * @since 1.0.0 * @return true/false */ public static function del_option( $name ) { if ( empty( self::$db_options ) ) { self::refresh(); } unset( self::$db_options[ $name ] ); self::$db_options['t'] = time(); update_option( STATS4WP_NAME . '_plugin', self::$db_options ); return true; } }