Completed
Push — master ( 274f34...8ff377 )
by J.D.
04:05
created
src/includes/classes/hook/event/post/publish.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -26,20 +26,20 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
src/includes/classes/hook/event/comment/leave.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -26,23 +26,23 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/includes/classes/hook/extension/miss/listeneri.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 	 *
22 22
 	 * @param WordPoints_Hook_Fire $fire The fire that was a miss.
23 23
 	 */
24
-	public function after_miss( WordPoints_Hook_Fire $fire );
24
+	public function after_miss(WordPoints_Hook_Fire $fire);
25 25
 }
26 26
 
27 27
 // EOF
Please login to merge, or discard this patch.
src/includes/classes/hook/extension/reversals/legacy/points.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
src/includes/classes/index.php 1 patch
Spacing   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -10,123 +10,123 @@
 block discarded – undo
10 10
  */
11 11
 
12 12
 // auto-generated {
13
-$dir = dirname( __FILE__ );
14
-require_once( $dir . '/specedi.php' );
15
-require_once( $dir . '/hook/settingsi.php' );
16
-require_once( $dir . '/hook/retroactive/queryi.php' );
17
-require_once( $dir . '/hook/retroactive/query/modifieri.php' );
18
-require_once( $dir . '/hook/reactioni.php' );
19
-require_once( $dir . '/hook/reaction/storei.php' );
20
-require_once( $dir . '/hook/extension/miss/listeneri.php' );
21
-require_once( $dir . '/hook/extension/hit/listeneri.php' );
22
-require_once( $dir . '/hook/eventi.php' );
23
-require_once( $dir . '/hook/event/reversingi.php' );
24
-require_once( $dir . '/hook/conditioni.php' );
25
-require_once( $dir . '/hook/actioni.php' );
26
-require_once( $dir . '/entityishi.php' );
27
-require_once( $dir . '/entityish/storedi.php' );
28
-require_once( $dir . '/entity/restricted/visibilityi.php' );
29
-require_once( $dir . '/entity/parenti.php' );
30
-require_once( $dir . '/entity/hierarchyi.php' );
31
-require_once( $dir . '/entity/enumerablei.php' );
32
-require_once( $dir . '/entity/childi.php' );
33
-require_once( $dir . '/data/typei.php' );
34
-require_once( $dir . '/class/registryi.php' );
35
-require_once( $dir . '/class/registry/childreni.php' );
36
-require_once( $dir . '/app.php' );
37
-require_once( $dir . '/app/registry.php' );
38
-require_once( $dir . '/class/autoloader.php' );
39
-require_once( $dir . '/class/registry.php' );
40
-require_once( $dir . '/class/registry/children.php' );
41
-require_once( $dir . '/class/registry/persistent.php' );
42
-require_once( $dir . '/data/type.php' );
43
-require_once( $dir . '/data/type/integer.php' );
44
-require_once( $dir . '/data/type/text.php' );
45
-require_once( $dir . '/db/query.php' );
46
-require_once( $dir . '/entityish.php' );
47
-require_once( $dir . '/entity.php' );
48
-require_once( $dir . '/entity/relationship.php' );
49
-require_once( $dir . '/entity/relationship/dynamic.php' );
50
-require_once( $dir . '/entity/relationship/stored/field.php' );
51
-require_once( $dir . '/entity/stored/array.php' );
52
-require_once( $dir . '/entity/stored/db/table.php' );
53
-require_once( $dir . '/entity/array.php' );
54
-require_once( $dir . '/entity/attr.php' );
55
-require_once( $dir . '/entity/attr/field.php' );
56
-require_once( $dir . '/entity/change.php' );
57
-require_once( $dir . '/entity/comment.php' );
58
-require_once( $dir . '/entity/comment/author.php' );
59
-require_once( $dir . '/entity/comment/post.php' );
60
-require_once( $dir . '/entity/context.php' );
61
-require_once( $dir . '/entity/context/network.php' );
62
-require_once( $dir . '/entity/context/site.php' );
63
-require_once( $dir . '/entity/hierarchy.php' );
64
-require_once( $dir . '/entity/post.php' );
65
-require_once( $dir . '/entity/post/author.php' );
66
-require_once( $dir . '/entity/post/content.php' );
67
-require_once( $dir . '/entity/post/terms.php' );
68
-require_once( $dir . '/entity/post/type.php' );
69
-require_once( $dir . '/entity/post/type/name.php' );
70
-require_once( $dir . '/entity/post/type/relationship.php' );
71
-require_once( $dir . '/entity/site.php' );
72
-require_once( $dir . '/entity/term.php' );
73
-require_once( $dir . '/entity/term/id.php' );
74
-require_once( $dir . '/entity/user.php' );
75
-require_once( $dir . '/entity/user/role.php' );
76
-require_once( $dir . '/entity/user/role/name.php' );
77
-require_once( $dir . '/entity/user/roles.php' );
78
-require_once( $dir . '/hierarchy.php' );
79
-require_once( $dir . '/hook/action.php' );
80
-require_once( $dir . '/hook/action/comment/new.php' );
81
-require_once( $dir . '/hook/action/post/publish.php' );
82
-require_once( $dir . '/hook/actions.php' );
83
-require_once( $dir . '/hook/arg.php' );
84
-require_once( $dir . '/hook/arg/current/post.php' );
85
-require_once( $dir . '/hook/arg/current/site.php' );
86
-require_once( $dir . '/hook/arg/current/user.php' );
87
-require_once( $dir . '/hook/arg/dynamic.php' );
88
-require_once( $dir . '/hook/condition.php' );
89
-require_once( $dir . '/hook/condition/entity/array/contains.php' );
90
-require_once( $dir . '/hook/condition/equals.php' );
91
-require_once( $dir . '/hook/condition/string/contains.php' );
92
-require_once( $dir . '/hook/event.php' );
93
-require_once( $dir . '/hook/event/dynamic.php' );
94
-require_once( $dir . '/hook/event/args.php' );
95
-require_once( $dir . '/hook/event/comment/leave.php' );
96
-require_once( $dir . '/hook/event/media/upload.php' );
97
-require_once( $dir . '/hook/event/post/publish.php' );
98
-require_once( $dir . '/hook/event/user/register.php' );
99
-require_once( $dir . '/hook/event/user/visit.php' );
100
-require_once( $dir . '/hook/events.php' );
101
-require_once( $dir . '/hook/extension.php' );
102
-require_once( $dir . '/hook/extension/blocker.php' );
103
-require_once( $dir . '/hook/extension/conditions.php' );
104
-require_once( $dir . '/hook/extension/periods.php' );
105
-require_once( $dir . '/hook/extension/repeat/blocker.php' );
106
-require_once( $dir . '/hook/extension/reversals.php' );
107
-require_once( $dir . '/hook/extension/reversals/legacy/points.php' );
108
-require_once( $dir . '/hook/fire.php' );
109
-require_once( $dir . '/hook/hit/logger.php' );
110
-require_once( $dir . '/hook/hit/query.php' );
111
-require_once( $dir . '/hook/reaction.php' );
112
-require_once( $dir . '/hook/reaction/options.php' );
113
-require_once( $dir . '/hook/reaction/store.php' );
114
-require_once( $dir . '/hook/reaction/store/options.php' );
115
-require_once( $dir . '/hook/reaction/store/options/network.php' );
116
-require_once( $dir . '/hook/reaction/validator.php' );
117
-require_once( $dir . '/hook/reactor.php' );
118
-require_once( $dir . '/hook/reactor/points.php' );
119
-require_once( $dir . '/hook/reactor/points/legacy.php' );
120
-require_once( $dir . '/hook/retroactive/conditions.php' );
121
-require_once( $dir . '/hook/retroactive/query.php' );
122
-require_once( $dir . '/hook/retroactive/queryable.php' );
123
-require_once( $dir . '/hook/router.php' );
124
-require_once( $dir . '/hook/settings.php' );
125
-require_once( $dir . '/hook/validator/exception.php' );
126
-require_once( $dir . '/hooks.php' );
127
-require_once( $dir . '/query/builder/db/mysql.php' );
128
-require_once( $dir . '/spec.php' );
129
-require_once( $dir . '/wpdb/wrapper.php' );
13
+$dir = dirname(__FILE__);
14
+require_once($dir.'/specedi.php');
15
+require_once($dir.'/hook/settingsi.php');
16
+require_once($dir.'/hook/retroactive/queryi.php');
17
+require_once($dir.'/hook/retroactive/query/modifieri.php');
18
+require_once($dir.'/hook/reactioni.php');
19
+require_once($dir.'/hook/reaction/storei.php');
20
+require_once($dir.'/hook/extension/miss/listeneri.php');
21
+require_once($dir.'/hook/extension/hit/listeneri.php');
22
+require_once($dir.'/hook/eventi.php');
23
+require_once($dir.'/hook/event/reversingi.php');
24
+require_once($dir.'/hook/conditioni.php');
25
+require_once($dir.'/hook/actioni.php');
26
+require_once($dir.'/entityishi.php');
27
+require_once($dir.'/entityish/storedi.php');
28
+require_once($dir.'/entity/restricted/visibilityi.php');
29
+require_once($dir.'/entity/parenti.php');
30
+require_once($dir.'/entity/hierarchyi.php');
31
+require_once($dir.'/entity/enumerablei.php');
32
+require_once($dir.'/entity/childi.php');
33
+require_once($dir.'/data/typei.php');
34
+require_once($dir.'/class/registryi.php');
35
+require_once($dir.'/class/registry/childreni.php');
36
+require_once($dir.'/app.php');
37
+require_once($dir.'/app/registry.php');
38
+require_once($dir.'/class/autoloader.php');
39
+require_once($dir.'/class/registry.php');
40
+require_once($dir.'/class/registry/children.php');
41
+require_once($dir.'/class/registry/persistent.php');
42
+require_once($dir.'/data/type.php');
43
+require_once($dir.'/data/type/integer.php');
44
+require_once($dir.'/data/type/text.php');
45
+require_once($dir.'/db/query.php');
46
+require_once($dir.'/entityish.php');
47
+require_once($dir.'/entity.php');
48
+require_once($dir.'/entity/relationship.php');
49
+require_once($dir.'/entity/relationship/dynamic.php');
50
+require_once($dir.'/entity/relationship/stored/field.php');
51
+require_once($dir.'/entity/stored/array.php');
52
+require_once($dir.'/entity/stored/db/table.php');
53
+require_once($dir.'/entity/array.php');
54
+require_once($dir.'/entity/attr.php');
55
+require_once($dir.'/entity/attr/field.php');
56
+require_once($dir.'/entity/change.php');
57
+require_once($dir.'/entity/comment.php');
58
+require_once($dir.'/entity/comment/author.php');
59
+require_once($dir.'/entity/comment/post.php');
60
+require_once($dir.'/entity/context.php');
61
+require_once($dir.'/entity/context/network.php');
62
+require_once($dir.'/entity/context/site.php');
63
+require_once($dir.'/entity/hierarchy.php');
64
+require_once($dir.'/entity/post.php');
65
+require_once($dir.'/entity/post/author.php');
66
+require_once($dir.'/entity/post/content.php');
67
+require_once($dir.'/entity/post/terms.php');
68
+require_once($dir.'/entity/post/type.php');
69
+require_once($dir.'/entity/post/type/name.php');
70
+require_once($dir.'/entity/post/type/relationship.php');
71
+require_once($dir.'/entity/site.php');
72
+require_once($dir.'/entity/term.php');
73
+require_once($dir.'/entity/term/id.php');
74
+require_once($dir.'/entity/user.php');
75
+require_once($dir.'/entity/user/role.php');
76
+require_once($dir.'/entity/user/role/name.php');
77
+require_once($dir.'/entity/user/roles.php');
78
+require_once($dir.'/hierarchy.php');
79
+require_once($dir.'/hook/action.php');
80
+require_once($dir.'/hook/action/comment/new.php');
81
+require_once($dir.'/hook/action/post/publish.php');
82
+require_once($dir.'/hook/actions.php');
83
+require_once($dir.'/hook/arg.php');
84
+require_once($dir.'/hook/arg/current/post.php');
85
+require_once($dir.'/hook/arg/current/site.php');
86
+require_once($dir.'/hook/arg/current/user.php');
87
+require_once($dir.'/hook/arg/dynamic.php');
88
+require_once($dir.'/hook/condition.php');
89
+require_once($dir.'/hook/condition/entity/array/contains.php');
90
+require_once($dir.'/hook/condition/equals.php');
91
+require_once($dir.'/hook/condition/string/contains.php');
92
+require_once($dir.'/hook/event.php');
93
+require_once($dir.'/hook/event/dynamic.php');
94
+require_once($dir.'/hook/event/args.php');
95
+require_once($dir.'/hook/event/comment/leave.php');
96
+require_once($dir.'/hook/event/media/upload.php');
97
+require_once($dir.'/hook/event/post/publish.php');
98
+require_once($dir.'/hook/event/user/register.php');
99
+require_once($dir.'/hook/event/user/visit.php');
100
+require_once($dir.'/hook/events.php');
101
+require_once($dir.'/hook/extension.php');
102
+require_once($dir.'/hook/extension/blocker.php');
103
+require_once($dir.'/hook/extension/conditions.php');
104
+require_once($dir.'/hook/extension/periods.php');
105
+require_once($dir.'/hook/extension/repeat/blocker.php');
106
+require_once($dir.'/hook/extension/reversals.php');
107
+require_once($dir.'/hook/extension/reversals/legacy/points.php');
108
+require_once($dir.'/hook/fire.php');
109
+require_once($dir.'/hook/hit/logger.php');
110
+require_once($dir.'/hook/hit/query.php');
111
+require_once($dir.'/hook/reaction.php');
112
+require_once($dir.'/hook/reaction/options.php');
113
+require_once($dir.'/hook/reaction/store.php');
114
+require_once($dir.'/hook/reaction/store/options.php');
115
+require_once($dir.'/hook/reaction/store/options/network.php');
116
+require_once($dir.'/hook/reaction/validator.php');
117
+require_once($dir.'/hook/reactor.php');
118
+require_once($dir.'/hook/reactor/points.php');
119
+require_once($dir.'/hook/reactor/points/legacy.php');
120
+require_once($dir.'/hook/retroactive/conditions.php');
121
+require_once($dir.'/hook/retroactive/query.php');
122
+require_once($dir.'/hook/retroactive/queryable.php');
123
+require_once($dir.'/hook/router.php');
124
+require_once($dir.'/hook/settings.php');
125
+require_once($dir.'/hook/validator/exception.php');
126
+require_once($dir.'/hooks.php');
127
+require_once($dir.'/query/builder/db/mysql.php');
128
+require_once($dir.'/spec.php');
129
+require_once($dir.'/wpdb/wrapper.php');
130 130
 // }
131 131
 
132 132
 // EOF
Please login to merge, or discard this patch.
src/includes/functions.php 1 patch
Spacing   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,10 +292,10 @@  discard block
 block discarded – undo
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 301
 
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
  *
309 309
  * @param WordPoints_App_Registry $entities The entities app.
310 310
  */
311
-function wordpoints_entities_app_init( $entities ) {
311
+function wordpoints_entities_app_init($entities) {
312 312
 
313
-	$entities->sub_apps->register( 'children', 'WordPoints_Class_Registry_Children' );
314
-	$entities->sub_apps->register( 'contexts', 'WordPoints_Class_Registry' );
313
+	$entities->sub_apps->register('children', 'WordPoints_Class_Registry_Children');
314
+	$entities->sub_apps->register('contexts', 'WordPoints_Class_Registry');
315 315
 }
316 316
 
317 317
 /**
@@ -323,10 +323,10 @@  discard block
 block discarded – undo
323 323
  *
324 324
  * @param WordPoints_Class_Registry $contexts The entity context registry.
325 325
  */
326
-function wordpoints_entity_contexts_init( $contexts ) {
326
+function wordpoints_entity_contexts_init($contexts) {
327 327
 
328
-	$contexts->register( 'network', 'WordPoints_Entity_Context_Network' );
329
-	$contexts->register( 'site', 'WordPoints_Entity_Context_Site' );
328
+	$contexts->register('network', 'WordPoints_Entity_Context_Network');
329
+	$contexts->register('site', 'WordPoints_Entity_Context_Site');
330 330
 }
331 331
 
332 332
 /**
@@ -338,18 +338,18 @@  discard block
 block discarded – undo
338 338
  *
339 339
  * @param WordPoints_App_Registry $entities The entities app.
340 340
  */
341
-function wordpoints_entities_init( $entities ) {
341
+function wordpoints_entities_init($entities) {
342 342
 
343 343
 	$children = $entities->children;
344 344
 
345
-	$entities->register( 'user', 'WordPoints_Entity_User' );
346
-	$children->register( 'user', 'roles', 'WordPoints_Entity_User_Roles' );
345
+	$entities->register('user', 'WordPoints_Entity_User');
346
+	$children->register('user', 'roles', 'WordPoints_Entity_User_Roles');
347 347
 
348
-	$entities->register( 'user_role', 'WordPoints_Entity_User_Role' );
349
-	$children->register( 'user_role', 'name', 'WordPoints_Entity_User_Role_Name' );
348
+	$entities->register('user_role', 'WordPoints_Entity_User_Role');
349
+	$children->register('user_role', 'name', 'WordPoints_Entity_User_Role_Name');
350 350
 
351 351
 	// Register entities for all of the public post types.
352
-	$post_types = get_post_types( array( 'public' => true ) );
352
+	$post_types = get_post_types(array('public' => true));
353 353
 
354 354
 	/**
355 355
 	 * Filter which post types to register entities for.
@@ -358,14 +358,14 @@  discard block
 block discarded – undo
358 358
 	 *
359 359
 	 * @param string[] The post type slugs ("names").
360 360
 	 */
361
-	$post_types = apply_filters( 'wordpoints_register_entities_for_post_types', $post_types );
361
+	$post_types = apply_filters('wordpoints_register_entities_for_post_types', $post_types);
362 362
 
363
-	foreach ( $post_types as $slug ) {
364
-		wordpoints_register_post_type_entities( $slug );
363
+	foreach ($post_types as $slug) {
364
+		wordpoints_register_post_type_entities($slug);
365 365
 	}
366 366
 
367 367
 	// Register entities for all of the public taxonomies.
368
-	$taxonomies = get_taxonomies( array( 'public' => true ) );
368
+	$taxonomies = get_taxonomies(array('public' => true));
369 369
 
370 370
 	/**
371 371
 	 * Filter which taxonomies to register entities for.
@@ -374,10 +374,10 @@  discard block
 block discarded – undo
374 374
 	 *
375 375
 	 * @param string[] The taxonomy slugs.
376 376
 	 */
377
-	$taxonomies = apply_filters( 'wordpoints_register_entities_for_taxonomies', $taxonomies );
377
+	$taxonomies = apply_filters('wordpoints_register_entities_for_taxonomies', $taxonomies);
378 378
 
379
-	foreach ( $taxonomies as $slug ) {
380
-		wordpoints_register_taxonomy_entities( $slug );
379
+	foreach ($taxonomies as $slug) {
380
+		wordpoints_register_taxonomy_entities($slug);
381 381
 	}
382 382
 }
383 383
 
@@ -388,28 +388,28 @@  discard block
 block discarded – undo
388 388
  *
389 389
  * @param string $slug The slug of the post type.
390 390
  */
391
-function wordpoints_register_post_type_entities( $slug ) {
391
+function wordpoints_register_post_type_entities($slug) {
392 392
 
393 393
 	$entities = wordpoints_entities();
394 394
 	$children = $entities->children;
395 395
 
396
-	$entities->register( "post\\{$slug}", 'WordPoints_Entity_Post' );
397
-	$children->register( "post\\{$slug}", 'author', 'WordPoints_Entity_Post_Author' );
396
+	$entities->register("post\\{$slug}", 'WordPoints_Entity_Post');
397
+	$children->register("post\\{$slug}", 'author', 'WordPoints_Entity_Post_Author');
398 398
 
399
-	$supports = get_all_post_type_supports( $slug );
399
+	$supports = get_all_post_type_supports($slug);
400 400
 
401
-	if ( isset( $supports['editor'] ) ) {
402
-		$children->register( "post\\{$slug}", 'content', 'WordPoints_Entity_Post_Content' );
401
+	if (isset($supports['editor'])) {
402
+		$children->register("post\\{$slug}", 'content', 'WordPoints_Entity_Post_Content');
403 403
 	}
404 404
 
405
-	if ( isset( $supports['comments'] ) ) {
406
-		$entities->register( "comment\\{$slug}", 'WordPoints_Entity_Comment' );
407
-		$children->register( "comment\\{$slug}", "post\\{$slug}", 'WordPoints_Entity_Comment_Post' );
408
-		$children->register( "comment\\{$slug}", 'author', 'WordPoints_Entity_Comment_Author' );
405
+	if (isset($supports['comments'])) {
406
+		$entities->register("comment\\{$slug}", 'WordPoints_Entity_Comment');
407
+		$children->register("comment\\{$slug}", "post\\{$slug}", 'WordPoints_Entity_Comment_Post');
408
+		$children->register("comment\\{$slug}", 'author', 'WordPoints_Entity_Comment_Author');
409 409
 	}
410 410
 
411
-	foreach ( get_object_taxonomies( $slug ) as $taxonomy_slug ) {
412
-		$children->register( "post\\{$slug}", "terms\\{$taxonomy_slug}", 'WordPoints_Entity_Post_Terms' );
411
+	foreach (get_object_taxonomies($slug) as $taxonomy_slug) {
412
+		$children->register("post\\{$slug}", "terms\\{$taxonomy_slug}", 'WordPoints_Entity_Post_Terms');
413 413
 	}
414 414
 
415 415
 	/**
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 	 *
420 420
 	 * @param string $slug The slug ("name") of the post type.
421 421
 	 */
422
-	do_action( 'wordpoints_register_post_type_entities', $slug );
422
+	do_action('wordpoints_register_post_type_entities', $slug);
423 423
 }
424 424
 
425 425
 /**
@@ -429,11 +429,11 @@  discard block
 block discarded – undo
429 429
  *
430 430
  * @param string $slug The slug of the post type.
431 431
  */
432
-function wordpoints_register_post_type_hook_events( $slug ) {
432
+function wordpoints_register_post_type_hook_events($slug) {
433 433
 
434 434
 	$events = wordpoints_hooks()->events;
435 435
 
436
-	if ( 'attachment' === $slug ) {
436
+	if ('attachment' === $slug) {
437 437
 
438 438
 		$events->register(
439 439
 			'media_upload'
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 			, array(
458 458
 				'actions' => array(
459 459
 					'toggle_on'  => 'post_publish',
460
-					'toggle_off' => array( 'post_depublish', 'post_delete' ),
460
+					'toggle_off' => array('post_depublish', 'post_delete'),
461 461
 				),
462 462
 				'args'    => array(
463 463
 					"post\\{$slug}" => 'WordPoints_Hook_Arg_Dynamic',
@@ -466,14 +466,14 @@  discard block
 block discarded – undo
466 466
 		);
467 467
 	}
468 468
 
469
-	if ( post_type_supports( $slug, 'comments' ) ) {
469
+	if (post_type_supports($slug, 'comments')) {
470 470
 
471 471
 		$events->register(
472 472
 			"comment_leave\\{$slug}"
473 473
 			, 'WordPoints_Hook_Event_Comment_Leave'
474 474
 			, array(
475 475
 				'actions' => array(
476
-					'toggle_on'  => array( 'comment_approve', 'comment_new' ),
476
+					'toggle_on'  => array('comment_approve', 'comment_new'),
477 477
 					'toggle_off' => 'comment_deapprove',
478 478
 				),
479 479
 				'args' => array(
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 	 *
491 491
 	 * @param string $slug The slug ("name") of the post type.
492 492
 	 */
493
-	do_action( 'wordpoints_register_post_type_hook_events', $slug );
493
+	do_action('wordpoints_register_post_type_hook_events', $slug);
494 494
 }
495 495
 
496 496
 /**
@@ -500,13 +500,13 @@  discard block
 block discarded – undo
500 500
  *
501 501
  * @param string $slug The slug of the taxonomy.
502 502
  */
503
-function wordpoints_register_taxonomy_entities( $slug ) {
503
+function wordpoints_register_taxonomy_entities($slug) {
504 504
 
505 505
 	$entities = wordpoints_entities();
506 506
 	$children = $entities->children;
507 507
 
508
-	$entities->register( "term\\{$slug}", 'WordPoints_Entity_Term' );
509
-	$children->register( "term\\{$slug}", 'id', 'WordPoints_Entity_Term_Id' );
508
+	$entities->register("term\\{$slug}", 'WordPoints_Entity_Term');
509
+	$children->register("term\\{$slug}", 'id', 'WordPoints_Entity_Term_Id');
510 510
 
511 511
 	/**
512 512
 	 * Fired when registering the entities for a taxonomy.
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 	 *
516 516
 	 * @param string $slug The taxonomy's slug.
517 517
 	 */
518
-	do_action( 'wordpoints_register_taxonomy_entities', $slug );
518
+	do_action('wordpoints_register_taxonomy_entities', $slug);
519 519
 }
520 520
 
521 521
 /**
@@ -527,10 +527,10 @@  discard block
 block discarded – undo
527 527
  *
528 528
  * @param WordPoints_Class_RegistryI $data_types The data types registry.
529 529
  */
530
-function wordpoints_data_types_init( $data_types ) {
530
+function wordpoints_data_types_init($data_types) {
531 531
 
532
-	$data_types->register( 'integer', 'WordPoints_Data_Type_Integer' );
533
-	$data_types->register( 'text', 'WordPoints_Data_Type_Text' );
532
+	$data_types->register('integer', 'WordPoints_Data_Type_Integer');
533
+	$data_types->register('text', 'WordPoints_Data_Type_Text');
534 534
 }
535 535
 
536 536
 /**
@@ -545,9 +545,9 @@  discard block
 block discarded – undo
545 545
  *
546 546
  * @return bool Whether the user can view the points log.
547 547
  */
548
-function wordpoints_hooks_user_can_view_points_log( $can_view, $log ) {
548
+function wordpoints_hooks_user_can_view_points_log($can_view, $log) {
549 549
 
550
-	if ( ! $can_view ) {
550
+	if ( ! $can_view) {
551 551
 		return $can_view;
552 552
 	}
553 553
 
@@ -556,11 +556,11 @@  discard block
 block discarded – undo
556 556
 	$event_slug = $log->log_type;
557 557
 
558 558
 	/** @var WordPoints_Hook_Arg $arg */
559
-	foreach ( wordpoints_hooks()->events->args->get_children( $event_slug ) as $slug => $arg ) {
559
+	foreach (wordpoints_hooks()->events->args->get_children($event_slug) as $slug => $arg) {
560 560
 
561
-		$value = wordpoints_get_points_log_meta( $log->id, $slug, true );
561
+		$value = wordpoints_get_points_log_meta($log->id, $slug, true);
562 562
 
563
-		if ( ! $value ) {
563
+		if ( ! $value) {
564 564
 			continue;
565 565
 		}
566 566
 
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 			, $value
571 571
 		);
572 572
 
573
-		if ( ! $can_view ) {
573
+		if ( ! $can_view) {
574 574
 			break;
575 575
 		}
576 576
 	}
@@ -589,20 +589,20 @@  discard block
 block discarded – undo
589 589
  *
590 590
  * @return bool Whether the user can view this entity.
591 591
  */
592
-function wordpoints_entity_user_can_view( $user_id, $entity_slug, $entity_id ) {
592
+function wordpoints_entity_user_can_view($user_id, $entity_slug, $entity_id) {
593 593
 
594
-	$entity = wordpoints_entities()->get( $entity_slug );
594
+	$entity = wordpoints_entities()->get($entity_slug);
595 595
 
596 596
 	// If this entity type is not found, we have no way of determining whether it is
597 597
 	// safe for the user to view it.
598
-	if ( ! ( $entity instanceof WordPoints_Entity ) ) {
598
+	if ( ! ($entity instanceof WordPoints_Entity)) {
599 599
 		return false;
600 600
 	}
601 601
 
602 602
 	$can_view = true;
603 603
 
604
-	if ( $entity instanceof WordPoints_Entity_Restricted_VisibilityI ) {
605
-		$can_view = $entity->user_can_view( $user_id, $entity_id );
604
+	if ($entity instanceof WordPoints_Entity_Restricted_VisibilityI) {
605
+		$can_view = $entity->user_can_view($user_id, $entity_id);
606 606
 	}
607 607
 
608 608
 	/**
@@ -633,8 +633,8 @@  discard block
 block discarded – undo
633 633
  */
634 634
 function wordpoints_apps() {
635 635
 
636
-	if ( ! isset( WordPoints_App::$main ) ) {
637
-		WordPoints_App::$main = new WordPoints_App( 'apps' );
636
+	if ( ! isset(WordPoints_App::$main)) {
637
+		WordPoints_App::$main = new WordPoints_App('apps');
638 638
 	}
639 639
 
640 640
 	return WordPoints_App::$main;
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
  */
650 650
 function wordpoints_hooks() {
651 651
 
652
-	if ( ! isset( WordPoints_App::$main ) ) {
652
+	if ( ! isset(WordPoints_App::$main)) {
653 653
 		wordpoints_apps();
654 654
 	}
655 655
 
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
  */
666 666
 function wordpoints_entities() {
667 667
 
668
-	if ( ! isset( WordPoints_App::$main ) ) {
668
+	if ( ! isset(WordPoints_App::$main)) {
669 669
 		wordpoints_apps();
670 670
 	}
671 671
 
@@ -681,13 +681,13 @@  discard block
 block discarded – undo
681 681
  *
682 682
  * @param WordPoints_App $app The main apps app.
683 683
  */
684
-function wordpoints_apps_init( $app ) {
684
+function wordpoints_apps_init($app) {
685 685
 
686 686
 	$apps = $app->sub_apps;
687 687
 
688
-	$apps->register( 'hooks', 'WordPoints_Hooks' );
689
-	$apps->register( 'entities', 'WordPoints_App_Registry' );
690
-	$apps->register( 'data_types', 'WordPoints_Class_Registry' );
688
+	$apps->register('hooks', 'WordPoints_Hooks');
689
+	$apps->register('entities', 'WordPoints_App_Registry');
690
+	$apps->register('data_types', 'WordPoints_Class_Registry');
691 691
 }
692 692
 
693 693
 /**
@@ -700,19 +700,19 @@  discard block
 block discarded – undo
700 700
  *
701 701
  * @return object|false The constructed object, or false if to many args were passed.
702 702
  */
703
-function wordpoints_construct_class_with_args( $class_name, array $args ) {
703
+function wordpoints_construct_class_with_args($class_name, array $args) {
704 704
 
705
-	switch ( count( $args ) ) {
705
+	switch (count($args)) {
706 706
 		case 0:
707 707
 			return new $class_name();
708 708
 		case 1:
709
-			return new $class_name( $args[0] );
709
+			return new $class_name($args[0]);
710 710
 		case 2:
711
-			return new $class_name( $args[0], $args[1] );
711
+			return new $class_name($args[0], $args[1]);
712 712
 		case 3:
713
-			return new $class_name( $args[0], $args[1], $args[2] );
713
+			return new $class_name($args[0], $args[1], $args[2]);
714 714
 		case 4:
715
-			return new $class_name( $args[0], $args[1], $args[2], $args[3] );
715
+			return new $class_name($args[0], $args[1], $args[2], $args[3]);
716 716
 		default:
717 717
 			return false;
718 718
 	}
@@ -734,13 +734,13 @@  discard block
 block discarded – undo
734 734
  * @return array The slug parsed into the 'generic' and 'dynamic' portions. If the
735 735
  *               slug is not dynamic, the value of each of those keys will be false.
736 736
  */
737
-function wordpoints_parse_dynamic_slug( $slug ) {
737
+function wordpoints_parse_dynamic_slug($slug) {
738 738
 
739
-	$parsed = array( 'dynamic' => false, 'generic' => false );
739
+	$parsed = array('dynamic' => false, 'generic' => false);
740 740
 
741
-	$parts = explode( '\\', $slug, 2 );
741
+	$parts = explode('\\', $slug, 2);
742 742
 
743
-	if ( isset( $parts[1] ) ) {
743
+	if (isset($parts[1])) {
744 744
 		$parsed['dynamic'] = $parts[1];
745 745
 		$parsed['generic'] = $parts[0];
746 746
 	}
@@ -779,28 +779,28 @@  discard block
 block discarded – undo
779 779
  *                     contexts, indexed by context slug, or false if any of the
780 780
  *                     contexts isn't current.
781 781
  */
782
-function wordpoints_entities_get_current_context_id( $slug ) {
782
+function wordpoints_entities_get_current_context_id($slug) {
783 783
 
784 784
 	$current_context = array();
785 785
 
786 786
 	/** @var WordPoints_Class_Registry $contexts */
787 787
 	$contexts = wordpoints_entities()->contexts;
788 788
 
789
-	while ( $slug ) {
789
+	while ($slug) {
790 790
 
791
-		$context = $contexts->get( $slug );
791
+		$context = $contexts->get($slug);
792 792
 
793
-		if ( ! $context instanceof WordPoints_Entity_Context ) {
793
+		if ( ! $context instanceof WordPoints_Entity_Context) {
794 794
 			return false;
795 795
 		}
796 796
 
797 797
 		$id = $context->get_current_id();
798 798
 
799
-		if ( false === $id ) {
799
+		if (false === $id) {
800 800
 			return false;
801 801
 		}
802 802
 
803
-		$current_context[ $slug ] = $id;
803
+		$current_context[$slug] = $id;
804 804
 
805 805
 		$slug = $context->get_parent_slug();
806 806
 	}
@@ -821,22 +821,22 @@  discard block
 block discarded – undo
821 821
  */
822 822
 function wordpoints_is_network_context() {
823 823
 
824
-	if ( ! is_multisite() ) {
824
+	if ( ! is_multisite()) {
825 825
 		return false;
826 826
 	}
827 827
 
828
-	if ( is_network_admin() ) {
828
+	if (is_network_admin()) {
829 829
 		return true;
830 830
 	}
831 831
 
832 832
 	// See https://core.trac.wordpress.org/ticket/22589
833 833
 	if (
834
-		defined( 'DOING_AJAX' )
834
+		defined('DOING_AJAX')
835 835
 		&& DOING_AJAX
836
-		&& isset( $_SERVER['HTTP_REFERER'] )
836
+		&& isset($_SERVER['HTTP_REFERER'])
837 837
 		&& preg_match(
838
-			'#^' . preg_quote( network_admin_url(), '#' ) . '#i'
839
-			, esc_url_raw( wp_unslash( $_SERVER['HTTP_REFERER'] ) )
838
+			'#^'.preg_quote(network_admin_url(), '#').'#i'
839
+			, esc_url_raw(wp_unslash($_SERVER['HTTP_REFERER']))
840 840
 		)
841 841
 	) {
842 842
 		return true;
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
 	 *
850 850
 	 * @param bool $in_network_context Whether we are in network context.
851 851
 	 */
852
-	return apply_filters( 'wordpoints_is_network_context', false );
852
+	return apply_filters('wordpoints_is_network_context', false);
853 853
 }
854 854
 
855 855
 /**
@@ -863,21 +863,21 @@  discard block
 block discarded – undo
863 863
  *
864 864
  * @return string The primary arg's GUID, JSON encoded.
865 865
  */
866
-function wordpoints_hooks_get_event_primary_arg_guid_json( WordPoints_Hook_Event_Args $event_args ) {
866
+function wordpoints_hooks_get_event_primary_arg_guid_json(WordPoints_Hook_Event_Args $event_args) {
867 867
 
868 868
 	$entity = $event_args->get_primary_arg();
869 869
 
870
-	if ( ! $entity ) {
870
+	if ( ! $entity) {
871 871
 		return '';
872 872
 	}
873 873
 
874 874
 	$the_guid = $entity->get_the_guid();
875 875
 
876
-	if ( ! $the_guid ) {
876
+	if ( ! $the_guid) {
877 877
 		return '';
878 878
 	}
879 879
 
880
-	return wp_json_encode( $the_guid );
880
+	return wp_json_encode($the_guid);
881 881
 }
882 882
 
883 883
 /**
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
  */
891 891
 function wordpoints_hooks_api_add_global_cache_groups() {
892 892
 
893
-	if ( function_exists( 'wp_cache_add_global_groups' ) ) {
893
+	if (function_exists('wp_cache_add_global_groups')) {
894 894
 
895 895
 		wp_cache_add_global_groups(
896 896
 			array(
@@ -916,8 +916,8 @@  discard block
 block discarded – undo
916 916
  * @return string The escaped identifier. Already quoted, do not place within
917 917
  *                backticks.
918 918
  */
919
-function wordpoints_escape_mysql_identifier( $identifier ) {
920
-	return '`' . str_replace( '`', '``', $identifier ) . '`';
919
+function wordpoints_escape_mysql_identifier($identifier) {
920
+	return '`'.str_replace('`', '``', $identifier).'`';
921 921
 }
922 922
 
923 923
 // EOF
Please login to merge, or discard this patch.
src/admin/includes/classes/screen/points/types.php 1 patch
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * @since 1.0.0
57 57
 	 */
58 58
 	protected function get_title() {
59
-		return _x( 'Points Types', 'page title', 'wordpoints' );
59
+		return _x('Points Types', 'page title', 'wordpoints');
60 60
 	}
61 61
 
62 62
 	/**
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 
67 67
 		parent::hooks();
68 68
 
69
-		add_action( 'add_meta_boxes', array( $this, 'add_points_settings_meta_box' ) );
70
-		add_action( 'add_meta_boxes', array( $this, 'add_event_meta_boxes' ) );
69
+		add_action('add_meta_boxes', array($this, 'add_points_settings_meta_box'));
70
+		add_action('add_meta_boxes', array($this, 'add_event_meta_boxes'));
71 71
 	}
72 72
 
73 73
 	/**
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function enqueue_scripts() {
77 77
 
78
-		wp_enqueue_style( 'wordpoints-hooks-admin' );
78
+		wp_enqueue_style('wordpoints-hooks-admin');
79 79
 
80
-		wp_enqueue_script( 'postbox' );
81
-		wp_enqueue_script( 'wordpoints-admin-points-types' );
80
+		wp_enqueue_script('postbox');
81
+		wp_enqueue_script('wordpoints-admin-points-types');
82 82
 
83 83
 		wordpoints_hooks_ui_setup_script_data();
84 84
 	}
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 					.addClass( 'closed' );
99 99
 
100 100
 				postboxes.add_postbox_toggles(
101
-					<?php echo wp_json_encode( $this->id ); ?>
101
+					<?php echo wp_json_encode($this->id); ?>
102 102
 				);
103 103
 			} );
104 104
 		</script>
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
 	 */
114 114
 	public function add_points_settings_meta_box() {
115 115
 
116
-		if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) {
116
+		if ( ! current_user_can('manage_wordpoints_points_types')) {
117 117
 			return;
118 118
 		}
119 119
 
120 120
 		add_meta_box(
121 121
 			'settings'
122
-			, __( 'Settings', 'wordpoints' )
123
-			, array( $this, 'display_points_settings_meta_box' )
122
+			, __('Settings', 'wordpoints')
123
+			, array($this, 'display_points_settings_meta_box')
124 124
 			, $this->id
125 125
 			, 'side'
126 126
 			, 'default'
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function display_points_settings_meta_box() {
136 136
 
137
-		if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) {
137
+		if ( ! current_user_can('manage_wordpoints_points_types')) {
138 138
 			return;
139 139
 		}
140 140
 
@@ -142,12 +142,12 @@  discard block
 block discarded – undo
142 142
 
143 143
 		$add_new = 0;
144 144
 
145
-		$points_type = wordpoints_get_points_type( $slug );
145
+		$points_type = wordpoints_get_points_type($slug);
146 146
 
147
-		if ( ! $points_type ) {
147
+		if ( ! $points_type) {
148 148
 
149 149
 			$points_type = array();
150
-			$add_new     = wp_create_nonce( 'wordpoints_add_new_points_type' );
150
+			$add_new     = wp_create_nonce('wordpoints_add_new_points_type');
151 151
 		}
152 152
 
153 153
 		$points_type = array_merge(
@@ -162,15 +162,15 @@  discard block
 block discarded – undo
162 162
 		?>
163 163
 
164 164
 		<form method="post">
165
-			<?php if ( $slug ) : ?>
165
+			<?php if ($slug) : ?>
166 166
 				<p>
167 167
 					<span class="wordpoints-points-slug">
168 168
 						<em>
169
-							<?php echo esc_html( sprintf( __( 'Slug: %s', 'wordpoints' ), $slug ) ); ?>
169
+							<?php echo esc_html(sprintf(__('Slug: %s', 'wordpoints'), $slug)); ?>
170 170
 						</em>
171 171
 					</span>
172 172
 				</p>
173
-				<?php wp_nonce_field( "wordpoints_update_points_type-$slug", 'update_points_type' ); ?>
173
+				<?php wp_nonce_field("wordpoints_update_points_type-$slug", 'update_points_type'); ?>
174 174
 			<?php endif; ?>
175 175
 
176 176
 			<?php
@@ -184,45 +184,45 @@  discard block
 block discarded – undo
184 184
 			 *
185 185
 			 * @param string $points_type The slug of the points type.
186 186
 			 */
187
-			do_action( 'wordpoints_points_type_form_top', $slug );
187
+			do_action('wordpoints_points_type_form_top', $slug);
188 188
 
189
-			if ( $add_new ) {
189
+			if ($add_new) {
190 190
 
191 191
 				// Mark the prefix and suffix optional on the add new form.
192
-				$prefix = _x( 'Prefix (optional):', 'points type', 'wordpoints' );
193
-				$suffix = _x( 'Suffix (optional):', 'points type', 'wordpoints' );
192
+				$prefix = _x('Prefix (optional):', 'points type', 'wordpoints');
193
+				$suffix = _x('Suffix (optional):', 'points type', 'wordpoints');
194 194
 
195 195
 			} else {
196 196
 
197
-				$prefix = _x( 'Prefix:', 'points type', 'wordpoints' );
198
-				$suffix = _x( 'Suffix:', 'points type', 'wordpoints' );
197
+				$prefix = _x('Prefix:', 'points type', 'wordpoints');
198
+				$suffix = _x('Suffix:', 'points type', 'wordpoints');
199 199
 			}
200 200
 
201 201
 			?>
202 202
 
203 203
 			<p>
204 204
 				<label
205
-					for="points-name-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html_x( 'Name:', 'points type', 'wordpoints' ); ?></label>
205
+					for="points-name-<?php echo esc_attr($slug); ?>"><?php echo esc_html_x('Name:', 'points type', 'wordpoints'); ?></label>
206 206
 				<input class="widefat" type="text"
207
-				       id="points-name-<?php echo esc_attr( $slug ); ?>"
207
+				       id="points-name-<?php echo esc_attr($slug); ?>"
208 208
 				       name="points-name"
209
-				       value="<?php echo esc_attr( $points_type['name'] ); ?>"/>
209
+				       value="<?php echo esc_attr($points_type['name']); ?>"/>
210 210
 			</p>
211 211
 			<p>
212 212
 				<label
213
-					for="points-prefix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $prefix ); ?></label>
213
+					for="points-prefix-<?php echo esc_attr($slug); ?>"><?php echo esc_html($prefix); ?></label>
214 214
 				<input class="widefat" type="text"
215
-				       id="points-prefix-<?php echo esc_attr( $slug ); ?>"
215
+				       id="points-prefix-<?php echo esc_attr($slug); ?>"
216 216
 				       name="points-prefix"
217
-				       value="<?php echo esc_attr( $points_type['prefix'] ); ?>"/>
217
+				       value="<?php echo esc_attr($points_type['prefix']); ?>"/>
218 218
 			</p>
219 219
 			<p>
220 220
 				<label
221
-					for="points-suffix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $suffix ); ?></label>
221
+					for="points-suffix-<?php echo esc_attr($slug); ?>"><?php echo esc_html($suffix); ?></label>
222 222
 				<input class="widefat" type="text"
223
-				       id="points-suffix-<?php echo esc_attr( $slug ); ?>"
223
+				       id="points-suffix-<?php echo esc_attr($slug); ?>"
224 224
 				       name="points-suffix"
225
-				       value="<?php echo esc_attr( $points_type['suffix'] ); ?>"/>
225
+				       value="<?php echo esc_attr($points_type['suffix']); ?>"/>
226 226
 			</p>
227 227
 
228 228
 			<?php
@@ -236,28 +236,28 @@  discard block
 block discarded – undo
236 236
 			 *
237 237
 			 * @param string $points_type The slug of the points type.
238 238
 			 */
239
-			do_action( 'wordpoints_points_type_form_bottom', $slug );
239
+			do_action('wordpoints_points_type_form_bottom', $slug);
240 240
 
241 241
 			?>
242 242
 
243 243
 			<input type="hidden" name="points-slug"
244
-			       value="<?php echo esc_attr( $slug ); ?>"/>
244
+			       value="<?php echo esc_attr($slug); ?>"/>
245 245
 			<input type="hidden" name="add_new" class="add_new"
246
-			       value="<?php echo esc_attr( $add_new ); ?>"/>
246
+			       value="<?php echo esc_attr($add_new); ?>"/>
247 247
 
248 248
 			<div class="hook-control-actions">
249 249
 				<div class="alignleft">
250 250
 					<?php
251 251
 
252
-					if ( ! $add_new ) {
253
-						wp_nonce_field( "wordpoints_delete_points_type-{$slug}", 'delete-points-type-nonce' );
254
-						submit_button( _x( 'Delete', 'points type', 'wordpoints' ), 'delete', 'delete-points-type', false, array( 'id' => "delete_points_type-{$slug}" ) );
252
+					if ( ! $add_new) {
253
+						wp_nonce_field("wordpoints_delete_points_type-{$slug}", 'delete-points-type-nonce');
254
+						submit_button(_x('Delete', 'points type', 'wordpoints'), 'delete', 'delete-points-type', false, array('id' => "delete_points_type-{$slug}"));
255 255
 					}
256 256
 
257 257
 					?>
258 258
 				</div>
259 259
 				<div class="alignright">
260
-					<?php submit_button( _x( 'Save', 'points type', 'wordpoints' ), 'button-primary hook-control-save right', 'save-points-type', false, array( 'id' => "points-{$slug}-save" ) ); ?>
260
+					<?php submit_button(_x('Save', 'points type', 'wordpoints'), 'button-primary hook-control-save right', 'save-points-type', false, array('id' => "points-{$slug}-save")); ?>
261 261
 					<span class="spinner"></span>
262 262
 				</div>
263 263
 				<br class="clear"/>
@@ -274,17 +274,17 @@  discard block
 block discarded – undo
274 274
 	 */
275 275
 	public function add_event_meta_boxes() {
276 276
 
277
-		if ( ! $this->current_points_type ) {
277
+		if ( ! $this->current_points_type) {
278 278
 			return;
279 279
 		}
280 280
 
281 281
 		/** @var WordPoints_Hook_EventI $event */
282
-		foreach ( $this->hooks->events->get_all() as $slug => $event ) {
282
+		foreach ($this->hooks->events->get_all() as $slug => $event) {
283 283
 
284 284
 			add_meta_box(
285 285
 				"{$this->current_points_type}-{$slug}"
286 286
 				, $event->get_title()
287
-				, array( $this, 'display_event_meta_box' )
287
+				, array($this, 'display_event_meta_box')
288 288
 				, $this->id
289 289
 				, 'events'
290 290
 				, 'default'
@@ -305,54 +305,54 @@  discard block
 block discarded – undo
305 305
 	 * @param array $points_type The points type this meta-box relates to.
306 306
 	 * @param array $meta_box    The data the meta-box was created with.
307 307
 	 */
308
-	public function display_event_meta_box( $points_type, $meta_box ) {
308
+	public function display_event_meta_box($points_type, $meta_box) {
309 309
 
310 310
 		$event_slug = $meta_box['args']['slug'];
311 311
 
312 312
 		$data = array();
313 313
 
314
-		$reaction_store = wordpoints_hooks()->get_reaction_store( 'points' );
314
+		$reaction_store = wordpoints_hooks()->get_reaction_store('points');
315 315
 
316
-		foreach ( $reaction_store->get_reactions_to_event( $event_slug ) as $id => $reaction ) {
317
-			if ( $reaction->get_meta( 'points_type' ) === $this->current_points_type ) {
316
+		foreach ($reaction_store->get_reactions_to_event($event_slug) as $id => $reaction) {
317
+			if ($reaction->get_meta('points_type') === $this->current_points_type) {
318 318
 				$data[] = WordPoints_Admin_Ajax_Hooks::prepare_hook_reaction(
319 319
 					$reaction
320 320
 				);
321 321
 			}
322 322
 		}
323 323
 
324
-		$args = $this->hooks->events->args->get_children( $event_slug );
324
+		$args = $this->hooks->events->args->get_children($event_slug);
325 325
 
326
-		$event_data = array( 'args' => array() );
326
+		$event_data = array('args' => array());
327 327
 
328
-		foreach ( $args as $slug => $arg ) {
328
+		foreach ($args as $slug => $arg) {
329 329
 
330
-			$event_data['args'][ $slug ] = array(
330
+			$event_data['args'][$slug] = array(
331 331
 				'slug' => $slug,
332 332
 			);
333 333
 
334
-			if ( $arg instanceof WordPoints_Hook_Arg ) {
335
-				$event_data['args'][ $slug ]['title'] = $arg->get_title();
336
-				$event_data['args'][ $slug ]['is_stateful'] = $arg->is_stateful();
334
+			if ($arg instanceof WordPoints_Hook_Arg) {
335
+				$event_data['args'][$slug]['title'] = $arg->get_title();
336
+				$event_data['args'][$slug]['is_stateful'] = $arg->is_stateful();
337 337
 			}
338 338
 		}
339 339
 
340 340
 		?>
341 341
 
342 342
 		<script>
343
-			WordPointsHooksAdminData.events[<?php echo wp_json_encode( $event_slug ); ?>] = <?php echo wp_json_encode( $event_data ); ?>;
344
-			WordPointsHooksAdminData.reactions[<?php echo wp_json_encode( $event_slug ); ?>] = <?php echo wp_json_encode( $data ); ?>;
343
+			WordPointsHooksAdminData.events[<?php echo wp_json_encode($event_slug); ?>] = <?php echo wp_json_encode($event_data); ?>;
344
+			WordPointsHooksAdminData.reactions[<?php echo wp_json_encode($event_slug); ?>] = <?php echo wp_json_encode($data); ?>;
345 345
 		</script>
346 346
 
347 347
 		<div class="wordpoints-hook-reaction-group-container">
348 348
 			<p class="description wordpoints-hook-reaction-group-description">
349
-				<?php echo esc_html( $meta_box['args']['event']->get_description() ); ?>
349
+				<?php echo esc_html($meta_box['args']['event']->get_description()); ?>
350 350
 			</p>
351 351
 
352 352
 			<div class="wordpoints-hook-reaction-group"
353
-				data-wordpoints-hooks-hook-event="<?php echo esc_attr( $event_slug ); ?>"
354
-				data-wordpoints-hooks-points-type="<?php echo esc_attr( $this->current_points_type ); ?>"
355
-				data-wordpoints-hooks-create-nonce="<?php echo esc_attr( WordPoints_Admin_Ajax_Hooks::get_create_nonce( $reaction_store ) ); ?>"
353
+				data-wordpoints-hooks-hook-event="<?php echo esc_attr($event_slug); ?>"
354
+				data-wordpoints-hooks-points-type="<?php echo esc_attr($this->current_points_type); ?>"
355
+				data-wordpoints-hooks-create-nonce="<?php echo esc_attr(WordPoints_Admin_Ajax_Hooks::get_create_nonce($reaction_store)); ?>"
356 356
 				data-wordpoints-hooks-reaction-store="points"
357 357
 				data-wordpoints-hooks-reactor="points">
358 358
 			</div>
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 
368 368
 			<div class="controls">
369 369
 				<button type="button" class="button-primary add-reaction">
370
-					<?php esc_html_e( 'Add New', 'wordpoints' ); ?>
370
+					<?php esc_html_e('Add New', 'wordpoints'); ?>
371 371
 				</button>
372 372
 			</div>
373 373
 		</div>
@@ -387,19 +387,19 @@  discard block
 block discarded – undo
387 387
 		// Show a tab for each points type.
388 388
 		$tabs = array();
389 389
 
390
-		foreach ( $points_types as $slug => $settings ) {
391
-			$tabs[ $slug ] = $settings['name'];
390
+		foreach ($points_types as $slug => $settings) {
391
+			$tabs[$slug] = $settings['name'];
392 392
 		}
393 393
 
394
-		$tabs['add-new'] = __( 'Add New', 'wordpoints' );
394
+		$tabs['add-new'] = __('Add New', 'wordpoints');
395 395
 
396
-		$tab = wordpoints_admin_get_current_tab( $tabs );
396
+		$tab = wordpoints_admin_get_current_tab($tabs);
397 397
 
398
-		if ( 'add-new' !== $tab ) {
398
+		if ('add-new' !== $tab) {
399 399
 			$this->current_points_type = $tab;
400 400
 		}
401 401
 
402
-		do_action( 'add_meta_boxes', $this->id );
402
+		do_action('add_meta_boxes', $this->id);
403 403
 
404 404
 		$this->tabs = $tabs;
405 405
 	}
@@ -411,19 +411,19 @@  discard block
 block discarded – undo
411 411
 	 */
412 412
 	public function save_points_type() {
413 413
 
414
-		if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) {
414
+		if ( ! current_user_can('manage_wordpoints_points_types')) {
415 415
 			return;
416 416
 		}
417 417
 
418
-		if ( isset( $_POST['save-points-type'] ) ) {
418
+		if (isset($_POST['save-points-type'])) {
419 419
 			
420
-			if ( isset( $_POST['points-slug'] ) ) {
420
+			if (isset($_POST['points-slug'])) {
421 421
 				$this->update_points_type();
422 422
 			} else {
423 423
 				$this->add_points_type();
424 424
 			}
425 425
 
426
-		} elseif ( ! empty( $_POST['delete-points-type'] ) ) {
426
+		} elseif ( ! empty($_POST['delete-points-type'])) {
427 427
 			
428 428
 			$this->delete_points_type();
429 429
 		}
@@ -440,21 +440,21 @@  discard block
 block discarded – undo
440 440
 
441 441
 		$settings = array();
442 442
 
443
-		if ( isset( $_POST['points-name'] ) ) {
443
+		if (isset($_POST['points-name'])) {
444 444
 			$settings['name'] = trim(
445
-				sanitize_text_field( wp_unslash( $_POST['points-name'] ) ) // WPCS: CSRF OK
445
+				sanitize_text_field(wp_unslash($_POST['points-name'])) // WPCS: CSRF OK
446 446
 			);
447 447
 		}
448 448
 
449
-		if ( isset( $_POST['points-prefix'] ) ) {
449
+		if (isset($_POST['points-prefix'])) {
450 450
 			$settings['prefix'] = ltrim(
451
-				sanitize_text_field( wp_unslash( $_POST['points-prefix'] ) ) // WPCS: CSRF OK
451
+				sanitize_text_field(wp_unslash($_POST['points-prefix'])) // WPCS: CSRF OK
452 452
 			);
453 453
 		}
454 454
 
455
-		if ( isset( $_POST['points-suffix'] ) ) {
455
+		if (isset($_POST['points-suffix'])) {
456 456
 			$settings['suffix'] = rtrim(
457
-				sanitize_text_field( wp_unslash( $_POST['points-suffix'] ) ) // WPCS: CSRF OK
457
+				sanitize_text_field(wp_unslash($_POST['points-suffix'])) // WPCS: CSRF OK
458 458
 			);
459 459
 		}
460 460
 
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 			! wordpoints_verify_nonce(
473 473
 				'update_points_type'
474 474
 				, 'wordpoints_update_points_type-%s'
475
-				, array( 'points-slug' )
475
+				, array('points-slug')
476 476
 				, 'post'
477 477
 			)
478 478
 		) {
@@ -481,42 +481,42 @@  discard block
 block discarded – undo
481 481
 
482 482
 		$settings = $this->get_points_type_settings();
483 483
 		
484
-		if ( empty( $settings['name'] ) ) {
484
+		if (empty($settings['name'])) {
485 485
 
486 486
 			add_settings_error(
487 487
 				'points-name'
488 488
 				, 'wordpoints_points_type_update'
489
-				, __( 'Error: points type name cannot be empty.', 'wordpoints' )
489
+				, __('Error: points type name cannot be empty.', 'wordpoints')
490 490
 			);
491 491
 
492 492
 			return;
493 493
 		}
494 494
 
495
-		$points_type = sanitize_key( $_POST['points-slug'] );
495
+		$points_type = sanitize_key($_POST['points-slug']);
496 496
 
497
-		$old_settings = wordpoints_get_points_type( $points_type );
497
+		$old_settings = wordpoints_get_points_type($points_type);
498 498
 
499
-		if ( false === $old_settings ) {
499
+		if (false === $old_settings) {
500 500
 
501 501
 			add_settings_error(
502 502
 				''
503 503
 				, 'wordpoints_points_type_update'
504
-				, __( 'Error: failed updating points type.', 'wordpoints' )
504
+				, __('Error: failed updating points type.', 'wordpoints')
505 505
 			);
506 506
 
507 507
 			return;
508 508
 		}
509 509
 
510
-		if ( is_array( $old_settings ) ) {
511
-			$settings = array_merge( $old_settings, $settings );
510
+		if (is_array($old_settings)) {
511
+			$settings = array_merge($old_settings, $settings);
512 512
 		}
513 513
 
514
-		if ( ! wordpoints_update_points_type( $points_type, $settings ) ) {
514
+		if ( ! wordpoints_update_points_type($points_type, $settings)) {
515 515
 
516 516
 			add_settings_error(
517 517
 				''
518 518
 				, 'wordpoints_points_type_update'
519
-				, __( 'Error: failed updating points type.', 'wordpoints' )
519
+				, __('Error: failed updating points type.', 'wordpoints')
520 520
 			);
521 521
 
522 522
 		} else {
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 			add_settings_error(
525 525
 				''
526 526
 				, 'wordpoints_points_type_update'
527
-				, __( 'Points type updated.', 'wordpoints' )
527
+				, __('Points type updated.', 'wordpoints')
528 528
 				, 'updated'
529 529
 			);
530 530
 		}
@@ -550,14 +550,14 @@  discard block
 block discarded – undo
550 550
 			
551 551
 		$settings = $this->get_points_type_settings();
552 552
 		
553
-		$slug = wordpoints_add_points_type( $settings );
553
+		$slug = wordpoints_add_points_type($settings);
554 554
 
555
-		if ( ! $slug ) {
555
+		if ( ! $slug) {
556 556
 
557 557
 			add_settings_error(
558 558
 				''
559 559
 				, 'wordpoints_points_type_create'
560
-				, __( 'Please choose a unique name for this points type.', 'wordpoints' )
560
+				, __('Please choose a unique name for this points type.', 'wordpoints')
561 561
 			);
562 562
 
563 563
 		} else {
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 			add_settings_error(
568 568
 				''
569 569
 				, 'wordpoints_points_type_create'
570
-				, __( 'Points type created.', 'wordpoints' )
570
+				, __('Points type created.', 'wordpoints')
571 571
 				, 'updated'
572 572
 			);
573 573
 		}
@@ -581,25 +581,25 @@  discard block
 block discarded – undo
581 581
 	protected function delete_points_type() {
582 582
 		
583 583
 		if (
584
-			isset( $_POST['points-slug'] )
584
+			isset($_POST['points-slug'])
585 585
 		   && wordpoints_verify_nonce(
586 586
 				'delete-points-type-nonce'
587 587
 				, 'wordpoints_delete_points_type-%s'
588
-				, array( 'points-slug' )
588
+				, array('points-slug')
589 589
 				, 'post'
590 590
 			)
591 591
 		) {
592 592
 			
593 593
 			if (
594 594
 				wordpoints_delete_points_type(
595
-					sanitize_key( $_POST['points-slug'] )
595
+					sanitize_key($_POST['points-slug'])
596 596
 				)
597 597
 			) {
598 598
 
599 599
 				add_settings_error(
600 600
 					''
601 601
 					, 'wordpoints_points_type_delete'
602
-					, __( 'Points type deleted.', 'wordpoints' )
602
+					, __('Points type deleted.', 'wordpoints')
603 603
 					, 'updated'
604 604
 				);
605 605
 
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 				add_settings_error(
609 609
 					''
610 610
 					, 'wordpoints_points_type_delete'
611
-					, __( 'Error while deleting.', 'wordpoints' )
611
+					, __('Error while deleting.', 'wordpoints')
612 612
 				);
613 613
 			}
614 614
 		}
@@ -624,25 +624,25 @@  discard block
 block discarded – undo
624 624
 		 *
625 625
 		 * @since 1.0.0
626 626
 		 */
627
-		do_action( 'wordpoints_admin_points_events_head' );
627
+		do_action('wordpoints_admin_points_events_head');
628 628
 
629
-		if ( is_network_admin() ) {
630
-			$title = __( 'Network Events', 'wordpoints' );
631
-			$description = __( 'Award points when various events happen on this network.', 'wordpoints' );
629
+		if (is_network_admin()) {
630
+			$title = __('Network Events', 'wordpoints');
631
+			$description = __('Award points when various events happen on this network.', 'wordpoints');
632 632
 		} else {
633
-			$title = __( 'Events', 'wordpoints' );
634
-			$description = __( 'Award points when various events happen on this site.', 'wordpoints' );
633
+			$title = __('Events', 'wordpoints');
634
+			$description = __('Award points when various events happen on this site.', 'wordpoints');
635 635
 		}
636 636
 
637
-		$points_type = wordpoints_get_points_type( $this->current_points_type );
637
+		$points_type = wordpoints_get_points_type($this->current_points_type);
638 638
 
639 639
 		?>
640 640
 
641 641
 		<div class="wordpoints-points-type-meta-box-wrap">
642 642
 
643 643
 				<form>
644
-					<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
645
-					<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
644
+					<?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?>
645
+					<?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); ?>
646 646
 				</form>
647 647
 
648 648
 				<div id="poststuff">
@@ -650,17 +650,17 @@  discard block
 block discarded – undo
650 650
 					<div id="post-body" class="metabox-holder columns-<?php echo 1 === (int) get_current_screen()->get_columns() ? '1' : '2'; ?>">
651 651
 
652 652
 						<div id="postbox-container-1" class="postbox-container">
653
-							<?php do_meta_boxes( $this->id, 'side', $points_type ); ?>
653
+							<?php do_meta_boxes($this->id, 'side', $points_type); ?>
654 654
 						</div>
655 655
 
656
-						<?php if ( isset( $this->current_points_type ) ) : ?>
656
+						<?php if (isset($this->current_points_type)) : ?>
657 657
 							<div class="wordpoints-hook-events-heading">
658
-								<h2><?php echo esc_html( $title ); ?></h2>
659
-								<p class="description"><?php echo esc_html( $description ); ?></p>
658
+								<h2><?php echo esc_html($title); ?></h2>
659
+								<p class="description"><?php echo esc_html($description); ?></p>
660 660
 							</div>
661 661
 
662 662
 							<div id="postbox-container-2" class="postbox-container">
663
-								<?php do_meta_boxes( $this->id, 'events', $points_type ); ?>
663
+								<?php do_meta_boxes($this->id, 'events', $points_type); ?>
664 664
 							</div>
665 665
 						<?php endif; ?>
666 666
 
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 		 *
680 680
 		 * @since 1.0.0
681 681
 		 */
682
-		do_action( 'wordpoints_admin_points_events_foot' );
682
+		do_action('wordpoints_admin_points_events_foot');
683 683
 	}
684 684
 }
685 685
 
Please login to merge, or discard this patch.
src/admin/includes/functions.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@
 block discarded – undo
106 106
 		, 'WordPointsPointsTypesL10n'
107 107
 		, array(
108 108
 			'confirmDelete' => esc_html__( 'Are you sure that you want to delete this points type? This will delete all related logs and event hooks.', 'wordpoints' )
109
-			                   . ' ' . esc_html__( 'Once a points type has been deleted, you cannot bring it back.', 'wordpoints' ),
109
+							   . ' ' . esc_html__( 'Once a points type has been deleted, you cannot bring it back.', 'wordpoints' ),
110 110
 			'confirmTitle'  => esc_html__( 'Are you sure?', 'wordpoints' ),
111 111
 			'deleteText'    => esc_html__( 'Delete', 'wordpoints' ),
112 112
 			'cancelText'    => esc_html__( 'Cancel', 'wordpoints' ),
Please login to merge, or discard this patch.
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -16,16 +16,16 @@  discard block
 block discarded – undo
16 16
  *
17 17
  * @param WordPoints_App $app The main WordPoints app.
18 18
  */
19
-function wordpoints_hooks_register_admin_apps( $app ) {
19
+function wordpoints_hooks_register_admin_apps($app) {
20 20
 
21 21
 	$apps = $app->sub_apps;
22 22
 
23
-	$apps->register( 'admin', 'WordPoints_App' );
23
+	$apps->register('admin', 'WordPoints_App');
24 24
 
25 25
 	/** @var WordPoints_App $admin */
26
-	$admin = $apps->get( 'admin' );
26
+	$admin = $apps->get('admin');
27 27
 
28
-	$admin->sub_apps->register( 'screen', 'WordPoints_Admin_Screens' );
28
+	$admin->sub_apps->register('screen', 'WordPoints_Admin_Screens');
29 29
 }
30 30
 
31 31
 /**
@@ -46,15 +46,15 @@  discard block
 block discarded – undo
46 46
 	// Hooks page.
47 47
 	$id = add_submenu_page(
48 48
 		$wordpoints_menu
49
-		, __( 'WordPoints — Points Types', 'wordpoints' )
50
-		, __( 'Points Types', 'wordpoints' )
49
+		, __('WordPoints — Points Types', 'wordpoints')
50
+		, __('Points Types', 'wordpoints')
51 51
 		, 'manage_options'
52 52
 		, 'wordpoints_points_types'
53
-		, array( $admin_screens, 'display' )
53
+		, array($admin_screens, 'display')
54 54
 	);
55 55
 
56
-	if ( $id ) {
57
-		$admin_screens->register( $id, 'WordPoints_Admin_Screen_Points_Types' );
56
+	if ($id) {
57
+		$admin_screens->register($id, 'WordPoints_Admin_Screen_Points_Types');
58 58
 	}
59 59
 }
60 60
 
@@ -67,14 +67,14 @@  discard block
 block discarded – undo
67 67
  */
68 68
 function wordpoints_hooks_admin_register_scripts() {
69 69
 
70
-	$assets_url = wordpoints_modules_url( '/assets', dirname( __FILE__ ) );
70
+	$assets_url = wordpoints_modules_url('/assets', dirname(__FILE__));
71 71
 
72 72
 	// CSS
73 73
 
74 74
 	wp_register_style(
75 75
 		'wordpoints-hooks-admin'
76
-		, $assets_url . '/css/hooks.css'
77
-		, array( 'dashicons', 'wp-jquery-ui-dialog' )
76
+		, $assets_url.'/css/hooks.css'
77
+		, array('dashicons', 'wp-jquery-ui-dialog')
78 78
 		, WORDPOINTS_VERSION
79 79
 	);
80 80
 
@@ -82,22 +82,22 @@  discard block
 block discarded – undo
82 82
 
83 83
 	wp_register_script(
84 84
 		'wordpoints-admin-points-types'
85
-		, $assets_url . '/js/points-types.js'
86
-		, array( 'backbone', 'jquery-ui-dialog', 'wp-util' )
85
+		, $assets_url.'/js/points-types.js'
86
+		, array('backbone', 'jquery-ui-dialog', 'wp-util')
87 87
 		, WORDPOINTS_VERSION
88 88
 	);
89 89
 
90 90
 	wp_register_script(
91 91
 		'wordpoints-hooks-models'
92
-		, $assets_url . '/js/hooks/models.js'
93
-		, array( 'backbone', 'jquery-ui-dialog', 'wp-util' )
92
+		, $assets_url.'/js/hooks/models.js'
93
+		, array('backbone', 'jquery-ui-dialog', 'wp-util')
94 94
 		, WORDPOINTS_VERSION
95 95
 	);
96 96
 
97 97
 	wp_register_script(
98 98
 		'wordpoints-hooks-views'
99
-		, $assets_url . '/js/hooks/views.js'
100
-		, array( 'wordpoints-hooks-models' )
99
+		, $assets_url.'/js/hooks/views.js'
100
+		, array('wordpoints-hooks-models')
101 101
 		, WORDPOINTS_VERSION
102 102
 	);
103 103
 
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 		'wordpoints-admin-points-types'
106 106
 		, 'WordPointsPointsTypesL10n'
107 107
 		, array(
108
-			'confirmDelete' => esc_html__( 'Are you sure that you want to delete this points type? This will delete all related logs and event hooks.', 'wordpoints' )
109
-			                   . ' ' . esc_html__( 'Once a points type has been deleted, you cannot bring it back.', 'wordpoints' ),
110
-			'confirmTitle'  => esc_html__( 'Are you sure?', 'wordpoints' ),
111
-			'deleteText'    => esc_html__( 'Delete', 'wordpoints' ),
112
-			'cancelText'    => esc_html__( 'Cancel', 'wordpoints' ),
108
+			'confirmDelete' => esc_html__('Are you sure that you want to delete this points type? This will delete all related logs and event hooks.', 'wordpoints')
109
+			                   . ' '.esc_html__('Once a points type has been deleted, you cannot bring it back.', 'wordpoints'),
110
+			'confirmTitle'  => esc_html__('Are you sure?', 'wordpoints'),
111
+			'deleteText'    => esc_html__('Delete', 'wordpoints'),
112
+			'cancelText'    => esc_html__('Cancel', 'wordpoints'),
113 113
 		)
114 114
 	);
115 115
 
@@ -117,16 +117,16 @@  discard block
 block discarded – undo
117 117
 		'wordpoints-hooks-views'
118 118
 		, 'WordPointsHooksAdminL10n'
119 119
 		, array(
120
-			'unexpectedError' => __( 'There was an unexpected error. Try reloading the page.', 'wordpoints' ),
121
-			'changesSaved'    => __( 'Your changes have been saved.', 'wordpoints' ),
120
+			'unexpectedError' => __('There was an unexpected error. Try reloading the page.', 'wordpoints'),
121
+			'changesSaved'    => __('Your changes have been saved.', 'wordpoints'),
122 122
 			/* translators: the name of the field that cannot be empty */
123
-			'emptyField'      => sprintf( __( '%s cannot be empty.', 'wordpoints' ), '{{ data.label }}' ),
124
-			'confirmDelete'   => __( 'Are you sure that you want to delete this reaction? This action cannot be undone.', 'wordpoints' ),
125
-			'confirmTitle'    => __( 'Are you sure?', 'wordpoints' ),
126
-			'deleteText'      => __( 'Delete', 'wordpoints' ),
127
-			'cancelText'      => __( 'Cancel', 'wordpoints' ),
128
-			'separator'       => __( ' » ', 'wordpoints' ),
129
-			'target_label'    => __( 'Target', 'wordpoints' ),
123
+			'emptyField'      => sprintf(__('%s cannot be empty.', 'wordpoints'), '{{ data.label }}'),
124
+			'confirmDelete'   => __('Are you sure that you want to delete this reaction? This action cannot be undone.', 'wordpoints'),
125
+			'confirmTitle'    => __('Are you sure?', 'wordpoints'),
126
+			'deleteText'      => __('Delete', 'wordpoints'),
127
+			'cancelText'      => __('Cancel', 'wordpoints'),
128
+			'separator'       => __(' » ', 'wordpoints'),
129
+			'target_label'    => __('Target', 'wordpoints'),
130 130
 		)
131 131
 	);
132 132
 
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
 			<div class="view">
139 139
 				<div class="title"></div>
140 140
 				<button type="button" class="edit button-secondary">
141
-					' . esc_html__( 'Edit', 'wordpoints' ) . '
141
+					' . esc_html__('Edit', 'wordpoints').'
142 142
 				</button>
143 143
 				<button type="button" class="close button-secondary">
144
-					' . esc_html__( 'Close', 'wordpoints' ) . '
144
+					' . esc_html__('Close', 'wordpoints').'
145 145
 				</button>
146 146
 			</div>
147 147
 			<div class="form">
@@ -160,16 +160,16 @@  discard block
 block discarded – undo
160 160
 						</div>
161 161
 						<div class="action-buttons">
162 162
 							<button type="button" class="save button-primary" disabled>
163
-								' . esc_html__( 'Save', 'wordpoints' ) . '
163
+								' . esc_html__('Save', 'wordpoints').'
164 164
 							</button>
165 165
 							<button type="button" class="cancel button-secondary">
166
-								' . esc_html__( 'Cancel', 'wordpoints' ) . '
166
+								' . esc_html__('Cancel', 'wordpoints').'
167 167
 							</button>
168 168
 							<button type="button" class="close button-secondary">
169
-								' . esc_html__( 'Close', 'wordpoints' ) . '
169
+								' . esc_html__('Close', 'wordpoints').'
170 170
 							</button>
171 171
 							<button type="button" class="delete button-secondary">
172
-								' . esc_html__( 'Delete', 'wordpoints' ) . '
172
+								' . esc_html__('Delete', 'wordpoints').'
173 173
 							</button>
174 174
 						</div>
175 175
 					</div>
@@ -217,15 +217,15 @@  discard block
 block discarded – undo
217 217
 
218 218
 	wp_register_script(
219 219
 		'wordpoints-hooks-reactor-points'
220
-		, $assets_url . '/js/hooks/reactors/points.js'
221
-		, array( 'wordpoints-hooks-views' )
220
+		, $assets_url.'/js/hooks/reactors/points.js'
221
+		, array('wordpoints-hooks-views')
222 222
 		, WORDPOINTS_VERSION
223 223
 	);
224 224
 
225 225
 	wp_register_script(
226 226
 		'wordpoints-hooks-extension-conditions'
227
-		, $assets_url . '/js/hooks/extensions/conditions.js'
228
-		, array( 'wordpoints-hooks-views' )
227
+		, $assets_url.'/js/hooks/extensions/conditions.js'
228
+		, array('wordpoints-hooks-views')
229 229
 		, WORDPOINTS_VERSION
230 230
 	);
231 231
 
@@ -235,25 +235,25 @@  discard block
 block discarded – undo
235 235
 		, '
236 236
 			<script type="text/template" id="tmpl-wordpoints-hook-condition-groups">
237 237
 				<div class="conditions-title section-title">
238
-					<h4>' . esc_html__( 'Conditions', 'wordpoints' ) . '</h4>
238
+					<h4>' . esc_html__('Conditions', 'wordpoints').'</h4>
239 239
 					<button type="button" class="add-new button-secondary button-link">
240
-						<span class="screen-reader-text">' . esc_html__( 'Add New Condition', 'wordpoints' ) . '</span>
240
+						<span class="screen-reader-text">' . esc_html__('Add New Condition', 'wordpoints').'</span>
241 241
 						<span class="dashicons dashicons-plus"></span>
242 242
 					</button>
243 243
 				</div>
244 244
 				<div class="add-condition-form hidden">
245 245
 					<div class="no-conditions hidden">
246
-						' . esc_html__( 'No conditions available.', 'wordpoints' ) . '
246
+						' . esc_html__('No conditions available.', 'wordpoints').'
247 247
 					</div>
248 248
 					<div class="condition-selectors">
249 249
 						<div class="arg-selectors"></div>
250 250
 						<div class="condition-selector"></div>
251 251
 					</div>
252
-					<button type="button" class="confirm-add-new button-secondary" disabled aria-label="' . esc_attr__( 'Add Condition', 'wordpoints' ) . '">
253
-						' . esc_html_x( 'Add', 'reaction condition', 'wordpoints' ) . '
252
+					<button type="button" class="confirm-add-new button-secondary" disabled aria-label="' . esc_attr__('Add Condition', 'wordpoints').'">
253
+						' . esc_html_x('Add', 'reaction condition', 'wordpoints').'
254 254
 					</button>
255
-					<button type="button" class="cancel-add-new button-secondary" aria-label="' . esc_attr__( 'Cancel Adding New Condition', 'wordpoints' ) . '">
256
-						' . esc_html_x( 'Cancel', 'reaction condition', 'wordpoints' ) . '
255
+					<button type="button" class="cancel-add-new button-secondary" aria-label="' . esc_attr__('Cancel Adding New Condition', 'wordpoints').'">
256
+						' . esc_html_x('Cancel', 'reaction condition', 'wordpoints').'
257 257
 					</button>
258 258
 				</div>
259 259
 				<div class="condition-groups section-content"></div>
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 				<div class="condition-controls">
268 268
 					<div class="condition-title"></div>
269 269
 					<button type="button" class="delete button-secondary button-link">
270
-						<span class="screen-reader-text">' . esc_html__( 'Remove Condition', 'wordpoints' ) . '</span>
270
+						<span class="screen-reader-text">' . esc_html__('Remove Condition', 'wordpoints').'</span>
271 271
 						<span class="dashicons dashicons-no"></span>
272 272
 					</button>
273 273
 				</div>
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
 
286 286
 	wp_register_script(
287 287
 		'wordpoints-hooks-extension-periods'
288
-		, $assets_url . '/js/hooks/extensions/periods.js'
289
-		, array( 'wordpoints-hooks-views' )
288
+		, $assets_url.'/js/hooks/extensions/periods.js'
289
+		, array('wordpoints-hooks-views')
290 290
 		, WORDPOINTS_VERSION
291 291
 	);
292 292
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 		, '
297 297
 			<script type="text/template" id="tmpl-wordpoints-hook-periods">
298 298
 				<div class="periods-title section-title">
299
-					<h4>' . esc_html__( 'Rate Limit', 'wordpoints' ) . '</h4>
299
+					<h4>' . esc_html__('Rate Limit', 'wordpoints').'</h4>
300 300
 				</div>
301 301
 				<div class="periods section-content"></div>
302 302
 			</script>
@@ -315,33 +315,33 @@  discard block
 block discarded – undo
315 315
 
316 316
 	$extensions_data = array();
317 317
 
318
-	foreach ( $hooks->extensions->get_all() as $slug => $extension ) {
318
+	foreach ($hooks->extensions->get_all() as $slug => $extension) {
319 319
 
320
-		if ( $extension instanceof WordPoints_Hook_Extension ) {
321
-			$extensions_data[ $slug ] = $extension->get_ui_script_data();
320
+		if ($extension instanceof WordPoints_Hook_Extension) {
321
+			$extensions_data[$slug] = $extension->get_ui_script_data();
322 322
 		}
323 323
 
324
-		if ( wp_script_is( "wordpoints-hooks-extension-{$slug}", 'registered' ) ) {
325
-			wp_enqueue_script( "wordpoints-hooks-extension-{$slug}" );
324
+		if (wp_script_is("wordpoints-hooks-extension-{$slug}", 'registered')) {
325
+			wp_enqueue_script("wordpoints-hooks-extension-{$slug}");
326 326
 		}
327 327
 	}
328 328
 
329
-	unset( $extension, $slug );
329
+	unset($extension, $slug);
330 330
 
331 331
 	$reactor_data = array();
332 332
 
333
-	foreach ( $hooks->reactors->get_all() as $slug => $reactor ) {
333
+	foreach ($hooks->reactors->get_all() as $slug => $reactor) {
334 334
 
335
-		if ( $reactor instanceof WordPoints_Hook_Reactor ) {
336
-			$reactor_data[ $slug ] = $reactor->get_ui_script_data();
335
+		if ($reactor instanceof WordPoints_Hook_Reactor) {
336
+			$reactor_data[$slug] = $reactor->get_ui_script_data();
337 337
 		}
338 338
 
339
-		if ( wp_script_is( "wordpoints-hooks-reactor-{$slug}", 'registered' ) ) {
340
-			wp_enqueue_script( "wordpoints-hooks-reactor-{$slug}" );
339
+		if (wp_script_is("wordpoints-hooks-reactor-{$slug}", 'registered')) {
340
+			wp_enqueue_script("wordpoints-hooks-reactor-{$slug}");
341 341
 		}
342 342
 	}
343 343
 
344
-	unset( $reactor, $slug );
344
+	unset($reactor, $slug);
345 345
 
346 346
 	$event_action_types = wordpoints_hooks_ui_get_script_data_event_action_types();
347 347
 	$entities_data = wordpoints_hooks_ui_get_script_data_entities();
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 *
366 366
 	 * @param array $data The data.
367 367
 	 */
368
-	$data = apply_filters( 'wordpoints_hooks_ui_data', $data );
368
+	$data = apply_filters('wordpoints_hooks_ui_data', $data);
369 369
 
370 370
 	wp_localize_script(
371 371
 		'wordpoints-hooks-models'
@@ -391,28 +391,28 @@  discard block
 block discarded – undo
391 391
 	$entity_children = $entities->children;
392 392
 
393 393
 	/** @var WordPoints_Entity $entity */
394
-	foreach ( $entities->get_all() as $slug => $entity ) {
394
+	foreach ($entities->get_all() as $slug => $entity) {
395 395
 
396 396
 		$child_data = array();
397 397
 
398 398
 		/** @var WordPoints_EntityishI $child */
399
-		foreach ( $entity_children->get_children( $slug ) as $child_slug => $child ) {
399
+		foreach ($entity_children->get_children($slug) as $child_slug => $child) {
400 400
 
401
-			$child_data[ $child_slug ] = array(
401
+			$child_data[$child_slug] = array(
402 402
 				'slug'  => $child_slug,
403 403
 				'title' => $child->get_title(),
404 404
 			);
405 405
 
406
-			if ( $child instanceof WordPoints_Entity_Attr ) {
406
+			if ($child instanceof WordPoints_Entity_Attr) {
407 407
 
408
-				$child_data[ $child_slug ]['_type']     = 'attr';
409
-				$child_data[ $child_slug ]['data_type'] = $child->get_data_type();
408
+				$child_data[$child_slug]['_type']     = 'attr';
409
+				$child_data[$child_slug]['data_type'] = $child->get_data_type();
410 410
 
411
-			} elseif ( $child instanceof WordPoints_Entity_Relationship ) {
411
+			} elseif ($child instanceof WordPoints_Entity_Relationship) {
412 412
 
413
-				$child_data[ $child_slug ]['_type']     = 'relationship';
414
-				$child_data[ $child_slug ]['primary']   = $child->get_primary_entity_slug();
415
-				$child_data[ $child_slug ]['secondary'] = $child->get_related_entity_slug();
413
+				$child_data[$child_slug]['_type']     = 'relationship';
414
+				$child_data[$child_slug]['primary']   = $child->get_primary_entity_slug();
415
+				$child_data[$child_slug]['secondary'] = $child->get_related_entity_slug();
416 416
 			}
417 417
 
418 418
 			/**
@@ -423,14 +423,14 @@  discard block
 block discarded – undo
423 423
 			 * @param array                $data  The data for the entity child.
424 424
 			 * @param WordPoints_Entityish $child The child's object.
425 425
 			 */
426
-			$child_data[ $child_slug ] = apply_filters(
426
+			$child_data[$child_slug] = apply_filters(
427 427
 				'wordpoints_hooks_ui_data_entity_child'
428
-				, $child_data[ $child_slug ]
428
+				, $child_data[$child_slug]
429 429
 				, $child
430 430
 			);
431 431
 		}
432 432
 
433
-		$entities_data[ $slug ] = array(
433
+		$entities_data[$slug] = array(
434 434
 			'slug'     => $slug,
435 435
 			'title'    => $entity->get_title(),
436 436
 			'children' => $child_data,
@@ -438,12 +438,12 @@  discard block
 block discarded – undo
438 438
 			'_type'    => 'entity',
439 439
 		);
440 440
 
441
-		if ( $entity instanceof WordPoints_Entity_EnumerableI ) {
441
+		if ($entity instanceof WordPoints_Entity_EnumerableI) {
442 442
 
443 443
 			$values = array();
444 444
 
445
-			foreach ( $entity->get_enumerated_values() as $value ) {
446
-				if ( $entity->set_the_value( $value ) ) {
445
+			foreach ($entity->get_enumerated_values() as $value) {
446
+				if ($entity->set_the_value($value)) {
447 447
 					$values[] = array(
448 448
 						'value' => $entity->get_the_id(),
449 449
 						'label' => $entity->get_the_human_id(),
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 				}
452 452
 			}
453 453
 
454
-			$entities_data[ $slug ]['values'] = $values;
454
+			$entities_data[$slug]['values'] = $values;
455 455
 		}
456 456
 
457 457
 		/**
@@ -460,9 +460,9 @@  discard block
 block discarded – undo
460 460
 		 * @param array             $data   The data for the entity.
461 461
 		 * @param WordPoints_Entity $entity The entity object.
462 462
 		 */
463
-		$entities_data[ $slug ] = apply_filters(
463
+		$entities_data[$slug] = apply_filters(
464 464
 			'wordpoints_hooks_ui_data_entity'
465
-			, $entities_data[ $slug ]
465
+			, $entities_data[$slug]
466 466
 			, $entity
467 467
 		);
468 468
 	}
@@ -486,15 +486,15 @@  discard block
 block discarded – undo
486 486
 
487 487
 	// We don't care about the action slugs, so first we get rid of that bottom level
488 488
 	// of the array.
489
-	$event_index = call_user_func_array( 'array_merge_recursive', $event_index );
489
+	$event_index = call_user_func_array('array_merge_recursive', $event_index);
490 490
 
491 491
 	$event_action_types = array();
492 492
 
493 493
 	// This leaves us the event indexed by action type. But we actually need to flip
494 494
 	// this, so that we have the action types indexed by event slug.
495
-	foreach ( $event_index as $action_type => $events ) {
496
-		foreach ( $events as $event => $unused ) {
497
-			$event_action_types[ $event ][ $action_type ] = true;
495
+	foreach ($event_index as $action_type => $events) {
496
+		foreach ($events as $event => $unused) {
497
+			$event_action_types[$event][$action_type] = true;
498 498
 		}
499 499
 	}
500 500
 
@@ -517,13 +517,13 @@  discard block
 block discarded – undo
517 517
  *
518 518
  * @return string The HTML with templates appended.
519 519
  */
520
-function wordpoints_script_templates_filter( $html, $handle ) {
520
+function wordpoints_script_templates_filter($html, $handle) {
521 521
 
522 522
 	global $wp_scripts;
523 523
 
524
-	$templates = $wp_scripts->get_data( $handle, 'wordpoints-templates' );
524
+	$templates = $wp_scripts->get_data($handle, 'wordpoints-templates');
525 525
 
526
-	if ( $templates ) {
526
+	if ($templates) {
527 527
 		$html .= $templates;
528 528
 	}
529 529
 
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
  */
540 540
 function wordpoints_hooks_admin_ajax() {
541 541
 
542
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
542
+	if (defined('DOING_AJAX') && DOING_AJAX) {
543 543
 		new WordPoints_Admin_Ajax_Hooks;
544 544
 	}
545 545
 }
Please login to merge, or discard this patch.