'bottom-right', 'color' => '#0073e6', 'size' => 'medium', 'button_text' => '', 'hide_mobile' => false, 'tools' => array( 'font_size' => true, 'high_contrast' => true, 'highlight_links' => true, 'readable_font' => true, 'stop_animations' => true, 'big_cursor' => true, ), ); } /** * Returns merged plugin options with defaults. * * @return array Merged options. */ function accessibar_get_options() { $saved = get_option( ACCESSIBAR_OPTION_KEY, array() ); if ( is_string( $saved ) ) { $saved = json_decode( $saved, true ); } if ( ! is_array( $saved ) ) { $saved = array(); } $defaults = accessibar_get_defaults(); $options = wp_parse_args( $saved, $defaults ); if ( isset( $saved['tools'] ) && is_array( $saved['tools'] ) ) { $options['tools'] = wp_parse_args( $saved['tools'], $defaults['tools'] ); } return $options; } add_action( 'plugins_loaded', function () { if ( is_admin() ) { new AccessiBar_Admin(); } else { new AccessiBar_Frontend(); } } ); register_activation_hook( __FILE__, function () { if ( false === get_option( ACCESSIBAR_OPTION_KEY ) ) { update_option( ACCESSIBAR_OPTION_KEY, accessibar_get_defaults() ); } } );