Changeset 36848
- Timestamp:
- 03/04/2016 06:55:23 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-press-this.php
r36819 r36848 113 113 } 114 114 115 $post = array(115 $post_data = array( 116 116 'ID' => $post_id, 117 117 'post_title' => ( ! empty( $_POST['post_title'] ) ) ? sanitize_text_field( trim( $_POST['post_title'] ) ) : '', … … 126 126 if ( ! empty( $_POST['post_status'] ) && 'publish' === $_POST['post_status'] ) { 127 127 if ( current_user_can( 'publish_posts' ) ) { 128 $post ['post_status'] = 'publish';128 $post_data['post_status'] = 'publish'; 129 129 } else { 130 $post ['post_status'] = 'pending';131 } 132 } 133 134 $post ['post_content'] = $this->side_load_images( $post_id, $post['post_content'] );130 $post_data['post_status'] = 'pending'; 131 } 132 } 133 134 $post_data['post_content'] = $this->side_load_images( $post_id, $post_data['post_content'] ); 135 135 136 136 /** 137 * Filter the post _contentof a Press This post before saving/updating, after137 * Filter the post data of a Press This post before saving/updating, after 138 138 * side_load_images action had run. 139 139 * 140 140 * @since 4.5.0 141 141 * 142 * @param string $content Content after side_load_images process. 143 * @param int $post_id Post ID. 142 * @param array $post_data The post data. 144 143 */ 145 $post ['post_content'] = apply_filters( 'press_this_save_post_content', $post['post_content'], $post_id);146 147 $updated = wp_update_post( $post , true );144 $post_data = apply_filters( 'press_this_save_post', $post_data ); 145 146 $updated = wp_update_post( $post_data, true ); 148 147 149 148 if ( is_wp_error( $updated ) ) { 150 149 wp_send_json_error( array( 'errorMessage' => $updated->get_error_message() ) ); 151 150 } else { 152 if ( isset( $post ['post_format'] ) ) {153 if ( current_theme_supports( 'post-formats', $post ['post_format'] ) ) {154 set_post_format( $post_id, $post ['post_format'] );155 } elseif ( $post ['post_format'] ) {151 if ( isset( $post_data['post_format'] ) ) { 152 if ( current_theme_supports( 'post-formats', $post_data['post_format'] ) ) { 153 set_post_format( $post_id, $post_data['post_format'] ); 154 } elseif ( $post_data['post_format'] ) { 156 155 set_post_format( $post_id, false ); 157 156 } … … 179 178 * @param string $status Post status. 180 179 */ 181 $redirect = apply_filters( 'press_this_save_redirect', $redirect, $post_id, $post ['post_status'] );180 $redirect = apply_filters( 'press_this_save_redirect', $redirect, $post_id, $post_data['post_status'] ); 182 181 183 182 if ( $redirect ) { … … 284 283 } 285 284 286 $ useful_html_elements = array(285 $allowed_elements = array( 287 286 'img' => array( 288 287 'src' => true, … … 305 304 ); 306 305 307 /**308 * Filter 'useful' HTML elements list for fetch source step.309 *310 * @since 4.5.0311 *312 * @param array $useful_html_elements Default list of useful elements.313 */314 $useful_html_elements = apply_filter( 'press_this_useful_html_elements', $useful_html_elements );315 316 306 $source_content = wp_remote_retrieve_body( $remote_url ); 317 $source_content = wp_kses( $source_content, $ useful_html_elements );307 $source_content = wp_kses( $source_content, $allowed_elements ); 318 308 319 309 return $source_content; … … 1182 1172 1183 1173 /** 1184 * Filter the default HTML for the Press This editor. 1174 * Filter the default HTML tags used in the suggested content for the editor. 1175 * 1176 * The HTML strings use printf format. After filtering the content is added at the specified places with `sprintf()`. 1185 1177 * 1186 1178 * @since 4.2.0 1187 1179 * 1188 * @param array $default_html Associative array with two keys: 'quote' where %1$s is replaced with the site description 1189 * or the selected content, and 'link' there %1$s is link href, %2$s is link text. 1180 * @param array $default_html Associative array with three possible keys: 1181 * - 'quote' where %1$s is replaced with the site description or the selected content. 1182 * - 'link' where %1$s is link href, %2$s is link text, usually the source page title. 1183 * - 'embed' which contains an [embed] shortcode when the source page offers embeddable content. 1184 * @param array $data Associative array containing the data from the source page. 1190 1185 */ 1191 1186 $default_html = apply_filters( 'press_this_suggested_html', $default_html, $data ); … … 1213 1208 } 1214 1209 } 1215 1216 /**1217 * Filter the assembled HTML for the Press This editor.1218 *1219 * @since 4.5.01220 *1221 * @param string $content Assembled end output of suggested content for the Press This editor.1222 */1223 $content = apply_filters( 'press_this_suggested_content', $content );1224 1210 1225 1211 return $content;
Note: See TracChangeset
for help on using the changeset viewer.