@@ -22,7 +22,9 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function onCreateReview( $postData, $meta, $postId ) |
24 | 24 | { |
25 | - if( !$this->isReviewPostType( $review = get_post( $postId )))return; |
|
25 | + if( !$this->isReviewPostType( $review = get_post( $postId ))) { |
|
26 | + return; |
|
27 | + } |
|
26 | 28 | $this->updateAssignedToPost( $review ); |
27 | 29 | } |
28 | 30 | |
@@ -32,7 +34,9 @@ discard block |
||
32 | 34 | */ |
33 | 35 | public function onDeleteReview( $postId ) |
34 | 36 | { |
35 | - if( !$this->isReviewPostType( $review = get_post( $postId )))return; |
|
37 | + if( !$this->isReviewPostType( $review = get_post( $postId ))) { |
|
38 | + return; |
|
39 | + } |
|
36 | 40 | $review->post_status = 'deleted'; // important to change the post_status here first! |
37 | 41 | $this->updateAssignedToPost( $review ); |
38 | 42 | } |
@@ -52,7 +56,9 @@ discard block |
||
52 | 56 | */ |
53 | 57 | public function saveAssignedToMetabox( $postId ) |
54 | 58 | { |
55 | - if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-assigned-to' ), 'assigned_to' ))return; |
|
59 | + if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-assigned-to' ), 'assigned_to' )) { |
|
60 | + return; |
|
61 | + } |
|
56 | 62 | $assignedTo = filter_input( INPUT_POST, 'assigned_to' ); |
57 | 63 | $assignedTo || $assignedTo = ''; |
58 | 64 | if( get_post_meta( $postId, 'assigned_to', true ) != $assignedTo ) { |
@@ -67,7 +73,9 @@ discard block |
||
67 | 73 | */ |
68 | 74 | public function saveResponseMetabox( $postId ) |
69 | 75 | { |
70 | - if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-response' ), 'response' ))return; |
|
76 | + if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-response' ), 'response' )) { |
|
77 | + return; |
|
78 | + } |
|
71 | 79 | $response = filter_input( INPUT_POST, 'response' ); |
72 | 80 | $response || $response = ''; |
73 | 81 | update_post_meta( $postId, 'response', trim( wp_kses( $response, [ |
@@ -120,9 +128,13 @@ discard block |
||
120 | 128 | */ |
121 | 129 | protected function updateAssignedToPost( WP_Post $review ) |
122 | 130 | { |
123 | - if( !( $postId = $this->getAssignedToPostId( $review->ID )))return; |
|
131 | + if( !( $postId = $this->getAssignedToPostId( $review->ID ))) { |
|
132 | + return; |
|
133 | + } |
|
124 | 134 | $reviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID )); |
125 | - if( empty( $reviewIds ))return; |
|
135 | + if( empty( $reviewIds )) { |
|
136 | + return; |
|
137 | + } |
|
126 | 138 | $this->updateReviewIdOfPost( $postId, $review, $reviewIds ); |
127 | 139 | $updatedReviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID )); |
128 | 140 | if( empty( $updatedReviewIds )) { |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function onCreateReview( $postData, $meta, $postId ) |
24 | 24 | { |
25 | - if( !$this->isReviewPostType( $review = get_post( $postId )))return; |
|
25 | + if( !$this->isReviewPostType( $review = get_post( $postId ) ) )return; |
|
26 | 26 | $this->updateAssignedToPost( $review ); |
27 | 27 | } |
28 | 28 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function onDeleteReview( $postId ) |
34 | 34 | { |
35 | - if( !$this->isReviewPostType( $review = get_post( $postId )))return; |
|
35 | + if( !$this->isReviewPostType( $review = get_post( $postId ) ) )return; |
|
36 | 36 | $review->post_status = 'deleted'; // important to change the post_status here first! |
37 | 37 | $this->updateAssignedToPost( $review ); |
38 | 38 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function saveAssignedToMetabox( $postId ) |
54 | 54 | { |
55 | - if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-assigned-to' ), 'assigned_to' ))return; |
|
55 | + if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-assigned-to' ), 'assigned_to' ) )return; |
|
56 | 56 | $assignedTo = filter_input( INPUT_POST, 'assigned_to' ); |
57 | 57 | $assignedTo || $assignedTo = ''; |
58 | 58 | if( get_post_meta( $postId, 'assigned_to', true ) != $assignedTo ) { |
@@ -67,14 +67,14 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function saveResponseMetabox( $postId ) |
69 | 69 | { |
70 | - if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-response' ), 'response' ))return; |
|
70 | + if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-response' ), 'response' ) )return; |
|
71 | 71 | $response = filter_input( INPUT_POST, 'response' ); |
72 | 72 | $response || $response = ''; |
73 | 73 | update_post_meta( $postId, 'response', trim( wp_kses( $response, [ |
74 | 74 | 'a' => ['href' => [], 'title' => []], |
75 | 75 | 'em' => [], |
76 | 76 | 'strong' => [], |
77 | - ]))); |
|
77 | + ] ) ) ); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | */ |
84 | 84 | protected function getAssignedToPostId( $postId ) |
85 | 85 | { |
86 | - $assignedTo = intval( get_post_meta( $postId, 'assigned_to', true )); |
|
87 | - if(( $post = get_post( $assignedTo )) instanceof WP_Post ) { |
|
86 | + $assignedTo = intval( get_post_meta( $postId, 'assigned_to', true ) ); |
|
87 | + if( ($post = get_post( $assignedTo )) instanceof WP_Post ) { |
|
88 | 88 | return $post->ID; |
89 | 89 | } |
90 | 90 | return false; |
@@ -120,22 +120,22 @@ discard block |
||
120 | 120 | */ |
121 | 121 | protected function updateAssignedToPost( WP_Post $review ) |
122 | 122 | { |
123 | - if( !( $postId = $this->getAssignedToPostId( $review->ID )))return; |
|
124 | - $reviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID )); |
|
125 | - if( empty( $reviewIds ))return; |
|
123 | + if( !($postId = $this->getAssignedToPostId( $review->ID )) )return; |
|
124 | + $reviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID ) ); |
|
125 | + if( empty($reviewIds) )return; |
|
126 | 126 | $this->updateReviewIdOfPost( $postId, $review, $reviewIds ); |
127 | - $updatedReviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID )); |
|
128 | - if( empty( $updatedReviewIds )) { |
|
127 | + $updatedReviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID ) ); |
|
128 | + if( empty($updatedReviewIds) ) { |
|
129 | 129 | delete_post_meta( $postId, static::META_RANKING ); |
130 | 130 | delete_post_meta( $postId, static::META_REVIEW_ID ); |
131 | 131 | } |
132 | - else if( !glsr( Helper::class )->compareArrays( $reviewIds, $updatedReviewIds )) { |
|
133 | - $reviews = glsr( Database::class )->getReviews([ |
|
132 | + else if( !glsr( Helper::class )->compareArrays( $reviewIds, $updatedReviewIds ) ) { |
|
133 | + $reviews = glsr( Database::class )->getReviews( [ |
|
134 | 134 | 'count' => -1, |
135 | 135 | 'post__in' => $updatedReviewIds, |
136 | - ]); |
|
137 | - update_post_meta( $postId, static::META_AVERAGE, $this->recalculatePostAverage( $reviews->results )); |
|
138 | - update_post_meta( $postId, static::META_RANKING, $this->recalculatePostRanking( $reviews->results )); |
|
136 | + ] ); |
|
137 | + update_post_meta( $postId, static::META_AVERAGE, $this->recalculatePostAverage( $reviews->results ) ); |
|
138 | + update_post_meta( $postId, static::META_RANKING, $this->recalculatePostRanking( $reviews->results ) ); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | if( $review->post_status != 'publish' ) { |
149 | 149 | delete_post_meta( $postId, static::META_REVIEW_ID, $review->ID ); |
150 | 150 | } |
151 | - else if( !in_array( $review->ID, $reviewIds )) { |
|
151 | + else if( !in_array( $review->ID, $reviewIds ) ) { |
|
152 | 152 | add_post_meta( $postId, static::META_REVIEW_ID, $review->ID ); |
153 | 153 | } |
154 | 154 | } |
@@ -22,7 +22,8 @@ |
||
22 | 22 | protected $public; |
23 | 23 | protected $translator; |
24 | 24 | |
25 | - public function __construct( Application $app ) { |
|
25 | + public function __construct( Application $app ) |
|
26 | + { |
|
26 | 27 | $this->app = $app; |
27 | 28 | $this->admin = $app->make( AdminController::class ); |
28 | 29 | $this->basename = plugin_basename( $app->file ); |
@@ -38,27 +38,27 @@ |
||
38 | 38 | */ |
39 | 39 | public function run() |
40 | 40 | { |
41 | - add_filter( 'mce_external_plugins', [$this->admin, 'filterTinymcePlugins'], 15 ); |
|
42 | - add_filter( 'plugin_action_links_'.$this->basename, [$this->admin, 'filterActionLinks'] ); |
|
43 | - add_filter( 'dashboard_glance_items', [$this->admin, 'filterDashboardGlanceItems'] ); |
|
44 | - add_filter( 'wp_editor_settings', [$this->editor, 'filterEditorSettings'] ); |
|
45 | - add_filter( 'the_editor', [$this->editor, 'filterEditorTextarea'] ); |
|
46 | - add_filter( 'gettext', [$this->editor, 'filterPostStatusLabels'], 10, 3 ); |
|
47 | - add_filter( 'gettext_with_context', [$this->editor, 'filterPostStatusLabelsWithContext'], 10, 4 ); |
|
48 | - add_filter( 'post_updated_messages', [$this->editor, 'filterUpdateMessages'] ); |
|
49 | - add_filter( 'bulk_post_updated_messages', [$this->listtable, 'filterBulkUpdateMessages'], 10, 2 ); |
|
50 | - add_filter( 'manage_'.Application::POST_TYPE.'_posts_columns', [$this->listtable, 'filterColumnsForPostType'] ); |
|
51 | - add_filter( 'post_date_column_status', [$this->listtable, 'filterDateColumnStatus'], 10, 2 ); |
|
52 | - add_filter( 'default_hidden_columns', [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2 ); |
|
53 | - add_filter( 'display_post_states', [$this->listtable, 'filterPostStates'], 10, 2 ); |
|
54 | - add_filter( 'post_row_actions', [$this->listtable, 'filterRowActions'], 10, 2 ); |
|
41 | + add_filter( 'mce_external_plugins', [$this->admin, 'filterTinymcePlugins'], 15 ); |
|
42 | + add_filter( 'plugin_action_links_'.$this->basename, [$this->admin, 'filterActionLinks'] ); |
|
43 | + add_filter( 'dashboard_glance_items', [$this->admin, 'filterDashboardGlanceItems'] ); |
|
44 | + add_filter( 'wp_editor_settings', [$this->editor, 'filterEditorSettings'] ); |
|
45 | + add_filter( 'the_editor', [$this->editor, 'filterEditorTextarea'] ); |
|
46 | + add_filter( 'gettext', [$this->editor, 'filterPostStatusLabels'], 10, 3 ); |
|
47 | + add_filter( 'gettext_with_context', [$this->editor, 'filterPostStatusLabelsWithContext'], 10, 4 ); |
|
48 | + add_filter( 'post_updated_messages', [$this->editor, 'filterUpdateMessages'] ); |
|
49 | + add_filter( 'bulk_post_updated_messages', [$this->listtable, 'filterBulkUpdateMessages'], 10, 2 ); |
|
50 | + add_filter( 'manage_'.Application::POST_TYPE.'_posts_columns', [$this->listtable, 'filterColumnsForPostType'] ); |
|
51 | + add_filter( 'post_date_column_status', [$this->listtable, 'filterDateColumnStatus'], 10, 2 ); |
|
52 | + add_filter( 'default_hidden_columns', [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2 ); |
|
53 | + add_filter( 'display_post_states', [$this->listtable, 'filterPostStates'], 10, 2 ); |
|
54 | + add_filter( 'post_row_actions', [$this->listtable, 'filterRowActions'], 10, 2 ); |
|
55 | 55 | add_filter( 'manage_edit-'.Application::POST_TYPE.'_sortable_columns', [$this->listtable, 'filterSortableColumns'] ); |
56 | - add_filter( 'ngettext', [$this->listtable, 'filterStatusText'], 10, 5 ); |
|
57 | - add_filter( 'script_loader_tag', [$this->public, 'filterEnqueuedScripts'], 10, 2 ); |
|
58 | - add_filter( 'query_vars', [$this->public, 'filterQueryVars'] ); |
|
59 | - add_filter( 'gettext', [$this->translator, 'filterGettext'], 10, 3 ); |
|
60 | - add_filter( 'gettext_with_context', [$this->translator, 'filterGettextWithContext'], 10, 4 ); |
|
61 | - add_filter( 'ngettext', [$this->translator, 'filterNgettext'], 10, 5 ); |
|
62 | - add_filter( 'ngettext_with_context', [$this->translator, 'filterNgettextWithContext'], 10, 6 ); |
|
56 | + add_filter( 'ngettext', [$this->listtable, 'filterStatusText'], 10, 5 ); |
|
57 | + add_filter( 'script_loader_tag', [$this->public, 'filterEnqueuedScripts'], 10, 2 ); |
|
58 | + add_filter( 'query_vars', [$this->public, 'filterQueryVars'] ); |
|
59 | + add_filter( 'gettext', [$this->translator, 'filterGettext'], 10, 3 ); |
|
60 | + add_filter( 'gettext_with_context', [$this->translator, 'filterGettextWithContext'], 10, 4 ); |
|
61 | + add_filter( 'ngettext', [$this->translator, 'filterNgettext'], 10, 5 ); |
|
62 | + add_filter( 'ngettext_with_context', [$this->translator, 'filterNgettextWithContext'], 10, 6 ); |
|
63 | 63 | } |
64 | 64 | } |
@@ -25,7 +25,8 @@ |
||
25 | 25 | protected $router; |
26 | 26 | protected $settings; |
27 | 27 | |
28 | - public function __construct( Application $app ) { |
|
28 | + public function __construct( Application $app ) |
|
29 | + { |
|
29 | 30 | $this->app = $app; |
30 | 31 | $this->admin = $app->make( AdminController::class ); |
31 | 32 | $this->editor = $app->make( EditorController::class ); |
@@ -42,48 +42,48 @@ |
||
42 | 42 | */ |
43 | 43 | public function run() |
44 | 44 | { |
45 | - add_action( 'admin_enqueue_scripts', [$this->admin, 'enqueueAssets'] ); |
|
46 | - add_action( 'admin_enqueue_scripts', [$this->admin, 'registerPointers'], 13 ); |
|
47 | - add_action( 'admin_init', [$this->admin, 'registerShortcodeButtons'] ); |
|
48 | - add_action( 'edit_form_after_title', [$this->admin, 'renderReviewEditor'] ); |
|
49 | - add_action( 'edit_form_top', [$this->admin, 'renderReviewNotice'] ); |
|
50 | - add_action( 'media_buttons', [$this->admin, 'renderTinymceButton'], 11 ); |
|
51 | - add_action( 'plugins_loaded', [$this->app, 'getDefaults'], 11 ); |
|
52 | - add_action( 'plugins_loaded', [$this->app, 'registerAddons'] ); |
|
53 | - add_action( 'plugins_loaded', [$this->app, 'registerLanguages'] ); |
|
54 | - add_action( 'plugins_loaded', [$this->app, 'registerReviewTypes'] ); |
|
55 | - add_action( 'upgrader_process_complete', [$this->app, 'upgraded'], 10, 2 ); |
|
56 | - add_action( 'admin_enqueue_scripts', [$this->editor, 'customizePostStatusLabels'] ); |
|
57 | - add_action( 'site-reviews/create/review', [$this->editor, 'onCreateReview'], 10, 3 ); |
|
58 | - add_action( 'before_delete_post', [$this->editor, 'onDeleteReview'] ); |
|
59 | - add_action( 'save_post_'.Application::POST_TYPE, [$this->editor, 'onSaveReview'], 20, 2 ); |
|
60 | - add_action( 'add_meta_boxes', [$this->editor, 'registerMetaBoxes'] ); |
|
61 | - add_action( 'admin_print_scripts', [$this->editor, 'removeAutosave'], 999 ); |
|
62 | - add_action( 'admin_menu', [$this->editor, 'removeMetaBoxes'] ); |
|
63 | - add_action( 'post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox'] ); |
|
64 | - add_action( 'admin_action_revert', [$this->editor, 'revertReview'] ); |
|
65 | - add_action( 'save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes'] ); |
|
66 | - add_action( 'admin_action_approve', [$this->listtable, 'approve'] ); |
|
67 | - add_action( 'bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2 ); |
|
68 | - add_action( 'restrict_manage_posts', [$this->listtable, 'renderColumnFilters'] ); |
|
69 | - add_action( 'manage_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2 ); |
|
70 | - add_action( 'save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields'] ); |
|
71 | - add_action( 'pre_get_posts', [$this->listtable, 'setQueryForColumn'] ); |
|
72 | - add_action( 'admin_action_unapprove', [$this->listtable, 'unapprove'] ); |
|
73 | - add_action( 'init', [$this->main, 'registerPostType'], 8 ); |
|
74 | - add_action( 'init', [$this->main, 'registerShortcodes'] ); |
|
75 | - add_action( 'init', [$this->main, 'registerTaxonomy'] ); |
|
76 | - add_action( 'widgets_init', [$this->main, 'registerWidgets'] ); |
|
77 | - add_action( 'wp_footer', [$this->main, 'renderSchema'] ); |
|
78 | - add_action( 'admin_menu', [$this->menu, 'registerMenuCount'] ); |
|
79 | - add_action( 'admin_menu', [$this->menu, 'registerSubMenus'] ); |
|
80 | - add_action( 'admin_init', [$this->menu, 'setCustomPermissions'], 999 ); |
|
81 | - add_action( 'wp_enqueue_scripts', [$this->public, 'enqueueAssets'], 999 ); |
|
82 | - add_action( 'admin_init', [$this->router, 'routeAdminPostRequest'] ); |
|
83 | - add_action( 'wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] ); |
|
45 | + add_action( 'admin_enqueue_scripts', [$this->admin, 'enqueueAssets'] ); |
|
46 | + add_action( 'admin_enqueue_scripts', [$this->admin, 'registerPointers'], 13 ); |
|
47 | + add_action( 'admin_init', [$this->admin, 'registerShortcodeButtons'] ); |
|
48 | + add_action( 'edit_form_after_title', [$this->admin, 'renderReviewEditor'] ); |
|
49 | + add_action( 'edit_form_top', [$this->admin, 'renderReviewNotice'] ); |
|
50 | + add_action( 'media_buttons', [$this->admin, 'renderTinymceButton'], 11 ); |
|
51 | + add_action( 'plugins_loaded', [$this->app, 'getDefaults'], 11 ); |
|
52 | + add_action( 'plugins_loaded', [$this->app, 'registerAddons'] ); |
|
53 | + add_action( 'plugins_loaded', [$this->app, 'registerLanguages'] ); |
|
54 | + add_action( 'plugins_loaded', [$this->app, 'registerReviewTypes'] ); |
|
55 | + add_action( 'upgrader_process_complete', [$this->app, 'upgraded'], 10, 2 ); |
|
56 | + add_action( 'admin_enqueue_scripts', [$this->editor, 'customizePostStatusLabels'] ); |
|
57 | + add_action( 'site-reviews/create/review', [$this->editor, 'onCreateReview'], 10, 3 ); |
|
58 | + add_action( 'before_delete_post', [$this->editor, 'onDeleteReview'] ); |
|
59 | + add_action( 'save_post_'.Application::POST_TYPE, [$this->editor, 'onSaveReview'], 20, 2 ); |
|
60 | + add_action( 'add_meta_boxes', [$this->editor, 'registerMetaBoxes'] ); |
|
61 | + add_action( 'admin_print_scripts', [$this->editor, 'removeAutosave'], 999 ); |
|
62 | + add_action( 'admin_menu', [$this->editor, 'removeMetaBoxes'] ); |
|
63 | + add_action( 'post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox'] ); |
|
64 | + add_action( 'admin_action_revert', [$this->editor, 'revertReview'] ); |
|
65 | + add_action( 'save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes'] ); |
|
66 | + add_action( 'admin_action_approve', [$this->listtable, 'approve'] ); |
|
67 | + add_action( 'bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2 ); |
|
68 | + add_action( 'restrict_manage_posts', [$this->listtable, 'renderColumnFilters'] ); |
|
69 | + add_action( 'manage_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2 ); |
|
70 | + add_action( 'save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields'] ); |
|
71 | + add_action( 'pre_get_posts', [$this->listtable, 'setQueryForColumn'] ); |
|
72 | + add_action( 'admin_action_unapprove', [$this->listtable, 'unapprove'] ); |
|
73 | + add_action( 'init', [$this->main, 'registerPostType'], 8 ); |
|
74 | + add_action( 'init', [$this->main, 'registerShortcodes'] ); |
|
75 | + add_action( 'init', [$this->main, 'registerTaxonomy'] ); |
|
76 | + add_action( 'widgets_init', [$this->main, 'registerWidgets'] ); |
|
77 | + add_action( 'wp_footer', [$this->main, 'renderSchema'] ); |
|
78 | + add_action( 'admin_menu', [$this->menu, 'registerMenuCount'] ); |
|
79 | + add_action( 'admin_menu', [$this->menu, 'registerSubMenus'] ); |
|
80 | + add_action( 'admin_init', [$this->menu, 'setCustomPermissions'], 999 ); |
|
81 | + add_action( 'wp_enqueue_scripts', [$this->public, 'enqueueAssets'], 999 ); |
|
82 | + add_action( 'admin_init', [$this->router, 'routeAdminPostRequest'] ); |
|
83 | + add_action( 'wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] ); |
|
84 | 84 | add_action( 'wp_ajax_nopriv_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] ); |
85 | - add_action( 'init', [$this->router, 'routePublicPostRequest'] ); |
|
86 | - add_action( 'admin_init', [$this->router, 'routeWebhookRequest'] ); |
|
87 | - add_action( 'admin_init', [$this->settings, 'registerSettings'] ); |
|
85 | + add_action( 'init', [$this->router, 'routePublicPostRequest'] ); |
|
86 | + add_action( 'admin_init', [$this->router, 'routeWebhookRequest'] ); |
|
87 | + add_action( 'admin_init', [$this->settings, 'registerSettings'] ); |
|
88 | 88 | } |
89 | 89 | } |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function validateRequest( array $request ) |
57 | 57 | { |
58 | - if( !$this->isRequestValid( $request )) { |
|
58 | + if( !$this->isRequestValid( $request ) ) { |
|
59 | 59 | $this->error = __( 'Please fix the submission errors.', 'site-reviews' ); |
60 | 60 | return $request; |
61 | 61 | } |
62 | - if( empty( $request['title'] )) { |
|
62 | + if( empty($request['title']) ) { |
|
63 | 63 | $request['title'] = __( 'No Title', 'site-reviews' ); |
64 | 64 | } |
65 | 65 | return array_merge( glsr( ValidateReviewDefaults::class )->defaults(), $request ); |
@@ -73,14 +73,14 @@ discard block |
||
73 | 73 | $rules = array_intersect_key( |
74 | 74 | apply_filters( 'site-reviews/validation/rules', static::VALIDATION_RULES ), |
75 | 75 | array_flip( array_merge( |
76 | - ['rating','terms'], |
|
76 | + ['rating', 'terms'], |
|
77 | 77 | glsr( OptionManager::class )->get( 'settings.submissions.required', [] ) |
78 | - )) |
|
78 | + ) ) |
|
79 | 79 | ); |
80 | - $excluded = isset( $request['excluded'] ) |
|
80 | + $excluded = isset($request['excluded']) |
|
81 | 81 | ? json_decode( $request['excluded'] ) |
82 | 82 | : []; |
83 | - return array_diff_key( $rules, array_flip( $excluded )); |
|
83 | + return array_diff_key( $rules, array_flip( $excluded ) ); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | return true; |
94 | 94 | } |
95 | 95 | $recaptchaResponse = filter_input( INPUT_POST, 'g-recaptcha-response' ); |
96 | - if( empty( $recaptchaResponse )) { |
|
96 | + if( empty($recaptchaResponse) ) { |
|
97 | 97 | return null; //if response is empty we need to return null |
98 | 98 | } |
99 | 99 | if( $integration == 'custom' ) { |
100 | 100 | return $this->isRecaptchaValid( $recaptchaResponse ); |
101 | 101 | } |
102 | 102 | if( $integration == 'invisible-recaptcha' ) { |
103 | - return boolval( apply_filters( 'google_invre_is_valid_request_filter', true )); |
|
103 | + return boolval( apply_filters( 'google_invre_is_valid_request_filter', true ) ); |
|
104 | 104 | } |
105 | 105 | return false; |
106 | 106 | } |
@@ -110,17 +110,17 @@ discard block |
||
110 | 110 | */ |
111 | 111 | protected function isRecaptchaValid( $recaptchaResponse ) |
112 | 112 | { |
113 | - $endpoint = add_query_arg([ |
|
113 | + $endpoint = add_query_arg( [ |
|
114 | 114 | 'remoteip' => glsr( Helper::class )->getIpAddress(), |
115 | 115 | 'response' => $recaptchaResponse, |
116 | 116 | 'secret' => glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.secret' ), |
117 | 117 | ], 'https://www.google.com/recaptcha/api/siteverify' ); |
118 | - if( is_wp_error( $response = wp_remote_get( $endpoint ))) { |
|
118 | + if( is_wp_error( $response = wp_remote_get( $endpoint ) ) ) { |
|
119 | 119 | glsr_log()->error( $response->get_error_message() ); |
120 | 120 | return false; |
121 | 121 | } |
122 | - $response = json_decode( wp_remote_retrieve_body( $response )); |
|
123 | - if( !empty( $response->success )) { |
|
122 | + $response = json_decode( wp_remote_retrieve_body( $response ) ); |
|
123 | + if( !empty($response->success) ) { |
|
124 | 124 | return boolval( $response->success ); |
125 | 125 | } |
126 | 126 | $errorCodes = [ |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | { |
144 | 144 | $rules = $this->getValidationRules( $request ); |
145 | 145 | $errors = glsr( Validator::class )->validate( $request, $rules ); |
146 | - if( empty( $errors )) { |
|
146 | + if( empty($errors) ) { |
|
147 | 147 | return true; |
148 | 148 | } |
149 | 149 | $this->setSessionValues( 'errors', $errors ); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | protected function setSessionValues( $type, $value, $loggedMessage = '' ) |
161 | 161 | { |
162 | 162 | glsr( Session::class )->set( $this->form_id.$type, $value ); |
163 | - if( !empty( $loggedMessage )) { |
|
163 | + if( !empty($loggedMessage) ) { |
|
164 | 164 | glsr_log()->warning( $loggedMessage ); |
165 | 165 | glsr_log()->warning( $this->request ); |
166 | 166 | } |
@@ -171,8 +171,8 @@ discard block |
||
171 | 171 | */ |
172 | 172 | protected function validateAkismet() |
173 | 173 | { |
174 | - if( !empty( $this->error ))return; |
|
175 | - if( !glsr( Akismet::class )->isSpam( $this->request ))return; |
|
174 | + if( !empty($this->error) )return; |
|
175 | + if( !glsr( Akismet::class )->isSpam( $this->request ) )return; |
|
176 | 176 | $this->setSessionValues( 'errors', [], 'Akismet caught a spam submission:' ); |
177 | 177 | $this->error = __( 'Your review cannot be submitted at this time. Please try again later.', 'site-reviews' ); |
178 | 178 | } |
@@ -182,8 +182,8 @@ discard block |
||
182 | 182 | */ |
183 | 183 | protected function validateBlacklist() |
184 | 184 | { |
185 | - if( !empty( $this->error ))return; |
|
186 | - if( !glsr( Blacklist::class )->isBlacklisted( $this->request ))return; |
|
185 | + if( !empty($this->error) )return; |
|
186 | + if( !glsr( Blacklist::class )->isBlacklisted( $this->request ) )return; |
|
187 | 187 | $blacklistAction = glsr( OptionManager::class )->get( 'settings.submissions.blacklist.action' ); |
188 | 188 | if( $blacklistAction == 'unapprove' ) { |
189 | 189 | $this->request['blacklisted'] = true; |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | */ |
200 | 200 | protected function validateCustom() |
201 | 201 | { |
202 | - if( !empty( $this->error ))return; |
|
202 | + if( !empty($this->error) )return; |
|
203 | 203 | $validated = apply_filters( 'site-reviews/validate/review/submission', true, $this->request ); |
204 | 204 | if( $validated === true )return; |
205 | 205 | $this->setSessionValues( 'errors', [] ); |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | */ |
215 | 215 | protected function validateHoneyPot() |
216 | 216 | { |
217 | - if( !empty( $this->error ))return; |
|
218 | - if( empty( $this->request['gotcha'] ))return; |
|
217 | + if( !empty($this->error) )return; |
|
218 | + if( empty($this->request['gotcha']) )return; |
|
219 | 219 | $this->setSessionValues( 'errors', [], 'The Honeypot caught a bad submission:' ); |
220 | 220 | $this->error = __( 'The review submission failed. Please notify the site administrator.', 'site-reviews' ); |
221 | 221 | } |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | */ |
226 | 226 | protected function validateRecaptcha() |
227 | 227 | { |
228 | - if( !empty( $this->error ))return; |
|
228 | + if( !empty($this->error) )return; |
|
229 | 229 | $isValid = $this->isRecaptchaResponseValid(); |
230 | - if( is_null( $isValid )) { |
|
230 | + if( is_null( $isValid ) ) { |
|
231 | 231 | $this->setSessionValues( 'recaptcha', true ); |
232 | 232 | $this->recaptchaIsUnset = true; |
233 | 233 | } |
@@ -171,8 +171,12 @@ discard block |
||
171 | 171 | */ |
172 | 172 | protected function validateAkismet() |
173 | 173 | { |
174 | - if( !empty( $this->error ))return; |
|
175 | - if( !glsr( Akismet::class )->isSpam( $this->request ))return; |
|
174 | + if( !empty( $this->error )) { |
|
175 | + return; |
|
176 | + } |
|
177 | + if( !glsr( Akismet::class )->isSpam( $this->request )) { |
|
178 | + return; |
|
179 | + } |
|
176 | 180 | $this->setSessionValues( 'errors', [], 'Akismet caught a spam submission:' ); |
177 | 181 | $this->error = __( 'Your review cannot be submitted at this time. Please try again later.', 'site-reviews' ); |
178 | 182 | } |
@@ -182,8 +186,12 @@ discard block |
||
182 | 186 | */ |
183 | 187 | protected function validateBlacklist() |
184 | 188 | { |
185 | - if( !empty( $this->error ))return; |
|
186 | - if( !glsr( Blacklist::class )->isBlacklisted( $this->request ))return; |
|
189 | + if( !empty( $this->error )) { |
|
190 | + return; |
|
191 | + } |
|
192 | + if( !glsr( Blacklist::class )->isBlacklisted( $this->request )) { |
|
193 | + return; |
|
194 | + } |
|
187 | 195 | $blacklistAction = glsr( OptionManager::class )->get( 'settings.submissions.blacklist.action' ); |
188 | 196 | if( $blacklistAction == 'unapprove' ) { |
189 | 197 | $this->request['blacklisted'] = true; |
@@ -199,9 +207,13 @@ discard block |
||
199 | 207 | */ |
200 | 208 | protected function validateCustom() |
201 | 209 | { |
202 | - if( !empty( $this->error ))return; |
|
210 | + if( !empty( $this->error )) { |
|
211 | + return; |
|
212 | + } |
|
203 | 213 | $validated = apply_filters( 'site-reviews/validate/review/submission', true, $this->request ); |
204 | - if( $validated === true )return; |
|
214 | + if( $validated === true ) { |
|
215 | + return; |
|
216 | + } |
|
205 | 217 | $this->setSessionValues( 'errors', [] ); |
206 | 218 | $this->setSessionValues( 'values', $this->request ); |
207 | 219 | $this->error = is_string( $validated ) |
@@ -214,8 +226,12 @@ discard block |
||
214 | 226 | */ |
215 | 227 | protected function validateHoneyPot() |
216 | 228 | { |
217 | - if( !empty( $this->error ))return; |
|
218 | - if( empty( $this->request['gotcha'] ))return; |
|
229 | + if( !empty( $this->error )) { |
|
230 | + return; |
|
231 | + } |
|
232 | + if( empty( $this->request['gotcha'] )) { |
|
233 | + return; |
|
234 | + } |
|
219 | 235 | $this->setSessionValues( 'errors', [], 'The Honeypot caught a bad submission:' ); |
220 | 236 | $this->error = __( 'The review submission failed. Please notify the site administrator.', 'site-reviews' ); |
221 | 237 | } |
@@ -225,7 +241,9 @@ discard block |
||
225 | 241 | */ |
226 | 242 | protected function validateRecaptcha() |
227 | 243 | { |
228 | - if( !empty( $this->error ))return; |
|
244 | + if( !empty( $this->error )) { |
|
245 | + return; |
|
246 | + } |
|
229 | 247 | $isValid = $this->isRecaptchaResponseValid(); |
230 | 248 | if( is_null( $isValid )) { |
231 | 249 | $this->setSessionValues( 'recaptcha', true ); |
@@ -10,7 +10,7 @@ |
||
10 | 10 | const EXPIRY_TIME = WEEK_IN_SECONDS; |
11 | 11 | |
12 | 12 | /** |
13 | - * @return array |
|
13 | + * @return array |
|
14 | 14 | */ |
15 | 15 | public function getCloudflareIps() |
16 | 16 | { |
@@ -19,11 +19,11 @@ discard block |
||
19 | 19 | $ipAddresses = array_fill_keys( ['v4', 'v6'], [] ); |
20 | 20 | foreach( array_keys( $ipAddresses ) as $version ) { |
21 | 21 | $response = wp_remote_get( 'https://www.cloudflare.com/ips-'.$version ); |
22 | - if( is_wp_error( $response )) { |
|
22 | + if( is_wp_error( $response ) ) { |
|
23 | 23 | glsr_log()->error( $response->get_error_message() ); |
24 | 24 | continue; |
25 | 25 | } |
26 | - $ipAddresses[$version] = array_filter( explode( PHP_EOL, wp_remote_retrieve_body( $response ))); |
|
26 | + $ipAddresses[$version] = array_filter( explode( PHP_EOL, wp_remote_retrieve_body( $response ) ) ); |
|
27 | 27 | } |
28 | 28 | set_transient( Application::ID.'_cloudflare_ips', $ipAddresses, static::EXPIRY_TIME ); |
29 | 29 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | if( $test === false ) { |
58 | 58 | $response = wp_remote_post( 'https://api.wordpress.org/stats/php/1.0/' ); |
59 | 59 | $test = !is_wp_error( $response ) |
60 | - && in_array( $response['response']['code'], range( 200, 299 )) |
|
60 | + && in_array( $response['response']['code'], range( 200, 299 ) ) |
|
61 | 61 | ? 'Works' |
62 | 62 | : 'Does not work'; |
63 | 63 | set_transient( Application::ID.'_remote_post_test', $test, static::EXPIRY_TIME ); |
@@ -15,13 +15,13 @@ discard block |
||
15 | 15 | public function __construct( $idBase, $name, $values ) |
16 | 16 | { |
17 | 17 | $controlOptions = $widgetOptions = []; |
18 | - if( isset( $values['class'] )) { |
|
18 | + if( isset($values['class']) ) { |
|
19 | 19 | $widgetOptions['classname'] = $values['class']; |
20 | 20 | } |
21 | - if( isset( $values['description'] )) { |
|
21 | + if( isset($values['description']) ) { |
|
22 | 22 | $widgetOptions['description'] = $values['description']; |
23 | 23 | } |
24 | - if( isset( $values['width'] )) { |
|
24 | + if( isset($values['width']) ) { |
|
25 | 25 | $controlOptions['width'] = $values['width']; |
26 | 26 | } |
27 | 27 | parent::__construct( $idBase, $name, $widgetOptions, $controlOptions ); |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | protected function renderField( $tag, array $args = [] ) |
35 | 35 | { |
36 | 36 | $args = $this->normalizeFieldAttributes( $tag, $args ); |
37 | - $field = glsr( Html::class )->build( ['is_widget' => true] )->{$tag}( $args['name'], $args ); |
|
37 | + $field = glsr( Html::class )->build( ['is_widget' => true] )->{$tag}($args['name'], $args); |
|
38 | 38 | echo glsr( Html::class )->build( ['is_widget' => true] )->div( $field, [ |
39 | 39 | 'class' => 'glsr-field', |
40 | - ]); |
|
40 | + ] ); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | */ |
47 | 47 | protected function normalizeFieldAttributes( $tag, array $args ) |
48 | 48 | { |
49 | - if( empty( $args['value'] )) { |
|
49 | + if( empty($args['value']) ) { |
|
50 | 50 | $args['value'] = $this->widgetArgs[$args['name']]; |
51 | 51 | } |
52 | - if( empty( $this->widgetArgs['options'] ) && in_array( $tag, ['checkbox', 'radio'] )) { |
|
52 | + if( empty($this->widgetArgs['options']) && in_array( $tag, ['checkbox', 'radio'] ) ) { |
|
53 | 53 | $args['checked'] = in_array( $args['value'], (array)$this->widgetArgs[$args['name']] ); |
54 | 54 | } |
55 | 55 | $args['id'] = $this->get_field_id( $args['name'] ); |
@@ -87,7 +87,9 @@ discard block |
||
87 | 87 | ]; |
88 | 88 | if( !isset( $properties[$property] ) |
89 | 89 | || empty( array_filter( [$value], $properties[$property] )) |
90 | - )return; |
|
90 | + ) { |
|
91 | + return; |
|
92 | + } |
|
91 | 93 | $this->$property = $value; |
92 | 94 | } |
93 | 95 | |
@@ -137,7 +139,9 @@ discard block |
||
137 | 139 | */ |
138 | 140 | protected function buildFieldDescription() |
139 | 141 | { |
140 | - if( empty( $this->args['description'] ))return; |
|
142 | + if( empty( $this->args['description'] )) { |
|
143 | + return; |
|
144 | + } |
|
141 | 145 | if( !empty( $this->globals['is_widget'] )) { |
142 | 146 | return $this->small( $this->args['description'] ); |
143 | 147 | } |
@@ -186,7 +190,9 @@ discard block |
||
186 | 190 | */ |
187 | 191 | protected function buildFormLabel() |
188 | 192 | { |
189 | - if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' )return; |
|
193 | + if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' ) { |
|
194 | + return; |
|
195 | + } |
|
190 | 196 | return $this->label([ |
191 | 197 | 'for' => $this->args['id'], |
192 | 198 | 'text' => $this->args['label'], |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function __call( $method, $args ) |
65 | 65 | { |
66 | - $instance = new static( $this->globals ); |
|
66 | + $instance = new static($this->globals); |
|
67 | 67 | $instance->setTagFromMethod( $method ); |
68 | - call_user_func_array( [$instance, 'normalize'], $args += ['',''] ); |
|
68 | + call_user_func_array( [$instance, 'normalize'], $args += ['', ''] ); |
|
69 | 69 | $tags = array_merge( static::TAGS_FORM, static::TAGS_SINGLE, static::TAGS_STRUCTURE, static::TAGS_TEXT ); |
70 | 70 | $generatedTag = in_array( $instance->tag, $tags ) |
71 | 71 | ? $instance->buildTag() |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | 'render' => 'is_bool', |
90 | 90 | 'tag' => 'is_string', |
91 | 91 | ]; |
92 | - if( !isset( $properties[$property] ) |
|
93 | - || empty( array_filter( [$value], $properties[$property] )) |
|
92 | + if( !isset($properties[$property]) |
|
93 | + || empty(array_filter( [$value], $properties[$property] )) |
|
94 | 94 | )return; |
95 | 95 | $this->$property = $value; |
96 | 96 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function getOpeningTag() |
110 | 110 | { |
111 | - $attributes = glsr( Attributes::class )->{$this->tag}( $this->args )->toString(); |
|
111 | + $attributes = glsr( Attributes::class )->{$this->tag}($this->args)->toString(); |
|
112 | 112 | return '<'.trim( $this->tag.' '.$attributes ).'>'; |
113 | 113 | } |
114 | 114 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | protected function buildDefaultTag( $text = '' ) |
130 | 130 | { |
131 | - if( empty( $text )) { |
|
131 | + if( empty($text) ) { |
|
132 | 132 | $text = $this->args['text']; |
133 | 133 | } |
134 | 134 | return $this->getOpeningTag().$text.$this->getClosingTag(); |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | */ |
140 | 140 | protected function buildFieldDescription() |
141 | 141 | { |
142 | - if( empty( $this->args['description'] ))return; |
|
143 | - if( !empty( $this->globals['is_widget'] )) { |
|
142 | + if( empty($this->args['description']) )return; |
|
143 | + if( !empty($this->globals['is_widget']) ) { |
|
144 | 144 | return $this->small( $this->args['description'] ); |
145 | 145 | } |
146 | 146 | return $this->p( $this->args['description'], ['class' => 'description'] ); |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | */ |
152 | 152 | protected function buildFormInput() |
153 | 153 | { |
154 | - if( !in_array( $this->args['type'], ['checkbox', 'radio'] )) { |
|
154 | + if( !in_array( $this->args['type'], ['checkbox', 'radio'] ) ) { |
|
155 | 155 | return $this->buildFormLabel().$this->getOpeningTag(); |
156 | 156 | } |
157 | - return empty( $this->args['options'] ) |
|
157 | + return empty($this->args['options']) |
|
158 | 158 | ? $this->buildFormInputChoice() |
159 | 159 | : $this->buildFormInputMultiChoice(); |
160 | 160 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | protected function buildFormInputMultiChoice() |
174 | 174 | { |
175 | 175 | if( $this->args['type'] == 'checkbox' ) { |
176 | - $this->args['name'].= '[]'; |
|
176 | + $this->args['name'] .= '[]'; |
|
177 | 177 | } |
178 | 178 | $options = array_reduce( array_keys( $this->args['options'] ), function( $carry, $key ) { |
179 | 179 | return $carry.$this->li( $this->{$this->args['type']}([ |
@@ -181,12 +181,12 @@ discard block |
||
181 | 181 | 'name' => $this->args['name'], |
182 | 182 | 'text' => $this->args['options'][$key], |
183 | 183 | 'value' => $key, |
184 | - ])); |
|
184 | + ]) ); |
|
185 | 185 | }); |
186 | 186 | return $this->ul( $options, [ |
187 | 187 | 'class' => $this->args['class'], |
188 | 188 | 'id' => $this->args['id'], |
189 | - ]); |
|
189 | + ] ); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -194,11 +194,11 @@ discard block |
||
194 | 194 | */ |
195 | 195 | protected function buildFormLabel() |
196 | 196 | { |
197 | - if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' )return; |
|
198 | - return $this->label([ |
|
197 | + if( empty($this->args['label']) || $this->args['type'] == 'hidden' )return; |
|
198 | + return $this->label( [ |
|
199 | 199 | 'for' => $this->args['id'], |
200 | 200 | 'text' => $this->args['label'], |
201 | - ]); |
|
201 | + ] ); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -215,11 +215,11 @@ discard block |
||
215 | 215 | protected function buildFormSelectOptions() |
216 | 216 | { |
217 | 217 | return array_reduce( array_keys( $this->args['options'] ), function( $carry, $key ) { |
218 | - return $carry.$this->option([ |
|
218 | + return $carry.$this->option( [ |
|
219 | 219 | 'selected' => $this->args['value'] == $key, |
220 | 220 | 'text' => $this->args['options'][$key], |
221 | 221 | 'value' => $key, |
222 | - ]); |
|
222 | + ] ); |
|
223 | 223 | }); |
224 | 224 | } |
225 | 225 | |
@@ -236,10 +236,10 @@ discard block |
||
236 | 236 | */ |
237 | 237 | protected function buildTag() |
238 | 238 | { |
239 | - if( in_array( $this->tag, static::TAGS_SINGLE )) { |
|
239 | + if( in_array( $this->tag, static::TAGS_SINGLE ) ) { |
|
240 | 240 | return $this->getOpeningTag(); |
241 | 241 | } |
242 | - if( !in_array( $this->tag, static::TAGS_FORM )) { |
|
242 | + if( !in_array( $this->tag, static::TAGS_FORM ) ) { |
|
243 | 243 | return $this->buildDefaultTag(); |
244 | 244 | } |
245 | 245 | return call_user_func( [$this, 'buildForm'.ucfirst( $this->tag )] ).$this->buildFieldDescription(); |
@@ -274,13 +274,13 @@ discard block |
||
274 | 274 | */ |
275 | 275 | protected function normalize( ...$params ) |
276 | 276 | { |
277 | - if( is_string( $params[0] ) || is_numeric( $params[0] )) { |
|
277 | + if( is_string( $params[0] ) || is_numeric( $params[0] ) ) { |
|
278 | 278 | $this->setNameOrTextAttributeForTag( $params[0] ); |
279 | 279 | } |
280 | - if( is_array( $params[0] )) { |
|
280 | + if( is_array( $params[0] ) ) { |
|
281 | 281 | $this->args += $params[0]; |
282 | 282 | } |
283 | - else if( is_array( $params[1] )) { |
|
283 | + else if( is_array( $params[1] ) ) { |
|
284 | 284 | $this->args += $params[1]; |
285 | 285 | } |
286 | 286 | $this->mergeArgsWithRequiredDefaults(); |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | protected function setTagFromMethod( $method ) |
306 | 306 | { |
307 | 307 | $this->tag = strtolower( $method ); |
308 | - if( in_array( $this->tag, static::INPUT_TYPES )) { |
|
308 | + if( in_array( $this->tag, static::INPUT_TYPES ) ) { |
|
309 | 309 | $this->args['type'] = $this->tag; |
310 | 310 | $this->tag = 'input'; |
311 | 311 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | 'name' => 'tripadvisor', |
13 | 13 | 'title' => 'Tripadvisor Reviews', |
14 | 14 | ], |
15 | - ]); |
|
15 | + ] ); |
|
16 | 16 | $template->render( 'partials/addons/addon', [ |
17 | 17 | 'context' => [ |
18 | 18 | 'description' => __( 'Sync your Yelp reviews and display them on your site.', 'site-reviews' ), |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | 'name' => 'yelp', |
21 | 21 | 'title' => 'Yelp Reviews', |
22 | 22 | ], |
23 | - ]); |
|
23 | + ] ); |
|
24 | 24 | ?> |
25 | 25 | </div> |
26 | 26 | </div> |
@@ -3,7 +3,7 @@ |
||
3 | 3 | <p>{{ data.s1 }}</p> |
4 | 4 | <p>{{ data.p1 }}</p> |
5 | 5 | <p class="row-actions"> |
6 | - <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' );?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
6 | + <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' ); ?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
7 | 7 | </p> |
8 | 8 | <button type="button" class="toggle-row"> |
9 | 9 | <span class="screen-reader-text"><?= __( 'Show custom translation', 'site-reviews' ); ?></span> |