@@ -10,122 +10,122 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // auto-generated { |
13 | -require_once( dirname( __FILE__ ) . 'app.php' ); |
|
14 | -require_once( dirname( __FILE__ ) . 'app/registry.php' ); |
|
15 | -require_once( dirname( __FILE__ ) . 'class/autoloader.php' ); |
|
16 | -require_once( dirname( __FILE__ ) . 'class/registry.php' ); |
|
17 | -require_once( dirname( __FILE__ ) . 'class/registry/children.php' ); |
|
18 | -require_once( dirname( __FILE__ ) . 'class/registry/childreni.php' ); |
|
19 | -require_once( dirname( __FILE__ ) . 'class/registry/persistent.php' ); |
|
20 | -require_once( dirname( __FILE__ ) . 'class/registryi.php' ); |
|
21 | -require_once( dirname( __FILE__ ) . 'data/type.php' ); |
|
22 | -require_once( dirname( __FILE__ ) . 'data/type/integer.php' ); |
|
23 | -require_once( dirname( __FILE__ ) . 'data/type/text.php' ); |
|
24 | -require_once( dirname( __FILE__ ) . 'data/typei.php' ); |
|
25 | -require_once( dirname( __FILE__ ) . 'db/query.php' ); |
|
26 | -require_once( dirname( __FILE__ ) . 'entity.php' ); |
|
27 | -require_once( dirname( __FILE__ ) . 'entity/array.php' ); |
|
28 | -require_once( dirname( __FILE__ ) . 'entity/attr.php' ); |
|
29 | -require_once( dirname( __FILE__ ) . 'entity/attr/field.php' ); |
|
30 | -require_once( dirname( __FILE__ ) . 'entity/change.php' ); |
|
31 | -require_once( dirname( __FILE__ ) . 'entity/childi.php' ); |
|
32 | -require_once( dirname( __FILE__ ) . 'entity/comment.php' ); |
|
33 | -require_once( dirname( __FILE__ ) . 'entity/comment/author.php' ); |
|
34 | -require_once( dirname( __FILE__ ) . 'entity/comment/post.php' ); |
|
35 | -require_once( dirname( __FILE__ ) . 'entity/context.php' ); |
|
36 | -require_once( dirname( __FILE__ ) . 'entity/context/network.php' ); |
|
37 | -require_once( dirname( __FILE__ ) . 'entity/context/site.php' ); |
|
38 | -require_once( dirname( __FILE__ ) . 'entity/enumerablei.php' ); |
|
39 | -require_once( dirname( __FILE__ ) . 'entity/hierarchy.php' ); |
|
40 | -require_once( dirname( __FILE__ ) . 'entity/hierarchyi.php' ); |
|
41 | -require_once( dirname( __FILE__ ) . 'entity/parenti.php' ); |
|
42 | -require_once( dirname( __FILE__ ) . 'entity/post.php' ); |
|
43 | -require_once( dirname( __FILE__ ) . 'entity/post/author.php' ); |
|
44 | -require_once( dirname( __FILE__ ) . 'entity/post/content.php' ); |
|
45 | -require_once( dirname( __FILE__ ) . 'entity/post/terms.php' ); |
|
46 | -require_once( dirname( __FILE__ ) . 'entity/post/type.php' ); |
|
47 | -require_once( dirname( __FILE__ ) . 'entity/post/type/name.php' ); |
|
48 | -require_once( dirname( __FILE__ ) . 'entity/post/type/relationship.php' ); |
|
49 | -require_once( dirname( __FILE__ ) . 'entity/relationship.php' ); |
|
50 | -require_once( dirname( __FILE__ ) . 'entity/relationship/dynamic.php' ); |
|
51 | -require_once( dirname( __FILE__ ) . 'entity/relationship/stored/field.php' ); |
|
52 | -require_once( dirname( __FILE__ ) . 'entity/restricted/visibilityi.php' ); |
|
53 | -require_once( dirname( __FILE__ ) . 'entity/site.php' ); |
|
54 | -require_once( dirname( __FILE__ ) . 'entity/stored/array.php' ); |
|
55 | -require_once( dirname( __FILE__ ) . 'entity/stored/db/table.php' ); |
|
56 | -require_once( dirname( __FILE__ ) . 'entity/term.php' ); |
|
57 | -require_once( dirname( __FILE__ ) . 'entity/term/id.php' ); |
|
58 | -require_once( dirname( __FILE__ ) . 'entity/user.php' ); |
|
59 | -require_once( dirname( __FILE__ ) . 'entity/user/role.php' ); |
|
60 | -require_once( dirname( __FILE__ ) . 'entity/user/role/name.php' ); |
|
61 | -require_once( dirname( __FILE__ ) . 'entity/user/roles.php' ); |
|
62 | -require_once( dirname( __FILE__ ) . 'entityish.php' ); |
|
63 | -require_once( dirname( __FILE__ ) . 'entityish/storedi.php' ); |
|
64 | -require_once( dirname( __FILE__ ) . 'entityishi.php' ); |
|
65 | -require_once( dirname( __FILE__ ) . 'hierarchy.php' ); |
|
66 | -require_once( dirname( __FILE__ ) . 'hook/action.php' ); |
|
67 | -require_once( dirname( __FILE__ ) . 'hook/action/comment/new.php' ); |
|
68 | -require_once( dirname( __FILE__ ) . 'hook/action/post/publish.php' ); |
|
69 | -require_once( dirname( __FILE__ ) . 'hook/actioni.php' ); |
|
70 | -require_once( dirname( __FILE__ ) . 'hook/actions.php' ); |
|
71 | -require_once( dirname( __FILE__ ) . 'hook/arg.php' ); |
|
72 | -require_once( dirname( __FILE__ ) . 'hook/arg/current/post.php' ); |
|
73 | -require_once( dirname( __FILE__ ) . 'hook/arg/current/site.php' ); |
|
74 | -require_once( dirname( __FILE__ ) . 'hook/arg/current/user.php' ); |
|
75 | -require_once( dirname( __FILE__ ) . 'hook/arg/dynamic.php' ); |
|
76 | -require_once( dirname( __FILE__ ) . 'hook/condition.php' ); |
|
77 | -require_once( dirname( __FILE__ ) . 'hook/condition/entity/array/contains.php' ); |
|
78 | -require_once( dirname( __FILE__ ) . 'hook/condition/equals.php' ); |
|
79 | -require_once( dirname( __FILE__ ) . 'hook/condition/string/contains.php' ); |
|
80 | -require_once( dirname( __FILE__ ) . 'hook/conditioni.php' ); |
|
81 | -require_once( dirname( __FILE__ ) . 'hook/event.php' ); |
|
82 | -require_once( dirname( __FILE__ ) . 'hook/event/args.php' ); |
|
83 | -require_once( dirname( __FILE__ ) . 'hook/event/comment/leave.php' ); |
|
84 | -require_once( dirname( __FILE__ ) . 'hook/event/dynamic.php' ); |
|
85 | -require_once( dirname( __FILE__ ) . 'hook/event/media/upload.php' ); |
|
86 | -require_once( dirname( __FILE__ ) . 'hook/event/post/publish.php' ); |
|
87 | -require_once( dirname( __FILE__ ) . 'hook/event/reversingi.php' ); |
|
88 | -require_once( dirname( __FILE__ ) . 'hook/event/user/register.php' ); |
|
89 | -require_once( dirname( __FILE__ ) . 'hook/event/user/visit.php' ); |
|
90 | -require_once( dirname( __FILE__ ) . 'hook/eventi.php' ); |
|
91 | -require_once( dirname( __FILE__ ) . 'hook/events.php' ); |
|
92 | -require_once( dirname( __FILE__ ) . 'hook/extension.php' ); |
|
93 | -require_once( dirname( __FILE__ ) . 'hook/extension/blocker.php' ); |
|
94 | -require_once( dirname( __FILE__ ) . 'hook/extension/conditions.php' ); |
|
95 | -require_once( dirname( __FILE__ ) . 'hook/extension/hit/listeneri.php' ); |
|
96 | -require_once( dirname( __FILE__ ) . 'hook/extension/miss/listeneri.php' ); |
|
97 | -require_once( dirname( __FILE__ ) . 'hook/extension/periods.php' ); |
|
98 | -require_once( dirname( __FILE__ ) . 'hook/extension/repeat/blocker.php' ); |
|
99 | -require_once( dirname( __FILE__ ) . 'hook/extension/reversals.php' ); |
|
100 | -require_once( dirname( __FILE__ ) . 'hook/extension/reversals/legacy/points.php' ); |
|
101 | -require_once( dirname( __FILE__ ) . 'hook/fire.php' ); |
|
102 | -require_once( dirname( __FILE__ ) . 'hook/hit/logger.php' ); |
|
103 | -require_once( dirname( __FILE__ ) . 'hook/hit/query.php' ); |
|
104 | -require_once( dirname( __FILE__ ) . 'hook/reaction.php' ); |
|
105 | -require_once( dirname( __FILE__ ) . 'hook/reaction/options.php' ); |
|
106 | -require_once( dirname( __FILE__ ) . 'hook/reaction/store.php' ); |
|
107 | -require_once( dirname( __FILE__ ) . 'hook/reaction/store/options.php' ); |
|
108 | -require_once( dirname( __FILE__ ) . 'hook/reaction/store/options/network.php' ); |
|
109 | -require_once( dirname( __FILE__ ) . 'hook/reaction/storei.php' ); |
|
110 | -require_once( dirname( __FILE__ ) . 'hook/reaction/validator.php' ); |
|
111 | -require_once( dirname( __FILE__ ) . 'hook/reactioni.php' ); |
|
112 | -require_once( dirname( __FILE__ ) . 'hook/reactor.php' ); |
|
113 | -require_once( dirname( __FILE__ ) . 'hook/reactor/points.php' ); |
|
114 | -require_once( dirname( __FILE__ ) . 'hook/reactor/points/legacy.php' ); |
|
115 | -require_once( dirname( __FILE__ ) . 'hook/retroactive/conditions.php' ); |
|
116 | -require_once( dirname( __FILE__ ) . 'hook/retroactive/query.php' ); |
|
117 | -require_once( dirname( __FILE__ ) . 'hook/retroactive/query/modifieri.php' ); |
|
118 | -require_once( dirname( __FILE__ ) . 'hook/retroactive/queryable.php' ); |
|
119 | -require_once( dirname( __FILE__ ) . 'hook/retroactive/queryi.php' ); |
|
120 | -require_once( dirname( __FILE__ ) . 'hook/router.php' ); |
|
121 | -require_once( dirname( __FILE__ ) . 'hook/settings.php' ); |
|
122 | -require_once( dirname( __FILE__ ) . 'hook/settingsi.php' ); |
|
123 | -require_once( dirname( __FILE__ ) . 'hook/validator/exception.php' ); |
|
124 | -require_once( dirname( __FILE__ ) . 'hooks.php' ); |
|
125 | -require_once( dirname( __FILE__ ) . 'query/builder/db/mysql.php' ); |
|
126 | -require_once( dirname( __FILE__ ) . 'spec.php' ); |
|
127 | -require_once( dirname( __FILE__ ) . 'specedi.php' ); |
|
128 | -require_once( dirname( __FILE__ ) . 'wpdb/wrapper.php' ); |
|
13 | +require_once(dirname(__FILE__).'app.php'); |
|
14 | +require_once(dirname(__FILE__).'app/registry.php'); |
|
15 | +require_once(dirname(__FILE__).'class/autoloader.php'); |
|
16 | +require_once(dirname(__FILE__).'class/registry.php'); |
|
17 | +require_once(dirname(__FILE__).'class/registry/children.php'); |
|
18 | +require_once(dirname(__FILE__).'class/registry/childreni.php'); |
|
19 | +require_once(dirname(__FILE__).'class/registry/persistent.php'); |
|
20 | +require_once(dirname(__FILE__).'class/registryi.php'); |
|
21 | +require_once(dirname(__FILE__).'data/type.php'); |
|
22 | +require_once(dirname(__FILE__).'data/type/integer.php'); |
|
23 | +require_once(dirname(__FILE__).'data/type/text.php'); |
|
24 | +require_once(dirname(__FILE__).'data/typei.php'); |
|
25 | +require_once(dirname(__FILE__).'db/query.php'); |
|
26 | +require_once(dirname(__FILE__).'entity.php'); |
|
27 | +require_once(dirname(__FILE__).'entity/array.php'); |
|
28 | +require_once(dirname(__FILE__).'entity/attr.php'); |
|
29 | +require_once(dirname(__FILE__).'entity/attr/field.php'); |
|
30 | +require_once(dirname(__FILE__).'entity/change.php'); |
|
31 | +require_once(dirname(__FILE__).'entity/childi.php'); |
|
32 | +require_once(dirname(__FILE__).'entity/comment.php'); |
|
33 | +require_once(dirname(__FILE__).'entity/comment/author.php'); |
|
34 | +require_once(dirname(__FILE__).'entity/comment/post.php'); |
|
35 | +require_once(dirname(__FILE__).'entity/context.php'); |
|
36 | +require_once(dirname(__FILE__).'entity/context/network.php'); |
|
37 | +require_once(dirname(__FILE__).'entity/context/site.php'); |
|
38 | +require_once(dirname(__FILE__).'entity/enumerablei.php'); |
|
39 | +require_once(dirname(__FILE__).'entity/hierarchy.php'); |
|
40 | +require_once(dirname(__FILE__).'entity/hierarchyi.php'); |
|
41 | +require_once(dirname(__FILE__).'entity/parenti.php'); |
|
42 | +require_once(dirname(__FILE__).'entity/post.php'); |
|
43 | +require_once(dirname(__FILE__).'entity/post/author.php'); |
|
44 | +require_once(dirname(__FILE__).'entity/post/content.php'); |
|
45 | +require_once(dirname(__FILE__).'entity/post/terms.php'); |
|
46 | +require_once(dirname(__FILE__).'entity/post/type.php'); |
|
47 | +require_once(dirname(__FILE__).'entity/post/type/name.php'); |
|
48 | +require_once(dirname(__FILE__).'entity/post/type/relationship.php'); |
|
49 | +require_once(dirname(__FILE__).'entity/relationship.php'); |
|
50 | +require_once(dirname(__FILE__).'entity/relationship/dynamic.php'); |
|
51 | +require_once(dirname(__FILE__).'entity/relationship/stored/field.php'); |
|
52 | +require_once(dirname(__FILE__).'entity/restricted/visibilityi.php'); |
|
53 | +require_once(dirname(__FILE__).'entity/site.php'); |
|
54 | +require_once(dirname(__FILE__).'entity/stored/array.php'); |
|
55 | +require_once(dirname(__FILE__).'entity/stored/db/table.php'); |
|
56 | +require_once(dirname(__FILE__).'entity/term.php'); |
|
57 | +require_once(dirname(__FILE__).'entity/term/id.php'); |
|
58 | +require_once(dirname(__FILE__).'entity/user.php'); |
|
59 | +require_once(dirname(__FILE__).'entity/user/role.php'); |
|
60 | +require_once(dirname(__FILE__).'entity/user/role/name.php'); |
|
61 | +require_once(dirname(__FILE__).'entity/user/roles.php'); |
|
62 | +require_once(dirname(__FILE__).'entityish.php'); |
|
63 | +require_once(dirname(__FILE__).'entityish/storedi.php'); |
|
64 | +require_once(dirname(__FILE__).'entityishi.php'); |
|
65 | +require_once(dirname(__FILE__).'hierarchy.php'); |
|
66 | +require_once(dirname(__FILE__).'hook/action.php'); |
|
67 | +require_once(dirname(__FILE__).'hook/action/comment/new.php'); |
|
68 | +require_once(dirname(__FILE__).'hook/action/post/publish.php'); |
|
69 | +require_once(dirname(__FILE__).'hook/actioni.php'); |
|
70 | +require_once(dirname(__FILE__).'hook/actions.php'); |
|
71 | +require_once(dirname(__FILE__).'hook/arg.php'); |
|
72 | +require_once(dirname(__FILE__).'hook/arg/current/post.php'); |
|
73 | +require_once(dirname(__FILE__).'hook/arg/current/site.php'); |
|
74 | +require_once(dirname(__FILE__).'hook/arg/current/user.php'); |
|
75 | +require_once(dirname(__FILE__).'hook/arg/dynamic.php'); |
|
76 | +require_once(dirname(__FILE__).'hook/condition.php'); |
|
77 | +require_once(dirname(__FILE__).'hook/condition/entity/array/contains.php'); |
|
78 | +require_once(dirname(__FILE__).'hook/condition/equals.php'); |
|
79 | +require_once(dirname(__FILE__).'hook/condition/string/contains.php'); |
|
80 | +require_once(dirname(__FILE__).'hook/conditioni.php'); |
|
81 | +require_once(dirname(__FILE__).'hook/event.php'); |
|
82 | +require_once(dirname(__FILE__).'hook/event/args.php'); |
|
83 | +require_once(dirname(__FILE__).'hook/event/comment/leave.php'); |
|
84 | +require_once(dirname(__FILE__).'hook/event/dynamic.php'); |
|
85 | +require_once(dirname(__FILE__).'hook/event/media/upload.php'); |
|
86 | +require_once(dirname(__FILE__).'hook/event/post/publish.php'); |
|
87 | +require_once(dirname(__FILE__).'hook/event/reversingi.php'); |
|
88 | +require_once(dirname(__FILE__).'hook/event/user/register.php'); |
|
89 | +require_once(dirname(__FILE__).'hook/event/user/visit.php'); |
|
90 | +require_once(dirname(__FILE__).'hook/eventi.php'); |
|
91 | +require_once(dirname(__FILE__).'hook/events.php'); |
|
92 | +require_once(dirname(__FILE__).'hook/extension.php'); |
|
93 | +require_once(dirname(__FILE__).'hook/extension/blocker.php'); |
|
94 | +require_once(dirname(__FILE__).'hook/extension/conditions.php'); |
|
95 | +require_once(dirname(__FILE__).'hook/extension/hit/listeneri.php'); |
|
96 | +require_once(dirname(__FILE__).'hook/extension/miss/listeneri.php'); |
|
97 | +require_once(dirname(__FILE__).'hook/extension/periods.php'); |
|
98 | +require_once(dirname(__FILE__).'hook/extension/repeat/blocker.php'); |
|
99 | +require_once(dirname(__FILE__).'hook/extension/reversals.php'); |
|
100 | +require_once(dirname(__FILE__).'hook/extension/reversals/legacy/points.php'); |
|
101 | +require_once(dirname(__FILE__).'hook/fire.php'); |
|
102 | +require_once(dirname(__FILE__).'hook/hit/logger.php'); |
|
103 | +require_once(dirname(__FILE__).'hook/hit/query.php'); |
|
104 | +require_once(dirname(__FILE__).'hook/reaction.php'); |
|
105 | +require_once(dirname(__FILE__).'hook/reaction/options.php'); |
|
106 | +require_once(dirname(__FILE__).'hook/reaction/store.php'); |
|
107 | +require_once(dirname(__FILE__).'hook/reaction/store/options.php'); |
|
108 | +require_once(dirname(__FILE__).'hook/reaction/store/options/network.php'); |
|
109 | +require_once(dirname(__FILE__).'hook/reaction/storei.php'); |
|
110 | +require_once(dirname(__FILE__).'hook/reaction/validator.php'); |
|
111 | +require_once(dirname(__FILE__).'hook/reactioni.php'); |
|
112 | +require_once(dirname(__FILE__).'hook/reactor.php'); |
|
113 | +require_once(dirname(__FILE__).'hook/reactor/points.php'); |
|
114 | +require_once(dirname(__FILE__).'hook/reactor/points/legacy.php'); |
|
115 | +require_once(dirname(__FILE__).'hook/retroactive/conditions.php'); |
|
116 | +require_once(dirname(__FILE__).'hook/retroactive/query.php'); |
|
117 | +require_once(dirname(__FILE__).'hook/retroactive/query/modifieri.php'); |
|
118 | +require_once(dirname(__FILE__).'hook/retroactive/queryable.php'); |
|
119 | +require_once(dirname(__FILE__).'hook/retroactive/queryi.php'); |
|
120 | +require_once(dirname(__FILE__).'hook/router.php'); |
|
121 | +require_once(dirname(__FILE__).'hook/settings.php'); |
|
122 | +require_once(dirname(__FILE__).'hook/settingsi.php'); |
|
123 | +require_once(dirname(__FILE__).'hook/validator/exception.php'); |
|
124 | +require_once(dirname(__FILE__).'hooks.php'); |
|
125 | +require_once(dirname(__FILE__).'query/builder/db/mysql.php'); |
|
126 | +require_once(dirname(__FILE__).'spec.php'); |
|
127 | +require_once(dirname(__FILE__).'specedi.php'); |
|
128 | +require_once(dirname(__FILE__).'wpdb/wrapper.php'); |
|
129 | 129 | // } |
130 | 130 | |
131 | 131 | // EOF |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | /** |
28 | 28 | * @since 1.0.0 |
29 | 29 | */ |
30 | - protected $action_types = array( 'fire', 'toggle_on', 'toggle_off' ); |
|
30 | + protected $action_types = array('fire', 'toggle_on', 'toggle_off'); |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * @since 1.0.0 |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function get_settings_fields() { |
60 | 60 | |
61 | - $this->settings_fields['points']['label'] = _x( 'Points', 'form label', 'wordpoints' ); |
|
62 | - $this->settings_fields['log_text']['label'] = _x( 'Log Text', 'form label', 'wordpoints' ); |
|
63 | - $this->settings_fields['description']['label'] = _x( 'Description', 'form label', 'wordpoints' ); |
|
61 | + $this->settings_fields['points']['label'] = _x('Points', 'form label', 'wordpoints'); |
|
62 | + $this->settings_fields['log_text']['label'] = _x('Log Text', 'form label', 'wordpoints'); |
|
63 | + $this->settings_fields['description']['label'] = _x('Description', 'form label', 'wordpoints'); |
|
64 | 64 | |
65 | 65 | return parent::get_settings_fields(); |
66 | 66 | } |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | |
73 | 73 | $data = parent::get_ui_script_data(); |
74 | 74 | |
75 | - $data['target_label'] = __( 'Award To', 'wordpoints' ); |
|
76 | - $data['periods_label'] = __( 'Award each user no more than once per:', 'wordpoints' ); |
|
75 | + $data['target_label'] = __('Award To', 'wordpoints'); |
|
76 | + $data['periods_label'] = __('Award each user no more than once per:', 'wordpoints'); |
|
77 | 77 | |
78 | 78 | return $data; |
79 | 79 | } |
@@ -87,23 +87,23 @@ discard block |
||
87 | 87 | WordPoints_Hook_Event_Args $event_args |
88 | 88 | ) { |
89 | 89 | |
90 | - if ( ! isset( $settings['points'] ) || false === wordpoints_int( $settings['points'] ) ) { |
|
91 | - $validator->add_error( __( 'Points must be an integer.', 'wordpoints' ), 'points' ); |
|
90 | + if ( ! isset($settings['points']) || false === wordpoints_int($settings['points'])) { |
|
91 | + $validator->add_error(__('Points must be an integer.', 'wordpoints'), 'points'); |
|
92 | 92 | } |
93 | 93 | |
94 | - if ( ! isset( $settings['points_type'] ) || ! wordpoints_is_points_type( $settings['points_type'] ) ) { |
|
95 | - $validator->add_error( __( 'Invalid points type.', 'wordpoints' ), 'points_type' ); |
|
94 | + if ( ! isset($settings['points_type']) || ! wordpoints_is_points_type($settings['points_type'])) { |
|
95 | + $validator->add_error(__('Invalid points type.', 'wordpoints'), 'points_type'); |
|
96 | 96 | } |
97 | 97 | |
98 | - if ( ! isset( $settings['description'] ) ) { |
|
99 | - $validator->add_error( __( 'Description is required.', 'wordpoints' ), 'description' ); |
|
98 | + if ( ! isset($settings['description'])) { |
|
99 | + $validator->add_error(__('Description is required.', 'wordpoints'), 'description'); |
|
100 | 100 | } |
101 | 101 | |
102 | - if ( ! isset( $settings['log_text'] ) ) { |
|
103 | - $validator->add_error( __( 'Log Text is required.', 'wordpoints' ), 'log_text' ); |
|
102 | + if ( ! isset($settings['log_text'])) { |
|
103 | + $validator->add_error(__('Log Text is required.', 'wordpoints'), 'log_text'); |
|
104 | 104 | } |
105 | 105 | |
106 | - return parent::validate_settings( $settings, $validator, $event_args ); |
|
106 | + return parent::validate_settings($settings, $validator, $event_args); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -114,58 +114,58 @@ discard block |
||
114 | 114 | array $settings |
115 | 115 | ) { |
116 | 116 | |
117 | - parent::update_settings( $reaction, $settings ); |
|
117 | + parent::update_settings($reaction, $settings); |
|
118 | 118 | |
119 | - $reaction->update_meta( 'points', $settings['points'] ); |
|
120 | - $reaction->update_meta( 'points_type', $settings['points_type'] ); |
|
121 | - $reaction->update_meta( 'description', $settings['description'] ); |
|
122 | - $reaction->update_meta( 'log_text', $settings['log_text'] ); |
|
119 | + $reaction->update_meta('points', $settings['points']); |
|
120 | + $reaction->update_meta('points_type', $settings['points_type']); |
|
121 | + $reaction->update_meta('description', $settings['description']); |
|
122 | + $reaction->update_meta('log_text', $settings['log_text']); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
126 | 126 | * @since 1.0.0 |
127 | 127 | */ |
128 | - public function hit( WordPoints_Hook_Fire $fire ) { |
|
128 | + public function hit(WordPoints_Hook_Fire $fire) { |
|
129 | 129 | |
130 | - if ( 'toggle_off' === $fire->action_type ) { |
|
131 | - $this->reverse_hit( $fire ); |
|
130 | + if ('toggle_off' === $fire->action_type) { |
|
131 | + $this->reverse_hit($fire); |
|
132 | 132 | return; |
133 | 133 | } |
134 | 134 | |
135 | 135 | $reaction = $fire->reaction; |
136 | 136 | |
137 | 137 | $target = $fire->event_args->get_from_hierarchy( |
138 | - $reaction->get_meta( 'target' ) |
|
138 | + $reaction->get_meta('target') |
|
139 | 139 | ); |
140 | 140 | |
141 | - if ( ! $target instanceof WordPoints_Entity ) { |
|
141 | + if ( ! $target instanceof WordPoints_Entity) { |
|
142 | 142 | return; |
143 | 143 | } |
144 | 144 | |
145 | - $meta = array( 'hook_hit_id' => $fire->hit_id ); |
|
145 | + $meta = array('hook_hit_id' => $fire->hit_id); |
|
146 | 146 | |
147 | - foreach ( $fire->event_args->get_entities() as $entity ) { |
|
148 | - $meta[ $entity->get_slug() ] = $entity->get_the_id(); |
|
147 | + foreach ($fire->event_args->get_entities() as $entity) { |
|
148 | + $meta[$entity->get_slug()] = $entity->get_the_id(); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | wordpoints_alter_points( |
152 | 152 | $target->get_the_id() |
153 | - , $reaction->get_meta( 'points' ) |
|
154 | - , $reaction->get_meta( 'points_type' ) |
|
153 | + , $reaction->get_meta('points') |
|
154 | + , $reaction->get_meta('points_type') |
|
155 | 155 | , $reaction->get_event_slug() |
156 | 156 | , $meta |
157 | - , $reaction->get_meta( 'log_text' ) |
|
157 | + , $reaction->get_meta('log_text') |
|
158 | 158 | ); |
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
162 | 162 | * @since 1.0.0 |
163 | 163 | */ |
164 | - public function reverse_hit( WordPoints_Hook_Fire $fire ) { |
|
164 | + public function reverse_hit(WordPoints_Hook_Fire $fire) { |
|
165 | 165 | |
166 | - $hit_ids = $this->get_hit_ids_to_be_reversed( $fire ); |
|
166 | + $hit_ids = $this->get_hit_ids_to_be_reversed($fire); |
|
167 | 167 | |
168 | - if ( empty( $hit_ids ) ) { |
|
168 | + if (empty($hit_ids)) { |
|
169 | 169 | return; |
170 | 170 | } |
171 | 171 | |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | |
184 | 184 | $logs = $query->get(); |
185 | 185 | |
186 | - if ( ! $logs ) { |
|
186 | + if ( ! $logs) { |
|
187 | 187 | return; |
188 | 188 | } |
189 | 189 | |
190 | - $this->reverse_logs( $logs, $fire ); |
|
190 | + $this->reverse_logs($logs, $fire); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -199,10 +199,10 @@ discard block |
||
199 | 199 | * |
200 | 200 | * @return array The IDs of the hits to be reversed. |
201 | 201 | */ |
202 | - protected function get_hit_ids_to_be_reversed( WordPoints_Hook_Fire $fire ) { |
|
202 | + protected function get_hit_ids_to_be_reversed(WordPoints_Hook_Fire $fire) { |
|
203 | 203 | |
204 | 204 | // We closely integrate with the reversals extension to get the hit IDs. |
205 | - if ( ! isset( $fire->data['reversals']['hit_ids'] ) ) { |
|
205 | + if ( ! isset($fire->data['reversals']['hit_ids'])) { |
|
206 | 206 | return array(); |
207 | 207 | } |
208 | 208 | |
@@ -217,28 +217,28 @@ discard block |
||
217 | 217 | * @param object[] $logs The logs to reverse. |
218 | 218 | * @param WordPoints_Hook_Fire $fire The fire object. |
219 | 219 | */ |
220 | - protected function reverse_logs( $logs, WordPoints_Hook_Fire $fire ) { |
|
220 | + protected function reverse_logs($logs, WordPoints_Hook_Fire $fire) { |
|
221 | 221 | |
222 | 222 | $event = wordpoints_hooks()->events->get( |
223 | 223 | $fire->reaction->get_event_slug() |
224 | 224 | ); |
225 | 225 | |
226 | - if ( $event instanceof WordPoints_Hook_Event_ReversingI ) { |
|
226 | + if ($event instanceof WordPoints_Hook_Event_ReversingI) { |
|
227 | 227 | |
228 | 228 | /* translators: 1: log text for transaction that is being reversed, 2: the reason that this is being reversed. */ |
229 | - $template = __( 'Reversed “%1$s” (%2$s)', 'wordpoints' ); |
|
229 | + $template = __('Reversed “%1$s” (%2$s)', 'wordpoints'); |
|
230 | 230 | |
231 | 231 | $event_description = $event->get_reversal_text(); |
232 | 232 | |
233 | 233 | } else { |
234 | 234 | |
235 | 235 | /* translators: 1: log text for transaction that is being reversed. */ |
236 | - $template = __( 'Reversed “%1$s”', 'wordpoints' ); |
|
236 | + $template = __('Reversed “%1$s”', 'wordpoints'); |
|
237 | 237 | |
238 | 238 | $event_description = ''; |
239 | 239 | } |
240 | 240 | |
241 | - foreach ( $logs as $log ) { |
|
241 | + foreach ($logs as $log) { |
|
242 | 242 | |
243 | 243 | $log_id = wordpoints_alter_points( |
244 | 244 | $log->user_id |
@@ -249,11 +249,11 @@ discard block |
||
249 | 249 | 'original_log_id' => $log->id, |
250 | 250 | 'hook_hit_id' => $fire->hit_id, |
251 | 251 | ) |
252 | - , sprintf( $template, $log->text, $event_description ) |
|
252 | + , sprintf($template, $log->text, $event_description) |
|
253 | 253 | ); |
254 | 254 | |
255 | 255 | // Mark the old log as reversed by this one. |
256 | - wordpoints_update_points_log_meta( $log->id, 'auto_reversed', $log_id ); |
|
256 | + wordpoints_update_points_log_meta($log->id, 'auto_reversed', $log_id); |
|
257 | 257 | } |
258 | 258 | } |
259 | 259 | } |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | array $settings |
28 | 28 | ) { |
29 | 29 | |
30 | - if ( isset( $settings['legacy_log_type'] ) ) { |
|
30 | + if (isset($settings['legacy_log_type'])) { |
|
31 | 31 | $reaction->update_meta( |
32 | 32 | 'legacy_log_type', |
33 | 33 | $settings['legacy_log_type'] |
34 | 34 | ); |
35 | 35 | } |
36 | 36 | |
37 | - parent::update_settings( $reaction, $settings ); |
|
37 | + parent::update_settings($reaction, $settings); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * @since 1.0.0 |
54 | 54 | */ |
55 | - public function reverse_hit( WordPoints_Hook_Fire $fire ) { |
|
55 | + public function reverse_hit(WordPoints_Hook_Fire $fire) { |
|
56 | 56 | |
57 | - if ( isset( $fire->data['reversals_legacy_points']['points_logs'] ) ) { |
|
57 | + if (isset($fire->data['reversals_legacy_points']['points_logs'])) { |
|
58 | 58 | |
59 | 59 | $this->reverse_logs( |
60 | 60 | $fire->data['reversals_legacy_points']['points_logs'] |
@@ -62,17 +62,17 @@ discard block |
||
62 | 62 | ); |
63 | 63 | |
64 | 64 | } else { |
65 | - parent::reverse_hit( $fire ); |
|
65 | + parent::reverse_hit($fire); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
70 | 70 | * @since 1.0.0 |
71 | 71 | */ |
72 | - protected function get_hit_ids_to_be_reversed( WordPoints_Hook_Fire $fire ) { |
|
72 | + protected function get_hit_ids_to_be_reversed(WordPoints_Hook_Fire $fire) { |
|
73 | 73 | |
74 | 74 | // We closely integrate with the legacy reversals extension to get the IDs. |
75 | - if ( ! isset( $fire->data['reversals_legacy_points']['hit_ids'] ) ) { |
|
75 | + if ( ! isset($fire->data['reversals_legacy_points']['hit_ids'])) { |
|
76 | 76 | return array(); |
77 | 77 | } |
78 | 78 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function get_title() { |
23 | 23 | |
24 | - return __( 'Upload Media', 'wordpoints' ); |
|
24 | + return __('Upload Media', 'wordpoints'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function get_description() { |
31 | 31 | |
32 | - return __( 'When a file is uploaded to the Media Library.', 'wordpoints' ); |
|
32 | + return __('When a file is uploaded to the Media Library.', 'wordpoints'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
36 | 36 | * @since 1.0.0 |
37 | 37 | */ |
38 | 38 | public function get_reversal_text() { |
39 | - return __( 'Media file deleted.', 'wordpoints' ); |
|
39 | + return __('Media file deleted.', 'wordpoints'); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 |
@@ -20,21 +20,21 @@ |
||
20 | 20 | * @since 1.0.0 |
21 | 21 | */ |
22 | 22 | public function get_title() { |
23 | - return __( 'Register', 'wordpoints' ); |
|
23 | + return __('Register', 'wordpoints'); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
27 | 27 | * @since 1.0.0 |
28 | 28 | */ |
29 | 29 | public function get_description() { |
30 | - return __( 'Registering.', 'wordpoints' ); |
|
30 | + return __('Registering.', 'wordpoints'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
34 | 34 | * @since 1.0.0 |
35 | 35 | */ |
36 | 36 | public function get_reversal_text() { |
37 | - return __( 'User removed.', 'wordpoints' ); |
|
37 | + return __('User removed.', 'wordpoints'); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 |
@@ -26,20 +26,20 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function get_title() { |
28 | 28 | |
29 | - $parsed = wordpoints_parse_dynamic_slug( $this->slug ); |
|
29 | + $parsed = wordpoints_parse_dynamic_slug($this->slug); |
|
30 | 30 | |
31 | - switch ( $parsed['dynamic'] ) { |
|
31 | + switch ($parsed['dynamic']) { |
|
32 | 32 | |
33 | 33 | case 'post': |
34 | - return __( 'Publish Post', 'wordpoints' ); |
|
34 | + return __('Publish Post', 'wordpoints'); |
|
35 | 35 | |
36 | 36 | case 'page': |
37 | - return __( 'Publish Page', 'wordpoints' ); |
|
37 | + return __('Publish Page', 'wordpoints'); |
|
38 | 38 | |
39 | 39 | default: |
40 | 40 | return sprintf( |
41 | 41 | // translators: singular name of the post type |
42 | - __( 'Publish %s', 'wordpoints' ) |
|
42 | + __('Publish %s', 'wordpoints') |
|
43 | 43 | , $this->get_entity_title() |
44 | 44 | ); |
45 | 45 | } |
@@ -50,20 +50,20 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function get_description() { |
52 | 52 | |
53 | - $parsed = wordpoints_parse_dynamic_slug( $this->slug ); |
|
53 | + $parsed = wordpoints_parse_dynamic_slug($this->slug); |
|
54 | 54 | |
55 | - switch ( $parsed['dynamic'] ) { |
|
55 | + switch ($parsed['dynamic']) { |
|
56 | 56 | |
57 | 57 | case 'post': |
58 | - return __( 'When a Post is published.', 'wordpoints' ); |
|
58 | + return __('When a Post is published.', 'wordpoints'); |
|
59 | 59 | |
60 | 60 | case 'page': |
61 | - return __( 'When a Page is published.', 'wordpoints' ); |
|
61 | + return __('When a Page is published.', 'wordpoints'); |
|
62 | 62 | |
63 | 63 | default: |
64 | 64 | return sprintf( |
65 | 65 | // translators: singular name of the post type |
66 | - __( 'When a %s is published.', 'wordpoints' ) |
|
66 | + __('When a %s is published.', 'wordpoints') |
|
67 | 67 | , $this->get_entity_title() |
68 | 68 | ); |
69 | 69 | } |
@@ -74,20 +74,20 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function get_reversal_text() { |
76 | 76 | |
77 | - $parsed = wordpoints_parse_dynamic_slug( $this->slug ); |
|
77 | + $parsed = wordpoints_parse_dynamic_slug($this->slug); |
|
78 | 78 | |
79 | - switch ( $parsed['dynamic'] ) { |
|
79 | + switch ($parsed['dynamic']) { |
|
80 | 80 | |
81 | 81 | case 'post': |
82 | - return __( 'Post removed.', 'wordpoints' ); |
|
82 | + return __('Post removed.', 'wordpoints'); |
|
83 | 83 | |
84 | 84 | case 'page': |
85 | - return __( 'Page removed.', 'wordpoints' ); |
|
85 | + return __('Page removed.', 'wordpoints'); |
|
86 | 86 | |
87 | 87 | default: |
88 | 88 | return sprintf( |
89 | 89 | // translators: singular name of the post type |
90 | - _x( '%s removed.', 'post type', 'wordpoints' ) |
|
90 | + _x('%s removed.', 'post type', 'wordpoints') |
|
91 | 91 | , $this->get_entity_title() |
92 | 92 | ); |
93 | 93 | } |
@@ -26,23 +26,23 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function get_title() { |
28 | 28 | |
29 | - $parsed = wordpoints_parse_dynamic_slug( $this->slug ); |
|
29 | + $parsed = wordpoints_parse_dynamic_slug($this->slug); |
|
30 | 30 | |
31 | - switch ( $parsed['dynamic'] ) { |
|
31 | + switch ($parsed['dynamic']) { |
|
32 | 32 | |
33 | 33 | case 'post': |
34 | - return __( 'Comment on a Post', 'wordpoints' ); |
|
34 | + return __('Comment on a Post', 'wordpoints'); |
|
35 | 35 | |
36 | 36 | case 'page': |
37 | - return __( 'Comment on a Page', 'wordpoints' ); |
|
37 | + return __('Comment on a Page', 'wordpoints'); |
|
38 | 38 | |
39 | 39 | case 'attachment': |
40 | - return __( 'Comment on a Media Upload', 'wordpoints' ); |
|
40 | + return __('Comment on a Media Upload', 'wordpoints'); |
|
41 | 41 | |
42 | 42 | default: |
43 | 43 | return sprintf( |
44 | 44 | // translators: singular name of the post type |
45 | - __( 'Comment on a %s', 'wordpoints' ) |
|
45 | + __('Comment on a %s', 'wordpoints') |
|
46 | 46 | , $this->get_entity_title() |
47 | 47 | ); |
48 | 48 | } |
@@ -53,23 +53,23 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function get_description() { |
55 | 55 | |
56 | - $parsed = wordpoints_parse_dynamic_slug( $this->slug ); |
|
56 | + $parsed = wordpoints_parse_dynamic_slug($this->slug); |
|
57 | 57 | |
58 | - switch ( $parsed['dynamic'] ) { |
|
58 | + switch ($parsed['dynamic']) { |
|
59 | 59 | |
60 | 60 | case 'post': |
61 | - return __( 'When a user leaves a comment on a Post.', 'wordpoints' ); |
|
61 | + return __('When a user leaves a comment on a Post.', 'wordpoints'); |
|
62 | 62 | |
63 | 63 | case 'page': |
64 | - return __( 'When a user leaves a comment on a Page.', 'wordpoints' ); |
|
64 | + return __('When a user leaves a comment on a Page.', 'wordpoints'); |
|
65 | 65 | |
66 | 66 | case 'attachment': |
67 | - return __( 'When a user leaves a comment on a file uploaded to the Media Library.', 'wordpoints' ); |
|
67 | + return __('When a user leaves a comment on a file uploaded to the Media Library.', 'wordpoints'); |
|
68 | 68 | |
69 | 69 | default: |
70 | 70 | return sprintf( |
71 | 71 | // translators: singular name of the post type |
72 | - __( 'When a user leaves a comment on a %s.', 'wordpoints' ) |
|
72 | + __('When a user leaves a comment on a %s.', 'wordpoints') |
|
73 | 73 | , $this->get_entity_title() |
74 | 74 | ); |
75 | 75 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @since 1.0.0 |
80 | 80 | */ |
81 | 81 | public function get_reversal_text() { |
82 | - return __( 'Comment removed.', 'wordpoints' ); |
|
82 | + return __('Comment removed.', 'wordpoints'); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * @since 1.0.0 |
25 | 25 | */ |
26 | - public function should_hit( WordPoints_Hook_Fire $fire ) { |
|
26 | + public function should_hit(WordPoints_Hook_Fire $fire) { |
|
27 | 27 | |
28 | - if ( ! parent::should_hit( $fire ) ) { |
|
28 | + if ( ! parent::should_hit($fire)) { |
|
29 | 29 | |
30 | - $logs = $this->get_points_logs_to_be_reversed( $fire ); |
|
30 | + $logs = $this->get_points_logs_to_be_reversed($fire); |
|
31 | 31 | |
32 | - return count( $logs ) > 0; |
|
32 | + return count($logs) > 0; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | return true; |
@@ -38,16 +38,16 @@ discard block |
||
38 | 38 | /** |
39 | 39 | * @since 1.0.0 |
40 | 40 | */ |
41 | - public function after_miss( WordPoints_Hook_Fire $fire ) { |
|
41 | + public function after_miss(WordPoints_Hook_Fire $fire) { |
|
42 | 42 | |
43 | - parent::after_miss( $fire ); |
|
43 | + parent::after_miss($fire); |
|
44 | 44 | |
45 | - if ( ! $this->get_settings_from_fire( $fire ) ) { |
|
45 | + if ( ! $this->get_settings_from_fire($fire)) { |
|
46 | 46 | return; |
47 | 47 | } |
48 | 48 | |
49 | - foreach ( $this->get_points_logs_to_be_reversed( $fire ) as $log ) { |
|
50 | - wordpoints_add_points_log_meta( $log->id, 'auto_reversed', 0 ); |
|
49 | + foreach ($this->get_points_logs_to_be_reversed($fire) as $log) { |
|
50 | + wordpoints_add_points_log_meta($log->id, 'auto_reversed', 0); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
@@ -60,23 +60,23 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return array The points logs to be reversed. |
62 | 62 | */ |
63 | - protected function get_points_logs_to_be_reversed( WordPoints_Hook_Fire $fire ) { |
|
63 | + protected function get_points_logs_to_be_reversed(WordPoints_Hook_Fire $fire) { |
|
64 | 64 | |
65 | - if ( isset( $fire->data[ $this->slug ]['points_logs'] ) ) { |
|
66 | - return $fire->data[ $this->slug ]['points_logs']; |
|
65 | + if (isset($fire->data[$this->slug]['points_logs'])) { |
|
66 | + return $fire->data[$this->slug]['points_logs']; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | $entity = $fire->event_args->get_primary_arg(); |
70 | 70 | |
71 | - if ( ! $entity ) { |
|
72 | - $fire->data[ $this->slug ]['points_logs'] = array(); |
|
71 | + if ( ! $entity) { |
|
72 | + $fire->data[$this->slug]['points_logs'] = array(); |
|
73 | 73 | return array(); |
74 | 74 | } |
75 | 75 | |
76 | 76 | $slug = $entity->get_slug(); |
77 | 77 | |
78 | - if ( ( $pos = strpos( $slug, '\\' ) ) ) { |
|
79 | - $slug = substr( $slug, 0, $pos ); |
|
78 | + if (($pos = strpos($slug, '\\'))) { |
|
79 | + $slug = substr($slug, 0, $pos); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | $meta_queries = array( |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | ) |
93 | 93 | ); |
94 | 94 | |
95 | - $log_type = $fire->reaction->get_meta( 'legacy_log_type' ); |
|
95 | + $log_type = $fire->reaction->get_meta('legacy_log_type'); |
|
96 | 96 | |
97 | - if ( ! $log_type ) { |
|
97 | + if ( ! $log_type) { |
|
98 | 98 | $log_type = $fire->reaction->get_event_slug(); |
99 | 99 | } |
100 | 100 | |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | |
108 | 108 | $logs = $query->get(); |
109 | 109 | |
110 | - if ( ! $logs ) { |
|
110 | + if ( ! $logs) { |
|
111 | 111 | $logs = array(); |
112 | 112 | } |
113 | 113 | |
114 | - $fire->data[ $this->slug ]['points_logs'] = $logs; |
|
114 | + $fire->data[$this->slug]['points_logs'] = $logs; |
|
115 | 115 | |
116 | 116 | return $logs; |
117 | 117 | } |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @param WordPoints_Class_Registry_Persistent $reactors The reactors registry. |
35 | 35 | */ |
36 | -function wordpoints_hook_reactors_init( $reactors ) { |
|
36 | +function wordpoints_hook_reactors_init($reactors) { |
|
37 | 37 | |
38 | - $reactors->register( 'points', 'WordPoints_Hook_Reactor_Points' ); |
|
39 | - $reactors->register( 'points_legacy', 'WordPoints_Hook_Reactor_Points_Legacy' ); |
|
38 | + $reactors->register('points', 'WordPoints_Hook_Reactor_Points'); |
|
39 | + $reactors->register('points_legacy', 'WordPoints_Hook_Reactor_Points_Legacy'); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @param WordPoints_Class_Registry_Children $reaction_stores The store registry. |
50 | 50 | */ |
51 | -function wordpoints_hook_reaction_stores_init( $reaction_stores ) { |
|
51 | +function wordpoints_hook_reaction_stores_init($reaction_stores) { |
|
52 | 52 | |
53 | 53 | $reaction_stores->register( |
54 | 54 | 'standard' |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | , 'WordPoints_Hook_Reaction_Store_Options' |
57 | 57 | ); |
58 | 58 | |
59 | - if ( is_wordpoints_network_active() ) { |
|
59 | + if (is_wordpoints_network_active()) { |
|
60 | 60 | $reaction_stores->register( |
61 | 61 | 'network' |
62 | 62 | , 'points' |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @param WordPoints_Class_Registry_Persistent $extensions The extension registry. |
76 | 76 | */ |
77 | -function wordpoints_hook_extension_init( $extensions ) { |
|
78 | - |
|
79 | - $extensions->register( 'blocker', 'WordPoints_Hook_Extension_Blocker' ); |
|
80 | - $extensions->register( 'repeat_blocker', 'WordPoints_Hook_Extension_Repeat_Blocker' ); |
|
81 | - $extensions->register( 'reversals', 'WordPoints_Hook_Extension_Reversals' ); |
|
82 | - $extensions->register( 'reversals_legacy_points', 'WordPoints_Hook_Extension_Reversals_Legacy_Points' ); |
|
83 | - $extensions->register( 'conditions', 'WordPoints_Hook_Extension_Conditions' ); |
|
84 | - $extensions->register( 'periods', 'WordPoints_Hook_Extension_Periods' ); |
|
77 | +function wordpoints_hook_extension_init($extensions) { |
|
78 | + |
|
79 | + $extensions->register('blocker', 'WordPoints_Hook_Extension_Blocker'); |
|
80 | + $extensions->register('repeat_blocker', 'WordPoints_Hook_Extension_Repeat_Blocker'); |
|
81 | + $extensions->register('reversals', 'WordPoints_Hook_Extension_Reversals'); |
|
82 | + $extensions->register('reversals_legacy_points', 'WordPoints_Hook_Extension_Reversals_Legacy_Points'); |
|
83 | + $extensions->register('conditions', 'WordPoints_Hook_Extension_Conditions'); |
|
84 | + $extensions->register('periods', 'WordPoints_Hook_Extension_Periods'); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @param WordPoints_Class_Registry_Children $conditions The conditions registry. |
95 | 95 | */ |
96 | -function wordpoints_hook_conditions_init( $conditions ) { |
|
96 | +function wordpoints_hook_conditions_init($conditions) { |
|
97 | 97 | |
98 | 98 | $conditions->register( |
99 | 99 | 'text' |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * |
130 | 130 | * @param WordPoints_Hook_Actions $actions The action registry. |
131 | 131 | */ |
132 | -function wordpoints_hook_actions_init( $actions ) { |
|
132 | +function wordpoints_hook_actions_init($actions) { |
|
133 | 133 | |
134 | 134 | $actions->register( |
135 | 135 | 'comment_approve' |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | , array( |
138 | 138 | 'action' => 'transition_comment_status', |
139 | 139 | 'data' => array( |
140 | - 'arg_index' => array( 'comment' => 2 ), |
|
141 | - 'requirements' => array( 0 => 'approved' ), |
|
140 | + 'arg_index' => array('comment' => 2), |
|
141 | + 'requirements' => array(0 => 'approved'), |
|
142 | 142 | ), |
143 | 143 | ) |
144 | 144 | ); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | , array( |
150 | 150 | 'action' => 'wp_insert_comment', |
151 | 151 | 'data' => array( |
152 | - 'arg_index' => array( 'comment' => 1 ), |
|
152 | + 'arg_index' => array('comment' => 1), |
|
153 | 153 | ), |
154 | 154 | ) |
155 | 155 | ); |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | , array( |
161 | 161 | 'action' => 'transition_comment_status', |
162 | 162 | 'data' => array( |
163 | - 'arg_index' => array( 'comment' => 2 ), |
|
164 | - 'requirements' => array( 1 => 'approved' ), |
|
163 | + 'arg_index' => array('comment' => 2), |
|
164 | + 'requirements' => array(1 => 'approved'), |
|
165 | 165 | ), |
166 | 166 | ) |
167 | 167 | ); |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | , array( |
174 | 174 | 'action' => 'transition_post_status', |
175 | 175 | 'data' => array( |
176 | - 'arg_index' => array( 'post' => 2 ), |
|
177 | - 'requirements' => array( 0 => 'publish' ), |
|
176 | + 'arg_index' => array('post' => 2), |
|
177 | + 'requirements' => array(0 => 'publish'), |
|
178 | 178 | ), |
179 | 179 | ) |
180 | 180 | ); |
@@ -185,8 +185,8 @@ discard block |
||
185 | 185 | , array( |
186 | 186 | 'action' => 'transition_post_status', |
187 | 187 | 'data' => array( |
188 | - 'arg_index' => array( 'post' => 2 ), |
|
189 | - 'requirements' => array( 1 => 'publish' ), |
|
188 | + 'arg_index' => array('post' => 2), |
|
189 | + 'requirements' => array(1 => 'publish'), |
|
190 | 190 | ), |
191 | 191 | ) |
192 | 192 | ); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | , array( |
198 | 198 | 'action' => 'add_attachment', |
199 | 199 | 'data' => array( |
200 | - 'arg_index' => array( 'post\attachment' => 0 ), |
|
200 | + 'arg_index' => array('post\attachment' => 0), |
|
201 | 201 | ), |
202 | 202 | ) |
203 | 203 | ); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | , array( |
209 | 209 | 'action' => 'delete_post', |
210 | 210 | 'data' => array( |
211 | - 'arg_index' => array( 'post' => 0 ), |
|
211 | + 'arg_index' => array('post' => 0), |
|
212 | 212 | ), |
213 | 213 | ) |
214 | 214 | ); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | , array( |
220 | 220 | 'action' => 'user_register', |
221 | 221 | 'data' => array( |
222 | - 'arg_index' => array( 'user' => 0 ), |
|
222 | + 'arg_index' => array('user' => 0), |
|
223 | 223 | ), |
224 | 224 | ) |
225 | 225 | ); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | , array( |
231 | 231 | 'action' => is_multisite() ? 'wpmu_delete_user' : 'delete_user', |
232 | 232 | 'data' => array( |
233 | - 'arg_index' => array( 'user' => 0 ), |
|
233 | + 'arg_index' => array('user' => 0), |
|
234 | 234 | ), |
235 | 235 | ) |
236 | 236 | ); |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * |
254 | 254 | * @param WordPoints_Hook_Events $events The event registry. |
255 | 255 | */ |
256 | -function wordpoints_hook_events_init( $events ) { |
|
256 | +function wordpoints_hook_events_init($events) { |
|
257 | 257 | |
258 | 258 | $events->register( |
259 | 259 | 'user_register' |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | ); |
284 | 284 | |
285 | 285 | // Register events for all of the public post types. |
286 | - $post_types = get_post_types( array( 'public' => true ) ); |
|
286 | + $post_types = get_post_types(array('public' => true)); |
|
287 | 287 | |
288 | 288 | /** |
289 | 289 | * Filter which post types to register hook events for. |
@@ -292,20 +292,20 @@ discard block |
||
292 | 292 | * |
293 | 293 | * @param string[] The post type slugs ("names"). |
294 | 294 | */ |
295 | - $post_types = apply_filters( 'wordpoints_register_hook_events_for_post_types', $post_types ); |
|
295 | + $post_types = apply_filters('wordpoints_register_hook_events_for_post_types', $post_types); |
|
296 | 296 | |
297 | - foreach ( $post_types as $slug ) { |
|
298 | - wordpoints_register_post_type_hook_events( $slug ); |
|
297 | + foreach ($post_types as $slug) { |
|
298 | + wordpoints_register_post_type_hook_events($slug); |
|
299 | 299 | } |
300 | 300 | |
301 | - if ( is_multisite() ) { |
|
301 | + if (is_multisite()) { |
|
302 | 302 | |
303 | 303 | $event_slugs = array( |
304 | 304 | 'user_visit', |
305 | 305 | 'user_register', |
306 | 306 | ); |
307 | 307 | |
308 | - foreach ( $event_slugs as $event_slug ) { |
|
308 | + foreach ($event_slugs as $event_slug) { |
|
309 | 309 | // TODO network hooks |
310 | 310 | $events->args->register( |
311 | 311 | $event_slug |
@@ -325,10 +325,10 @@ discard block |
||
325 | 325 | * |
326 | 326 | * @param WordPoints_App_Registry $entities The entities app. |
327 | 327 | */ |
328 | -function wordpoints_entities_app_init( $entities ) { |
|
328 | +function wordpoints_entities_app_init($entities) { |
|
329 | 329 | |
330 | - $entities->sub_apps->register( 'children', 'WordPoints_Class_Registry_Children' ); |
|
331 | - $entities->sub_apps->register( 'contexts', 'WordPoints_Class_Registry' ); |
|
330 | + $entities->sub_apps->register('children', 'WordPoints_Class_Registry_Children'); |
|
331 | + $entities->sub_apps->register('contexts', 'WordPoints_Class_Registry'); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
@@ -340,10 +340,10 @@ discard block |
||
340 | 340 | * |
341 | 341 | * @param WordPoints_Class_Registry $contexts The entity context registry. |
342 | 342 | */ |
343 | -function wordpoints_entity_contexts_init( $contexts ) { |
|
343 | +function wordpoints_entity_contexts_init($contexts) { |
|
344 | 344 | |
345 | - $contexts->register( 'network', 'WordPoints_Entity_Context_Network' ); |
|
346 | - $contexts->register( 'site', 'WordPoints_Entity_Context_Site' ); |
|
345 | + $contexts->register('network', 'WordPoints_Entity_Context_Network'); |
|
346 | + $contexts->register('site', 'WordPoints_Entity_Context_Site'); |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | /** |
@@ -355,18 +355,18 @@ discard block |
||
355 | 355 | * |
356 | 356 | * @param WordPoints_App_Registry $entities The entities app. |
357 | 357 | */ |
358 | -function wordpoints_entities_init( $entities ) { |
|
358 | +function wordpoints_entities_init($entities) { |
|
359 | 359 | |
360 | 360 | $children = $entities->children; |
361 | 361 | |
362 | - $entities->register( 'user', 'WordPoints_Entity_User' ); |
|
363 | - $children->register( 'user', 'roles', 'WordPoints_Entity_User_Roles' ); |
|
362 | + $entities->register('user', 'WordPoints_Entity_User'); |
|
363 | + $children->register('user', 'roles', 'WordPoints_Entity_User_Roles'); |
|
364 | 364 | |
365 | - $entities->register( 'user_role', 'WordPoints_Entity_User_Role' ); |
|
366 | - $children->register( 'user_role', 'name', 'WordPoints_Entity_User_Role_Name' ); |
|
365 | + $entities->register('user_role', 'WordPoints_Entity_User_Role'); |
|
366 | + $children->register('user_role', 'name', 'WordPoints_Entity_User_Role_Name'); |
|
367 | 367 | |
368 | 368 | // Register entities for all of the public post types. |
369 | - $post_types = get_post_types( array( 'public' => true ) ); |
|
369 | + $post_types = get_post_types(array('public' => true)); |
|
370 | 370 | |
371 | 371 | /** |
372 | 372 | * Filter which post types to register entities for. |
@@ -375,14 +375,14 @@ discard block |
||
375 | 375 | * |
376 | 376 | * @param string[] The post type slugs ("names"). |
377 | 377 | */ |
378 | - $post_types = apply_filters( 'wordpoints_register_entities_for_post_types', $post_types ); |
|
378 | + $post_types = apply_filters('wordpoints_register_entities_for_post_types', $post_types); |
|
379 | 379 | |
380 | - foreach ( $post_types as $slug ) { |
|
381 | - wordpoints_register_post_type_entities( $slug ); |
|
380 | + foreach ($post_types as $slug) { |
|
381 | + wordpoints_register_post_type_entities($slug); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | // Register entities for all of the public taxonomies. |
385 | - $taxonomies = get_taxonomies( array( 'public' => true ) ); |
|
385 | + $taxonomies = get_taxonomies(array('public' => true)); |
|
386 | 386 | |
387 | 387 | /** |
388 | 388 | * Filter which taxonomies to register entities for. |
@@ -391,10 +391,10 @@ discard block |
||
391 | 391 | * |
392 | 392 | * @param string[] The taxonomy slugs. |
393 | 393 | */ |
394 | - $taxonomies = apply_filters( 'wordpoints_register_entities_for_taxonomies', $taxonomies ); |
|
394 | + $taxonomies = apply_filters('wordpoints_register_entities_for_taxonomies', $taxonomies); |
|
395 | 395 | |
396 | - foreach ( $taxonomies as $slug ) { |
|
397 | - wordpoints_register_taxonomy_entities( $slug ); |
|
396 | + foreach ($taxonomies as $slug) { |
|
397 | + wordpoints_register_taxonomy_entities($slug); |
|
398 | 398 | } |
399 | 399 | } |
400 | 400 | |
@@ -405,28 +405,28 @@ discard block |
||
405 | 405 | * |
406 | 406 | * @param string $slug The slug of the post type. |
407 | 407 | */ |
408 | -function wordpoints_register_post_type_entities( $slug ) { |
|
408 | +function wordpoints_register_post_type_entities($slug) { |
|
409 | 409 | |
410 | 410 | $entities = wordpoints_entities(); |
411 | 411 | $children = $entities->children; |
412 | 412 | |
413 | - $entities->register( "post\\{$slug}", 'WordPoints_Entity_Post' ); |
|
414 | - $children->register( "post\\{$slug}", 'author', 'WordPoints_Entity_Post_Author' ); |
|
413 | + $entities->register("post\\{$slug}", 'WordPoints_Entity_Post'); |
|
414 | + $children->register("post\\{$slug}", 'author', 'WordPoints_Entity_Post_Author'); |
|
415 | 415 | |
416 | - $supports = get_all_post_type_supports( $slug ); |
|
416 | + $supports = get_all_post_type_supports($slug); |
|
417 | 417 | |
418 | - if ( isset( $supports['editor'] ) ) { |
|
419 | - $children->register( "post\\{$slug}", 'content', 'WordPoints_Entity_Post_Content' ); |
|
418 | + if (isset($supports['editor'])) { |
|
419 | + $children->register("post\\{$slug}", 'content', 'WordPoints_Entity_Post_Content'); |
|
420 | 420 | } |
421 | 421 | |
422 | - if ( isset( $supports['comments'] ) ) { |
|
423 | - $entities->register( "comment\\{$slug}", 'WordPoints_Entity_Comment' ); |
|
424 | - $children->register( "comment\\{$slug}", "post\\{$slug}", 'WordPoints_Entity_Comment_Post' ); |
|
425 | - $children->register( "comment\\{$slug}", 'author', 'WordPoints_Entity_Comment_Author' ); |
|
422 | + if (isset($supports['comments'])) { |
|
423 | + $entities->register("comment\\{$slug}", 'WordPoints_Entity_Comment'); |
|
424 | + $children->register("comment\\{$slug}", "post\\{$slug}", 'WordPoints_Entity_Comment_Post'); |
|
425 | + $children->register("comment\\{$slug}", 'author', 'WordPoints_Entity_Comment_Author'); |
|
426 | 426 | } |
427 | 427 | |
428 | - foreach ( get_object_taxonomies( $slug ) as $taxonomy_slug ) { |
|
429 | - $children->register( "post\\{$slug}", "terms\\{$taxonomy_slug}", 'WordPoints_Entity_Post_Terms' ); |
|
428 | + foreach (get_object_taxonomies($slug) as $taxonomy_slug) { |
|
429 | + $children->register("post\\{$slug}", "terms\\{$taxonomy_slug}", 'WordPoints_Entity_Post_Terms'); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | /** |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | * |
437 | 437 | * @param string $slug The slug ("name") of the post type. |
438 | 438 | */ |
439 | - do_action( 'wordpoints_register_post_type_entities', $slug ); |
|
439 | + do_action('wordpoints_register_post_type_entities', $slug); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | /** |
@@ -446,13 +446,13 @@ discard block |
||
446 | 446 | * |
447 | 447 | * @param string $slug The slug of the post type. |
448 | 448 | */ |
449 | -function wordpoints_register_post_type_hook_events( $slug ) { |
|
449 | +function wordpoints_register_post_type_hook_events($slug) { |
|
450 | 450 | |
451 | 451 | $event_slugs = array(); |
452 | 452 | |
453 | 453 | $events = wordpoints_hooks()->events; |
454 | 454 | |
455 | - if ( 'attachment' === $slug ) { |
|
455 | + if ('attachment' === $slug) { |
|
456 | 456 | |
457 | 457 | $event_slugs[] = 'media_upload'; |
458 | 458 | |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | , array( |
481 | 481 | 'actions' => array( |
482 | 482 | 'toggle_on' => 'post_publish', |
483 | - 'toggle_off' => array( 'post_depublish', 'post_delete' ), |
|
483 | + 'toggle_off' => array('post_depublish', 'post_delete'), |
|
484 | 484 | ), |
485 | 485 | 'args' => array( |
486 | 486 | "post\\{$slug}" => 'WordPoints_Hook_Arg_Dynamic', |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | ); |
490 | 490 | } |
491 | 491 | |
492 | - if ( post_type_supports( $slug, 'comments' ) ) { |
|
492 | + if (post_type_supports($slug, 'comments')) { |
|
493 | 493 | |
494 | 494 | $event_slugs[] = "comment_leave\\{$slug}"; |
495 | 495 | |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | , 'WordPoints_Hook_Event_Comment_Leave' |
499 | 499 | , array( |
500 | 500 | 'actions' => array( |
501 | - 'toggle_on' => array( 'comment_approve', 'comment_new' ), |
|
501 | + 'toggle_on' => array('comment_approve', 'comment_new'), |
|
502 | 502 | 'toggle_off' => 'comment_deapprove', |
503 | 503 | ), |
504 | 504 | 'args' => array( |
@@ -508,8 +508,8 @@ discard block |
||
508 | 508 | ); |
509 | 509 | } |
510 | 510 | |
511 | - if ( is_multisite() ) { |
|
512 | - foreach ( $event_slugs as $event_slug ) { |
|
511 | + if (is_multisite()) { |
|
512 | + foreach ($event_slugs as $event_slug) { |
|
513 | 513 | $events->args->register( |
514 | 514 | $event_slug |
515 | 515 | , 'current:site' |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | * |
526 | 526 | * @param string $slug The slug ("name") of the post type. |
527 | 527 | */ |
528 | - do_action( 'wordpoints_register_post_type_hook_events', $slug ); |
|
528 | + do_action('wordpoints_register_post_type_hook_events', $slug); |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | /** |
@@ -535,13 +535,13 @@ discard block |
||
535 | 535 | * |
536 | 536 | * @param string $slug The slug of the taxonomy. |
537 | 537 | */ |
538 | -function wordpoints_register_taxonomy_entities( $slug ) { |
|
538 | +function wordpoints_register_taxonomy_entities($slug) { |
|
539 | 539 | |
540 | 540 | $entities = wordpoints_entities(); |
541 | 541 | $children = $entities->children; |
542 | 542 | |
543 | - $entities->register( "term\\{$slug}", 'WordPoints_Entity_Term' ); |
|
544 | - $children->register( "term\\{$slug}", 'id', 'WordPoints_Entity_Term_Id' ); |
|
543 | + $entities->register("term\\{$slug}", 'WordPoints_Entity_Term'); |
|
544 | + $children->register("term\\{$slug}", 'id', 'WordPoints_Entity_Term_Id'); |
|
545 | 545 | |
546 | 546 | /** |
547 | 547 | * Fired when registering the entities for a taxonomy. |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | * |
551 | 551 | * @param string $slug The taxonomy's slug. |
552 | 552 | */ |
553 | - do_action( 'wordpoints_register_taxonomy_entities', $slug ); |
|
553 | + do_action('wordpoints_register_taxonomy_entities', $slug); |
|
554 | 554 | } |
555 | 555 | |
556 | 556 | /** |
@@ -562,10 +562,10 @@ discard block |
||
562 | 562 | * |
563 | 563 | * @param WordPoints_Class_RegistryI $data_types The data types registry. |
564 | 564 | */ |
565 | -function wordpoints_data_types_init( $data_types ) { |
|
565 | +function wordpoints_data_types_init($data_types) { |
|
566 | 566 | |
567 | - $data_types->register( 'integer', 'WordPoints_Data_Type_Integer' ); |
|
568 | - $data_types->register( 'text', 'WordPoints_Data_Type_Text' ); |
|
567 | + $data_types->register('integer', 'WordPoints_Data_Type_Integer'); |
|
568 | + $data_types->register('text', 'WordPoints_Data_Type_Text'); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | /** |
@@ -580,9 +580,9 @@ discard block |
||
580 | 580 | * |
581 | 581 | * @return bool Whether the user can view the points log. |
582 | 582 | */ |
583 | -function wordpoints_hooks_user_can_view_points_log( $can_view, $log ) { |
|
583 | +function wordpoints_hooks_user_can_view_points_log($can_view, $log) { |
|
584 | 584 | |
585 | - if ( ! $can_view ) { |
|
585 | + if ( ! $can_view) { |
|
586 | 586 | return $can_view; |
587 | 587 | } |
588 | 588 | |
@@ -591,11 +591,11 @@ discard block |
||
591 | 591 | $event_slug = $log->log_type; |
592 | 592 | |
593 | 593 | /** @var WordPoints_Hook_Arg $arg */ |
594 | - foreach ( wordpoints_hooks()->events->args->get_children( $event_slug ) as $slug => $arg ) { |
|
594 | + foreach (wordpoints_hooks()->events->args->get_children($event_slug) as $slug => $arg) { |
|
595 | 595 | |
596 | - $value = wordpoints_get_points_log_meta( $log->id, $slug, true ); |
|
596 | + $value = wordpoints_get_points_log_meta($log->id, $slug, true); |
|
597 | 597 | |
598 | - if ( ! $value ) { |
|
598 | + if ( ! $value) { |
|
599 | 599 | continue; |
600 | 600 | } |
601 | 601 | |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | , $value |
606 | 606 | ); |
607 | 607 | |
608 | - if ( ! $can_view ) { |
|
608 | + if ( ! $can_view) { |
|
609 | 609 | break; |
610 | 610 | } |
611 | 611 | } |
@@ -624,20 +624,20 @@ discard block |
||
624 | 624 | * |
625 | 625 | * @return bool Whether the user can view this entity. |
626 | 626 | */ |
627 | -function wordpoints_entity_user_can_view( $user_id, $entity_slug, $entity_id ) { |
|
627 | +function wordpoints_entity_user_can_view($user_id, $entity_slug, $entity_id) { |
|
628 | 628 | |
629 | - $entity = wordpoints_entities()->get( $entity_slug ); |
|
629 | + $entity = wordpoints_entities()->get($entity_slug); |
|
630 | 630 | |
631 | 631 | // If this entity type is not found, we have no way of determining whether it is |
632 | 632 | // safe for the user to view it. |
633 | - if ( ! ( $entity instanceof WordPoints_Entity ) ) { |
|
633 | + if ( ! ($entity instanceof WordPoints_Entity)) { |
|
634 | 634 | return false; |
635 | 635 | } |
636 | 636 | |
637 | 637 | $can_view = true; |
638 | 638 | |
639 | - if ( $entity instanceof WordPoints_Entity_Restricted_VisibilityI ) { |
|
640 | - $can_view = $entity->user_can_view( $user_id, $entity_id ); |
|
639 | + if ($entity instanceof WordPoints_Entity_Restricted_VisibilityI) { |
|
640 | + $can_view = $entity->user_can_view($user_id, $entity_id); |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | /** |
@@ -668,8 +668,8 @@ discard block |
||
668 | 668 | */ |
669 | 669 | function wordpoints_apps() { |
670 | 670 | |
671 | - if ( ! isset( WordPoints_App::$main ) ) { |
|
672 | - WordPoints_App::$main = new WordPoints_App( 'apps' ); |
|
671 | + if ( ! isset(WordPoints_App::$main)) { |
|
672 | + WordPoints_App::$main = new WordPoints_App('apps'); |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | return WordPoints_App::$main; |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | */ |
685 | 685 | function wordpoints_hooks() { |
686 | 686 | |
687 | - if ( ! isset( WordPoints_App::$main ) ) { |
|
687 | + if ( ! isset(WordPoints_App::$main)) { |
|
688 | 688 | wordpoints_apps(); |
689 | 689 | } |
690 | 690 | |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | */ |
701 | 701 | function wordpoints_entities() { |
702 | 702 | |
703 | - if ( ! isset( WordPoints_App::$main ) ) { |
|
703 | + if ( ! isset(WordPoints_App::$main)) { |
|
704 | 704 | wordpoints_apps(); |
705 | 705 | } |
706 | 706 | |
@@ -716,13 +716,13 @@ discard block |
||
716 | 716 | * |
717 | 717 | * @param WordPoints_App $app The main apps app. |
718 | 718 | */ |
719 | -function wordpoints_apps_init( $app ) { |
|
719 | +function wordpoints_apps_init($app) { |
|
720 | 720 | |
721 | 721 | $apps = $app->sub_apps; |
722 | 722 | |
723 | - $apps->register( 'hooks', 'WordPoints_Hooks' ); |
|
724 | - $apps->register( 'entities', 'WordPoints_App_Registry' ); |
|
725 | - $apps->register( 'data_types', 'WordPoints_Class_Registry' ); |
|
723 | + $apps->register('hooks', 'WordPoints_Hooks'); |
|
724 | + $apps->register('entities', 'WordPoints_App_Registry'); |
|
725 | + $apps->register('data_types', 'WordPoints_Class_Registry'); |
|
726 | 726 | } |
727 | 727 | |
728 | 728 | /** |
@@ -735,19 +735,19 @@ discard block |
||
735 | 735 | * |
736 | 736 | * @return object|false The constructed object, or false if to many args were passed. |
737 | 737 | */ |
738 | -function wordpoints_construct_class_with_args( $class_name, array $args ) { |
|
738 | +function wordpoints_construct_class_with_args($class_name, array $args) { |
|
739 | 739 | |
740 | - switch ( count( $args ) ) { |
|
740 | + switch (count($args)) { |
|
741 | 741 | case 0: |
742 | 742 | return new $class_name(); |
743 | 743 | case 1: |
744 | - return new $class_name( $args[0] ); |
|
744 | + return new $class_name($args[0]); |
|
745 | 745 | case 2: |
746 | - return new $class_name( $args[0], $args[1] ); |
|
746 | + return new $class_name($args[0], $args[1]); |
|
747 | 747 | case 3: |
748 | - return new $class_name( $args[0], $args[1], $args[2] ); |
|
748 | + return new $class_name($args[0], $args[1], $args[2]); |
|
749 | 749 | case 4: |
750 | - return new $class_name( $args[0], $args[1], $args[2], $args[3] ); |
|
750 | + return new $class_name($args[0], $args[1], $args[2], $args[3]); |
|
751 | 751 | default: |
752 | 752 | return false; |
753 | 753 | } |
@@ -769,13 +769,13 @@ discard block |
||
769 | 769 | * @return array The slug parsed into the 'generic' and 'dynamic' portions. If the |
770 | 770 | * slug is not dynamic, the value of each of those keys will be false. |
771 | 771 | */ |
772 | -function wordpoints_parse_dynamic_slug( $slug ) { |
|
772 | +function wordpoints_parse_dynamic_slug($slug) { |
|
773 | 773 | |
774 | - $parsed = array( 'dynamic' => false, 'generic' => false ); |
|
774 | + $parsed = array('dynamic' => false, 'generic' => false); |
|
775 | 775 | |
776 | - $parts = explode( '\\', $slug, 2 ); |
|
776 | + $parts = explode('\\', $slug, 2); |
|
777 | 777 | |
778 | - if ( isset( $parts[1] ) ) { |
|
778 | + if (isset($parts[1])) { |
|
779 | 779 | $parsed['dynamic'] = $parts[1]; |
780 | 780 | $parsed['generic'] = $parts[0]; |
781 | 781 | } |
@@ -814,28 +814,28 @@ discard block |
||
814 | 814 | * contexts, indexed by context slug, or false if any of the |
815 | 815 | * contexts isn't current. |
816 | 816 | */ |
817 | -function wordpoints_entities_get_current_context_id( $slug ) { |
|
817 | +function wordpoints_entities_get_current_context_id($slug) { |
|
818 | 818 | |
819 | 819 | $current_context = array(); |
820 | 820 | |
821 | 821 | /** @var WordPoints_Class_Registry $contexts */ |
822 | 822 | $contexts = wordpoints_entities()->contexts; |
823 | 823 | |
824 | - while ( $slug ) { |
|
824 | + while ($slug) { |
|
825 | 825 | |
826 | - $context = $contexts->get( $slug ); |
|
826 | + $context = $contexts->get($slug); |
|
827 | 827 | |
828 | - if ( ! $context instanceof WordPoints_Entity_Context ) { |
|
828 | + if ( ! $context instanceof WordPoints_Entity_Context) { |
|
829 | 829 | return false; |
830 | 830 | } |
831 | 831 | |
832 | 832 | $id = $context->get_current_id(); |
833 | 833 | |
834 | - if ( false === $id ) { |
|
834 | + if (false === $id) { |
|
835 | 835 | return false; |
836 | 836 | } |
837 | 837 | |
838 | - $current_context[ $slug ] = $id; |
|
838 | + $current_context[$slug] = $id; |
|
839 | 839 | |
840 | 840 | $slug = $context->get_parent_slug(); |
841 | 841 | } |
@@ -856,22 +856,22 @@ discard block |
||
856 | 856 | */ |
857 | 857 | function wordpoints_is_network_context() { |
858 | 858 | |
859 | - if ( ! is_multisite() ) { |
|
859 | + if ( ! is_multisite()) { |
|
860 | 860 | return false; |
861 | 861 | } |
862 | 862 | |
863 | - if ( is_network_admin() ) { |
|
863 | + if (is_network_admin()) { |
|
864 | 864 | return true; |
865 | 865 | } |
866 | 866 | |
867 | 867 | // See https://core.trac.wordpress.org/ticket/22589 |
868 | 868 | if ( |
869 | - defined( 'DOING_AJAX' ) |
|
869 | + defined('DOING_AJAX') |
|
870 | 870 | && DOING_AJAX |
871 | - && isset( $_SERVER['HTTP_REFERER'] ) |
|
871 | + && isset($_SERVER['HTTP_REFERER']) |
|
872 | 872 | && preg_match( |
873 | - '#^' . preg_quote( network_admin_url(), '#' ) . '#i' |
|
874 | - , esc_url_raw( wp_unslash( $_SERVER['HTTP_REFERER'] ) ) |
|
873 | + '#^'.preg_quote(network_admin_url(), '#').'#i' |
|
874 | + , esc_url_raw(wp_unslash($_SERVER['HTTP_REFERER'])) |
|
875 | 875 | ) |
876 | 876 | ) { |
877 | 877 | return true; |
@@ -884,7 +884,7 @@ discard block |
||
884 | 884 | * |
885 | 885 | * @param bool $in_network_context Whether we are in network context. |
886 | 886 | */ |
887 | - return apply_filters( 'wordpoints_is_network_context', false ); |
|
887 | + return apply_filters('wordpoints_is_network_context', false); |
|
888 | 888 | } |
889 | 889 | |
890 | 890 | /** |
@@ -898,21 +898,21 @@ discard block |
||
898 | 898 | * |
899 | 899 | * @return string The primary arg's GUID, JSON encoded. |
900 | 900 | */ |
901 | -function wordpoints_hooks_get_event_primary_arg_guid_json( WordPoints_Hook_Event_Args $event_args ) { |
|
901 | +function wordpoints_hooks_get_event_primary_arg_guid_json(WordPoints_Hook_Event_Args $event_args) { |
|
902 | 902 | |
903 | 903 | $entity = $event_args->get_primary_arg(); |
904 | 904 | |
905 | - if ( ! $entity ) { |
|
905 | + if ( ! $entity) { |
|
906 | 906 | return ''; |
907 | 907 | } |
908 | 908 | |
909 | 909 | $the_guid = $entity->get_the_guid(); |
910 | 910 | |
911 | - if ( ! $the_guid ) { |
|
911 | + if ( ! $the_guid) { |
|
912 | 912 | return ''; |
913 | 913 | } |
914 | 914 | |
915 | - return wp_json_encode( $the_guid ); |
|
915 | + return wp_json_encode($the_guid); |
|
916 | 916 | } |
917 | 917 | |
918 | 918 | /** |
@@ -925,7 +925,7 @@ discard block |
||
925 | 925 | */ |
926 | 926 | function wordpoints_hooks_api_add_global_cache_groups() { |
927 | 927 | |
928 | - if ( function_exists( 'wp_cache_add_global_groups' ) ) { |
|
928 | + if (function_exists('wp_cache_add_global_groups')) { |
|
929 | 929 | |
930 | 930 | wp_cache_add_global_groups( |
931 | 931 | array( |
@@ -951,8 +951,8 @@ discard block |
||
951 | 951 | * @return string The escaped identifier. Already quoted, do not place within |
952 | 952 | * backticks. |
953 | 953 | */ |
954 | -function wordpoints_escape_mysql_identifier( $identifier ) { |
|
955 | - return '`' . str_replace( '`', '``', $identifier ) . '`'; |
|
954 | +function wordpoints_escape_mysql_identifier($identifier) { |
|
955 | + return '`'.str_replace('`', '``', $identifier).'`'; |
|
956 | 956 | } |
957 | 957 | |
958 | 958 | // EOF |