@@ -57,7 +57,7 @@ |
||
57 | 57 | */ |
58 | 58 | protected function isReviewEditable() |
59 | 59 | { |
60 | - $postId = intval( filter_input( INPUT_GET, 'post' )); |
|
60 | + $postId = intval( filter_input( INPUT_GET, 'post' ) ); |
|
61 | 61 | return $postId > 0 |
62 | 62 | && get_post_meta( $postId, 'review_type', true ) == 'local' |
63 | 63 | && $this->isReviewEditor(); |
@@ -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,47 +42,47 @@ |
||
42 | 42 | */ |
43 | 43 | public function run() |
44 | 44 | { |
45 | - add_action( 'admin_enqueue_scripts', [$this->admin, 'enqueueAssets'] ); |
|
46 | - add_action( 'admin_init', [$this->admin, 'registerShortcodeButtons'] ); |
|
47 | - add_action( 'edit_form_after_title', [$this->admin, 'renderReviewEditor'] ); |
|
48 | - add_action( 'edit_form_top', [$this->admin, 'renderReviewNotice'] ); |
|
49 | - add_action( 'media_buttons', [$this->admin, 'renderTinymceButton'], 11 ); |
|
50 | - add_action( 'plugins_loaded', [$this->app, 'getDefaults'], 11 ); |
|
51 | - add_action( 'plugins_loaded', [$this->app, 'registerAddons'] ); |
|
52 | - add_action( 'plugins_loaded', [$this->app, 'registerLanguages'] ); |
|
53 | - add_action( 'plugins_loaded', [$this->app, 'registerReviewTypes'] ); |
|
54 | - add_action( 'upgrader_process_complete', [$this->app, 'upgraded'], 10, 2 ); |
|
55 | - add_action( 'admin_enqueue_scripts', [$this->editor, 'customizePostStatusLabels'] ); |
|
56 | - add_action( 'site-reviews/create/review', [$this->editor, 'onCreateReview'], 10, 3 ); |
|
57 | - add_action( 'before_delete_post', [$this->editor, 'onDeleteReview'] ); |
|
58 | - add_action( 'save_post_'.Application::POST_TYPE, [$this->editor, 'onSaveReview'], 20, 2 ); |
|
59 | - add_action( 'add_meta_boxes', [$this->editor, 'registerMetaBoxes'] ); |
|
60 | - add_action( 'admin_print_scripts', [$this->editor, 'removeAutosave'], 999 ); |
|
61 | - add_action( 'admin_menu', [$this->editor, 'removeMetaBoxes'] ); |
|
62 | - add_action( 'post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox'] ); |
|
63 | - add_action( 'admin_action_revert', [$this->editor, 'revertReview'] ); |
|
64 | - add_action( 'save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes'] ); |
|
65 | - add_action( 'admin_action_approve', [$this->listtable, 'approve'] ); |
|
66 | - add_action( 'bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2 ); |
|
67 | - add_action( 'restrict_manage_posts', [$this->listtable, 'renderColumnFilters'] ); |
|
68 | - add_action( 'manage_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2 ); |
|
69 | - add_action( 'save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields'] ); |
|
70 | - add_action( 'pre_get_posts', [$this->listtable, 'setQueryForColumn'] ); |
|
71 | - add_action( 'admin_action_unapprove', [$this->listtable, 'unapprove'] ); |
|
72 | - add_action( 'init', [$this->main, 'registerPostType'], 8 ); |
|
73 | - add_action( 'init', [$this->main, 'registerShortcodes'] ); |
|
74 | - add_action( 'init', [$this->main, 'registerTaxonomy'] ); |
|
75 | - add_action( 'widgets_init', [$this->main, 'registerWidgets'] ); |
|
76 | - add_action( 'wp_footer', [$this->main, 'renderSchema'] ); |
|
77 | - add_action( 'admin_menu', [$this->menu, 'registerMenuCount'] ); |
|
78 | - add_action( 'admin_menu', [$this->menu, 'registerSubMenus'] ); |
|
79 | - add_action( 'admin_init', [$this->menu, 'setCustomPermissions'], 999 ); |
|
80 | - add_action( 'wp_enqueue_scripts', [$this->public, 'enqueueAssets'], 999 ); |
|
81 | - add_action( 'admin_init', [$this->router, 'routeAdminPostRequest'] ); |
|
82 | - add_action( 'wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] ); |
|
45 | + add_action( 'admin_enqueue_scripts', [$this->admin, 'enqueueAssets'] ); |
|
46 | + add_action( 'admin_init', [$this->admin, 'registerShortcodeButtons'] ); |
|
47 | + add_action( 'edit_form_after_title', [$this->admin, 'renderReviewEditor'] ); |
|
48 | + add_action( 'edit_form_top', [$this->admin, 'renderReviewNotice'] ); |
|
49 | + add_action( 'media_buttons', [$this->admin, 'renderTinymceButton'], 11 ); |
|
50 | + add_action( 'plugins_loaded', [$this->app, 'getDefaults'], 11 ); |
|
51 | + add_action( 'plugins_loaded', [$this->app, 'registerAddons'] ); |
|
52 | + add_action( 'plugins_loaded', [$this->app, 'registerLanguages'] ); |
|
53 | + add_action( 'plugins_loaded', [$this->app, 'registerReviewTypes'] ); |
|
54 | + add_action( 'upgrader_process_complete', [$this->app, 'upgraded'], 10, 2 ); |
|
55 | + add_action( 'admin_enqueue_scripts', [$this->editor, 'customizePostStatusLabels'] ); |
|
56 | + add_action( 'site-reviews/create/review', [$this->editor, 'onCreateReview'], 10, 3 ); |
|
57 | + add_action( 'before_delete_post', [$this->editor, 'onDeleteReview'] ); |
|
58 | + add_action( 'save_post_'.Application::POST_TYPE, [$this->editor, 'onSaveReview'], 20, 2 ); |
|
59 | + add_action( 'add_meta_boxes', [$this->editor, 'registerMetaBoxes'] ); |
|
60 | + add_action( 'admin_print_scripts', [$this->editor, 'removeAutosave'], 999 ); |
|
61 | + add_action( 'admin_menu', [$this->editor, 'removeMetaBoxes'] ); |
|
62 | + add_action( 'post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox'] ); |
|
63 | + add_action( 'admin_action_revert', [$this->editor, 'revertReview'] ); |
|
64 | + add_action( 'save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes'] ); |
|
65 | + add_action( 'admin_action_approve', [$this->listtable, 'approve'] ); |
|
66 | + add_action( 'bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2 ); |
|
67 | + add_action( 'restrict_manage_posts', [$this->listtable, 'renderColumnFilters'] ); |
|
68 | + add_action( 'manage_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2 ); |
|
69 | + add_action( 'save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields'] ); |
|
70 | + add_action( 'pre_get_posts', [$this->listtable, 'setQueryForColumn'] ); |
|
71 | + add_action( 'admin_action_unapprove', [$this->listtable, 'unapprove'] ); |
|
72 | + add_action( 'init', [$this->main, 'registerPostType'], 8 ); |
|
73 | + add_action( 'init', [$this->main, 'registerShortcodes'] ); |
|
74 | + add_action( 'init', [$this->main, 'registerTaxonomy'] ); |
|
75 | + add_action( 'widgets_init', [$this->main, 'registerWidgets'] ); |
|
76 | + add_action( 'wp_footer', [$this->main, 'renderSchema'] ); |
|
77 | + add_action( 'admin_menu', [$this->menu, 'registerMenuCount'] ); |
|
78 | + add_action( 'admin_menu', [$this->menu, 'registerSubMenus'] ); |
|
79 | + add_action( 'admin_init', [$this->menu, 'setCustomPermissions'], 999 ); |
|
80 | + add_action( 'wp_enqueue_scripts', [$this->public, 'enqueueAssets'], 999 ); |
|
81 | + add_action( 'admin_init', [$this->router, 'routeAdminPostRequest'] ); |
|
82 | + add_action( 'wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] ); |
|
83 | 83 | add_action( 'wp_ajax_nopriv_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] ); |
84 | - add_action( 'init', [$this->router, 'routePublicPostRequest'] ); |
|
85 | - add_action( 'admin_init', [$this->router, 'routeWebhookRequest'] ); |
|
86 | - add_action( 'admin_init', [$this->settings, 'registerSettings'] ); |
|
84 | + add_action( 'init', [$this->router, 'routePublicPostRequest'] ); |
|
85 | + add_action( 'admin_init', [$this->router, 'routeWebhookRequest'] ); |
|
86 | + add_action( 'admin_init', [$this->settings, 'registerSettings'] ); |
|
87 | 87 | } |
88 | 88 | } |
@@ -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 ); |
@@ -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> |
@@ -2,7 +2,7 @@ |
||
2 | 2 | <td class="glsr-string-td1 column-primary"> |
3 | 3 | <p>{{ data.s1 }}</p> |
4 | 4 | <p class="row-actions"> |
5 | - <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' );?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
5 | + <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' ); ?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
6 | 6 | </p> |
7 | 7 | <button type="button" class="toggle-row"> |
8 | 8 | <span class="screen-reader-text"><?= __( 'Show custom translation', 'site-reviews' ); ?></span> |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | </ul> |
21 | 21 | </div> |
22 | 22 | |
23 | - <?php if( current_user_can( $taxonomy->cap->edit_terms )) : ?> |
|
23 | + <?php if( current_user_can( $taxonomy->cap->edit_terms ) ) : ?> |
|
24 | 24 | <div id="<?= $tax_name; ?>-adder" class="wp-hidden-children"> |
25 | 25 | <a id="<?= $tax_name; ?>-add-toggle" href="#<?= $tax_name; ?>-add" class="hide-if-no-js taxonomy-add-new"> |
26 | 26 | <?= sprintf( '+ %s', $taxonomy->labels->add_new_item ); ?> |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | <label class="screen-reader-text" for="new<?= $tax_name; ?>"><?= $taxonomy->labels->add_new_item; ?></label> |
30 | 30 | <input type="text" name="new<?= $tax_name; ?>" id="new<?= $tax_name; ?>" class="form-required form-input-tip" value="<?= esc_attr( $taxonomy->labels->new_item_name ); ?>" aria-required="true"/> |
31 | 31 | <input type="button" id="<?= $tax_name; ?>-add-submit" data-wp-lists="add:<?= $tax_name; ?>checklist:<?= $tax_name; ?>-add" class="button category-add-submit" value="<?= esc_attr( $taxonomy->labels->add_new_item ); ?>" /> |
32 | - <?php wp_nonce_field( 'add-' . $tax_name, '_ajax_nonce-add-' . $tax_name, false ); ?> |
|
32 | + <?php wp_nonce_field( 'add-'.$tax_name, '_ajax_nonce-add-'.$tax_name, false ); ?> |
|
33 | 33 | <span id="<?= $tax_name; ?>-ajax-response"></span> |
34 | 34 | </div> |
35 | 35 | </div> |