$data ) { $schedules[ $name ] = $data['display']; } return $schedules; } public static function get_post_types(): array { $types = get_post_types( [ 'public' => true ], 'objects' ); $result = [ 'post' => __( 'Posts', 'ai-bulk-post' ) ]; foreach ( $types as $type ) { if ( $type->name !== 'post' && $type->name !== 'attachment' ) { $result[ $type->name ] = $type->labels->name; } } return $result; } public static function get_post_statuses(): array { return [ 'publish' => __( 'Publish', 'ai-bulk-post' ), 'draft' => __( 'Draft', 'ai-bulk-post' ), 'pending' => __( 'Pending Review', 'ai-bulk-post' ), ]; } public static function get_categories(): array { $categories = get_categories( [ 'hide_empty' => false, 'orderby' => 'name', 'order' => 'ASC', ] ); $result = []; foreach ( $categories as $category ) { $result[] = [ 'id' => $category->term_id, 'name' => $category->name, ]; } return $result; } public static function remove_quotes( string $str ): string { $length = strlen( $str ); if ( $length >= 2 && $str[0] === '"' && $str[ $length - 1 ] === '"' ) { return substr( $str, 1, -1 ); } return $str; } }