'object', 'single' => true, 'show_in_rest' => array( 'schema' => array( 'type' => 'object', 'properties' => array( 'season' => array('type' => array('string','integer')), 'team_id' => array('type' => array('string','integer')), 'match_id' => array('type' => array('string','integer')), ), 'additionalProperties' => true, ), ), 'auth_callback' => function( $allowed, $meta_key, $post_id, $user ) { return current_user_can('edit_post', $post_id); } ); register_post_meta('post', 'swi_foot_context', $meta_args); register_post_meta('page', 'swi_foot_context', $meta_args); new Swi_Foot_API(); new Swi_Foot_Admin(); new Swi_Foot_Blocks(); new Swi_Foot_Shortcodes(); } public function load_textdomain() { load_plugin_textdomain( 'swi_foot_matchdata', false, dirname(plugin_basename(__FILE__)) . '/languages' ); } public function activate() { // Create options with defaults add_option('swi_foot_api_base_url', 'https://club-api-services.football.ch/api/v1'); add_option('swi_foot_api_username', ''); add_option('swi_foot_api_password', ''); add_option('swi_foot_verein_id', ''); add_option('swi_foot_season_id', date('Y')); // Current year as default add_option('swi_foot_match_cache_duration', 30); // Flush rewrite rules flush_rewrite_rules(); } public function deactivate() { // Clean up transient cache data (do not remove finished/permanent records) delete_transient('swi_foot_access_token'); delete_transient('swi_foot_teams'); $keys = get_transient('swi_foot_match_keys'); if (is_array($keys)) { foreach ($keys as $mid) { delete_transient('swi_foot_match_' . $mid); } } delete_transient('swi_foot_match_keys'); // Flush rewrite rules flush_rewrite_rules(); } } // Initialize the plugin new Swiss_Football_Matchdata(); ?>