diff --git a/src/wp-admin/plugin-editor.php b/src/wp-admin/plugin-editor.php
index 73017cae91..cb6caae0ea 100644
|
a
|
b
|
if ( str_ends_with( $real_file, '.php' ) ) { |
| 178 | 178 | $docs_select .= '<option value="">' . esc_html__( 'Function Name…' ) . '</option>'; |
| 179 | 179 | |
| 180 | 180 | foreach ( $functions as $function ) { |
| 181 | | $docs_select .= '<option value="' . esc_attr( $function ) . '">' . esc_html( $function ) . '()</option>'; |
| | 181 | |
| | 182 | /** |
| | 183 | * Allows the documentation URL to be filtered for the Plugin Editor. |
| | 184 | * |
| | 185 | * @since x |
| | 186 | * |
| | 187 | * @param string $function Name of the selected function. |
| | 188 | * @param string $file Path to the file being edited. |
| | 189 | * @param string $plugin Plugin file/directory name. |
| | 190 | */ |
| | 191 | $option_value = apply_filters( 'plugin_editor_documentation_url', $function, $file, $plugin ); |
| | 192 | |
| | 193 | $docs_select .= '<option value="' . esc_attr( $option_value ) . '">' . esc_html( $function ) . '()</option>'; |
| 182 | 194 | } |
| 183 | 195 | |
| 184 | 196 | $docs_select .= '</select>'; |
| … |
… |
endif; |
| 295 | 307 | <div id="documentation" class="hide-if-no-js"> |
| 296 | 308 | <label for="docs-list"><?php _e( 'Documentation:' ); ?></label> |
| 297 | 309 | <?php echo $docs_select; ?> |
| 298 | | <input disabled id="docs-lookup" type="button" class="button" value="<?php esc_attr_e( 'Look Up' ); ?>" onclick="if ( '' !== jQuery('#docs-list').val() ) { window.open( 'https://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&locale=<?php echo urlencode( get_user_locale() ); ?>&version=<?php echo urlencode( get_bloginfo( 'version' ) ); ?>&redirect=true'); }" /> |
| | 310 | <input disabled id="docs-lookup" type="button" class="button" value="<?php esc_attr_e( 'Look Up' ); ?>" onclick="(() => { const v = jQuery('#docs-list').val(); if (!v) return; let url; if (v.startsWith('http://') || v.startsWith('https://')) { url = v; } else { try { new URL(v); url = v; } catch { url = `https://api.wordpress.org/core/handbook/1.0/?function=${escape(v)}&locale=<?php echo urlencode(get_user_locale()); ?>&version=<?php echo urlencode(get_bloginfo('version')); ?>&redirect=true`; } } window.open(url); })()" /> |
| 299 | 311 | </div> |
| 300 | 312 | <?php endif; ?> |
| 301 | 313 | |
diff --git a/src/wp-admin/theme-editor.php b/src/wp-admin/theme-editor.php
index bf869f4d8a..bcf96726e4 100644
|
a
|
b
|
if ( ! empty( $posted_content ) ) { |
| 172 | 172 | $docs_select .= '<option value="">' . esc_html__( 'Function Name…' ) . '</option>'; |
| 173 | 173 | |
| 174 | 174 | foreach ( $functions as $function ) { |
| 175 | | $docs_select .= '<option value="' . esc_attr( $function ) . '">' . esc_html( $function ) . '()</option>'; |
| | 175 | |
| | 176 | /** |
| | 177 | * Allows the documentation URL to be filtered for the Theme Editor. |
| | 178 | * |
| | 179 | * @since x |
| | 180 | * |
| | 181 | * @param string $function Name of the selected function. |
| | 182 | * @param string $file Path to the file being edited. |
| | 183 | * @param string $theme Directory name of the theme being edited. |
| | 184 | */ |
| | 185 | $option_value = apply_filters( 'theme_editor_documentation_url', $function, $file, $theme->get_stylesheet() ); |
| | 186 | |
| | 187 | $docs_select .= '<option value="' . esc_attr( $option_value ) . '">' . esc_html( $function ) . '()</option>'; |
| 176 | 188 | } |
| 177 | 189 | |
| 178 | 190 | $docs_select .= '</select>'; |
| … |
… |
else : |
| 324 | 336 | <div id="documentation" class="hide-if-no-js"> |
| 325 | 337 | <label for="docs-list"><?php _e( 'Documentation:' ); ?></label> |
| 326 | 338 | <?php echo $docs_select; ?> |
| 327 | | <input disabled id="docs-lookup" type="button" class="button" value="<?php esc_attr_e( 'Look Up' ); ?>" onclick="if ( '' !== jQuery('#docs-list').val() ) { window.open( 'https://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&locale=<?php echo urlencode( get_user_locale() ); ?>&version=<?php echo urlencode( get_bloginfo( 'version' ) ); ?>&redirect=true'); }" /> |
| | 339 | <input disabled id="docs-lookup" type="button" class="button" value="<?php esc_attr_e( 'Look Up' ); ?>" onclick="(() => { const v = jQuery('#docs-list').val(); if (!v) return; let url; if (v.startsWith('http://') || v.startsWith('https://')) { url = v; } else { try { new URL(v); url = v; } catch { url = `https://api.wordpress.org/core/handbook/1.0/?function=${escape(v)}&locale=<?php echo urlencode(get_user_locale()); ?>&version=<?php echo urlencode(get_bloginfo('version')); ?>&redirect=true`; } } window.open(url); })()" /> |
| 328 | 340 | </div> |
| 329 | 341 | <?php endif; ?> |
| 330 | 342 | |