Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
0f486fc
Coding Standards: Rename `$x` to `$response` in `wp-admin/includes/aj…
Sep 1, 2022
4341657
Coding Standards: Rename `$r` to `$result` in `wp-admin/includes/ajax…
Sep 1, 2022
9b3af2c
Coding Standards: Rename `$u` to `$update_result` in `wp-admin/includ…
Sep 1, 2022
deb6c71
Coding Standards: Rename `$t` to `$taxonomy` in `wp-admin/includes/aj…
Sep 1, 2022
8a27d14
Coding Standards: Rename `$r` to `$edit_result` in `wp-admin/includes…
Sep 1, 2022
53b7e9d
Coding Standards: Rename `$out` to `$output` in `wp-admin/includes/aj…
Sep 1, 2022
50490ed
Coding Standards: Rename `$cat_name` to `$category_name` in `wp-admin…
Sep 1, 2022
05554b4
Coding Standards: Rename `$cat_id` to `$category_id` in `wp-admin/inc…
Sep 1, 2022
5e7f789
Coding Standards: Rename `$sup` to `$supplemental` in `wp-admin/inclu…
Sep 1, 2022
88ace6a
Coding Standards: Rename `$noparents` to `$no_parents` in `wp-admin/i…
Sep 1, 2022
4733fbb
Coding Standards: Rename `$menu_obj` to `$menu_object` in `wp-admin/i…
Sep 1, 2022
4366267
Coding Standards: Rename `$pid` to `$post_id` in `wp-admin/includes/a…
Sep 1, 2022
50d7ad0
Coding Standards: Rename `$alt` to `$alternate` in `wp-admin/includes…
Sep 1, 2022
d42a57a
Coding Standards: Rename `$sb` to `$sidebar` in `wp-admin/includes/aj…
Sep 1, 2022
c26935c
Coding Standards: Rename `$msg` to `$message` in `wp-admin/includes/a…
Sep 1, 2022
9e60a17
Coding Standards: Rename `$id3data` to `$id3_data` in `wp-admin/inclu…
Sep 1, 2022
2b1e497
Coding Standards: Rename `$ext` to `$extension` in `wp-admin/includes…
Sep 1, 2022
73724a5
Coding Standards: Rename `$ext_type` to `$extension_type` in `wp-admi…
Sep 1, 2022
21728c0
Coding Standards: Rename `$post_ID` to `$post_id` in `wp-admin/includ…
Sep 1, 2022
18ad209
Coding Standards: Rename `$c` to `$count` in `wp-admin/includes/ajax-…
Sep 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Coding Standards: Rename $post_ID to $post_id in `wp-admin/includ…
…es/ajax-actions.php`.

Per naming conventions, use lowercase letters in variable, action/filter,
and function names (never camelCase).
  • Loading branch information
costdev committed Sep 5, 2022
commit 21728c07ab97d1cd2b3bcfa2a128b867a60f7a13
34 changes: 17 additions & 17 deletions src/wp-admin/includes/ajax-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2034,19 +2034,19 @@ function wp_ajax_inline_save() {
wp_die();
}

$post_ID = (int) $_POST['post_ID'];
$post_id = (int) $_POST['post_ID'];

if ( 'page' === $_POST['post_type'] ) {
if ( ! current_user_can( 'edit_page', $post_ID ) ) {
if ( ! current_user_can( 'edit_page', $post_id ) ) {
wp_die( __( 'Sorry, you are not allowed to edit this page.' ) );
}
} else {
if ( ! current_user_can( 'edit_post', $post_ID ) ) {
if ( ! current_user_can( 'edit_post', $post_id ) ) {
wp_die( __( 'Sorry, you are not allowed to edit this post.' ) );
}
}

$last = wp_check_post_lock( $post_ID );
$last = wp_check_post_lock( $post_id );
if ( $last ) {
$last_user = get_userdata( $last );
$last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
Expand All @@ -2065,7 +2065,7 @@ function wp_ajax_inline_save() {

$data = &$_POST;

$post = get_post( $post_ID, ARRAY_A );
$post = get_post( $post_id, ARRAY_A );

// Since it's coming from the database.
$post = wp_slash( $post );
Expand Down Expand Up @@ -2699,30 +2699,30 @@ function wp_ajax_image_editor() {
function wp_ajax_set_post_thumbnail() {
$json = ! empty( $_REQUEST['json'] ); // New-style request.

$post_ID = (int) $_POST['post_id'];
if ( ! current_user_can( 'edit_post', $post_ID ) ) {
$post_id = (int) $_POST['post_id'];
if ( ! current_user_can( 'edit_post', $post_id ) ) {
wp_die( -1 );
}

$thumbnail_id = (int) $_POST['thumbnail_id'];

if ( $json ) {
check_ajax_referer( "update-post_$post_ID" );
check_ajax_referer( "update-post_$post_id" );
} else {
check_ajax_referer( "set_post_thumbnail-$post_ID" );
check_ajax_referer( "set_post_thumbnail-$post_id" );
}

if ( '-1' == $thumbnail_id ) {
if ( delete_post_thumbnail( $post_ID ) ) {
$return = _wp_post_thumbnail_html( null, $post_ID );
if ( delete_post_thumbnail( $post_id ) ) {
$return = _wp_post_thumbnail_html( null, $post_id );
$json ? wp_send_json_success( $return ) : wp_die( $return );
} else {
wp_die( 0 );
}
}

if ( set_post_thumbnail( $post_ID, $thumbnail_id ) ) {
$return = _wp_post_thumbnail_html( $thumbnail_id, $post_ID );
if ( set_post_thumbnail( $post_id, $thumbnail_id ) ) {
$return = _wp_post_thumbnail_html( $thumbnail_id, $post_id );
$json ? wp_send_json_success( $return ) : wp_die( $return );
}

Expand All @@ -2735,11 +2735,11 @@ function wp_ajax_set_post_thumbnail() {
* @since 4.6.0
*/
function wp_ajax_get_post_thumbnail_html() {
$post_ID = (int) $_POST['post_id'];
$post_id = (int) $_POST['post_id'];

check_ajax_referer( "update-post_$post_ID" );
check_ajax_referer( "update-post_$post_id" );

if ( ! current_user_can( 'edit_post', $post_ID ) ) {
if ( ! current_user_can( 'edit_post', $post_id ) ) {
wp_die( -1 );
}

Expand All @@ -2750,7 +2750,7 @@ function wp_ajax_get_post_thumbnail_html() {
$thumbnail_id = null;
}

$return = _wp_post_thumbnail_html( $thumbnail_id, $post_ID );
$return = _wp_post_thumbnail_html( $thumbnail_id, $post_id );
wp_send_json_success( $return );
}

Expand Down