| @@ -73,10 +73,8 @@ | ||
| 73 | 73 | |
| 74 | 74 | $thumb_id = get_post_thumbnail_id( $post ); |
| 75 | 75 | $thumb_data = wp_prepare_attachment_for_js( $thumb_id ); |
| 76 | 76 | |
| 77 | - $registered_post_types = get_post_types(); | |
| 78 | - | |
| 79 | 77 | $all_users = get_users( [ 'who' => 'authors' ] ); |
| 80 | 78 | $users = []; |
| 81 | 79 | |
| 82 | 80 | foreach ( $all_users as $user ) { |
| @@ -87,51 +85,37 @@ | ||
| 87 | 85 | require_once ABSPATH . 'wp-admin/includes/post.php'; |
| 88 | 86 | } |
| 89 | 87 | |
| 90 | 88 | $response = [ |
| 91 | - 'author' => $author, | |
| 92 | - 'post_author' => $post->post_author, | |
| 93 | - 'commentsAllowed' => 'open' === $post->comment_status ? true : false, | |
| 94 | - 'excerpt' => $post->post_excerpt, | |
| 95 | - 'date' => $date, | |
| 96 | - 'editUrl' => $this->get_edit_post_link( $post ), | |
| 97 | - 'previewUrl' => PreviewHelper::get_post_preview_url( $post ), | |
| 98 | - 'id' => $post->ID, | |
| 99 | - 'labels' => [], | |
| 100 | - 'order' => $post->menu_order, | |
| 101 | - 'parent' => $post->post_parent, | |
| 102 | - 'password' => $post->post_password, | |
| 103 | - 'pingbacksAllowed' => 'open' === $post->ping_status ? true : false, | |
| 104 | - 'slug' => $post->post_name, | |
| 105 | - 'status' => $post->post_status, | |
| 106 | - 'template' => empty( $template ) ? 'default' : $template, | |
| 107 | - 'terms' => [], | |
| 108 | - 'thumbnail' => get_the_post_thumbnail_url( $post, 'thumbnail' ), | |
| 109 | - 'thumbnailData' => $thumb_data, | |
| 110 | - 'title' => empty( $post->post_title ) ? __( '(no title)', 'assistant' ) : $post->post_title, | |
| 111 | - 'trashedStatus' => get_post_meta( $post->ID, '_wp_trash_meta_status', true ), | |
| 112 | - 'type' => $post->post_type, | |
| 113 | - 'url' => get_permalink( $post ), | |
| 114 | - 'visibility' => 'public', | |
| 115 | - 'commentsCount' => get_comments_number( $post->ID ), | |
| 116 | - 'isSticky' => is_sticky( $post->ID ), | |
| 117 | - 'authorList' => $users, | |
| 118 | - 'hasLock' => wp_check_post_lock( $post->ID ), | |
| 119 | - 'postTypeRegistered' => in_array( $post->post_type, $registered_post_types ), | |
| 89 | + 'author' => $author, | |
| 90 | + 'post_author' => $post->post_author, | |
| 91 | + 'commentsAllowed' => 'open' === $post->comment_status ? true : false, | |
| 92 | + 'excerpt' => $post->post_excerpt, | |
| 93 | + 'date' => $date, | |
| 94 | + 'editUrl' => $this->get_edit_post_link( $post ), | |
| 95 | + 'previewUrl' => PreviewHelper::get_post_preview_url( $post ), | |
| 96 | + 'id' => $post->ID, | |
| 97 | + 'labels' => [], | |
| 98 | + 'order' => $post->menu_order, | |
| 99 | + 'parent' => $post->post_parent, | |
| 100 | + 'password' => $post->post_password, | |
| 101 | + 'pingbacksAllowed' => 'open' === $post->ping_status ? true : false, | |
| 102 | + 'slug' => $post->post_name, | |
| 103 | + 'status' => $post->post_status, | |
| 104 | + 'template' => empty( $template ) ? 'default' : $template, | |
| 105 | + 'terms' => [], | |
| 106 | + 'thumbnail' => get_the_post_thumbnail_url( $post, 'thumbnail' ), | |
| 107 | + 'thumbnailData' => $thumb_data, | |
| 108 | + 'title' => empty( $post->post_title ) ? __( '(no title)', 'assistant' ) : $post->post_title, | |
| 109 | + 'trashedStatus' => get_post_meta( $post->ID, '_wp_trash_meta_status', true ), | |
| 110 | + 'type' => $post->post_type, | |
| 111 | + 'url' => get_permalink( $post ), | |
| 112 | + 'visibility' => 'public', | |
| 113 | + 'commentsCount' => get_comments_number( $post->ID ), | |
| 114 | + 'isSticky' => is_sticky( $post->ID ), | |
| 115 | + 'authorList' => $users, | |
| 116 | + 'hasLock' => wp_check_post_lock( $post->ID ), | |
| 120 | 117 | ]; |
| 121 | - | |
| 122 | - // Code App | |
| 123 | - if ( 'fl_code' === $post->post_type ) { | |
| 124 | - $code = get_post_meta( $post->ID, '_fl_asst_code', true ); | |
| 125 | - $code_type = get_post_meta( $post->ID, '_fl_asst_code_type', true ); | |
| 126 | - $locations = get_post_meta( $post->ID, '_fl_asst_code_locations', true ); | |
| 127 | - $enabled = get_post_meta( $post->ID, '_fl_asst_enable', true ); | |
| 128 | - $response['code'] = $code; | |
| 129 | - $response['description'] = $post->post_content; | |
| 130 | - $response['enable'] = $enabled; | |
| 131 | - $response['subtype'] = $code_type; | |
| 132 | - $response['locations'] = $locations; | |
| 133 | - } | |
| 134 | 118 | |
| 135 | 119 | // Post visibility. |
| 136 | 120 | if ( 'private' === $post->post_status ) { |
| 137 | 121 | $response['visibility'] = 'private'; |