| @@ -4,8 +4,9 @@ | ||
| 4 | 4 | |
| 5 | 5 | use Code_Snippets\Integration\Evaluate_Functions; |
| 6 | 6 | use Code_Snippets\Model\Snippet; |
| 7 | 7 | use function Code_Snippets\code_snippets; |
| 8 | +use function Code_Snippets\get_snippet_author; | |
| 8 | 9 | use function Code_Snippets\get_snippets; |
| 9 | 10 | use function Code_Snippets\Settings\get_setting; |
| 10 | 11 | use function Code_Snippets\Utils\enqueue_code_preview_editor; |
| 11 | 12 | use const Code_Snippets\PLUGIN_FILE; |
| @@ -112,8 +113,11 @@ | ||
| 112 | 113 | $snippets = array_map( |
| 113 | 114 | function ( Snippet $snippet ) { |
| 114 | 115 | $fields = $snippet->get_fields(); |
| 115 | 116 | $fields['code'] = ''; |
| 117 | + $fields['created_by'] = get_snippet_author( (int) ( $snippet->created_by ?? 0 ) ); | |
| 118 | + $fields['updated_by'] = get_snippet_author( (int) ( $snippet->updated_by ?? 0 ) ); | |
| 119 | + | |
| 116 | 120 | // Match the REST response: a UTC value with no offset is read |
| 117 | 121 | // as local time by the browser. |
| 118 | 122 | $fields['modified'] = $snippet->modified_iso; |
| 119 | 123 | return $fields; |
| @@ -126,8 +130,16 @@ | ||
| 126 | 130 | |
| 127 | 131 | if ( $inline_limit > 0 ) { |
| 128 | 132 | $localized['snippetsList'] = array_slice( $snippets, 0, $inline_limit ); |
| 129 | 133 | } |
| 134 | + } | |
| 135 | + | |
| 136 | + if ( $this->screen_options->is_ai_agent_view() ) { | |
| 137 | + // The AI Agent demo writes the site name into the snippet it builds, | |
| 138 | + // so the walkthrough reads as though it were written for this site. | |
| 139 | + $localized['aiDemo'] = [ | |
| 140 | + 'siteName' => get_bloginfo( 'name' ), | |
| 141 | + ]; | |
| 130 | 142 | } |
| 131 | 143 | |
| 132 | 144 | wp_localize_script( self::JS_HANDLE, 'CODE_SNIPPETS_MANAGE', $localized ); |
| 133 | 145 | } |