@@ -40,23 +40,23 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return object|false The action object, or false if not found. |
42 | 42 | */ |
43 | - public function get( $slug, array $action_args = array(), array $args = array() ) { |
|
43 | + public function get($slug, array $action_args = array(), array $args = array()) { |
|
44 | 44 | |
45 | - if ( ! isset( $this->classes[ $slug ] ) ) { |
|
45 | + if ( ! isset($this->classes[$slug])) { |
|
46 | 46 | return false; |
47 | 47 | } |
48 | 48 | |
49 | - return new $this->classes[ $slug ]( $slug, $action_args, $args ); |
|
49 | + return new $this->classes[$slug]($slug, $action_args, $args); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
53 | 53 | * @since 1.0.0 |
54 | 54 | */ |
55 | - public function register( $slug, $class, array $args = array() ) { |
|
55 | + public function register($slug, $class, array $args = array()) { |
|
56 | 56 | |
57 | - parent::register( $slug, $class, $args ); |
|
57 | + parent::register($slug, $class, $args); |
|
58 | 58 | |
59 | - $this->router->add_action( $slug, $args ); |
|
59 | + $this->router->add_action($slug, $args); |
|
60 | 60 | |
61 | 61 | return true; |
62 | 62 | } |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | /** |
65 | 65 | * @since 1.0.0 |
66 | 66 | */ |
67 | - public function deregister( $slug ) { |
|
67 | + public function deregister($slug) { |
|
68 | 68 | |
69 | - parent::deregister( $slug ); |
|
69 | + parent::deregister($slug); |
|
70 | 70 | |
71 | - $this->router->remove_action( $slug ); |
|
71 | + $this->router->remove_action($slug); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 |
@@ -61,14 +61,14 @@ discard block |
||
61 | 61 | * @param string $slug The arg slug. |
62 | 62 | * @param WordPoints_Hook_ActionI $action The calling action's object. |
63 | 63 | */ |
64 | - public function __construct( $slug, WordPoints_Hook_ActionI $action = null ) { |
|
64 | + public function __construct($slug, WordPoints_Hook_ActionI $action = null) { |
|
65 | 65 | |
66 | 66 | $this->slug = $slug; |
67 | 67 | $this->action = $action; |
68 | 68 | |
69 | - $parts = explode( ':', $slug, 2 ); |
|
69 | + $parts = explode(':', $slug, 2); |
|
70 | 70 | |
71 | - if ( isset( $parts[1] ) ) { |
|
71 | + if (isset($parts[1])) { |
|
72 | 72 | $this->entity_slug = $parts[1]; |
73 | 73 | } else { |
74 | 74 | $this->entity_slug = $slug; |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | $this->get_entity_slug() |
111 | 111 | ); |
112 | 112 | |
113 | - if ( $entity instanceof WordPoints_Entity ) { |
|
114 | - $entity->set_the_value( $this->get_value() ); |
|
113 | + if ($entity instanceof WordPoints_Entity) { |
|
114 | + $entity->set_the_value($this->get_value()); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | return $entity; |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function get_value() { |
128 | 128 | |
129 | - if ( $this->action instanceof WordPoints_Hook_ActionI ) { |
|
130 | - return $this->action->get_arg_value( $this->slug ); |
|
129 | + if ($this->action instanceof WordPoints_Hook_ActionI) { |
|
130 | + return $this->action->get_arg_value($this->slug); |
|
131 | 131 | } else { |
132 | 132 | return null; |
133 | 133 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | $entity = $this->get_entity(); |
146 | 146 | |
147 | - if ( ! $entity ) { |
|
147 | + if ( ! $entity) { |
|
148 | 148 | return $this->slug; |
149 | 149 | } |
150 | 150 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @since 1.0.0 |
19 | 19 | */ |
20 | 20 | public function get_title() { |
21 | - return __( 'Current Post', 'wordpoints' ); // TODO better title? |
|
21 | + return __('Current Post', 'wordpoints'); // TODO better title? |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function get_value() { |
28 | 28 | |
29 | - if ( ! is_main_query() ) { |
|
29 | + if ( ! is_main_query()) { |
|
30 | 30 | return false; |
31 | 31 | } |
32 | 32 | |
33 | 33 | $object = get_queried_object(); |
34 | 34 | |
35 | - if ( $object instanceof WP_Post ) { |
|
35 | + if ($object instanceof WP_Post) { |
|
36 | 36 | return $object; |
37 | 37 | } else { |
38 | 38 | return false; |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * @since 1.0.0 |
26 | 26 | */ |
27 | 27 | public function get_title() { |
28 | - return __( 'Visitor', 'wordpoints' ); |
|
28 | + return __('Visitor', 'wordpoints'); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 |
@@ -23,33 +23,33 @@ discard block |
||
23 | 23 | WordPoints_Hook_Reaction_Validator $validator |
24 | 24 | ) { |
25 | 25 | |
26 | - if ( ! isset( $settings['value'] ) || '' === $settings['value'] ) { |
|
26 | + if ( ! isset($settings['value']) || '' === $settings['value']) { |
|
27 | 27 | |
28 | 28 | $settings_fields = $this->get_settings_fields(); |
29 | 29 | |
30 | 30 | $validator->add_error( |
31 | 31 | sprintf( |
32 | - __( '%s is required.', 'wordpoints' ) |
|
32 | + __('%s is required.', 'wordpoints') |
|
33 | 33 | , $settings_fields['value']['label'] |
34 | 34 | ) |
35 | 35 | , 'value' |
36 | 36 | ); |
37 | 37 | |
38 | - } elseif ( $arg instanceof WordPoints_Entity_Attr ) { |
|
38 | + } elseif ($arg instanceof WordPoints_Entity_Attr) { |
|
39 | 39 | |
40 | 40 | $data_types = wordpoints_apps()->data_types; |
41 | 41 | |
42 | - $data_type = $data_types->get( $arg->get_data_type() ); |
|
42 | + $data_type = $data_types->get($arg->get_data_type()); |
|
43 | 43 | |
44 | 44 | // If this data type isn't recognized, that's probably OK. Validation is |
45 | 45 | // just to help the user know that they've made a mistake anyway. |
46 | - if ( ! ( $data_type instanceof WordPoints_Data_TypeI ) ) { |
|
46 | + if ( ! ($data_type instanceof WordPoints_Data_TypeI)) { |
|
47 | 47 | return $settings; |
48 | 48 | } |
49 | 49 | |
50 | - $validated_value = $data_type->validate_value( $settings['value'] ); |
|
50 | + $validated_value = $data_type->validate_value($settings['value']); |
|
51 | 51 | |
52 | - if ( is_wp_error( $validated_value ) ) { |
|
52 | + if (is_wp_error($validated_value)) { |
|
53 | 53 | |
54 | 54 | $settings_fields = $this->get_settings_fields(); |
55 | 55 | |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | |
67 | 67 | $settings['value'] = $validated_value; |
68 | 68 | |
69 | - } elseif ( $arg instanceof WordPoints_Entity ) { |
|
69 | + } elseif ($arg instanceof WordPoints_Entity) { |
|
70 | 70 | |
71 | - if ( ! $arg->exists( $settings['value'] ) ) { |
|
71 | + if ( ! $arg->exists($settings['value'])) { |
|
72 | 72 | $validator->add_error( |
73 | 73 | sprintf( |
74 | 74 | // translators: 1. item type, 2. item ID/slug. |
75 | - __( '%1$s “%2$s” not found.', 'wordpoints' ) |
|
75 | + __('%1$s “%2$s” not found.', 'wordpoints') |
|
76 | 76 | , $arg->get_title() |
77 | 77 | , $settings['value'] |
78 | 78 | ) |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @since 1.0.0 |
19 | 19 | */ |
20 | 20 | public function get_title() { |
21 | - return __( 'Equals', 'wordpoints' ); |
|
21 | + return __('Equals', 'wordpoints'); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | return array( |
30 | 30 | 'value' => array( |
31 | 31 | 'type' => 'text', |
32 | - 'label' => __( 'Equals', 'wordpoints' ), // TODO |
|
32 | + 'label' => __('Equals', 'wordpoints'), // TODO |
|
33 | 33 | ), |
34 | 34 | ); |
35 | 35 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | /** |
38 | 38 | * @since 1.0.0 |
39 | 39 | */ |
40 | - public function is_met( array $settings, WordPoints_Hook_Event_Args $args ) { |
|
40 | + public function is_met(array $settings, WordPoints_Hook_Event_Args $args) { |
|
41 | 41 | |
42 | 42 | return $settings['value'] === $args->get_current()->get_the_value(); |
43 | 43 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @since 1.0.0 |
19 | 19 | */ |
20 | 20 | public function get_title() { |
21 | - return __( 'Contains', 'wordpoints' ); |
|
21 | + return __('Contains', 'wordpoints'); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | return array( |
29 | 29 | 'value' => array( |
30 | 30 | 'type' => 'text', |
31 | - 'label' => __( 'Contains', 'wordpoints' ), // TODO |
|
31 | + 'label' => __('Contains', 'wordpoints'), // TODO |
|
32 | 32 | 'required' => true, |
33 | 33 | ), |
34 | 34 | ); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | /** |
38 | 38 | * @since 1.0.0 |
39 | 39 | */ |
40 | - public function is_met( array $settings, WordPoints_Hook_Event_Args $args ) { |
|
40 | + public function is_met(array $settings, WordPoints_Hook_Event_Args $args) { |
|
41 | 41 | |
42 | 42 | return false !== strpos( |
43 | 43 | $args->get_current()->get_the_value() |
@@ -64,7 +64,7 @@ |
||
64 | 64 | * |
65 | 65 | * @return bool Whether this condition is met. |
66 | 66 | */ |
67 | - public function is_met( array $settings, WordPoints_Hook_Event_Args $args ); |
|
67 | + public function is_met(array $settings, WordPoints_Hook_Event_Args $args); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // EOF |
@@ -26,7 +26,7 @@ |
||
26 | 26 | /** |
27 | 27 | * @since 1.0.0 |
28 | 28 | */ |
29 | - public function __construct( $slug ) { |
|
29 | + public function __construct($slug) { |
|
30 | 30 | |
31 | 31 | $this->slug = $slug; |
32 | 32 | } |