|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* WARNING: This file is distributed verbatim in Jetpack. |
|
5
|
|
|
* There should be nothing WordPress.com specific in this file. |
|
6
|
|
|
* |
|
7
|
|
|
* @hide-in-jetpack |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
class Jetpack_Post extends SAL_Post { |
|
11
|
|
|
public function get_like_count() { |
|
12
|
|
|
return 0; |
|
13
|
|
|
} |
|
14
|
|
|
|
|
15
|
|
|
public function is_liked() { |
|
16
|
|
|
return false; |
|
17
|
|
|
} |
|
18
|
|
|
|
|
19
|
|
|
public function is_reblogged() { |
|
20
|
|
|
return false; |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
public function is_following() { |
|
24
|
|
|
return false; |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
public function get_global_id() { |
|
28
|
|
|
return ''; |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public function get_geo() { |
|
32
|
|
|
return false; |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
public function is_public() { |
|
36
|
|
|
if ( 0 < strlen( $this->get_password() ) ) { |
|
37
|
|
|
return false; |
|
38
|
|
|
} |
|
39
|
|
|
if ( ! in_array( $this->get_type(), get_post_types( array( 'public' => true ) ) ) ) { |
|
40
|
|
|
return false; |
|
41
|
|
|
} |
|
42
|
|
|
$post_status = get_post_status( $this->ID ); // Inherited status is resolved here. |
|
|
|
|
|
|
43
|
|
|
if ( ! in_array( $post_status, get_post_stati( array( 'public' => true ) ) ) ) { |
|
44
|
|
|
return false; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
return true; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function is_excluded_from_search() { |
|
51
|
|
|
return get_post_type_object( $this->get_type() )->exclude_from_search; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function get_taxonomies() { |
|
55
|
|
|
$tax = array(); |
|
56
|
|
|
$taxonomies = get_object_taxonomies( $this ); |
|
57
|
|
|
foreach ( $taxonomies as $taxonomy ) { |
|
58
|
|
|
$terms = get_object_term_cache( $this->ID, $taxonomy ); |
|
|
|
|
|
|
59
|
|
|
if ( empty( $terms ) ) { |
|
60
|
|
|
$terms = wp_get_object_terms( $this->ID, $taxonomy ); |
|
|
|
|
|
|
61
|
|
|
} |
|
62
|
|
|
$term_names = array(); |
|
63
|
|
|
foreach ( $terms as $term ) { |
|
64
|
|
|
$term_names[] = $term->name; |
|
65
|
|
|
} |
|
66
|
|
|
$tax[ $taxonomy ] = $term_names; |
|
67
|
|
|
} |
|
68
|
|
|
return $tax; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
public function get_meta() { |
|
72
|
|
|
$meta = array(); |
|
73
|
|
|
$metas = get_post_meta( $this->ID, false ); |
|
|
|
|
|
|
74
|
|
|
foreach ( $metas as $key => $value ) { |
|
75
|
|
|
$meta[ $key ] = array_map( 'maybe_unserialize', $value ); |
|
76
|
|
|
} |
|
77
|
|
|
return $meta; |
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
|
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.