@@ -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 | } |
@@ -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 | } |
@@ -12,11 +12,11 @@ discard block |
||
12 | 12 | */ |
13 | 13 | public function handle( Command $command ) |
14 | 14 | { |
15 | - $postId = wp_update_post([ |
|
15 | + $postId = wp_update_post( [ |
|
16 | 16 | 'ID' => $command->id, |
17 | 17 | 'post_status' => $command->status, |
18 | - ]); |
|
19 | - if( is_wp_error( $postId )) { |
|
18 | + ] ); |
|
19 | + if( is_wp_error( $postId ) ) { |
|
20 | 20 | glsr_log()->error( $postId->get_error_message() ); |
21 | 21 | return []; |
22 | 22 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'aria-label' => '“'.esc_attr( $title ).'” ('.__( 'Edit', 'site-reviews' ).')', |
38 | 38 | 'class' => 'row-title', |
39 | 39 | 'href' => get_edit_post_link( $postId ), |
40 | - ]); |
|
40 | + ] ); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | protected function getPostState( $postId ) |
48 | 48 | { |
49 | 49 | ob_start(); |
50 | - _post_states( get_post( $postId )); |
|
50 | + _post_states( get_post( $postId ) ); |
|
51 | 51 | return ob_get_clean(); |
52 | 52 | } |
53 | 53 | } |
@@ -13,15 +13,15 @@ discard block |
||
13 | 13 | public function fields() |
14 | 14 | { |
15 | 15 | return [[ |
16 | - 'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' )), |
|
16 | + 'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' ) ), |
|
17 | 17 | 'minWidth' => 320, |
18 | 18 | 'type' => 'container', |
19 | - ],[ |
|
19 | + ], [ |
|
20 | 20 | 'label' => esc_html__( 'Title', 'site-reviews' ), |
21 | 21 | 'name' => 'title', |
22 | 22 | 'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ), |
23 | 23 | 'type' => 'textbox', |
24 | - ],[ |
|
24 | + ], [ |
|
25 | 25 | 'label' => esc_html__( 'Count', 'site-reviews' ), |
26 | 26 | 'maxLength' => 5, |
27 | 27 | 'name' => 'count', |
@@ -29,19 +29,19 @@ discard block |
||
29 | 29 | 'text' => '10', |
30 | 30 | 'tooltip' => __( 'How many reviews would you like to display (default: 10)?', 'site-reviews' ), |
31 | 31 | 'type' => 'textbox', |
32 | - ],[ |
|
32 | + ], [ |
|
33 | 33 | 'label' => esc_html__( 'Rating', 'site-reviews' ), |
34 | 34 | 'name' => 'rating', |
35 | 35 | 'options' => [ |
36 | - '5' => esc_html( sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 )), |
|
37 | - '4' => esc_html( sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 )), |
|
38 | - '3' => esc_html( sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 )), |
|
39 | - '2' => esc_html( sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 )), |
|
40 | - '1' => esc_html( sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 )), |
|
36 | + '5' => esc_html( sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 ) ), |
|
37 | + '4' => esc_html( sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 ) ), |
|
38 | + '3' => esc_html( sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 ) ), |
|
39 | + '2' => esc_html( sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 ) ), |
|
40 | + '1' => esc_html( sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 ) ), |
|
41 | 41 | ], |
42 | 42 | 'tooltip' => __( 'What is the minimum rating to display (default: 1 star)?', 'site-reviews' ), |
43 | 43 | 'type' => 'listbox', |
44 | - ],[ |
|
44 | + ], [ |
|
45 | 45 | 'label' => esc_html__( 'Pagination', 'site-reviews' ), |
46 | 46 | 'name' => 'pagination', |
47 | 47 | 'options' => [ |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | 'name' => 'assigned_to', |
60 | 60 | 'tooltip' => __( 'Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page.', 'site-reviews' ), |
61 | 61 | 'type' => 'textbox', |
62 | - ],[ |
|
62 | + ], [ |
|
63 | 63 | 'label' => esc_html__( 'Schema', 'site-reviews' ), |
64 | 64 | 'name' => 'schema', |
65 | 65 | 'options' => [ |
@@ -68,44 +68,44 @@ discard block |
||
68 | 68 | ], |
69 | 69 | 'tooltip' => __( 'Rich snippets are disabled by default.', 'site-reviews' ), |
70 | 70 | 'type' => 'listbox', |
71 | - ],[ |
|
71 | + ], [ |
|
72 | 72 | 'label' => esc_html__( 'Classes', 'site-reviews' ), |
73 | 73 | 'name' => 'class', |
74 | 74 | 'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ), |
75 | 75 | 'type' => 'textbox', |
76 | - ],[ |
|
76 | + ], [ |
|
77 | 77 | 'columns' => 2, |
78 | 78 | 'items' => [[ |
79 | 79 | 'name' => 'hide_author', |
80 | 80 | 'text' => esc_html__( 'Author', 'site-reviews' ), |
81 | 81 | 'tooltip' => __( 'Hide the review author?', 'site-reviews' ), |
82 | 82 | 'type' => 'checkbox', |
83 | - ],[ |
|
83 | + ], [ |
|
84 | 84 | 'name' => 'hide_avatar', |
85 | 85 | 'text' => esc_html__( 'Avatar', 'site-reviews' ), |
86 | 86 | 'tooltip' => __( 'Hide the reviewer avatar if shown?', 'site-reviews' ), |
87 | 87 | 'type' => 'checkbox', |
88 | - ],[ |
|
88 | + ], [ |
|
89 | 89 | 'name' => 'hide_date', |
90 | 90 | 'text' => esc_html__( 'Date', 'site-reviews' ), |
91 | 91 | 'tooltip' => __( 'Hide the review date?', 'site-reviews' ), |
92 | 92 | 'type' => 'checkbox', |
93 | - ],[ |
|
93 | + ], [ |
|
94 | 94 | 'name' => 'hide_excerpt', |
95 | 95 | 'text' => esc_html__( 'Excerpt', 'site-reviews' ), |
96 | 96 | 'tooltip' => __( 'Hide the review excerpt?', 'site-reviews' ), |
97 | 97 | 'type' => 'checkbox', |
98 | - ],[ |
|
98 | + ], [ |
|
99 | 99 | 'name' => 'hide_rating', |
100 | 100 | 'text' => esc_html__( 'Rating', 'site-reviews' ), |
101 | 101 | 'tooltip' => __( 'Hide the review rating?', 'site-reviews' ), |
102 | 102 | 'type' => 'checkbox', |
103 | - ],[ |
|
103 | + ], [ |
|
104 | 104 | 'name' => 'hide_response', |
105 | 105 | 'text' => esc_html__( 'Response', 'site-reviews' ), |
106 | 106 | 'tooltip' => __( 'Hide the review response?', 'site-reviews' ), |
107 | 107 | 'type' => 'checkbox', |
108 | - ],[ |
|
108 | + ], [ |
|
109 | 109 | 'name' => 'hide_title', |
110 | 110 | 'text' => esc_html__( 'Title', 'site-reviews' ), |
111 | 111 | 'tooltip' => __( 'Hide the review title?', 'site-reviews' ), |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | 'label' => esc_html__( 'Hide', 'site-reviews' ), |
116 | 116 | 'spacing' => 5, |
117 | 117 | 'type' => 'container', |
118 | - ],[ |
|
118 | + ], [ |
|
119 | 119 | 'hidden' => true, |
120 | 120 | 'name' => 'id', |
121 | 121 | 'type' => 'textbox', |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | public function getTerms() |
129 | 129 | { |
130 | 130 | $terms = glsr( Database::class )->getTerms(); |
131 | - if( empty( $terms )) { |
|
131 | + if( empty($terms) ) { |
|
132 | 132 | return []; |
133 | 133 | } |
134 | 134 | return [ |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | { |
31 | 31 | foreach( $args as $key => $value ) { |
32 | 32 | $property = glsr( Helper::class )->buildPropertyName( $key ); |
33 | - if( !property_exists( $this, $property ))continue; |
|
33 | + if( !property_exists( $this, $property ) )continue; |
|
34 | 34 | $this->$property = $value; |
35 | - unset( $args[$key] ); |
|
35 | + unset($args[$key]); |
|
36 | 36 | } |
37 | 37 | $this->args = wp_parse_args( $args, [ |
38 | 38 | 'menu_name' => $this->plural, |
39 | - ]); |
|
39 | + ] ); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | 'singular_name' => $this->single, |
60 | 60 | 'uploaded_to_this_item' => sprintf( _x( 'Uploaded to this %s', 'Uploaded to this Post', 'site-reviews' ), $this->single ), |
61 | 61 | 'view_item' => sprintf( _x( 'View %s', 'View Post', 'site-reviews' ), $this->single ), |
62 | - ]); |
|
63 | - unset( $this->args['menu_name'] ); |
|
62 | + ] ); |
|
63 | + unset($this->args['menu_name']); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -69,12 +69,12 @@ discard block |
||
69 | 69 | protected function normalizeColumns() |
70 | 70 | { |
71 | 71 | $this->columns = ['cb' => ''] + $this->columns; |
72 | - if( array_key_exists( 'category', $this->columns )) { |
|
72 | + if( array_key_exists( 'category', $this->columns ) ) { |
|
73 | 73 | $keys = array_keys( $this->columns ); |
74 | 74 | $keys[array_search( 'category', $keys )] = 'taxonomy-'.Application::TAXONOMY; |
75 | 75 | $this->columns = array_combine( $keys, $this->columns ); |
76 | 76 | } |
77 | - if( array_key_exists( 'pinned', $this->columns )) { |
|
77 | + if( array_key_exists( 'pinned', $this->columns ) ) { |
|
78 | 78 | $this->columns['pinned'] = glsr( Builder::class )->span( |
79 | 79 | '<span>'.$this->columns['pinned'].'</span>', |
80 | 80 | ['class' => 'pinned-icon'] |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | if( $assignedPost instanceof WP_Post && $assignedPost->post_status == 'publish' ) { |
23 | 23 | $column = glsr( Builder::class )->a( get_the_title( $assignedPost->ID ), [ |
24 | 24 | 'href' => (string)get_the_permalink( $assignedPost->ID ), |
25 | - ]); |
|
25 | + ] ); |
|
26 | 26 | } |
27 | 27 | return $column; |
28 | 28 | } |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | $pinned = glsr( Database::class )->getReviewMeta( $postId )->pinned |
37 | 37 | ? 'pinned ' |
38 | 38 | : ''; |
39 | - return glsr( Builder::class )->i([ |
|
39 | + return glsr( Builder::class )->i( [ |
|
40 | 40 | 'class' => $pinned.'dashicons dashicons-sticky', |
41 | 41 | 'data-id' => $postId, |
42 | - ]); |
|
42 | + ] ); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -58,13 +58,13 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function buildColumnRating( $postId, $rating = null ) |
60 | 60 | { |
61 | - if( is_null( $rating )) { |
|
61 | + if( is_null( $rating ) ) { |
|
62 | 62 | $rating = glsr( Database::class )->getReviewMeta( $postId )->rating; |
63 | 63 | } |
64 | 64 | ob_start(); |
65 | - wp_star_rating([ |
|
65 | + wp_star_rating( [ |
|
66 | 66 | 'rating' => $rating, |
67 | - ]); |
|
67 | + ] ); |
|
68 | 68 | return ob_get_clean(); |
69 | 69 | } |
70 | 70 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | public function buildColumnType( $postId ) |
76 | 76 | { |
77 | 77 | $reviewMeta = glsr( Database::class )->getReviewMeta( $postId ); |
78 | - return isset( glsr()->reviewTypes[$reviewMeta->review_type] ) |
|
78 | + return isset(glsr()->reviewTypes[$reviewMeta->review_type]) |
|
79 | 79 | ? glsr()->reviewTypes[$reviewMeta->review_type] |
80 | 80 | : $reviewMeta->review_type; |
81 | 81 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | public function renderFilters( $postType ) |
88 | 88 | { |
89 | 89 | if( $postType !== Application::POST_TYPE )return; |
90 | - if( !( $status = filter_input( INPUT_GET, 'post_status' ))) { |
|
90 | + if( !($status = filter_input( INPUT_GET, 'post_status' )) ) { |
|
91 | 91 | $status = 'publish'; |
92 | 92 | } |
93 | 93 | $ratings = glsr( Database::class )->getReviewsMeta( 'rating', $status ); |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | */ |
117 | 117 | protected function renderFilterRatings( $ratings ) |
118 | 118 | { |
119 | - if( empty( $ratings ))return; |
|
120 | - $ratings = array_flip( array_reverse( $ratings )); |
|
119 | + if( empty($ratings) )return; |
|
120 | + $ratings = array_flip( array_reverse( $ratings ) ); |
|
121 | 121 | array_walk( $ratings, function( &$value, $key ) { |
122 | 122 | $label = _n( '%s star', '%s stars', $key, 'site-reviews' ); |
123 | 123 | $value = sprintf( $label, $key ); |
@@ -125,12 +125,12 @@ discard block |
||
125 | 125 | echo glsr( Builder::class )->label( __( 'Filter by rating', 'site-reviews' ), [ |
126 | 126 | 'class' => 'screen-reader-text', |
127 | 127 | 'for' => 'rating', |
128 | - ]); |
|
129 | - echo glsr( Builder::class )->select([ |
|
128 | + ] ); |
|
129 | + echo glsr( Builder::class )->select( [ |
|
130 | 130 | 'name' => 'rating', |
131 | 131 | 'options' => ['' => __( 'All ratings', 'site-reviews' )] + $ratings, |
132 | 132 | 'value' => filter_input( INPUT_GET, 'rating' ), |
133 | - ]); |
|
133 | + ] ); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | echo glsr( Builder::class )->label( __( 'Filter by type', 'site-reviews' ), [ |
144 | 144 | 'class' => 'screen-reader-text', |
145 | 145 | 'for' => 'review_type', |
146 | - ]); |
|
147 | - echo glsr( Builder::class )->select([ |
|
146 | + ] ); |
|
147 | + echo glsr( Builder::class )->select( [ |
|
148 | 148 | 'name' => 'review_type', |
149 | 149 | 'options' => ['' => __( 'All types', 'site-reviews' )] + glsr()->reviewTypes, |
150 | 150 | 'value' => filter_input( INPUT_GET, 'review_type' ), |
151 | - ]); |
|
151 | + ] ); |
|
152 | 152 | } |
153 | 153 | } |
@@ -86,7 +86,9 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function renderFilters( $postType ) |
88 | 88 | { |
89 | - if( $postType !== Application::POST_TYPE )return; |
|
89 | + if( $postType !== Application::POST_TYPE ) { |
|
90 | + return; |
|
91 | + } |
|
90 | 92 | if( !( $status = filter_input( INPUT_GET, 'post_status' ))) { |
91 | 93 | $status = 'publish'; |
92 | 94 | } |
@@ -103,7 +105,9 @@ discard block |
||
103 | 105 | */ |
104 | 106 | public function renderValues( $column, $postId ) |
105 | 107 | { |
106 | - if( glsr_current_screen()->post_type != Application::POST_TYPE )return; |
|
108 | + if( glsr_current_screen()->post_type != Application::POST_TYPE ) { |
|
109 | + return; |
|
110 | + } |
|
107 | 111 | $method = glsr( Helper::class )->buildMethodName( $column, 'buildColumn' ); |
108 | 112 | echo method_exists( $this, $method ) |
109 | 113 | ? call_user_func( [$this, $method], $postId ) |
@@ -116,7 +120,9 @@ discard block |
||
116 | 120 | */ |
117 | 121 | protected function renderFilterRatings( $ratings ) |
118 | 122 | { |
119 | - if( empty( $ratings ))return; |
|
123 | + if( empty( $ratings )) { |
|
124 | + return; |
|
125 | + } |
|
120 | 126 | $ratings = array_flip( array_reverse( $ratings )); |
121 | 127 | array_walk( $ratings, function( &$value, $key ) { |
122 | 128 | $label = _n( '%s star', '%s stars', $key, 'site-reviews' ); |
@@ -139,7 +145,9 @@ discard block |
||
139 | 145 | */ |
140 | 146 | protected function renderFilterTypes( $types ) |
141 | 147 | { |
142 | - if( count( glsr()->reviewTypes ) < 2 )return; |
|
148 | + if( count( glsr()->reviewTypes ) < 2 ) { |
|
149 | + return; |
|
150 | + } |
|
143 | 151 | echo glsr( Builder::class )->label( __( 'Filter by type', 'site-reviews' ), [ |
144 | 152 | 'class' => 'screen-reader-text', |
145 | 153 | 'for' => 'review_type', |
@@ -51,9 +51,9 @@ |
||
51 | 51 | protected function normalize( array $data ) |
52 | 52 | { |
53 | 53 | $arrayKeys = ['context', 'globals']; |
54 | - $data = wp_parse_args( $data, array_fill_keys( $arrayKeys, [] )); |
|
54 | + $data = wp_parse_args( $data, array_fill_keys( $arrayKeys, [] ) ); |
|
55 | 55 | foreach( $arrayKeys as $key ) { |
56 | - if( is_array( $data[$key] ))continue; |
|
56 | + if( is_array( $data[$key] ) )continue; |
|
57 | 57 | $data[$key] = []; |
58 | 58 | } |
59 | 59 | return $data; |
@@ -53,7 +53,9 @@ |
||
53 | 53 | $arrayKeys = ['context', 'globals']; |
54 | 54 | $data = wp_parse_args( $data, array_fill_keys( $arrayKeys, [] )); |
55 | 55 | foreach( $arrayKeys as $key ) { |
56 | - if( is_array( $data[$key] ))continue; |
|
56 | + if( is_array( $data[$key] )) { |
|
57 | + continue; |
|
58 | + } |
|
57 | 59 | $data[$key] = []; |
58 | 60 | } |
59 | 61 | return $data; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | protected function filterAttributes( array $allowedAttributeKeys ) |
119 | 119 | { |
120 | - return array_intersect_key( $this->attributes, array_flip( $allowedAttributeKeys )); |
|
120 | + return array_intersect_key( $this->attributes, array_flip( $allowedAttributeKeys ) ); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $globalAttributes = $this->filterAttributes( static::GLOBAL_ATTRIBUTES ); |
129 | 129 | $wildcards = []; |
130 | 130 | foreach( static::GLOBAL_WILDCARD_ATTRIBUTES as $wildcard ) { |
131 | - $newWildcards = array_filter( $this->attributes, function( $key ) use( $wildcard ) { |
|
131 | + $newWildcards = array_filter( $this->attributes, function( $key ) use($wildcard) { |
|
132 | 132 | return glsr( Helper::class )->startsWith( $wildcard, $key ); |
133 | 133 | }, ARRAY_FILTER_USE_KEY ); |
134 | 134 | $wildcards = array_merge( $wildcards, $newWildcards ); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | protected function getPermanentAttributes() |
143 | 143 | { |
144 | 144 | $permanentAttributes = []; |
145 | - if( array_key_exists( 'value', $this->attributes )) { |
|
145 | + if( array_key_exists( 'value', $this->attributes ) ) { |
|
146 | 146 | $permanentAttributes['value'] = $this->attributes['value']; |
147 | 147 | } |
148 | 148 | return $permanentAttributes; |
@@ -194,11 +194,11 @@ discard block |
||
194 | 194 | protected function normalizeBooleanAttributes() |
195 | 195 | { |
196 | 196 | foreach( $this->attributes as $key => $value ) { |
197 | - if( $this->isAttributeKeyNumeric( $key, $value )) { |
|
197 | + if( $this->isAttributeKeyNumeric( $key, $value ) ) { |
|
198 | 198 | $key = $value; |
199 | 199 | $value = true; |
200 | 200 | } |
201 | - if( !in_array( $key, static::BOOLEAN_ATTRIBUTES ))continue; |
|
201 | + if( !in_array( $key, static::BOOLEAN_ATTRIBUTES ) )continue; |
|
202 | 202 | $this->attributes[$key] = wp_validate_boolean( $value ); |
203 | 203 | } |
204 | 204 | } |
@@ -209,12 +209,12 @@ discard block |
||
209 | 209 | protected function normalizeDataAttributes() |
210 | 210 | { |
211 | 211 | foreach( $this->attributes as $key => $value ) { |
212 | - if( $this->isAttributeKeyNumeric( $key, $value )) { |
|
212 | + if( $this->isAttributeKeyNumeric( $key, $value ) ) { |
|
213 | 213 | $key = $value; |
214 | 214 | $value = ''; |
215 | 215 | } |
216 | - if( !glsr( Helper::class )->startsWith( 'data-', $key ))continue; |
|
217 | - if( is_array( $value )) { |
|
216 | + if( !glsr( Helper::class )->startsWith( 'data-', $key ) )continue; |
|
217 | + if( is_array( $value ) ) { |
|
218 | 218 | $value = json_encode( $value, JSON_HEX_APOS | JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES ); |
219 | 219 | } |
220 | 220 | $this->attributes[$key] = $value; |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | protected function normalizeStringAttributes() |
228 | 228 | { |
229 | 229 | foreach( $this->attributes as $key => $value ) { |
230 | - if( !is_string( $value ))continue; |
|
230 | + if( !is_string( $value ) )continue; |
|
231 | 231 | $this->attributes[$key] = trim( $value ); |
232 | 232 | } |
233 | 233 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | { |
241 | 241 | if( $method != 'input' )return; |
242 | 242 | $attributes = wp_parse_args( $this->attributes, ['type' => ''] ); |
243 | - if( !in_array( $attributes['type'], static::INPUT_TYPES )) { |
|
243 | + if( !in_array( $attributes['type'], static::INPUT_TYPES ) ) { |
|
244 | 244 | $this->attributes['type'] = 'text'; |
245 | 245 | } |
246 | 246 | } |
@@ -254,11 +254,11 @@ discard block |
||
254 | 254 | $permanentAttributes = $this->getPermanentAttributes(); |
255 | 255 | foreach( $this->attributes as $key => $value ) { |
256 | 256 | if( in_array( $key, static::BOOLEAN_ATTRIBUTES ) && !$value ) { |
257 | - unset( $attributes[$key] ); |
|
257 | + unset($attributes[$key]); |
|
258 | 258 | } |
259 | - if( glsr( Helper::class )->startsWith( 'data-', $key )) { |
|
259 | + if( glsr( Helper::class )->startsWith( 'data-', $key ) ) { |
|
260 | 260 | $permanentAttributes[$key] = $value; |
261 | - unset( $attributes[$key] ); |
|
261 | + unset($attributes[$key]); |
|
262 | 262 | } |
263 | 263 | } |
264 | 264 | $this->attributes = array_merge( array_filter( $attributes ), $permanentAttributes ); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | { |
36 | 36 | $links[] = glsr( Builder::class )->a( __( 'Settings', 'site-reviews' ), [ |
37 | 37 | 'href' => admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=settings' ), |
38 | - ]); |
|
38 | + ] ); |
|
39 | 39 | return $links; |
40 | 40 | } |
41 | 41 | |
@@ -46,19 +46,19 @@ discard block |
||
46 | 46 | public function filterDashboardGlanceItems( array $items ) |
47 | 47 | { |
48 | 48 | $postCount = wp_count_posts( Application::POST_TYPE ); |
49 | - if( empty( $postCount->publish )) { |
|
49 | + if( empty($postCount->publish) ) { |
|
50 | 50 | return $items; |
51 | 51 | } |
52 | 52 | $text = _n( '%s Review', '%s Reviews', $postCount->publish, 'site-reviews' ); |
53 | - $text = sprintf( $text, number_format_i18n( $postCount->publish )); |
|
53 | + $text = sprintf( $text, number_format_i18n( $postCount->publish ) ); |
|
54 | 54 | $items[] = current_user_can( get_post_type_object( Application::POST_TYPE )->cap->edit_posts ) |
55 | 55 | ? glsr( Builder::class )->a( $text, [ |
56 | 56 | 'class' => 'glsr-review-count', |
57 | 57 | 'href' => 'edit.php?post_type='.Application::POST_TYPE, |
58 | - ]) |
|
58 | + ] ) |
|
59 | 59 | : glsr( Builder::class )->span( $text, [ |
60 | 60 | 'class' => 'glsr-review-count', |
61 | - ]); |
|
61 | + ] ); |
|
62 | 62 | return $items; |
63 | 63 | } |
64 | 64 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | public function filterTinymcePlugins( array $plugins ) |
70 | 70 | { |
71 | 71 | if( user_can_richedit() |
72 | - && ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ))) { |
|
72 | + && (current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' )) ) { |
|
73 | 73 | $plugins['glsr_shortcode'] = glsr()->url( 'assets/scripts/mce-plugin.js' ); |
74 | 74 | } |
75 | 75 | return $plugins; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function registerPointers() |
83 | 83 | { |
84 | - $command = new RegisterPointers([[ |
|
84 | + $command = new RegisterPointers( [[ |
|
85 | 85 | 'content' => __( 'You can pin exceptional reviews so that they are always shown first.', 'site-reviews' ), |
86 | 86 | 'id' => 'glsr-pointer-pinned', |
87 | 87 | 'position' => [ |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | 'screen' => Application::POST_TYPE, |
92 | 92 | 'target' => '#misc-pub-pinned', |
93 | 93 | 'title' => __( 'Pin Your Reviews', 'site-reviews' ), |
94 | - ]]); |
|
94 | + ]] ); |
|
95 | 95 | $this->execute( $command ); |
96 | 96 | } |
97 | 97 | |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function registerShortcodeButtons() |
103 | 103 | { |
104 | - $command = new RegisterShortcodeButtons([ |
|
104 | + $command = new RegisterShortcodeButtons( [ |
|
105 | 105 | 'site_reviews' => esc_html__( 'Recent Reviews', 'site-reviews' ), |
106 | 106 | 'site_reviews_form' => esc_html__( 'Submit a Review', 'site-reviews' ), |
107 | 107 | 'site_reviews_summary' => esc_html__( 'Summary of Reviews', 'site-reviews' ), |
108 | - ]); |
|
108 | + ] ); |
|
109 | 109 | $this->execute( $command ); |
110 | 110 | } |
111 | 111 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) )return; |
119 | 119 | glsr()->render( 'partials/editor/review', [ |
120 | 120 | 'post' => $post, |
121 | - ]); |
|
121 | + ] ); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -127,13 +127,13 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function renderReviewNotice( WP_Post $post ) |
129 | 129 | { |
130 | - if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return; |
|
131 | - glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' )); |
|
130 | + if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) )return; |
|
131 | + glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ) ); |
|
132 | 132 | glsr( Html::class )->renderTemplate( 'partials/editor/notice', [ |
133 | 133 | 'context' => [ |
134 | 134 | 'notices' => glsr( Notice::class )->get(), |
135 | 135 | ], |
136 | - ]); |
|
136 | + ] ); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -145,13 +145,13 @@ discard block |
||
145 | 145 | if( glsr_current_screen()->base != 'post' )return; |
146 | 146 | $shortcodes = []; |
147 | 147 | foreach( glsr()->mceShortcodes as $shortcode => $values ) { |
148 | - if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ))continue; |
|
148 | + if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ) )continue; |
|
149 | 149 | $shortcodes[$shortcode] = $values; |
150 | 150 | } |
151 | - if( empty( $shortcodes ))return; |
|
151 | + if( empty($shortcodes) )return; |
|
152 | 152 | glsr()->render( 'partials/editor/tinymce', [ |
153 | 153 | 'shortcodes' => $shortcodes, |
154 | - ]); |
|
154 | + ] ); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | public function routerClearLog() |
161 | 161 | { |
162 | 162 | glsr( Logger::class )->clear(); |
163 | - glsr( Notice::class )->addSuccess( __( 'Log cleared.', 'site-reviews' )); |
|
163 | + glsr( Notice::class )->addSuccess( __( 'Log cleared.', 'site-reviews' ) ); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -194,17 +194,17 @@ discard block |
||
194 | 194 | { |
195 | 195 | $file = $_FILES['import-file']; |
196 | 196 | if( $file['error'] !== UPLOAD_ERR_OK ) { |
197 | - return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] )); |
|
197 | + return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ) ); |
|
198 | 198 | } |
199 | - if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] )) { |
|
200 | - return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' )); |
|
199 | + if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] ) ) { |
|
200 | + return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ) ); |
|
201 | 201 | } |
202 | 202 | $settings = json_decode( file_get_contents( $file['tmp_name'] ), true ); |
203 | - if( empty( $settings )) { |
|
204 | - return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' )); |
|
203 | + if( empty($settings) ) { |
|
204 | + return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ) ); |
|
205 | 205 | } |
206 | - glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings )); |
|
207 | - glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' )); |
|
206 | + glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ) ); |
|
207 | + glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ) ); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | UPLOAD_ERR_CANT_WRITE => __( 'Failed to write file to disk.', 'site-reviews' ), |
223 | 223 | UPLOAD_ERR_EXTENSION => __( 'A PHP extension stopped the file upload.', 'site-reviews' ), |
224 | 224 | ]; |
225 | - return !isset( $errors[$errorCode] ) |
|
225 | + return !isset($errors[$errorCode]) |
|
226 | 226 | ? __( 'Unknown upload error.', 'site-reviews' ) |
227 | 227 | : $errors[$errorCode]; |
228 | 228 | } |
@@ -115,7 +115,9 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function renderReviewEditor( WP_Post $post ) |
117 | 117 | { |
118 | - if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) )return; |
|
118 | + if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) ) { |
|
119 | + return; |
|
120 | + } |
|
119 | 121 | glsr()->render( 'partials/editor/review', [ |
120 | 122 | 'post' => $post, |
121 | 123 | ]); |
@@ -127,7 +129,9 @@ discard block |
||
127 | 129 | */ |
128 | 130 | public function renderReviewNotice( WP_Post $post ) |
129 | 131 | { |
130 | - if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return; |
|
132 | + if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) { |
|
133 | + return; |
|
134 | + } |
|
131 | 135 | glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' )); |
132 | 136 | glsr( Html::class )->renderTemplate( 'partials/editor/notice', [ |
133 | 137 | 'context' => [ |
@@ -142,13 +146,19 @@ discard block |
||
142 | 146 | */ |
143 | 147 | public function renderTinymceButton() |
144 | 148 | { |
145 | - if( glsr_current_screen()->base != 'post' )return; |
|
149 | + if( glsr_current_screen()->base != 'post' ) { |
|
150 | + return; |
|
151 | + } |
|
146 | 152 | $shortcodes = []; |
147 | 153 | foreach( glsr()->mceShortcodes as $shortcode => $values ) { |
148 | - if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ))continue; |
|
154 | + if( !apply_filters( sanitize_title( $shortcode ).'_condition', true )) { |
|
155 | + continue; |
|
156 | + } |
|
149 | 157 | $shortcodes[$shortcode] = $values; |
150 | 158 | } |
151 | - if( empty( $shortcodes ))return; |
|
159 | + if( empty( $shortcodes )) { |
|
160 | + return; |
|
161 | + } |
|
152 | 162 | glsr()->render( 'partials/editor/tinymce', [ |
153 | 163 | 'shortcodes' => $shortcodes, |
154 | 164 | ]); |