| @@ -406,4 +406,34 @@ | ||
| 406 | 406 | |
| 407 | 407 | new WPSEO_Shortcode_Filter(); |
| 408 | 408 | |
| 409 | 409 | new WPSEO_Taxonomy_Columns(); |
| 410 | + | |
| 411 | +/* ********************* DEPRECATED FUNCTIONS ********************* */ | |
| 412 | + | |
| 413 | +/** | |
| 414 | + * Retrieves the keyword for the keyword doubles. | |
| 415 | + * | |
| 416 | + * @return void | |
| 417 | + */ | |
| 418 | +function ajax_get_keyword_usage() { | |
| 419 | + _deprecated_function( __METHOD__, 'WPSEO 20.4' ); | |
| 420 | + check_ajax_referer( 'wpseo-keyword-usage', 'nonce' ); | |
| 421 | + | |
| 422 | + if ( ! isset( $_POST['post_id'], $_POST['keyword'] ) || ! is_string( $_POST['keyword'] ) ) { | |
| 423 | + exit( '-1' ); | |
| 424 | + } | |
| 425 | + | |
| 426 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- We are casting to an integer. | |
| 427 | + $post_id = (int) wp_unslash( $_POST['post_id'] ); | |
| 428 | + | |
| 429 | + if ( $post_id === 0 || ! current_user_can( 'edit_post', $post_id ) ) { | |
| 430 | + exit( '-1' ); | |
| 431 | + } | |
| 432 | + | |
| 433 | + $keyword = sanitize_text_field( wp_unslash( $_POST['keyword'] ) ); | |
| 434 | + | |
| 435 | + wp_die( | |
| 436 | + // phpcs:ignore WordPress.Security.EscapeOutput -- Reason: WPSEO_Utils::format_json_encode is safe. | |
| 437 | + WPSEO_Utils::format_json_encode( WPSEO_Meta::keyword_usage( $keyword, $post_id ) ), | |
| 438 | + ); | |
| 439 | +} | |