IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 618 | 618 | $post->page_template = 'default'; |
| 619 | 619 | $post->post_parent = 0; |
| 620 | 620 | $post->menu_order = 0; |
| 621 | | $post = new WP_Post( $post ); |
| | 621 | $post = WP_Post::make_instance( $post ); |
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | /** |
| … |
… |
|
| 1844 | 1844 | */ |
| 1845 | 1845 | wp_redirect( apply_filters( 'redirect_post_location', $location, $post_id ) ); |
| 1846 | 1846 | exit; |
| 1847 | | } |
| 1848 | | No newline at end of file |
| | 1847 | } |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 197 | 197 | public $filter; |
| 198 | 198 | |
| 199 | 199 | /** |
| | 200 | * Flag to disallow "new WP_Post()" to be called w/o deprecation warning. |
| | 201 | * |
| | 202 | * @var bool |
| | 203 | */ |
| | 204 | private static $_allow__construct = false; |
| | 205 | |
| | 206 | /** |
| | 207 | * Retrieve virtual WP_Post instance. |
| | 208 | * |
| | 209 | * @static |
| | 210 | * @access public |
| | 211 | * |
| | 212 | * @param WP_Post|object|array $post Post value. |
| | 213 | * @return WP_Post|object Post object. |
| | 214 | */ |
| | 215 | public static function make_instance( $post ) { |
| | 216 | |
| | 217 | if ( is_array( $post ) || 'stdClass' === get_class( $post ) ) { |
| | 218 | self::$_allow__construct = true; |
| | 219 | $post = new WP_Post( (object) $post ); |
| | 220 | self::$_allow__construct = false; |
| | 221 | } |
| | 222 | |
| | 223 | /** |
| | 224 | * Filter post object to be sanitized, virtualized and/or have properties annotated. |
| | 225 | * |
| | 226 | * @since 4.4.0 |
| | 227 | * |
| | 228 | * @param WP_Post $post Post object to sanitize/virtualize/annotate/etc. |
| | 229 | */ |
| | 230 | return apply_filters( 'make_post_instance', $post ); |
| | 231 | |
| | 232 | } |
| | 233 | |
| | 234 | /** |
| 200 | 235 | * Retrieve WP_Post instance. |
| 201 | 236 | * |
| 202 | 237 | * @static |
| … |
… |
|
| 219 | 254 | if ( ! $_post ) { |
| 220 | 255 | $_post = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post_id ) ); |
| 221 | 256 | |
| 222 | | if ( ! $_post ) |
| 223 | | return false; |
| | 257 | if ( ! $_post ) { |
| | 258 | |
| | 259 | /** |
| | 260 | * Retrieve a virtual post instance based on its post_id |
| | 261 | * |
| | 262 | * @since 4.4.0 |
| | 263 | * |
| | 264 | * @param null $_post Null value returned by failed $wpdb->get_row() |
| | 265 | * @param int $post_id Virtual post object to retrieve |
| | 266 | */ |
| | 267 | $_post = apply_filters( 'get_virtual_post_instance', $_post, $post_id ); |
| | 268 | |
| | 269 | if ( ! $_post ) { |
| | 270 | return false; |
| | 271 | } |
| | 272 | } |
| 224 | 273 | |
| 225 | 274 | $_post = sanitize_post( $_post, 'raw' ); |
| 226 | 275 | wp_cache_add( $_post->ID, $_post, 'posts' ); |
| … |
… |
|
| 228 | 277 | $_post = sanitize_post( $_post, 'raw' ); |
| 229 | 278 | } |
| 230 | 279 | |
| 231 | | return new WP_Post( $_post ); |
| | 280 | return self::make_instance( $_post ); |
| 232 | 281 | } |
| 233 | 282 | |
| 234 | 283 | /** |
| … |
… |
|
| 237 | 286 | * @param WP_Post|object $post Post object. |
| 238 | 287 | */ |
| 239 | 288 | public function __construct( $post ) { |
| | 289 | |
| | 290 | if ( ! self::$_allow__construct ) { |
| | 291 | _deprecated_function( 'new ' . __CLASS__ . '()', '4.4', 'WP_Post::make_instance()' ); |
| | 292 | } |
| | 293 | |
| 240 | 294 | foreach ( get_object_vars( $post ) as $key => $value ) |
| 241 | 295 | $this->$key = $value; |
| 242 | 296 | } |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 433 | 433 | } elseif ( is_object( $post ) ) { |
| 434 | 434 | if ( empty( $post->filter ) ) { |
| 435 | 435 | $_post = sanitize_post( $post, 'raw' ); |
| 436 | | $_post = new WP_Post( $_post ); |
| | 436 | $_post = WP_Post::make_instance( $_post ); |
| 437 | 437 | } elseif ( 'raw' == $post->filter ) { |
| 438 | | $_post = new WP_Post( $post ); |
| | 438 | $_post = WP_Post::make_instance( $post ); |
| 439 | 439 | } else { |
| 440 | 440 | $_post = WP_Post::get_instance( $post->ID ); |
| 441 | 441 | } |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 1187 | 1187 | if ( is_int($post) ) |
| 1188 | 1188 | $post = get_post($post); |
| 1189 | 1189 | if ( is_array($post) ) |
| 1190 | | $post = new WP_Post( (object) $post ); |
| | 1190 | $post = WP_Post::make_instance( $post ); |
| 1191 | 1191 | |
| 1192 | 1192 | $image_url = wp_get_attachment_url($post->ID); |
| 1193 | 1193 | |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 1348 | 1348 | |
| 1349 | 1349 | $item->ID = $this->post_id; |
| 1350 | 1350 | $item->db_id = $this->post_id; |
| 1351 | | $post = new WP_Post( (object) $item ); |
| | 1351 | $post = WP_Post::make_instance( $item ); |
| 1352 | 1352 | |
| 1353 | 1353 | if ( empty( $post->post_author ) ) { |
| 1354 | 1354 | $post->post_author = get_current_user_id(); |