Passed
Branch master (51607c)
by Paul
05:13
created
plugin/Handlers/RegisterTaxonomy.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -10,16 +10,16 @@  discard block
 block discarded – undo
10 10
 	/**
11 11
 	 * @return void
12 12
 	 */
13
-	public function handle( Command $command )
13
+	public function handle(Command $command)
14 14
 	{
15
-		register_taxonomy( Application::TAXONOMY, Application::POST_TYPE, $command->args );
16
-		register_taxonomy_for_object_type( Application::TAXONOMY, Application::POST_TYPE );
15
+		register_taxonomy(Application::TAXONOMY, Application::POST_TYPE, $command->args);
16
+		register_taxonomy_for_object_type(Application::TAXONOMY, Application::POST_TYPE);
17 17
 
18
-		add_action( Application::TAXONOMY.'_term_edit_form_top', [$this, 'disableParents'] );
19
-		add_action( Application::TAXONOMY.'_term_new_form_tag',  [$this, 'disableParents'] );
20
-		add_action( Application::TAXONOMY.'_add_form_fields',    [$this, 'enableParents'] );
21
-		add_action( Application::TAXONOMY.'_edit_form',          [$this, 'enableParents'] );
22
-		add_action( 'restrict_manage_posts',                     [$this, 'renderFilterTaxonomy'], 9 );
18
+		add_action(Application::TAXONOMY.'_term_edit_form_top', [$this, 'disableParents']);
19
+		add_action(Application::TAXONOMY.'_term_new_form_tag', [$this, 'disableParents']);
20
+		add_action(Application::TAXONOMY.'_add_form_fields', [$this, 'enableParents']);
21
+		add_action(Application::TAXONOMY.'_edit_form', [$this, 'enableParents']);
22
+		add_action('restrict_manage_posts', [$this, 'renderFilterTaxonomy'], 9);
23 23
 	}
24 24
 
25 25
 	/**
@@ -55,16 +55,16 @@  discard block
 block discarded – undo
55 55
 	public function renderFilterTaxonomy()
56 56
 	{
57 57
 		global $wp_query;
58
-		if( !is_object_in_taxonomy( get_current_screen()->post_type, Application::TAXONOMY )
59
-			|| apply_filters( 'site-reviews/disable/filter/category', false )
58
+		if (!is_object_in_taxonomy(get_current_screen()->post_type, Application::TAXONOMY)
59
+			|| apply_filters('site-reviews/disable/filter/category', false)
60 60
 		)return;
61
-		printf( '<label class="screen-reader-text" for="%s">%s</label>', Application::TAXONOMY, __( 'Filter by category', 'site-reviews' ));
62
-		$selected = isset( $wp_query->query[Application::TAXONOMY] )
61
+		printf('<label class="screen-reader-text" for="%s">%s</label>', Application::TAXONOMY, __('Filter by category', 'site-reviews'));
62
+		$selected = isset($wp_query->query[Application::TAXONOMY])
63 63
 			? $wp_query->query[Application::TAXONOMY]
64 64
 			: '';
65
-		$taxonomy = get_taxonomy( Application::TAXONOMY );
65
+		$taxonomy = get_taxonomy(Application::TAXONOMY);
66 66
 		$showOptionAll = $taxonomy
67
-			? ucfirst( strtolower( $taxonomy->labels->all_items ))
67
+			? ucfirst(strtolower($taxonomy->labels->all_items))
68 68
 			: '';
69 69
 		wp_dropdown_categories([
70 70
 			'depth' => 3,
Please login to merge, or discard this patch.
plugin/Handlers/EnqueueAssets.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -15,19 +15,19 @@  discard block
 block discarded – undo
15 15
 	/**
16 16
 	 * @return void
17 17
 	 */
18
-	public function handle( Command $command )
18
+	public function handle(Command $command)
19 19
 	{
20
-		$this->dependencies = glsr( 'Html' )->getDependencies();
21
-		$ajaxNonce = wp_create_nonce( glsr()->id.'-ajax-nonce' );
20
+		$this->dependencies = glsr('Html')->getDependencies();
21
+		$ajaxNonce = wp_create_nonce(glsr()->id.'-ajax-nonce');
22 22
 		$variables = [
23
-			'action'  => glsr()->prefix . '_action',
24
-			'ajaxurl' => add_query_arg( '_nonce', $ajaxNonce, admin_url( 'admin-ajax.php' )),
23
+			'action'  => glsr()->prefix.'_action',
24
+			'ajaxurl' => add_query_arg('_nonce', $ajaxNonce, admin_url('admin-ajax.php')),
25 25
 			'ajaxnonce' => $ajaxNonce,
26
-			'ajaxpagination' => ['#wpadminbar','.site-navigation-fixed'],
26
+			'ajaxpagination' => ['#wpadminbar', '.site-navigation-fixed'],
27 27
 		];
28 28
 		$this->enqueueAssets();
29 29
 
30
-		wp_localize_script( glsr()->id, 'site_reviews', apply_filters( 'site-reviews/enqueue/localize', $variables ));
30
+		wp_localize_script(glsr()->id, 'site_reviews', apply_filters('site-reviews/enqueue/localize', $variables));
31 31
 	}
32 32
 
33 33
 	/**
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function enqueueAssets()
37 37
 	{
38
-		$currentTheme = sanitize_title( wp_get_theme()->get( 'Name' ));
39
-		$stylesheet = file_exists( glsr()->path.'assets/css/'.$currentTheme.'.css' )
38
+		$currentTheme = sanitize_title(wp_get_theme()->get('Name'));
39
+		$stylesheet = file_exists(glsr()->path.'assets/css/'.$currentTheme.'.css')
40 40
 			? glsr()->url.'assets/css/'.$currentTheme.'.css'
41 41
 			: glsr()->url.'assets/css/'.glsr()->id.'.css';
42
-		if( apply_filters( 'site-reviews/assets/css', true )) {
42
+		if (apply_filters('site-reviews/assets/css', true)) {
43 43
 			wp_enqueue_style(
44 44
 				glsr()->id,
45 45
 				$stylesheet,
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 				glsr()->version
48 48
 			);
49 49
 		}
50
-		if( apply_filters( 'site-reviews/assets/js', true )) {
50
+		if (apply_filters('site-reviews/assets/js', true)) {
51 51
 			wp_enqueue_script(
52 52
 				glsr()->id,
53 53
 				glsr()->url.'assets/js/'.glsr()->id.'.js',
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 				true
57 57
 			);
58 58
 		}
59
-		if( glsr_get_option( 'reviews-form.recaptcha.integration' ) == 'custom' ) {
59
+		if (glsr_get_option('reviews-form.recaptcha.integration') == 'custom') {
60 60
 			$this->enqueueRecaptchaScript();
61 61
 		}
62 62
 	}
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public function enqueueRecaptchaScript()
68 68
 	{
69
-		wp_enqueue_script( glsr()->id.'/google-recaptcha', add_query_arg([
70
-			'hl' => apply_filters( 'site-reviews/recaptcha/language', get_locale() ),
69
+		wp_enqueue_script(glsr()->id.'/google-recaptcha', add_query_arg([
70
+			'hl' => apply_filters('site-reviews/recaptcha/language', get_locale()),
71 71
 			'onload' => 'glsr_render_recaptcha',
72 72
 			'render' => 'explicit',
73
-		], 'https://www.google.com/recaptcha/api.js' ));
74
-		$inlineScript = file_get_contents( glsr()->path.'js/recaptcha.js' );
75
-		wp_add_inline_script( glsr()->id.'/google-recaptcha', $inlineScript, 'before' );
73
+		], 'https://www.google.com/recaptcha/api.js'));
74
+		$inlineScript = file_get_contents(glsr()->path.'js/recaptcha.js');
75
+		wp_add_inline_script(glsr()->id.'/google-recaptcha', $inlineScript, 'before');
76 76
 	}
77 77
 }
Please login to merge, or discard this patch.
plugin/Handlers/RegisterPointers.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -11,29 +11,29 @@  discard block
 block discarded – undo
11 11
 	 * Add pointers to the current screen if they have not yet been dismissed
12 12
 	 * @return void
13 13
 	 */
14
-	public function handle( Command $command )
14
+	public function handle(Command $command)
15 15
 	{
16
-		$pointers = $this->generatePointers( $command->pointers );
17
-		wp_localize_script( Application::ID, 'site_reviews_pointers', [
16
+		$pointers = $this->generatePointers($command->pointers);
17
+		wp_localize_script(Application::ID, 'site_reviews_pointers', [
18 18
 			'pointers' => $pointers,
19 19
 		]);
20
-		if( empty( $pointers ))return;
21
-		wp_enqueue_style( 'wp-pointer' );
22
-		wp_enqueue_script( 'wp-pointer' );
20
+		if (empty($pointers))return;
21
+		wp_enqueue_style('wp-pointer');
22
+		wp_enqueue_script('wp-pointer');
23 23
 	}
24 24
 
25 25
 	/**
26 26
 	 * @return array
27 27
 	 */
28
-	public function generatePointers( array $pointers )
28
+	public function generatePointers(array $pointers)
29 29
 	{
30
-		$dismissedPointers = get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true );
31
-		$dismissedPointers = explode( ',', (string)$dismissedPointers );
30
+		$dismissedPointers = get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true);
31
+		$dismissedPointers = explode(',', (string)$dismissedPointers);
32 32
 		$generatedPointers = [];
33
-		foreach( $pointers as $pointer ) {
34
-			if( $pointer['screen'] != glsr_current_screen()->id )continue;
35
-			if( in_array( $pointer['id'], $dismissedPointers ))continue;
36
-			$generatedPointers[] = $this->generatePointer( $pointer );
33
+		foreach ($pointers as $pointer) {
34
+			if ($pointer['screen'] != glsr_current_screen()->id)continue;
35
+			if (in_array($pointer['id'], $dismissedPointers))continue;
36
+			$generatedPointers[] = $this->generatePointer($pointer);
37 37
 		}
38 38
 		return $generatedPointers;
39 39
 	}
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	/**
42 42
 	 * @return array
43 43
 	 */
44
-	public function generatePointer( array $pointer )
44
+	public function generatePointer(array $pointer)
45 45
 	{
46 46
 		return [
47 47
 			'id' => $pointer['id'],
Please login to merge, or discard this patch.
plugin/Actions.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -25,15 +25,15 @@  discard block
 block discarded – undo
25 25
 	protected $router;
26 26
 	// protected $settings;
27 27
 
28
-	public function __construct( Application $app ) {
28
+	public function __construct(Application $app) {
29 29
 		$this->app = $app;
30
-		$this->admin = $app->make( AdminController::class );
30
+		$this->admin = $app->make(AdminController::class);
31 31
 		// $this->editor = $app->make( EditorController::class );
32
-		$this->listtable = $app->make( ListTableController::class );
33
-		$this->main = $app->make( MainController::class );
34
-		$this->menu = $app->make( MenuController::class );
32
+		$this->listtable = $app->make(ListTableController::class);
33
+		$this->main = $app->make(MainController::class);
34
+		$this->menu = $app->make(MenuController::class);
35 35
 		// $this->public = $app->make( PublicController::class );
36
-		$this->router = $app->make( Router::class );
36
+		$this->router = $app->make(Router::class);
37 37
 		// $this->settings = $app->make( SettingsController::class );
38 38
 	}
39 39
 
@@ -42,17 +42,17 @@  discard block
 block discarded – undo
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 );
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 56
 		// add_action( 'admin_enqueue_scripts',                     [$this->editor, 'customizePostStatusLabels'] );
57 57
 		// add_action( 'site-reviews/create/review',                [$this->editor, 'onCreateReview'], 10, 3 );
58 58
 		// add_action( 'before_delete_post',                        [$this->editor, 'onDeleteReview'] );
@@ -63,27 +63,27 @@  discard block
 block discarded – undo
63 63
 		// add_action( 'post_submitbox_misc_actions',               [$this->editor, 'renderMetaBoxPinned'] );
64 64
 		// add_action( 'admin_action_revert',                       [$this->editor, 'revert'] );
65 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'] );
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'] );
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']);
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 80
 		// add_action( 'admin_init',                                [$this->menu, 'setCustomPermissions'], 999 );
81 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
-		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'] );
82
+		add_action('admin_init', [$this->router, 'routeAdminPostRequest']);
83
+		add_action('wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest']);
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 87
 		// add_action( 'admin_init',                                [$this->settings, 'registerSettings'] );
88 88
 	}
89 89
 }
Please login to merge, or discard this patch.
plugin/Widgets/SiteReviewsWidget.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -12,70 +12,70 @@  discard block
 block discarded – undo
12 12
 	 * @param array $instance
13 13
 	 * @return void
14 14
 	 */
15
-	public function form( $instance )
15
+	public function form($instance)
16 16
 	{
17
-		$this->widgetArgs = glsr( SiteReviewsShortcode::class )->normalize( $instance );
18
-		$terms = glsr( Database::class )->getTerms();
19
-		$this->renderField( 'text', [
17
+		$this->widgetArgs = glsr(SiteReviewsShortcode::class)->normalize($instance);
18
+		$terms = glsr(Database::class)->getTerms();
19
+		$this->renderField('text', [
20 20
 			'class' => 'widefat',
21
-			'label' => __( 'Title', 'site-reviews' ),
21
+			'label' => __('Title', 'site-reviews'),
22 22
 			'name' => 'title',
23 23
 		]);
24
-		$this->renderField( 'number', [
24
+		$this->renderField('number', [
25 25
 			'class' => 'small-text',
26 26
 			'default' => 5,
27
-			'label' => __( 'How many reviews would you like to display?', 'site-reviews' ),
27
+			'label' => __('How many reviews would you like to display?', 'site-reviews'),
28 28
 			'max' => 100,
29 29
 			'name' => 'count',
30 30
 		]);
31
-		$this->renderField( 'select', [
32
-			'label' => __( 'What is the minimum rating to display?', 'site-reviews' ),
31
+		$this->renderField('select', [
32
+			'label' => __('What is the minimum rating to display?', 'site-reviews'),
33 33
 			'name' => 'rating',
34 34
 			'options' => [
35
-				'5' => sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 ),
36
-				'4' => sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 ),
37
-				'3' => sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 ),
38
-				'2' => sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 ),
39
-				'1' => sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 ),
35
+				'5' => sprintf(_n('%s star', '%s stars', 5, 'site-reviews'), 5),
36
+				'4' => sprintf(_n('%s star', '%s stars', 4, 'site-reviews'), 4),
37
+				'3' => sprintf(_n('%s star', '%s stars', 3, 'site-reviews'), 3),
38
+				'2' => sprintf(_n('%s star', '%s stars', 2, 'site-reviews'), 2),
39
+				'1' => sprintf(_n('%s star', '%s stars', 1, 'site-reviews'), 1),
40 40
 			],
41 41
 		]);
42
-		if( count( glsr()->reviewTypes ) > 1 ) {
43
-			$this->renderField( 'select', [
42
+		if (count(glsr()->reviewTypes) > 1) {
43
+			$this->renderField('select', [
44 44
 				'class' => 'widefat',
45
-				'label' => __( 'Which reviews would you like to display?', 'site-reviews' ),
45
+				'label' => __('Which reviews would you like to display?', 'site-reviews'),
46 46
 				'name' => 'display',
47
-				'options' => ['' => __( 'All Reviews', 'site-reviews' )] + glsr()->reviewTypes,
47
+				'options' => ['' => __('All Reviews', 'site-reviews')] + glsr()->reviewTypes,
48 48
 			]);
49 49
 		}
50
-		if( !empty( $terms )) {
51
-			$this->renderField( 'select', [
50
+		if (!empty($terms)) {
51
+			$this->renderField('select', [
52 52
 				'class' => 'widefat',
53
-				'label' => __( 'Limit reviews to this category', 'site-reviews' ),
53
+				'label' => __('Limit reviews to this category', 'site-reviews'),
54 54
 				'name' => 'category',
55
-				'options' => ['' => __( 'All Categories', 'site-reviews' )] + $terms,
55
+				'options' => ['' => __('All Categories', 'site-reviews')] + $terms,
56 56
 			]);
57 57
 		}
58
-		$this->renderField( 'text', [
58
+		$this->renderField('text', [
59 59
 			'class' => 'widefat',
60 60
 			'default' => '',
61
-			'description' => sprintf( __( "Separate multiple ID's with a comma. You may also enter %s to automatically represent the current page/post ID.", 'site-reviews' ), '<code>post_id</code>' ),
62
-			'label' => __( 'Limit reviews to those assigned to this page/post ID', 'site-reviews' ),
61
+			'description' => sprintf(__("Separate multiple ID's with a comma. You may also enter %s to automatically represent the current page/post ID.", 'site-reviews'), '<code>post_id</code>'),
62
+			'label' => __('Limit reviews to those assigned to this page/post ID', 'site-reviews'),
63 63
 			'name' => 'assigned_to',
64 64
 		]);
65
-		$this->renderField( 'text', [
65
+		$this->renderField('text', [
66 66
 			'class' => 'widefat',
67
-			'label' => __( 'Enter any custom CSS classes here', 'site-reviews' ),
67
+			'label' => __('Enter any custom CSS classes here', 'site-reviews'),
68 68
 			'name' => 'class',
69 69
 		]);
70
-		$this->renderField( 'checkbox', [
70
+		$this->renderField('checkbox', [
71 71
 			'name' => 'hide',
72 72
 			'options' => [
73
-				'author' => __( 'Hide the review author?', 'site-reviews' ),
74
-				'date' => __( 'Hide the review date?', 'site-reviews' ),
75
-				'excerpt' => __( 'Hide the review excerpt?', 'site-reviews' ),
76
-				'rating' => __( 'Hide the review rating?', 'site-reviews' ),
77
-				'response' => __( 'Hide the review response?', 'site-reviews' ),
78
-				'title' => __( 'Hide the review title?', 'site-reviews' ),
73
+				'author' => __('Hide the review author?', 'site-reviews'),
74
+				'date' => __('Hide the review date?', 'site-reviews'),
75
+				'excerpt' => __('Hide the review excerpt?', 'site-reviews'),
76
+				'rating' => __('Hide the review rating?', 'site-reviews'),
77
+				'response' => __('Hide the review response?', 'site-reviews'),
78
+				'title' => __('Hide the review title?', 'site-reviews'),
79 79
 			],
80 80
 		]);
81 81
 	}
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
 	 * @param array $oldInstance
86 86
 	 * @return array
87 87
 	 */
88
-	public function update( $newInstance, $oldInstance )
88
+	public function update($newInstance, $oldInstance)
89 89
 	{
90
-		if( !is_numeric( $newInstance['count'] )) {
90
+		if (!is_numeric($newInstance['count'])) {
91 91
 			$newInstance['count'] = 10;
92 92
 		}
93
-		$newInstance['count'] = min( 50, max( 0, intval( $newInstance['count'] )));
94
-		return parent::update( $newInstance, $oldInstance );
93
+		$newInstance['count'] = min(50, max(0, intval($newInstance['count'])));
94
+		return parent::update($newInstance, $oldInstance);
95 95
 	}
96 96
 
97 97
 	/**
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 	 * @param array $instance
100 100
 	 * @return void
101 101
 	 */
102
-	public function widget( $args, $instance )
102
+	public function widget($args, $instance)
103 103
 	{
104
-		echo glsr( SiteReviewsShortcode::class )->build( $instance, $args );
104
+		echo glsr(SiteReviewsShortcode::class)->build($instance, $args);
105 105
 	}
106 106
 }
Please login to merge, or discard this patch.
plugin/Widgets/SiteReviewsSummaryWidget.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -12,51 +12,51 @@  discard block
 block discarded – undo
12 12
 	 * @param array $instance
13 13
 	 * @return void
14 14
 	 */
15
-	public function form( $instance )
15
+	public function form($instance)
16 16
 	{
17
-		$this->widgetArgs = glsr( SiteReviewsSummaryShortcode::class )->normalize( $instance );
18
-		$terms = glsr( Database::class )->getTerms();
19
-		$this->renderField( 'text', [
17
+		$this->widgetArgs = glsr(SiteReviewsSummaryShortcode::class)->normalize($instance);
18
+		$terms = glsr(Database::class)->getTerms();
19
+		$this->renderField('text', [
20 20
 			'class' => 'widefat',
21
-			'label' => __( 'Title', 'site-reviews' ),
21
+			'label' => __('Title', 'site-reviews'),
22 22
 			'name' => 'title',
23 23
 		]);
24
-		if( count( glsr()->reviewTypes ) > 1 ) {
25
-			$this->renderField( 'select', [
24
+		if (count(glsr()->reviewTypes) > 1) {
25
+			$this->renderField('select', [
26 26
 				'class' => 'widefat',
27
-				'label' => __( 'Which type of review would you like to use?', 'site-reviews' ),
27
+				'label' => __('Which type of review would you like to use?', 'site-reviews'),
28 28
 				'name' => 'type',
29
-				'options' => ['' => __( 'All review types', 'site-reviews' )] + glsr()->reviewTypes,
29
+				'options' => ['' => __('All review types', 'site-reviews')] + glsr()->reviewTypes,
30 30
 			]);
31 31
 		}
32
-		if( !empty( $terms )) {
33
-			$this->renderField( 'select', [
32
+		if (!empty($terms)) {
33
+			$this->renderField('select', [
34 34
 				'class' => 'widefat',
35
-				'label' => __( 'Limit summary to this category', 'site-reviews' ),
35
+				'label' => __('Limit summary to this category', 'site-reviews'),
36 36
 				'name' => 'category',
37
-				'options' => ['' => __( 'All Categories', 'site-reviews' )] + $terms,
37
+				'options' => ['' => __('All Categories', 'site-reviews')] + $terms,
38 38
 			]);
39 39
 		}
40
-		$this->renderField( 'text', [
40
+		$this->renderField('text', [
41 41
 			'class' => 'widefat',
42 42
 			'default' => '',
43
-			'description' => sprintf( __( "Separate multiple ID's with a comma. You may also enter %s to automatically represent the current page/post ID.", 'site-reviews' ), '<code>post_id</code>' ),
44
-			'label' => __( 'Limit summary to reviews assigned to a page/post ID', 'site-reviews' ),
43
+			'description' => sprintf(__("Separate multiple ID's with a comma. You may also enter %s to automatically represent the current page/post ID.", 'site-reviews'), '<code>post_id</code>'),
44
+			'label' => __('Limit summary to reviews assigned to a page/post ID', 'site-reviews'),
45 45
 			'name' => 'assigned_to',
46 46
 		]);
47
-		$this->renderField( 'text', [
47
+		$this->renderField('text', [
48 48
 			'class' => 'widefat',
49
-			'label' => __( 'Enter any custom CSS classes here', 'site-reviews' ),
49
+			'label' => __('Enter any custom CSS classes here', 'site-reviews'),
50 50
 			'name' => 'class',
51 51
 		]);
52
-		$this->renderField( 'checkbox', [
52
+		$this->renderField('checkbox', [
53 53
 			'name' => 'hide',
54 54
 			'options' => [
55
-				'bars' => __( 'Hide the percentage bars?', 'site-reviews' ),
56
-				'rating' => __( 'Hide the rating?', 'site-reviews' ),
57
-				'stars' => __( 'Hide the stars?', 'site-reviews' ),
58
-				'summary' => __( 'Hide the summary text?', 'site-reviews' ),
59
-				'if_empty' => __( 'Hide the summary if no reviews are found?', 'site-reviews' ),
55
+				'bars' => __('Hide the percentage bars?', 'site-reviews'),
56
+				'rating' => __('Hide the rating?', 'site-reviews'),
57
+				'stars' => __('Hide the stars?', 'site-reviews'),
58
+				'summary' => __('Hide the summary text?', 'site-reviews'),
59
+				'if_empty' => __('Hide the summary if no reviews are found?', 'site-reviews'),
60 60
 			],
61 61
 		]);
62 62
 	}
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 	 * @param array $instance
67 67
 	 * @return void
68 68
 	 */
69
-	public function widget( $args, $instance )
69
+	public function widget($args, $instance)
70 70
 	{
71
-		echo glsr( SiteReviewsSummaryShortcode::class )->build( $instance, $args );
71
+		echo glsr(SiteReviewsSummaryShortcode::class)->build($instance, $args);
72 72
 	}
73 73
 }
Please login to merge, or discard this patch.
plugin/Widgets/Widget.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -12,30 +12,30 @@  discard block
 block discarded – undo
12 12
 	 */
13 13
 	protected $widgetArgs;
14 14
 
15
-	public function __construct( $idBase, $name, $values )
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
-		parent::__construct( $idBase, $name, $widgetOptions, $controlOptions );
27
+		parent::__construct($idBase, $name, $widgetOptions, $controlOptions);
28 28
 	}
29 29
 
30 30
 	/**
31 31
 	 * @param string $tag
32 32
 	 * @return void
33 33
 	 */
34
-	protected function renderField( $tag, array $args = [] )
34
+	protected function renderField($tag, array $args = [])
35 35
 	{
36
-		$args = $this->normalizeFieldAttributes( $tag, $args );
37
-		$field = glsr( Builder::class )->{$tag}( $args['name'], $args );
38
-		echo glsr( Builder::class )->div( $field, [
36
+		$args = $this->normalizeFieldAttributes($tag, $args);
37
+		$field = glsr(Builder::class)->{$tag}($args['name'], $args);
38
+		echo glsr(Builder::class)->div($field, [
39 39
 			'class' => 'glsr-field',
40 40
 		]);
41 41
 	}
@@ -44,16 +44,16 @@  discard block
 block discarded – undo
44 44
 	 * @param string $tag
45 45
 	 * @return array
46 46
 	 */
47
-	protected function normalizeFieldAttributes( $tag, array $args )
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'] )) {
53
-			$args['checked'] = in_array( $args['value'], (array)$this->widgetArgs[$args['name']] );
52
+		if (empty($this->widgetArgs['options']) && in_array($tag, ['checkbox', 'radio'])) {
53
+			$args['checked'] = in_array($args['value'], (array)$this->widgetArgs[$args['name']]);
54 54
 		}
55
-		$args['id'] = $this->get_field_id( $args['name'] );
56
-		$args['name'] = $this->get_field_name( $args['name'] );
55
+		$args['id'] = $this->get_field_id($args['name']);
56
+		$args['name'] = $this->get_field_name($args['name']);
57 57
 		return $args;
58 58
 	}
59 59
 }
Please login to merge, or discard this patch.
plugin/Widgets/SiteReviewsFormWidget.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -12,45 +12,45 @@  discard block
 block discarded – undo
12 12
 	 * @param array $instance
13 13
 	 * @return void
14 14
 	 */
15
-	public function form( $instance )
15
+	public function form($instance)
16 16
 	{
17
-		$this->widgetArgs = glsr( SiteReviewsFormShortcode::class )->normalize( $instance );
18
-		$terms = glsr( Database::class )->getTerms();
19
-		$this->renderField( 'text', [
17
+		$this->widgetArgs = glsr(SiteReviewsFormShortcode::class)->normalize($instance);
18
+		$terms = glsr(Database::class)->getTerms();
19
+		$this->renderField('text', [
20 20
 			'class' => 'widefat',
21
-			'label' => __( 'Title', 'site-reviews' ),
21
+			'label' => __('Title', 'site-reviews'),
22 22
 			'name' => 'title',
23 23
 		]);
24
-		$this->renderField( 'textarea', [
24
+		$this->renderField('textarea', [
25 25
 			'class' => 'widefat',
26
-			'label' => __( 'Description', 'site-reviews' ),
26
+			'label' => __('Description', 'site-reviews'),
27 27
 			'name' => 'description',
28 28
 		]);
29
-		$this->renderField( 'select', [
29
+		$this->renderField('select', [
30 30
 			'class' => 'widefat',
31
-			'label' => __( 'Automatically assign a category', 'site-reviews' ),
31
+			'label' => __('Automatically assign a category', 'site-reviews'),
32 32
 			'name' => 'category',
33
-			'options' => ['' => __( 'Do not assign a category', 'site-reviews' )] + $terms,
33
+			'options' => ['' => __('Do not assign a category', 'site-reviews')] + $terms,
34 34
 		]);
35
-		$this->renderField( 'text', [
35
+		$this->renderField('text', [
36 36
 			'class' => 'widefat',
37 37
 			'default' => '',
38
-			'description' => sprintf( __( 'You may also enter %s to assign to the current post.', 'site-reviews' ), '<code>post_id</code>' ),
39
-			'label' => __( 'Assign reviews to a custom page/post ID', 'site-reviews' ),
38
+			'description' => sprintf(__('You may also enter %s to assign to the current post.', 'site-reviews'), '<code>post_id</code>'),
39
+			'label' => __('Assign reviews to a custom page/post ID', 'site-reviews'),
40 40
 			'name' => 'assign_to',
41 41
 		]);
42
-		$this->renderField( 'text', [
42
+		$this->renderField('text', [
43 43
 			'class' => 'widefat',
44
-			'label' => __( 'Enter any custom CSS classes here', 'site-reviews' ),
44
+			'label' => __('Enter any custom CSS classes here', 'site-reviews'),
45 45
 			'name' => 'class',
46 46
 		]);
47
-		$this->renderField( 'checkbox', [
47
+		$this->renderField('checkbox', [
48 48
 			'name' => 'hide',
49 49
 			'options' => [
50
-				'email' => __( 'Hide the email field', 'site-reviews' ),
51
-				'name'  => __( 'Hide the name field', 'site-reviews' ),
52
-				'terms' => __( 'Hide the terms field', 'site-reviews' ),
53
-				'title' => __( 'Hide the title field', 'site-reviews' ),
50
+				'email' => __('Hide the email field', 'site-reviews'),
51
+				'name'  => __('Hide the name field', 'site-reviews'),
52
+				'terms' => __('Hide the terms field', 'site-reviews'),
53
+				'title' => __('Hide the title field', 'site-reviews'),
54 54
 			],
55 55
 		]);
56 56
 	}
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 	 * @param array $instance
61 61
 	 * @return void
62 62
 	 */
63
-	public function widget( $args, $instance )
63
+	public function widget($args, $instance)
64 64
 	{
65
-		echo glsr( SiteReviewsFormShortcode::class )->build( $instance, $args );
65
+		echo glsr(SiteReviewsFormShortcode::class)->build($instance, $args);
66 66
 	}
67 67
 }
Please login to merge, or discard this patch.
plugin/Database.php 1 patch
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 	 * @param SubmitReview $command
19 19
 	 * @return int|bool
20 20
 	 */
21
-	public function createReview( array $values, $command )
21
+	public function createReview(array $values, $command)
22 22
 	{
23
-		$review = glsr( CreateReviewDefaults::class )->merge( $values );
23
+		$review = glsr(CreateReviewDefaults::class)->merge($values);
24 24
 		$post = [
25 25
 			'comment_status' => 'closed',
26 26
 			'ping_status' => 'closed',
@@ -28,22 +28,22 @@  discard block
 block discarded – undo
28 28
 			'post_date' => $review['date'],
29 29
 			'post_name' => $review['review_type'].'-'.$review['review_id'],
30 30
 			'post_status' => 'publish',
31
-			'post_title' => wp_strip_all_tags( $review['title'] ),
31
+			'post_title' => wp_strip_all_tags($review['title']),
32 32
 			'post_type' => Application::POST_TYPE,
33 33
 		];
34
-		if( $review['review_type'] == 'local' && (
35
-			$this->options( 'settings.general.require.approval' ) == 'yes' || $command->blacklisted )) {
34
+		if ($review['review_type'] == 'local' && (
35
+			$this->options('settings.general.require.approval') == 'yes' || $command->blacklisted )) {
36 36
 			$post['post_status'] = 'pending';
37 37
 		}
38
-		$postId = wp_insert_post( $post, true );
39
-		if( is_wp_error( $postId )) {
40
-			glsr_log()->error( '['.__METHOD__.'] '.$postId->get_error_message() );
38
+		$postId = wp_insert_post($post, true);
39
+		if (is_wp_error($postId)) {
40
+			glsr_log()->error('['.__METHOD__.'] '.$postId->get_error_message());
41 41
 			return false;
42 42
 		}
43
-		foreach( $review as $field => $value ) {
44
-			update_post_meta( $postId, $field, $value );
43
+		foreach ($review as $field => $value) {
44
+			update_post_meta($postId, $field, $value);
45 45
 		}
46
-		do_action( 'site-reviews/create/review', $post, $review, $postId );
46
+		do_action('site-reviews/create/review', $post, $review, $postId);
47 47
 		return $postId;
48 48
 	}
49 49
 
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
 	 * @param string $metaReviewId
53 53
 	 * @return void
54 54
 	 */
55
-	public function deleteReview( $metaReviewId )
55
+	public function deleteReview($metaReviewId)
56 56
 	{
57
-		if( $postId = $this->getReviewPostId( $metaReviewId )) {
58
-			wp_delete_post( $postId, true );
57
+		if ($postId = $this->getReviewPostId($metaReviewId)) {
58
+			wp_delete_post($postId, true);
59 59
 		}
60 60
 	}
61 61
 
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 	 * @param \WP_Post|null $post
64 64
 	 * @return null|object
65 65
 	 */
66
-	public function getReview( $post )
66
+	public function getReview($post)
67 67
 	{
68
-		if( !( $post instanceof WP_Post ) || $post->post_type != Application::POST_TYPE )return;
69
-		$review = $this->getReviewMeta( $post->ID );
70
-		$modified = $this->isReviewModified( $review );
68
+		if (!($post instanceof WP_Post) || $post->post_type != Application::POST_TYPE)return;
69
+		$review = $this->getReviewMeta($post->ID);
70
+		$modified = $this->isReviewModified($review);
71 71
 		$review->content = $post->post_content;
72 72
 		$review->data = $post->post_date;
73 73
 		$review->ID = $post->ID;
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 		$review->status = $post->post_status;
76 76
 		$review->title = $post->post_title;
77 77
 		$review->user_id = $post->post_author;
78
-		return apply_filters( 'site-reviews/get/review', $review, $post );
78
+		return apply_filters('site-reviews/get/review', $review, $post);
79 79
 	}
80 80
 
81 81
 	/**
@@ -83,17 +83,17 @@  discard block
 block discarded – undo
83 83
 	 * @param string $metaValue
84 84
 	 * @return array|int
85 85
 	 */
86
-	public function getReviewCount( $metaKey = '', $metaValue = '' )
86
+	public function getReviewCount($metaKey = '', $metaValue = '')
87 87
 	{
88
-		$metaKey = $this->normalizeMetaKey( $metaKey );
89
-		if( !$metaKey ) {
90
-			return (array) wp_count_posts( Application::POST_TYPE );
88
+		$metaKey = $this->normalizeMetaKey($metaKey);
89
+		if (!$metaKey) {
90
+			return (array)wp_count_posts(Application::POST_TYPE);
91 91
 		}
92
-		$counts = glsr( Cache::class )->getReviewCountsFor( $metaKey );
93
-		if( !$metaValue ) {
92
+		$counts = glsr(Cache::class)->getReviewCountsFor($metaKey);
93
+		if (!$metaValue) {
94 94
 			return $counts;
95 95
 		}
96
-		return isset( $counts[$metaValue] )
96
+		return isset($counts[$metaValue])
97 97
 			? $counts[$metaValue]
98 98
 			: 0;
99 99
 	}
@@ -102,48 +102,48 @@  discard block
 block discarded – undo
102 102
 	 * @param string $metaReviewType
103 103
 	 * @return array
104 104
 	 */
105
-	public function getReviewIdsByType( $metaReviewType )
105
+	public function getReviewIdsByType($metaReviewType)
106 106
 	{
107
-		return glsr( SqlQueries::class )->getReviewIdsByType( $metaReviewType );
107
+		return glsr(SqlQueries::class)->getReviewIdsByType($metaReviewType);
108 108
 	}
109 109
 
110 110
 	/**
111 111
 	 * @param int $postId
112 112
 	 * @return object
113 113
 	 */
114
-	public function getReviewMeta( $postId )
114
+	public function getReviewMeta($postId)
115 115
 	{
116
-		$meta = get_post_type( $postId ) == Application::POST_TYPE
117
-			? array_map( 'array_shift', (array) get_post_meta( $postId ))
116
+		$meta = get_post_type($postId) == Application::POST_TYPE
117
+			? array_map('array_shift', (array)get_post_meta($postId))
118 118
 			: [];
119
-		return (object) $this->normalizeMeta( array_filter( $meta, 'strlen' ));
119
+		return (object)$this->normalizeMeta(array_filter($meta, 'strlen'));
120 120
 	}
121 121
 
122 122
 	/**
123 123
 	 * @param string $metaReviewId
124 124
 	 * @return int
125 125
 	 */
126
-	public function getReviewPostId( $metaReviewId )
126
+	public function getReviewPostId($metaReviewId)
127 127
 	{
128
-		return glsr( SqlQueries::class )->getReviewPostId( $metaReviewId );
128
+		return glsr(SqlQueries::class)->getReviewPostId($metaReviewId);
129 129
 	}
130 130
 
131 131
 	/**
132 132
 	 * @return object
133 133
 	 */
134
-	public function getReviews( array $args = [] )
134
+	public function getReviews(array $args = [])
135 135
 	{
136
-		$args = glsr( GetReviewsDefaults::class )->merge( $args, true );
137
-		$metaQuery = glsr( QueryBuilder::class )->buildQuery(
136
+		$args = glsr(GetReviewsDefaults::class)->merge($args, true);
137
+		$metaQuery = glsr(QueryBuilder::class)->buildQuery(
138 138
 			['assigned_to', 'type', 'rating'],
139 139
 			$args
140 140
 		);
141
-		$taxQuery = glsr( QueryBuilder::class )->buildQuery(
141
+		$taxQuery = glsr(QueryBuilder::class)->buildQuery(
142 142
 			['category'],
143
-			['category' => $this->normalizeTerms( $args['category'] )]
143
+			['category' => $this->normalizeTerms($args['category'])]
144 144
 		);
145
-		$paged = glsr( QueryBuilder::class )->getPaged(
146
-			wp_validate_boolean( $args['pagination'] )
145
+		$paged = glsr(QueryBuilder::class)->getPaged(
146
+			wp_validate_boolean($args['pagination'])
147 147
 		);
148 148
 		$reviews = new WP_Query([
149 149
 			'meta_key' => 'pinned',
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
 			'posts_per_page' => $args['count'] ? $args['count'] : -1,
160 160
 			'tax_query' => $taxQuery,
161 161
 		]);
162
-		return (object) [
163
-			'results' => array_map( [$this, 'getReview'], $reviews->posts ),
162
+		return (object)[
163
+			'results' => array_map([$this, 'getReview'], $reviews->posts),
164 164
 			'max_num_pages' => $reviews->max_num_pages,
165 165
 		];
166 166
 	}
@@ -170,30 +170,30 @@  discard block
 block discarded – undo
170 170
 	 * @param string $status
171 171
 	 * @return array
172 172
 	 */
173
-	public function getReviewsMeta( $keys, $status = 'publish' )
173
+	public function getReviewsMeta($keys, $status = 'publish')
174 174
 	{
175
-		$keys = array_map( [$this, 'normalizeMetaKey'], (array)$keys );
176
-		if( $status == 'all' || empty( $status )) {
177
-			$status = get_post_stati( ['exclude_from_search' => false] );
175
+		$keys = array_map([$this, 'normalizeMetaKey'], (array)$keys);
176
+		if ($status == 'all' || empty($status)) {
177
+			$status = get_post_stati(['exclude_from_search' => false]);
178 178
 		}
179
-		return glsr( SqlQueries::class )->getReviewsMeta( $keys, $status );
179
+		return glsr(SqlQueries::class)->getReviewsMeta($keys, $status);
180 180
 	}
181 181
 
182 182
 	/**
183 183
 	 * @param string $taxonomy
184 184
 	 * @return array
185 185
 	 */
186
-	public function getTerms( array $args = [] )
186
+	public function getTerms(array $args = [])
187 187
 	{
188
-		$args = wp_parse_args( $args, [
188
+		$args = wp_parse_args($args, [
189 189
 			'fields' => 'id=>name',
190 190
 			'hide_empty' => false,
191 191
 			'taxonomy' => Application::TAXONOMY,
192 192
 		]);
193
-		unset( $args['count'] ); //we don't want a term count
194
-		$terms = get_terms( $args );
195
-		if( is_wp_error( $terms )) {
196
-			glsr_log()->error( '['.__METHOD__.'] '.$terms->get_error_message() );
193
+		unset($args['count']); //we don't want a term count
194
+		$terms = get_terms($args);
195
+		if (is_wp_error($terms)) {
196
+			glsr_log()->error('['.__METHOD__.'] '.$terms->get_error_message());
197 197
 			return [];
198 198
 		}
199 199
 		return $terms;
@@ -202,28 +202,28 @@  discard block
 block discarded – undo
202 202
 	/**
203 203
 	 * @return array
204 204
 	 */
205
-	public function normalizeMeta( array $meta )
205
+	public function normalizeMeta(array $meta)
206 206
 	{
207
-		if( empty( $meta )) {
207
+		if (empty($meta)) {
208 208
 			return [];
209 209
 		}
210
-		$defaults = wp_parse_args( $meta, [
211
-			'author' => __( 'Anonymous', 'site-reviews' ),
210
+		$defaults = wp_parse_args($meta, [
211
+			'author' => __('Anonymous', 'site-reviews'),
212 212
 			'date' => '',
213 213
 			'review_id' => '',
214 214
 			'review_type' => '',
215 215
 		]);
216
-		return glsr( CreateReviewDefaults::class )->merge( $defaults, true );
216
+		return glsr(CreateReviewDefaults::class)->merge($defaults, true);
217 217
 	}
218 218
 
219 219
 	/**
220 220
 	 * @param string $metaKey
221 221
 	 * @return string
222 222
 	 */
223
-	public function normalizeMetaKey( $metaKey )
223
+	public function normalizeMetaKey($metaKey)
224 224
 	{
225
-		$metaKey = strtolower( $metaKey );
226
-		if( in_array( $metaKey, ['id', 'type'] )) {
225
+		$metaKey = strtolower($metaKey);
226
+		if (in_array($metaKey, ['id', 'type'])) {
227 227
 			$metaKey = 'review_'.$metaKey;
228 228
 		}
229 229
 		return $metaKey;
@@ -233,14 +233,14 @@  discard block
 block discarded – undo
233 233
 	 * @param string $termIds string of comma-separated term IDs
234 234
 	 * @return array
235 235
 	 */
236
-	public function normalizeTerms( $termIds )
236
+	public function normalizeTerms($termIds)
237 237
 	{
238 238
 		$terms = [];
239
-		$termIds = array_map( 'trim', explode( ',', $termIds ));
240
-		foreach( $termIds as $termId ) {
241
-			$term = term_exists( $termId, Application::TAXONOMY );
242
-			if( !isset( $term['term_id'] ))continue;
243
-			$terms[] = intval( $term['term_id'] );
239
+		$termIds = array_map('trim', explode(',', $termIds));
240
+		foreach ($termIds as $termId) {
241
+			$term = term_exists($termId, Application::TAXONOMY);
242
+			if (!isset($term['term_id']))continue;
243
+			$terms[] = intval($term['term_id']);
244 244
 		}
245 245
 		return $terms;
246 246
 	}
@@ -249,16 +249,16 @@  discard block
 block discarded – undo
249 249
 	 * @param string $postId
250 250
 	 * @return void|int
251 251
 	 */
252
-	public function revertReview( $postId )
252
+	public function revertReview($postId)
253 253
 	{
254
-		$post = get_post( $postId );
255
-		if( !( $post instanceof WP_Post ) || $post->post_type != Application::POST_TYPE )return;
256
-		delete_post_meta( $post->ID, '_edit_last' );
254
+		$post = get_post($postId);
255
+		if (!($post instanceof WP_Post) || $post->post_type != Application::POST_TYPE)return;
256
+		delete_post_meta($post->ID, '_edit_last');
257 257
 		return wp_update_post([
258 258
 			'ID' => $post->ID,
259
-			'post_content' => get_post_meta( $post->ID, 'content', true ),
260
-			'post_date' => get_post_meta( $post->ID, 'date', true ),
261
-			'post_title' => get_post_meta( $post->ID, 'title', true ),
259
+			'post_content' => get_post_meta($post->ID, 'content', true),
260
+			'post_date' => get_post_meta($post->ID, 'date', true),
261
+			'post_title' => get_post_meta($post->ID, 'title', true),
262 262
 		]);
263 263
 	}
264 264
 
@@ -266,13 +266,13 @@  discard block
 block discarded – undo
266 266
 	 * @param string $searchTerm
267 267
 	 * @return void|string
268 268
 	 */
269
-	public function searchPosts( $searchTerm )
269
+	public function searchPosts($searchTerm)
270 270
 	{
271 271
 		$args = [
272 272
 			'post_status' => 'publish',
273 273
 			'post_type' => 'any',
274 274
 		];
275
-		if( is_numeric( $searchTerm )) {
275
+		if (is_numeric($searchTerm)) {
276 276
 			$args['post__in'] = [$searchTerm];
277 277
 		}
278 278
 		else {
@@ -280,19 +280,19 @@  discard block
 block discarded – undo
280 280
 			$args['posts_per_page'] = 10;
281 281
 			$args['s'] = $searchTerm;
282 282
 		}
283
-		$queryBuilder = glsr( QueryBuilder::class );
284
-		add_filter( 'posts_search', [$queryBuilder, 'filterSearchByTitle'], 500, 2 );
285
-		$search = new WP_Query( $args );
286
-		remove_filter( 'posts_search', [$queryBuilder, 'filterSearchByTitle'], 500 );
287
-		if( !$search->have_posts() )return;
283
+		$queryBuilder = glsr(QueryBuilder::class);
284
+		add_filter('posts_search', [$queryBuilder, 'filterSearchByTitle'], 500, 2);
285
+		$search = new WP_Query($args);
286
+		remove_filter('posts_search', [$queryBuilder, 'filterSearchByTitle'], 500);
287
+		if (!$search->have_posts())return;
288 288
 		$results = '';
289
-		while( $search->have_posts() ) {
289
+		while ($search->have_posts()) {
290 290
 			$search->the_post();
291 291
 			ob_start();
292
-			glsr()->render( 'edit/search-result', [
292
+			glsr()->render('edit/search-result', [
293 293
 				'ID' => get_the_ID(),
294
-				'permalink' => esc_url( (string) get_permalink() ),
295
-				'title' => esc_attr( get_the_title() ),
294
+				'permalink' => esc_url((string)get_permalink()),
295
+				'title' => esc_attr(get_the_title()),
296 296
 			]);
297 297
 			$results .= ob_get_clean();
298 298
 		}
@@ -305,13 +305,13 @@  discard block
 block discarded – undo
305 305
 	 * @param string $termIds
306 306
 	 * @return void
307 307
 	 */
308
-	public function setReviewMeta( $postId, $termIds )
308
+	public function setReviewMeta($postId, $termIds)
309 309
 	{
310
-		$terms = $this->normalizeTerms( $termIds );
311
-		if( empty( $terms ))return;
312
-		$result = wp_set_object_terms( $postId, $terms, Application::TAXONOMY );
313
-		if( is_wp_error( $result )) {
314
-			glsr_log()->error( '['.__METHOD__.'] '.$result->get_error_message() );
310
+		$terms = $this->normalizeTerms($termIds);
311
+		if (empty($terms))return;
312
+		$result = wp_set_object_terms($postId, $terms, Application::TAXONOMY);
313
+		if (is_wp_error($result)) {
314
+			glsr_log()->error('['.__METHOD__.'] '.$result->get_error_message());
315 315
 		}
316 316
 	}
317 317
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 	 * @param object $review
320 320
 	 * @return bool
321 321
 	 */
322
-	protected function isReviewModified( WP_Post $post, $review )
322
+	protected function isReviewModified(WP_Post $post, $review)
323 323
 	{
324 324
 		return $post->post_date != $review->date
325 325
 			|| $post->post_content != $review->content
Please login to merge, or discard this patch.