@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | /** |
25 | 25 | * @since 1.0.0 |
26 | 26 | */ |
27 | - protected function get_entity( $id ) { |
|
27 | + protected function get_entity($id) { |
|
28 | 28 | |
29 | 29 | // We must do this because the $id parameter is expected by reference. |
30 | - $comment = get_comment( $id ); |
|
30 | + $comment = get_comment($id); |
|
31 | 31 | |
32 | - if ( ! $comment ) { |
|
32 | + if ( ! $comment) { |
|
33 | 33 | return false; |
34 | 34 | } |
35 | 35 | |
@@ -39,28 +39,28 @@ discard block |
||
39 | 39 | /** |
40 | 40 | * @since 1.0.0 |
41 | 41 | */ |
42 | - protected function get_entity_human_id( $entity ) { |
|
42 | + protected function get_entity_human_id($entity) { |
|
43 | 43 | // An extra space is added to the end in WP <4.4 if the comment is short. |
44 | 44 | // See https://core.trac.wordpress.org/ticket/27526#comment:5 |
45 | - return rtrim( get_comment_excerpt( $entity->comment_ID ) ); |
|
45 | + return rtrim(get_comment_excerpt($entity->comment_ID)); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
49 | 49 | * @since 1.0.0 |
50 | 50 | */ |
51 | 51 | public function get_title() { |
52 | - return __( 'Comment', 'wordpoints' ); |
|
52 | + return __('Comment', 'wordpoints'); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
56 | 56 | * @since 1.0.0 |
57 | 57 | */ |
58 | - public function user_can_view( $user_id, $id ) { |
|
58 | + public function user_can_view($user_id, $id) { |
|
59 | 59 | |
60 | - $comment = get_comment( $id ); |
|
60 | + $comment = get_comment($id); |
|
61 | 61 | |
62 | - if ( $comment ) { |
|
63 | - return user_can( $user_id, 'read_post', $comment->comment_post_ID ); |
|
62 | + if ($comment) { |
|
63 | + return user_can($user_id, 'read_post', $comment->comment_post_ID); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | return false; |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @param WordPoints_Entity|null $entity An entity. |
50 | 50 | */ |
51 | - public function __construct( WordPoints_Entity $entity = null ) { |
|
52 | - if ( isset( $entity ) ) { |
|
53 | - $this->add_entity( $entity ); |
|
51 | + public function __construct(WordPoints_Entity $entity = null) { |
|
52 | + if (isset($entity)) { |
|
53 | + $this->add_entity($entity); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
@@ -64,20 +64,20 @@ discard block |
||
64 | 64 | /** |
65 | 65 | * @since 1.0.0 |
66 | 66 | */ |
67 | - public function add_entity( WordPoints_Entity $entity ) { |
|
67 | + public function add_entity(WordPoints_Entity $entity) { |
|
68 | 68 | |
69 | - $this->entities[ $entity->get_slug() ] = $entity; |
|
69 | + $this->entities[$entity->get_slug()] = $entity; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
73 | 73 | * @since 1.0.0 |
74 | 74 | */ |
75 | - public function remove_entity( $slug ) { |
|
75 | + public function remove_entity($slug) { |
|
76 | 76 | |
77 | - unset( $this->entities[ $slug ] ); |
|
77 | + unset($this->entities[$slug]); |
|
78 | 78 | |
79 | 79 | if ( |
80 | - isset( $this->hierarchy[0] ) |
|
80 | + isset($this->hierarchy[0]) |
|
81 | 81 | && $this->hierarchy[0]->get_slug() === $slug |
82 | 82 | ) { |
83 | 83 | $this->current = null; |
@@ -88,30 +88,30 @@ discard block |
||
88 | 88 | /** |
89 | 89 | * @since 1.0.0 |
90 | 90 | */ |
91 | - public function descend( $child_slug ) { |
|
91 | + public function descend($child_slug) { |
|
92 | 92 | |
93 | - if ( ! $this->current ) { |
|
93 | + if ( ! $this->current) { |
|
94 | 94 | |
95 | - if ( ! isset( $this->entities[ $child_slug ] ) ) { |
|
95 | + if ( ! isset($this->entities[$child_slug])) { |
|
96 | 96 | return false; |
97 | 97 | } |
98 | 98 | |
99 | - $child = $this->entities[ $child_slug ]; |
|
99 | + $child = $this->entities[$child_slug]; |
|
100 | 100 | |
101 | 101 | } else { |
102 | 102 | |
103 | - if ( ! ( $this->current instanceof WordPoints_Entity_ParentI ) ) { |
|
103 | + if ( ! ($this->current instanceof WordPoints_Entity_ParentI)) { |
|
104 | 104 | return false; |
105 | 105 | } |
106 | 106 | |
107 | - $child = $this->current->get_child( $child_slug ); |
|
107 | + $child = $this->current->get_child($child_slug); |
|
108 | 108 | |
109 | - if ( ! $child ) { |
|
109 | + if ( ! $child) { |
|
110 | 110 | return false; |
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
114 | - if ( $this->current ) { |
|
114 | + if ($this->current) { |
|
115 | 115 | $this->hierarchy[] = $this->current; |
116 | 116 | } |
117 | 117 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function ascend() { |
127 | 127 | |
128 | - if ( empty( $this->current ) ) { |
|
128 | + if (empty($this->current)) { |
|
129 | 129 | |
130 | 130 | // We're already at the top, some logic is probably wrong. |
131 | 131 | _doing_it_wrong( |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | return false; |
138 | 138 | } |
139 | 139 | |
140 | - $this->current = array_pop( $this->hierarchy ); |
|
140 | + $this->current = array_pop($this->hierarchy); |
|
141 | 141 | |
142 | 142 | return true; |
143 | 143 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | /** |
153 | 153 | * @since 1.0.0 |
154 | 154 | */ |
155 | - public function get_from_hierarchy( array $hierarchy ) { |
|
155 | + public function get_from_hierarchy(array $hierarchy) { |
|
156 | 156 | |
157 | 157 | $backup = $this->hierarchy; |
158 | 158 | $current = $this->current; |
@@ -160,16 +160,16 @@ discard block |
||
160 | 160 | $this->hierarchy = array(); |
161 | 161 | $this->current = null; |
162 | 162 | |
163 | - $slug = reset( $hierarchy ); |
|
163 | + $slug = reset($hierarchy); |
|
164 | 164 | |
165 | - while ( $slug ) { |
|
165 | + while ($slug) { |
|
166 | 166 | |
167 | - if ( ! $this->descend( $slug ) ) { |
|
167 | + if ( ! $this->descend($slug)) { |
|
168 | 168 | $this->current = null; |
169 | 169 | break; |
170 | 170 | } |
171 | 171 | |
172 | - $slug = next( $hierarchy ); |
|
172 | + $slug = next($hierarchy); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | $entityish = $this->current; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @param WordPoints_Entity $entity An entity. |
35 | 35 | */ |
36 | - public function add_entity( WordPoints_Entity $entity ); |
|
36 | + public function add_entity(WordPoints_Entity $entity); |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * Remove an entity from the top of the hierarchy. |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @param string $slug The slug of the entity to remove. |
44 | 44 | */ |
45 | - public function remove_entity( $slug ); |
|
45 | + public function remove_entity($slug); |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Descend to a child of the current entity/entity child. |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @return bool Whether the descent was successful. |
55 | 55 | */ |
56 | - public function descend( $child_slug ); |
|
56 | + public function descend($child_slug); |
|
57 | 57 | |
58 | 58 | /** |
59 | 59 | * Ascend to the parent of the current entity/entity child. |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @return WordPoints_EntityishI|null The entity/child, or null if not found. |
84 | 84 | */ |
85 | - public function get_from_hierarchy( array $hierarchy ); |
|
85 | + public function get_from_hierarchy(array $hierarchy); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | // EOF |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * |
26 | 26 | * @return WordPoints_EntityishI|false The child, or false if not found. |
27 | 27 | */ |
28 | - public function get_child( $child_slug ); |
|
28 | + public function get_child($child_slug); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | // EOF |
@@ -33,7 +33,7 @@ |
||
33 | 33 | * @since 1.0.0 |
34 | 34 | */ |
35 | 35 | public function get_title() { |
36 | - return __( 'Author', 'wordpoints' ); |
|
36 | + return __('Author', 'wordpoints'); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 |
@@ -28,7 +28,7 @@ |
||
28 | 28 | * @since 1.0.0 |
29 | 29 | */ |
30 | 30 | public function get_title() { |
31 | - return __( 'Content', 'wordpoints' ); |
|
31 | + return __('Content', 'wordpoints'); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @since 1.0.0 |
34 | 34 | */ |
35 | 35 | public function get_title() { |
36 | - return __( 'Content Type', 'wordpoints' ); |
|
36 | + return __('Content Type', 'wordpoints'); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @since 1.0.0 |
43 | 43 | */ |
44 | 44 | public static function get_post_types() { |
45 | - return get_post_types( array( 'public' => true ), 'labels' ); |
|
45 | + return get_post_types(array('public' => true), 'labels'); |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 |
@@ -28,7 +28,7 @@ |
||
28 | 28 | * @since 1.0.0 |
29 | 29 | */ |
30 | 30 | public function get_title() { |
31 | - return _x( 'Name', 'post type', 'wordpoints' ); |
|
31 | + return _x('Name', 'post type', 'wordpoints'); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 |
@@ -34,7 +34,7 @@ |
||
34 | 34 | * @since 1.0.0 |
35 | 35 | */ |
36 | 36 | public function get_title() { |
37 | - return __( 'Post Type', 'wordpoints' ); |
|
37 | + return __('Post Type', 'wordpoints'); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 |