PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.13
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.13
1.1.13 1.1.12 1.1.11 1.1.10 1.1.9 1.1.8 1.1.7 1.1.6 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.1 1.0.0 0.9.8 0.9.7 0.9.6 0.9.4 0.9.5 0.9.3 0.9.2 0.9.1 0.9.0 All 37 releases
← All changes | includes/agents/store.php +35 -0 1.1.12 → 1.1.13 View file →
@@ -999,8 +999,43 @@
999 999 );
1000 1000 return get_users( array_merge( $defaults, is_array( $args ) ? $args : array() ) );
1001 1001 }
1002 1002
1003 +/**
1004 + * The agents the current user can hand an entity to with "Send to".
1005 + *
1006 + * Every agent declaring a `send-to` trigger that this user may invoke,
1007 + * with the entity kinds the trigger accepts (empty = every kind). The
1008 + * shell inlines it so desktop and folder tile menus can offer
1009 + * "Send to <agent>" synchronously, the way WP Explorer's menu does.
1010 + * Empty while the framework is off or the user may not invoke agents.
1011 + *
1012 + * @return array<int, array{id: int, name: string, description: string, avatarUrl: string, entityKinds: string[]}>
1013 + */
1014 +function openstation_agents_send_to_targets() {
1015 + if ( ! openstation_agents_enabled() || ! openstation_agents_user_can_invoke() ) {
1016 + return array();
1017 + }
1018 + $targets = array();
1019 + foreach ( openstation_agent_get_agents() as $user ) {
1020 + $trigger = openstation_agent_trigger_for_source( (int) $user->ID, 'send-to' );
1021 + if ( null === $trigger || ! openstation_agent_user_can_invoke_agent( (int) $user->ID, 'send-to' ) ) {
1022 + continue;
1023 + }
1024 + $kinds = isset( $trigger['config']['entityKinds'] ) && is_array( $trigger['config']['entityKinds'] )
1025 + ? array_values( array_map( 'strval', $trigger['config']['entityKinds'] ) )
1026 + : array();
1027 + $targets[] = array(
1028 + 'id' => (int) $user->ID,
1029 + 'name' => openstation_plain_text_title( $user->display_name ),
1030 + 'description' => openstation_agent_get_description( (int) $user->ID ),
1031 + 'avatarUrl' => openstation_agent_avatar_url( (int) $user->ID ),
1032 + 'entityKinds' => $kinds,
1033 + );
1034 + }
1035 + return $targets;
1036 +}
1037 +
1003 1038 // ---------------------------------------------------------------------------
1004 1039 // Orchestrators — the only write paths, each firing one audit action
1005 1040 // ---------------------------------------------------------------------------
1006 1041