@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | /** |
38 | 38 | * @since 1.0.0 |
39 | 39 | */ |
40 | - public function __construct( $slug, WordPoints_Hook_ActionI $action = null ) { |
|
40 | + public function __construct($slug, WordPoints_Hook_ActionI $action = null) { |
|
41 | 41 | |
42 | - parent::__construct( $slug, $action ); |
|
42 | + parent::__construct($slug, $action); |
|
43 | 43 | |
44 | - $parts = wordpoints_parse_dynamic_slug( $this->slug ); |
|
44 | + $parts = wordpoints_parse_dynamic_slug($this->slug); |
|
45 | 45 | |
46 | - if ( $parts['dynamic'] ) { |
|
46 | + if ($parts['dynamic']) { |
|
47 | 47 | $this->arg_slug = $parts['generic']; |
48 | 48 | } else { |
49 | 49 | $this->arg_slug = $this->slug; |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | $value = parent::get_value(); |
60 | 60 | |
61 | 61 | // If not, then we check for an arg with the generic name. |
62 | - if ( null === $value && $this->action instanceof WordPoints_Hook_ActionI ) { |
|
63 | - $value = $this->action->get_arg_value( $this->arg_slug ); |
|
62 | + if (null === $value && $this->action instanceof WordPoints_Hook_ActionI) { |
|
63 | + $value = $this->action->get_arg_value($this->arg_slug); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | return $value; |
@@ -46,17 +46,17 @@ |
||
46 | 46 | */ |
47 | 47 | protected function get_entity_title() { |
48 | 48 | |
49 | - $parts = wordpoints_parse_dynamic_slug( $this->slug ); |
|
49 | + $parts = wordpoints_parse_dynamic_slug($this->slug); |
|
50 | 50 | |
51 | - if ( $parts['dynamic'] ) { |
|
51 | + if ($parts['dynamic']) { |
|
52 | 52 | $entity_slug = "{$this->generic_entity_slug}\\{$parts['dynamic']}"; |
53 | 53 | } else { |
54 | 54 | $entity_slug = $this->generic_entity_slug; |
55 | 55 | } |
56 | 56 | |
57 | - $entity = wordpoints_entities()->get( $entity_slug ); |
|
57 | + $entity = wordpoints_entities()->get($entity_slug); |
|
58 | 58 | |
59 | - if ( ! $entity instanceof WordPoints_Entity ) { |
|
59 | + if ( ! $entity instanceof WordPoints_Entity) { |
|
60 | 60 | return $this->slug; |
61 | 61 | } |
62 | 62 |
@@ -24,20 +24,20 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function get_title() { |
26 | 26 | |
27 | - $parsed = wordpoints_parse_dynamic_slug( $this->slug ); |
|
27 | + $parsed = wordpoints_parse_dynamic_slug($this->slug); |
|
28 | 28 | |
29 | - switch ( $parsed['dynamic'] ) { |
|
29 | + switch ($parsed['dynamic']) { |
|
30 | 30 | |
31 | 31 | case 'post': |
32 | - return __( 'Publish Post', 'wordpoints' ); |
|
32 | + return __('Publish Post', 'wordpoints'); |
|
33 | 33 | |
34 | 34 | case 'page': |
35 | - return __( 'Publish Page', 'wordpoints' ); |
|
35 | + return __('Publish Page', 'wordpoints'); |
|
36 | 36 | |
37 | 37 | default: |
38 | 38 | return sprintf( |
39 | 39 | // translators: singular name of the post type |
40 | - __( 'Publish %s', 'wordpoints' ) |
|
40 | + __('Publish %s', 'wordpoints') |
|
41 | 41 | , $this->get_entity_title() |
42 | 42 | ); |
43 | 43 | } |
@@ -48,20 +48,20 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function get_description() { |
50 | 50 | |
51 | - $parsed = wordpoints_parse_dynamic_slug( $this->slug ); |
|
51 | + $parsed = wordpoints_parse_dynamic_slug($this->slug); |
|
52 | 52 | |
53 | - switch ( $parsed['dynamic'] ) { |
|
53 | + switch ($parsed['dynamic']) { |
|
54 | 54 | |
55 | 55 | case 'post': |
56 | - return __( 'When a Post is published.', 'wordpoints' ); |
|
56 | + return __('When a Post is published.', 'wordpoints'); |
|
57 | 57 | |
58 | 58 | case 'page': |
59 | - return __( 'When a Page is published.', 'wordpoints' ); |
|
59 | + return __('When a Page is published.', 'wordpoints'); |
|
60 | 60 | |
61 | 61 | default: |
62 | 62 | return sprintf( |
63 | 63 | // translators: singular name of the post type |
64 | - __( 'When a %s is published.', 'wordpoints' ) |
|
64 | + __('When a %s is published.', 'wordpoints') |
|
65 | 65 | , $this->get_entity_title() |
66 | 66 | ); |
67 | 67 | } |
@@ -24,23 +24,23 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function get_title() { |
26 | 26 | |
27 | - $parsed = wordpoints_parse_dynamic_slug( $this->slug ); |
|
27 | + $parsed = wordpoints_parse_dynamic_slug($this->slug); |
|
28 | 28 | |
29 | - switch ( $parsed['dynamic'] ) { |
|
29 | + switch ($parsed['dynamic']) { |
|
30 | 30 | |
31 | 31 | case 'post': |
32 | - return __( 'Comment on a Post', 'wordpoints' ); |
|
32 | + return __('Comment on a Post', 'wordpoints'); |
|
33 | 33 | |
34 | 34 | case 'page': |
35 | - return __( 'Comment on a Page', 'wordpoints' ); |
|
35 | + return __('Comment on a Page', 'wordpoints'); |
|
36 | 36 | |
37 | 37 | case 'attachment': |
38 | - return __( 'Comment on a Media Upload', 'wordpoints' ); |
|
38 | + return __('Comment on a Media Upload', 'wordpoints'); |
|
39 | 39 | |
40 | 40 | default: |
41 | 41 | return sprintf( |
42 | 42 | // translators: singular name of the post type |
43 | - __( 'Comment on a %s', 'wordpoints' ) |
|
43 | + __('Comment on a %s', 'wordpoints') |
|
44 | 44 | , $this->get_entity_title() |
45 | 45 | ); |
46 | 46 | } |
@@ -51,23 +51,23 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function get_description() { |
53 | 53 | |
54 | - $parsed = wordpoints_parse_dynamic_slug( $this->slug ); |
|
54 | + $parsed = wordpoints_parse_dynamic_slug($this->slug); |
|
55 | 55 | |
56 | - switch ( $parsed['dynamic'] ) { |
|
56 | + switch ($parsed['dynamic']) { |
|
57 | 57 | |
58 | 58 | case 'post': |
59 | - return __( 'When a user leaves a comment on a Post.', 'wordpoints' ); |
|
59 | + return __('When a user leaves a comment on a Post.', 'wordpoints'); |
|
60 | 60 | |
61 | 61 | case 'page': |
62 | - return __( 'When a user leaves a comment on a Page.', 'wordpoints' ); |
|
62 | + return __('When a user leaves a comment on a Page.', 'wordpoints'); |
|
63 | 63 | |
64 | 64 | case 'attachment': |
65 | - return __( 'When a user leaves a comment on a file uploaded to the Media Library.', 'wordpoints' ); |
|
65 | + return __('When a user leaves a comment on a file uploaded to the Media Library.', 'wordpoints'); |
|
66 | 66 | |
67 | 67 | default: |
68 | 68 | return sprintf( |
69 | 69 | // translators: singular name of the post type |
70 | - __( 'When a user leaves a comment on a %s.', 'wordpoints' ) |
|
70 | + __('When a user leaves a comment on a %s.', 'wordpoints') |
|
71 | 71 | , $this->get_entity_title() |
72 | 72 | ); |
73 | 73 | } |
@@ -17,20 +17,20 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * @since 1.0.0 |
19 | 19 | */ |
20 | - public function __construct( $slug ) { |
|
20 | + public function __construct($slug) { |
|
21 | 21 | |
22 | - parent::__construct( $slug ); |
|
22 | + parent::__construct($slug); |
|
23 | 23 | |
24 | - $parts = wordpoints_parse_dynamic_slug( $this->slug ); |
|
24 | + $parts = wordpoints_parse_dynamic_slug($this->slug); |
|
25 | 25 | |
26 | - if ( $parts['dynamic'] ) { |
|
26 | + if ($parts['dynamic']) { |
|
27 | 27 | |
28 | - $parsed = $this->parse_slug( $this->related_entity_slug ); |
|
28 | + $parsed = $this->parse_slug($this->related_entity_slug); |
|
29 | 29 | |
30 | 30 | $this->primary_entity_slug = "{$this->primary_entity_slug}\\{$parts['dynamic']}"; |
31 | 31 | $this->related_entity_slug = "{$parsed['slug']}\\{$parts['dynamic']}"; |
32 | 32 | |
33 | - if ( $parsed['is_array'] ) { |
|
33 | + if ($parsed['is_array']) { |
|
34 | 34 | $this->related_entity_slug .= '{}'; |
35 | 35 | } |
36 | 36 | } |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function get_title() { |
43 | 43 | |
44 | - $parsed = $this->parse_slug( $this->related_entity_slug ); |
|
44 | + $parsed = $this->parse_slug($this->related_entity_slug); |
|
45 | 45 | |
46 | - $entity = wordpoints_entities()->get( $parsed['slug'] ); |
|
46 | + $entity = wordpoints_entities()->get($parsed['slug']); |
|
47 | 47 | |
48 | - if ( $entity instanceof WordPoints_Entity ) { |
|
48 | + if ($entity instanceof WordPoints_Entity) { |
|
49 | 49 | return $entity->get_title(); |
50 | 50 | } else { |
51 | 51 | return $this->related_entity_slug; |
@@ -7,17 +7,17 @@ |
||
7 | 7 | * @since 1.0.0 |
8 | 8 | */ |
9 | 9 | |
10 | -add_action( 'wordpoints_init_app-apps', 'wordpoints_hooks_register_admin_apps' ); |
|
10 | +add_action('wordpoints_init_app-apps', 'wordpoints_hooks_register_admin_apps'); |
|
11 | 11 | |
12 | -add_action( 'admin_menu', 'wordpoints_hooks_api_admin_menu' ); |
|
12 | +add_action('admin_menu', 'wordpoints_hooks_api_admin_menu'); |
|
13 | 13 | |
14 | -if ( is_wordpoints_network_active() ) { |
|
15 | - add_action( 'network_admin_menu', 'wordpoints_hooks_api_admin_menu' ); |
|
14 | +if (is_wordpoints_network_active()) { |
|
15 | + add_action('network_admin_menu', 'wordpoints_hooks_api_admin_menu'); |
|
16 | 16 | } |
17 | 17 | |
18 | -add_action( 'admin_init', 'wordpoints_hooks_admin_register_scripts' ); |
|
19 | -add_action( 'admin_init', 'wordpoints_hooks_admin_ajax' ); |
|
18 | +add_action('admin_init', 'wordpoints_hooks_admin_register_scripts'); |
|
19 | +add_action('admin_init', 'wordpoints_hooks_admin_ajax'); |
|
20 | 20 | |
21 | -add_filter( 'script_loader_tag', 'wordpoints_script_templates_filter', 10, 2 ); |
|
21 | +add_filter('script_loader_tag', 'wordpoints_script_templates_filter', 10, 2); |
|
22 | 22 | |
23 | 23 | // EOF |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | public function hooks() { |
63 | 63 | |
64 | 64 | /* Load the JavaScript needed for the settings screen. */ |
65 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
|
66 | - add_action( "admin_footer-{$this->id}", array( $this, 'footer_scripts' ) ); |
|
65 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts')); |
|
66 | + add_action("admin_footer-{$this->id}", array($this, 'footer_scripts')); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | |
99 | 99 | <div class="wrap"> |
100 | 100 | |
101 | - <h1><?php echo esc_html( $this->get_title() ); ?></h1> |
|
101 | + <h1><?php echo esc_html($this->get_title()); ?></h1> |
|
102 | 102 | |
103 | 103 | <?php settings_errors(); ?> |
104 | 104 | |
105 | - <?php if ( ! empty( $this->tabs ) ) : ?> |
|
106 | - <?php wordpoints_admin_show_tabs( $this->tabs, false ); ?> |
|
105 | + <?php if ( ! empty($this->tabs)) : ?> |
|
106 | + <?php wordpoints_admin_show_tabs($this->tabs, false); ?> |
|
107 | 107 | <?php endif; ?> |
108 | 108 | |
109 | 109 | <?php $this->display_content(); ?> |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @since 1.0.0 |
28 | 28 | */ |
29 | 29 | public function __construct() { |
30 | - add_action( 'current_screen', array( $this, 'set_current_screen' ) ); |
|
30 | + add_action('current_screen', array($this, 'set_current_screen')); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -37,23 +37,23 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param WP_Screen $current_screen The WP_Screen object for the current screen. |
39 | 39 | */ |
40 | - public function set_current_screen( $current_screen ) { |
|
40 | + public function set_current_screen($current_screen) { |
|
41 | 41 | |
42 | 42 | $screen_id = $current_screen->id; |
43 | 43 | |
44 | - if ( is_network_admin() ) { |
|
45 | - $screen_id = substr( $screen_id, 0, -8 /* -network */ ); |
|
44 | + if (is_network_admin()) { |
|
45 | + $screen_id = substr($screen_id, 0, -8 /* -network */); |
|
46 | 46 | } |
47 | 47 | |
48 | - $screen = $this->get( $screen_id ); |
|
48 | + $screen = $this->get($screen_id); |
|
49 | 49 | |
50 | - if ( ! ( $screen instanceof WordPoints_Admin_Screen ) ) { |
|
50 | + if ( ! ($screen instanceof WordPoints_Admin_Screen)) { |
|
51 | 51 | return; |
52 | 52 | } |
53 | 53 | |
54 | 54 | $this->current_screen = $screen; |
55 | 55 | |
56 | - add_action( "load-{$screen_id}", array( $this->current_screen, 'load' ) ); |
|
56 | + add_action("load-{$screen_id}", array($this->current_screen, 'load')); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -16,16 +16,16 @@ discard block |
||
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 |
||
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 |
||
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,15 +82,15 @@ discard block |
||
82 | 82 | |
83 | 83 | wp_register_script( |
84 | 84 | 'wordpoints-hooks-models' |
85 | - , $assets_url . '/js/hooks/models.js' |
|
86 | - , array( 'backbone', 'jquery-ui-dialog', 'wp-util' ) |
|
85 | + , $assets_url.'/js/hooks/models.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-views' |
92 | - , $assets_url . '/js/hooks/views.js' |
|
93 | - , array( 'wordpoints-hooks-models' ) |
|
92 | + , $assets_url.'/js/hooks/views.js' |
|
93 | + , array('wordpoints-hooks-models') |
|
94 | 94 | , WORDPOINTS_VERSION |
95 | 95 | ); |
96 | 96 | |
@@ -98,15 +98,15 @@ discard block |
||
98 | 98 | 'wordpoints-hooks-views' |
99 | 99 | , 'WordPointsHooksAdminL10n' |
100 | 100 | , array( |
101 | - 'unexpectedError' => __( 'There was an unexpected error. Try reloading the page.', 'wordpoints' ), |
|
102 | - 'changesSaved' => __( 'Your changes have been saved.', 'wordpoints' ), |
|
101 | + 'unexpectedError' => __('There was an unexpected error. Try reloading the page.', 'wordpoints'), |
|
102 | + 'changesSaved' => __('Your changes have been saved.', 'wordpoints'), |
|
103 | 103 | /* translators: the name of the field that cannot be empty */ |
104 | - 'emptyField' => sprintf( __( '%s cannot be empty.', 'wordpoints' ), '{{ data.label }}' ), |
|
105 | - 'confirmDelete' => __( 'Are you sure that you want to delete this reaction? This action cannot be undone.', 'wordpoints' ), |
|
106 | - 'confirmTitle' => __( 'Are you sure?', 'wordpoints' ), |
|
107 | - 'deleteText' => __( 'Delete', 'wordpoints' ), |
|
108 | - 'cancelText' => __( 'Cancel', 'wordpoints' ), |
|
109 | - 'separator' => __( ' » ', 'wordpoints' ), |
|
104 | + 'emptyField' => sprintf(__('%s cannot be empty.', 'wordpoints'), '{{ data.label }}'), |
|
105 | + 'confirmDelete' => __('Are you sure that you want to delete this reaction? This action cannot be undone.', 'wordpoints'), |
|
106 | + 'confirmTitle' => __('Are you sure?', 'wordpoints'), |
|
107 | + 'deleteText' => __('Delete', 'wordpoints'), |
|
108 | + 'cancelText' => __('Cancel', 'wordpoints'), |
|
109 | + 'separator' => __(' » ', 'wordpoints'), |
|
110 | 110 | ) |
111 | 111 | ); |
112 | 112 | |
@@ -118,10 +118,10 @@ discard block |
||
118 | 118 | <div class="view"> |
119 | 119 | <div class="title"></div> |
120 | 120 | <button type="button" class="edit button-secondary"> |
121 | - ' . esc_html__( 'Edit', 'wordpoints' ) . ' |
|
121 | + ' . esc_html__('Edit', 'wordpoints').' |
|
122 | 122 | </button> |
123 | 123 | <button type="button" class="close button-secondary"> |
124 | - ' . esc_html__( 'Close', 'wordpoints' ) . ' |
|
124 | + ' . esc_html__('Close', 'wordpoints').' |
|
125 | 125 | </button> |
126 | 126 | </div> |
127 | 127 | <div class="form"> |
@@ -140,16 +140,16 @@ discard block |
||
140 | 140 | </div> |
141 | 141 | <div class="action-buttons"> |
142 | 142 | <button type="button" class="save button-primary" disabled> |
143 | - ' . esc_html__( 'Save', 'wordpoints' ) . ' |
|
143 | + ' . esc_html__('Save', 'wordpoints').' |
|
144 | 144 | </button> |
145 | 145 | <button type="button" class="cancel button-secondary"> |
146 | - ' . esc_html__( 'Cancel', 'wordpoints' ) . ' |
|
146 | + ' . esc_html__('Cancel', 'wordpoints').' |
|
147 | 147 | </button> |
148 | 148 | <button type="button" class="close button-secondary"> |
149 | - ' . esc_html__( 'Close', 'wordpoints' ) . ' |
|
149 | + ' . esc_html__('Close', 'wordpoints').' |
|
150 | 150 | </button> |
151 | 151 | <button type="button" class="delete button-secondary"> |
152 | - ' . esc_html__( 'Delete', 'wordpoints' ) . ' |
|
152 | + ' . esc_html__('Delete', 'wordpoints').' |
|
153 | 153 | </button> |
154 | 154 | </div> |
155 | 155 | </div> |
@@ -197,15 +197,15 @@ discard block |
||
197 | 197 | |
198 | 198 | wp_register_script( |
199 | 199 | 'wordpoints-hooks-reactor-points' |
200 | - , $assets_url . '/js/hooks/reactors/points.js' |
|
201 | - , array( 'wordpoints-hooks-views' ) |
|
200 | + , $assets_url.'/js/hooks/reactors/points.js' |
|
201 | + , array('wordpoints-hooks-views') |
|
202 | 202 | , WORDPOINTS_VERSION |
203 | 203 | ); |
204 | 204 | |
205 | 205 | wp_register_script( |
206 | 206 | 'wordpoints-hooks-extension-conditions' |
207 | - , $assets_url . '/js/hooks/extensions/conditions.js' |
|
208 | - , array( 'wordpoints-hooks-views' ) |
|
207 | + , $assets_url.'/js/hooks/extensions/conditions.js' |
|
208 | + , array('wordpoints-hooks-views') |
|
209 | 209 | , WORDPOINTS_VERSION |
210 | 210 | ); |
211 | 211 | |
@@ -215,25 +215,25 @@ discard block |
||
215 | 215 | , ' |
216 | 216 | <script type="text/template" id="tmpl-wordpoints-hook-condition-groups"> |
217 | 217 | <div class="conditions-title section-title"> |
218 | - <h4>' . esc_html__( 'Conditions', 'wordpoints' ) . '</h4> |
|
218 | + <h4>' . esc_html__('Conditions', 'wordpoints').'</h4> |
|
219 | 219 | <button type="button" class="add-new button-secondary button-link"> |
220 | - <span class="screen-reader-text">' . esc_html__( 'Add New Condition', 'wordpoints' ) . '</span> |
|
220 | + <span class="screen-reader-text">' . esc_html__('Add New Condition', 'wordpoints').'</span> |
|
221 | 221 | <span class="dashicons dashicons-plus"></span> |
222 | 222 | </button> |
223 | 223 | </div> |
224 | 224 | <div class="add-condition-form hidden"> |
225 | 225 | <div class="no-conditions hidden"> |
226 | - ' . esc_html__( 'No conditions available.', 'wordpoints' ) . ' |
|
226 | + ' . esc_html__('No conditions available.', 'wordpoints').' |
|
227 | 227 | </div> |
228 | 228 | <div class="condition-selectors"> |
229 | 229 | <div class="arg-selectors"></div> |
230 | 230 | <div class="condition-selector"></div> |
231 | 231 | </div> |
232 | - <button type="button" class="confirm-add-new button-secondary" disabled aria-label="' . esc_attr__( 'Add Condition', 'wordpoints' ) . '"> |
|
233 | - ' . esc_html_x( 'Add', 'reaction condition', 'wordpoints' ) . ' |
|
232 | + <button type="button" class="confirm-add-new button-secondary" disabled aria-label="' . esc_attr__('Add Condition', 'wordpoints').'"> |
|
233 | + ' . esc_html_x('Add', 'reaction condition', 'wordpoints').' |
|
234 | 234 | </button> |
235 | - <button type="button" class="cancel-add-new button-secondary" aria-label="' . esc_attr__( 'Cancel Adding New Condition', 'wordpoints' ) . '"> |
|
236 | - ' . esc_html_x( 'Cancel', 'reaction condition', 'wordpoints' ) . ' |
|
235 | + <button type="button" class="cancel-add-new button-secondary" aria-label="' . esc_attr__('Cancel Adding New Condition', 'wordpoints').'"> |
|
236 | + ' . esc_html_x('Cancel', 'reaction condition', 'wordpoints').' |
|
237 | 237 | </button> |
238 | 238 | </div> |
239 | 239 | <div class="condition-groups section-content"></div> |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | <div class="condition-controls"> |
248 | 248 | <div class="condition-title"></div> |
249 | 249 | <button type="button" class="delete button-secondary button-link"> |
250 | - <span class="screen-reader-text">' . esc_html__( 'Remove Condition', 'wordpoints' ) . '</span> |
|
250 | + <span class="screen-reader-text">' . esc_html__('Remove Condition', 'wordpoints').'</span> |
|
251 | 251 | <span class="dashicons dashicons-no"></span> |
252 | 252 | </button> |
253 | 253 | </div> |
@@ -265,8 +265,8 @@ discard block |
||
265 | 265 | |
266 | 266 | wp_register_script( |
267 | 267 | 'wordpoints-hooks-extension-periods' |
268 | - , $assets_url . '/js/hooks/extensions/periods.js' |
|
269 | - , array( 'wordpoints-hooks-views' ) |
|
268 | + , $assets_url.'/js/hooks/extensions/periods.js' |
|
269 | + , array('wordpoints-hooks-views') |
|
270 | 270 | , WORDPOINTS_VERSION |
271 | 271 | ); |
272 | 272 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | , ' |
277 | 277 | <script type="text/template" id="tmpl-wordpoints-hook-periods"> |
278 | 278 | <div class="periods-title section-title"> |
279 | - <h4>' . esc_html__( 'Rate Limit', 'wordpoints' ) . '</h4> |
|
279 | + <h4>' . esc_html__('Rate Limit', 'wordpoints').'</h4> |
|
280 | 280 | </div> |
281 | 281 | <div class="periods section-content"></div> |
282 | 282 | </script> |
@@ -295,32 +295,32 @@ discard block |
||
295 | 295 | |
296 | 296 | $extensions_data = array(); |
297 | 297 | |
298 | - foreach ( $hooks->extensions->get_all() as $slug => $extension ) { |
|
298 | + foreach ($hooks->extensions->get_all() as $slug => $extension) { |
|
299 | 299 | |
300 | - if ( $extension instanceof WordPoints_Hook_Extension ) { |
|
301 | - $extensions_data[ $slug ] = $extension->get_ui_script_data(); |
|
300 | + if ($extension instanceof WordPoints_Hook_Extension) { |
|
301 | + $extensions_data[$slug] = $extension->get_ui_script_data(); |
|
302 | 302 | } |
303 | 303 | |
304 | - if ( wp_script_is( "wordpoints-hooks-extension-{$slug}", 'registered' ) ) { |
|
305 | - wp_enqueue_script( "wordpoints-hooks-extension-{$slug}" ); |
|
304 | + if (wp_script_is("wordpoints-hooks-extension-{$slug}", 'registered')) { |
|
305 | + wp_enqueue_script("wordpoints-hooks-extension-{$slug}"); |
|
306 | 306 | } |
307 | 307 | } |
308 | 308 | |
309 | 309 | $reactor_data = array(); |
310 | 310 | |
311 | - foreach ( $hooks->reactors->get_all() as $slug => $reactor ) { |
|
311 | + foreach ($hooks->reactors->get_all() as $slug => $reactor) { |
|
312 | 312 | |
313 | - if ( $reactor instanceof WordPoints_Hook_Reactor ) { |
|
314 | - $reactor_data[ $slug ] = array( |
|
313 | + if ($reactor instanceof WordPoints_Hook_Reactor) { |
|
314 | + $reactor_data[$slug] = array( |
|
315 | 315 | 'slug' => $reactor->get_slug(), |
316 | 316 | 'fields' => $reactor->get_settings_fields(), |
317 | 317 | 'arg_types' => $reactor->get_arg_types(), |
318 | - 'target_label' => __( 'Award To', 'wordpoints' ), |
|
318 | + 'target_label' => __('Award To', 'wordpoints'), |
|
319 | 319 | ); |
320 | 320 | } |
321 | 321 | |
322 | - if ( wp_script_is( "wordpoints-hooks-reactor-{$slug}", 'registered' ) ) { |
|
323 | - wp_enqueue_script( "wordpoints-hooks-reactor-{$slug}" ); |
|
322 | + if (wp_script_is("wordpoints-hooks-reactor-{$slug}", 'registered')) { |
|
323 | + wp_enqueue_script("wordpoints-hooks-reactor-{$slug}"); |
|
324 | 324 | } |
325 | 325 | } |
326 | 326 | |
@@ -332,28 +332,28 @@ discard block |
||
332 | 332 | $entity_children = $entities->children; |
333 | 333 | |
334 | 334 | /** @var WordPoints_Entity $entity */ |
335 | - foreach ( $entities->get_all() as $slug => $entity ) { |
|
335 | + foreach ($entities->get_all() as $slug => $entity) { |
|
336 | 336 | |
337 | 337 | $child_data = array(); |
338 | 338 | |
339 | 339 | /** @var WordPoints_EntityishI $child */ |
340 | - foreach ( $entity_children->get_children( $slug ) as $child_slug => $child ) { |
|
340 | + foreach ($entity_children->get_children($slug) as $child_slug => $child) { |
|
341 | 341 | |
342 | - $child_data[ $child_slug ] = array( |
|
342 | + $child_data[$child_slug] = array( |
|
343 | 343 | 'slug' => $child_slug, |
344 | 344 | 'title' => $child->get_title(), |
345 | 345 | ); |
346 | 346 | |
347 | - if ( $child instanceof WordPoints_Entity_Attr ) { |
|
347 | + if ($child instanceof WordPoints_Entity_Attr) { |
|
348 | 348 | |
349 | - $child_data[ $child_slug ]['_type'] = 'attr'; |
|
350 | - $child_data[ $child_slug ]['data_type'] = $child->get_data_type(); |
|
349 | + $child_data[$child_slug]['_type'] = 'attr'; |
|
350 | + $child_data[$child_slug]['data_type'] = $child->get_data_type(); |
|
351 | 351 | |
352 | - } elseif ( $child instanceof WordPoints_Entity_Relationship ) { |
|
352 | + } elseif ($child instanceof WordPoints_Entity_Relationship) { |
|
353 | 353 | |
354 | - $child_data[ $child_slug ]['_type'] = 'relationship'; |
|
355 | - $child_data[ $child_slug ]['primary'] = $child->get_primary_entity_slug(); |
|
356 | - $child_data[ $child_slug ]['secondary'] = $child->get_related_entity_slug(); |
|
354 | + $child_data[$child_slug]['_type'] = 'relationship'; |
|
355 | + $child_data[$child_slug]['primary'] = $child->get_primary_entity_slug(); |
|
356 | + $child_data[$child_slug]['secondary'] = $child->get_related_entity_slug(); |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | /** |
@@ -364,10 +364,10 @@ discard block |
||
364 | 364 | * @param array $data The data for the entity child. |
365 | 365 | * @param WordPoints_Entityish $child The child's object. |
366 | 366 | */ |
367 | - $child_data[ $child_slug ] = apply_filters( 'wordpoints_hooks_ui_data_entity_child', $child_data[ $child_slug ], $child ); |
|
367 | + $child_data[$child_slug] = apply_filters('wordpoints_hooks_ui_data_entity_child', $child_data[$child_slug], $child); |
|
368 | 368 | } |
369 | 369 | |
370 | - $entities_data[ $slug ] = array( |
|
370 | + $entities_data[$slug] = array( |
|
371 | 371 | 'slug' => $slug, |
372 | 372 | 'title' => $entity->get_title(), |
373 | 373 | 'children' => $child_data, |
@@ -375,12 +375,12 @@ discard block |
||
375 | 375 | '_type' => 'entity', |
376 | 376 | ); |
377 | 377 | |
378 | - if ( $entity instanceof WordPoints_Entity_EnumerableI ) { |
|
378 | + if ($entity instanceof WordPoints_Entity_EnumerableI) { |
|
379 | 379 | |
380 | 380 | $values = array(); |
381 | 381 | |
382 | - foreach ( $entity->get_enumerated_values() as $value ) { |
|
383 | - if ( $entity->set_the_value( $value ) ) { |
|
382 | + foreach ($entity->get_enumerated_values() as $value) { |
|
383 | + if ($entity->set_the_value($value)) { |
|
384 | 384 | $values[] = array( |
385 | 385 | 'value' => $entity->get_the_id(), |
386 | 386 | 'label' => $entity->get_the_human_id(), |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | } |
389 | 389 | } |
390 | 390 | |
391 | - $entities_data[ $slug ]['values'] = $values; |
|
391 | + $entities_data[$slug]['values'] = $values; |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | /** |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | * @param array $data The data for the entity. |
398 | 398 | * @param WordPoints_Entity $entity The entity object. |
399 | 399 | */ |
400 | - $entities_data[ $slug ] = apply_filters( 'wordpoints_hooks_ui_data_entity', $entities_data[ $slug ], $entity ); |
|
400 | + $entities_data[$slug] = apply_filters('wordpoints_hooks_ui_data_entity', $entities_data[$slug], $entity); |
|
401 | 401 | } |
402 | 402 | |
403 | 403 | $data = array( |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | * |
419 | 419 | * @param array $data The data. |
420 | 420 | */ |
421 | - $data = apply_filters( 'wordpoints_hooks_ui_data', $data ); |
|
421 | + $data = apply_filters('wordpoints_hooks_ui_data', $data); |
|
422 | 422 | |
423 | 423 | wp_localize_script( |
424 | 424 | 'wordpoints-hooks-models' |
@@ -443,13 +443,13 @@ discard block |
||
443 | 443 | * |
444 | 444 | * @return string The HTML with templates appended. |
445 | 445 | */ |
446 | -function wordpoints_script_templates_filter( $html, $handle ) { |
|
446 | +function wordpoints_script_templates_filter($html, $handle) { |
|
447 | 447 | |
448 | 448 | global $wp_scripts; |
449 | 449 | |
450 | - $templates = $wp_scripts->get_data( $handle, 'wordpoints-templates' ); |
|
450 | + $templates = $wp_scripts->get_data($handle, 'wordpoints-templates'); |
|
451 | 451 | |
452 | - if ( $templates ) { |
|
452 | + if ($templates) { |
|
453 | 453 | $html .= $templates; |
454 | 454 | } |
455 | 455 | |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | */ |
466 | 466 | function wordpoints_hooks_admin_ajax() { |
467 | 467 | |
468 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
468 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
469 | 469 | new WordPoints_Admin_Ajax_Hooks; |
470 | 470 | } |
471 | 471 | } |