@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | $this->slug = $slug; |
76 | 76 | $this->action = $action; |
77 | 77 | |
78 | - $parts = explode( ':', $slug, 2 ); |
|
78 | + $parts = explode(':', $slug, 2); |
|
79 | 79 | |
80 | - if ( isset( $parts[1] ) ) { |
|
80 | + if (isset($parts[1])) { |
|
81 | 81 | $this->entity_slug = $parts[1]; |
82 | 82 | } else { |
83 | 83 | $this->entity_slug = $slug; |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | $this->get_entity_slug() |
108 | 108 | ); |
109 | 109 | |
110 | - if ( $entity instanceof WordPoints_Entity ) { |
|
110 | + if ($entity instanceof WordPoints_Entity) { |
|
111 | 111 | $value = $this->get_value(); |
112 | 112 | |
113 | - if ( $value ) { |
|
114 | - $entity->set_the_value( $value ); |
|
113 | + if ($value) { |
|
114 | + $entity->set_the_value($value); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function get_value() { |
125 | 125 | |
126 | - if ( $this->action instanceof WordPoints_Hook_ActionI ) { |
|
127 | - return $this->action->get_arg_value( $this->slug ); |
|
126 | + if ($this->action instanceof WordPoints_Hook_ActionI) { |
|
127 | + return $this->action->get_arg_value($this->slug); |
|
128 | 128 | } else { |
129 | 129 | return null; |
130 | 130 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | |
138 | 138 | $entity = $this->get_entity(); |
139 | 139 | |
140 | - if ( ! $entity ) { |
|
140 | + if ( ! $entity) { |
|
141 | 141 | return $this->slug; |
142 | 142 | } |
143 | 143 |
@@ -50,7 +50,7 @@ |
||
50 | 50 | * |
51 | 51 | * @return mixed The arg value. |
52 | 52 | */ |
53 | - public function get_arg_value( $arg_slug ); |
|
53 | + public function get_arg_value($arg_slug); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | // EOF |
@@ -83,16 +83,16 @@ discard block |
||
83 | 83 | * @param array $action_args The args the action was fired with. |
84 | 84 | * @param array $args Other args. |
85 | 85 | */ |
86 | - public function __construct( $slug, array $action_args, array $args = array() ) { |
|
86 | + public function __construct($slug, array $action_args, array $args = array()) { |
|
87 | 87 | |
88 | 88 | $this->slug = $slug; |
89 | 89 | $this->args = $action_args; |
90 | 90 | |
91 | - if ( isset( $args['requirements'] ) ) { |
|
91 | + if (isset($args['requirements'])) { |
|
92 | 92 | $this->requirements = $args['requirements']; |
93 | 93 | } |
94 | 94 | |
95 | - if ( isset( $args['arg_index'] ) ) { |
|
95 | + if (isset($args['arg_index'])) { |
|
96 | 96 | $this->arg_index = $args['arg_index']; |
97 | 97 | } |
98 | 98 | } |
@@ -109,25 +109,25 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function should_fire() { |
111 | 111 | |
112 | - foreach ( $this->requirements as $arg => $value ) { |
|
112 | + foreach ($this->requirements as $arg => $value) { |
|
113 | 113 | |
114 | 114 | $comparator = '='; |
115 | 115 | |
116 | - if ( is_array( $value ) && isset( $value['comparator'], $value['value'] ) ) { |
|
116 | + if (is_array($value) && isset($value['comparator'], $value['value'])) { |
|
117 | 117 | $comparator = $value['comparator']; |
118 | 118 | $value = $value['value']; |
119 | 119 | } |
120 | 120 | |
121 | - switch ( $comparator ) { |
|
121 | + switch ($comparator) { |
|
122 | 122 | |
123 | 123 | case '=': |
124 | - if ( ! isset( $this->args[ $arg ] ) || $this->args[ $arg ] !== $value ) { |
|
124 | + if ( ! isset($this->args[$arg]) || $this->args[$arg] !== $value) { |
|
125 | 125 | return false; |
126 | 126 | } |
127 | 127 | break; |
128 | 128 | |
129 | 129 | case '!=': |
130 | - if ( isset( $this->args[ $arg ] ) && $this->args[ $arg ] === $value ) { |
|
130 | + if (isset($this->args[$arg]) && $this->args[$arg] === $value) { |
|
131 | 131 | return false; |
132 | 132 | } |
133 | 133 | break; |
@@ -140,19 +140,19 @@ discard block |
||
140 | 140 | /** |
141 | 141 | * @since 2.1.0 |
142 | 142 | */ |
143 | - public function get_arg_value( $arg_slug ) { |
|
143 | + public function get_arg_value($arg_slug) { |
|
144 | 144 | |
145 | - if ( ! isset( $this->arg_index[ $arg_slug ] ) ) { |
|
145 | + if ( ! isset($this->arg_index[$arg_slug])) { |
|
146 | 146 | return null; |
147 | 147 | } |
148 | 148 | |
149 | - $index = $this->arg_index[ $arg_slug ]; |
|
149 | + $index = $this->arg_index[$arg_slug]; |
|
150 | 150 | |
151 | - if ( ! isset( $this->args[ $index ] ) ) { |
|
151 | + if ( ! isset($this->args[$index])) { |
|
152 | 152 | return null; |
153 | 153 | } |
154 | 154 | |
155 | - return $this->args[ $index ]; |
|
155 | + return $this->args[$index]; |
|
156 | 156 | } |
157 | 157 | } |
158 | 158 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @var string[] |
23 | 23 | */ |
24 | - protected $post_hierarchy = array( 'post\\post' ); |
|
24 | + protected $post_hierarchy = array('post\\post'); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * @since 2.1.0 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | $post = $this->get_post_entity(); |
32 | 32 | |
33 | - if ( ! $post ) { |
|
33 | + if ( ! $post) { |
|
34 | 34 | return false; |
35 | 35 | } |
36 | 36 | |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | */ |
49 | 49 | protected function get_post_entity() { |
50 | 50 | |
51 | - $parts = wordpoints_parse_dynamic_slug( $this->slug ); |
|
51 | + $parts = wordpoints_parse_dynamic_slug($this->slug); |
|
52 | 52 | |
53 | - if ( ! $parts['dynamic'] ) { |
|
53 | + if ( ! $parts['dynamic']) { |
|
54 | 54 | return false; |
55 | 55 | } |
56 | 56 | |
@@ -60,30 +60,30 @@ discard block |
||
60 | 60 | , $this->post_hierarchy |
61 | 61 | ); |
62 | 62 | |
63 | - $entity = wordpoints_entities()->get( $this->post_hierarchy[0] ); |
|
63 | + $entity = wordpoints_entities()->get($this->post_hierarchy[0]); |
|
64 | 64 | |
65 | - if ( ! $entity instanceof WordPoints_Entity ) { |
|
65 | + if ( ! $entity instanceof WordPoints_Entity) { |
|
66 | 66 | return false; |
67 | 67 | } |
68 | 68 | |
69 | - $entity->set_the_value( $this->get_arg_value( $this->post_hierarchy[0] ) ); |
|
69 | + $entity->set_the_value($this->get_arg_value($this->post_hierarchy[0])); |
|
70 | 70 | |
71 | - if ( 1 === count( $this->post_hierarchy ) ) { |
|
71 | + if (1 === count($this->post_hierarchy)) { |
|
72 | 72 | |
73 | 73 | $post_entity = $entity; |
74 | 74 | |
75 | 75 | } else { |
76 | 76 | |
77 | - $args = new WordPoints_Entity_Hierarchy( $entity ); |
|
77 | + $args = new WordPoints_Entity_Hierarchy($entity); |
|
78 | 78 | |
79 | - $post_entity = $args->get_from_hierarchy( $this->post_hierarchy ); |
|
79 | + $post_entity = $args->get_from_hierarchy($this->post_hierarchy); |
|
80 | 80 | |
81 | - if ( ! $post_entity instanceof WordPoints_Entity ) { |
|
81 | + if ( ! $post_entity instanceof WordPoints_Entity) { |
|
82 | 82 | return false; |
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | - if ( $parts['dynamic'] !== $post_entity->get_the_attr_value( 'post_type' ) ) { |
|
86 | + if ($parts['dynamic'] !== $post_entity->get_the_attr_value('post_type')) { |
|
87 | 87 | return false; |
88 | 88 | } |
89 | 89 |
@@ -21,11 +21,11 @@ |
||
21 | 21 | |
22 | 22 | $post = $this->get_post_entity(); |
23 | 23 | |
24 | - if ( ! $post ) { |
|
24 | + if ( ! $post) { |
|
25 | 25 | return false; |
26 | 26 | } |
27 | 27 | |
28 | - if ( 'publish' !== get_post_status( $post->get_the_id() ) ) { |
|
28 | + if ('publish' !== get_post_status($post->get_the_id())) { |
|
29 | 29 | return false; |
30 | 30 | } |
31 | 31 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | /** |
19 | 19 | * @since 2.1.0 |
20 | 20 | */ |
21 | - protected $post_hierarchy = array( 'comment\\post', 'post\\post', 'post\\post' ); |
|
21 | + protected $post_hierarchy = array('comment\\post', 'post\\post', 'post\\post'); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | // EOF |
@@ -18,18 +18,18 @@ |
||
18 | 18 | /** |
19 | 19 | * @since 2.1.0 |
20 | 20 | */ |
21 | - protected $post_hierarchy = array( 'comment\\post', 'post\\post', 'post\\post' ); |
|
21 | + protected $post_hierarchy = array('comment\\post', 'post\\post', 'post\\post'); |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * @since 2.1.0 |
25 | 25 | */ |
26 | 26 | public function should_fire() { |
27 | 27 | |
28 | - if ( ! isset( $this->args[1]->comment_approved ) ) { |
|
28 | + if ( ! isset($this->args[1]->comment_approved)) { |
|
29 | 29 | return false; |
30 | 30 | } |
31 | 31 | |
32 | - if ( 1 !== (int) $this->args[1]->comment_approved ) { |
|
32 | + if (1 !== (int) $this->args[1]->comment_approved) { |
|
33 | 33 | return false; |
34 | 34 | } |
35 | 35 |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return bool Whether the event was updated successfully. |
66 | 66 | */ |
67 | - public function update_event_slug( $event_slug ); |
|
67 | + public function update_event_slug($event_slug); |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Get the slug of the reactor this reaction is for. |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @return mixed|false The meta value, or false if not found. |
108 | 108 | */ |
109 | - public function get_meta( $key ); |
|
109 | + public function get_meta($key); |
|
110 | 110 | |
111 | 111 | /** |
112 | 112 | * Add a piece of metadata for this reaction. |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @return bool Whether the metadata was added successfully. |
122 | 122 | */ |
123 | - public function add_meta( $key, $value ); |
|
123 | + public function add_meta($key, $value); |
|
124 | 124 | |
125 | 125 | /** |
126 | 126 | * Update a piece of metadata for this reaction. |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * |
133 | 133 | * @return bool Whether the metadata was updated successfully. |
134 | 134 | */ |
135 | - public function update_meta( $key, $value ); |
|
135 | + public function update_meta($key, $value); |
|
136 | 136 | |
137 | 137 | /** |
138 | 138 | * Delete a piece of metadata for this reaction. |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * |
144 | 144 | * @return bool Whether the metadata was deleted successfully. |
145 | 145 | */ |
146 | - public function delete_meta( $key ); |
|
146 | + public function delete_meta($key); |
|
147 | 147 | |
148 | 148 | /** |
149 | 149 | * Get all of the metadata for this reaction. |
@@ -28,7 +28,7 @@ |
||
28 | 28 | * |
29 | 29 | * @param string $slug The event slug. |
30 | 30 | */ |
31 | - public function __construct( $slug ) { |
|
31 | + public function __construct($slug) { |
|
32 | 32 | |
33 | 33 | $this->slug = $slug; |
34 | 34 | } |