Completed
Push — develop ( 258a62...d62d7a )
by David
02:29
created
src/admin/elements/class-wordlift-admin-country-select-element.php 2 patches
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -18,37 +18,37 @@  discard block
 block discarded – undo
18 18
  */
19 19
 class Wordlift_Admin_Country_Select_Element extends Wordlift_Admin_Select_Element {
20 20
 
21
-	/**
22
-	 * Adds a filter that will add data `country-codes` attrbiute to the country select
23
-	 * to allow front-end validation.
24
-	 *
25
-	 * @since 3.18.0
26
-	 */
27
-	public function __construct() {
28
-		// Adds the country codes as data attribute to allow front-end validation.
29
-		add_filter( 'wl_admin_select_element_data_attributes', array( $this, 'add_country_codes_data' ), 10, 1 );
30
-	}
21
+    /**
22
+     * Adds a filter that will add data `country-codes` attrbiute to the country select
23
+     * to allow front-end validation.
24
+     *
25
+     * @since 3.18.0
26
+     */
27
+    public function __construct() {
28
+        // Adds the country codes as data attribute to allow front-end validation.
29
+        add_filter( 'wl_admin_select_element_data_attributes', array( $this, 'add_country_codes_data' ), 10, 1 );
30
+    }
31 31
 
32
-	/**
33
-	 * @inheritdoc
34
-	 */
35
-	public function render_options( $params ) {
36
-		// Print all the supported countries, preselecting the one configured
37
-		// in WP (or United Kingdom if not supported). We now use the `Wordlift_Countries`
38
-		// class which provides the list of countries supported by WordLift.
39
-		//
40
-		// https://github.com/insideout10/wordlift-plugin/issues/713
32
+    /**
33
+     * @inheritdoc
34
+     */
35
+    public function render_options( $params ) {
36
+        // Print all the supported countries, preselecting the one configured
37
+        // in WP (or United Kingdom if not supported). We now use the `Wordlift_Countries`
38
+        // class which provides the list of countries supported by WordLift.
39
+        //
40
+        // https://github.com/insideout10/wordlift-plugin/issues/713
41 41
 
42
-		$lang = ( isset( $params['lang'] ) ) ? $params['lang'] : false;
42
+        $lang = ( isset( $params['lang'] ) ) ? $params['lang'] : false;
43 43
 
44
-		// Get WordLift's supported countries.
45
-		$countries = Wordlift_Countries::get_countries( $lang );
44
+        // Get WordLift's supported countries.
45
+        $countries = Wordlift_Countries::get_countries( $lang );
46 46
 
47
-		// If we support WP's configured language, then use that, otherwise use English by default.
48
-		$language = isset( $countries[ $params['value'] ] ) ? $params['value'] : 'uk';
47
+        // If we support WP's configured language, then use that, otherwise use English by default.
48
+        $language = isset( $countries[ $params['value'] ] ) ? $params['value'] : 'uk';
49 49
 
50
-		foreach ( $countries as $code => $label ) :
51
-			?>
50
+        foreach ( $countries as $code => $label ) :
51
+            ?>
52 52
 			<option
53 53
 					value="<?php echo esc_attr( $code ); ?>"
54 54
 				<?php echo selected( $code, $language, false ); ?>
@@ -56,50 +56,50 @@  discard block
 block discarded – undo
56 56
 				<?php echo esc_html( $label ); ?>
57 57
 			</option>
58 58
 			<?php
59
-		endforeach;
60
-	}
59
+        endforeach;
60
+    }
61 61
 
62
-	/**
63
-	 * Returns select options html.
64
-	 *
65
-	 * @since 3.18.0
66
-	 *
67
-	 * @return void Echoes select options or empty string if required params are not set.
68
-	 */
69
-	public function get_options_html() {
70
-		$html = '';
62
+    /**
63
+     * Returns select options html.
64
+     *
65
+     * @since 3.18.0
66
+     *
67
+     * @return void Echoes select options or empty string if required params are not set.
68
+     */
69
+    public function get_options_html() {
70
+        $html = '';
71 71
 
72
-		// Check whether the required params are set.
72
+        // Check whether the required params are set.
73 73
         // phpcs:ignore Standard.Category.SniffName.ErrorCode
74
-		if ( ! empty( $_POST['lang'] ) && ! empty( $_POST['value'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Missing
75
-			ob_start();
76
-			// Get the new options.
77
-			// phpcs:ignore Standard.Category.SniffName.ErrorCode
78
-			$this->render_options( $_POST ); //phpcs:ignore WordPress.Security.NonceVerification.Missing
74
+        if ( ! empty( $_POST['lang'] ) && ! empty( $_POST['value'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Missing
75
+            ob_start();
76
+            // Get the new options.
77
+            // phpcs:ignore Standard.Category.SniffName.ErrorCode
78
+            $this->render_options( $_POST ); //phpcs:ignore WordPress.Security.NonceVerification.Missing
79 79
 
80
-			$html = ob_get_clean();
81
-		}
80
+            $html = ob_get_clean();
81
+        }
82 82
 
83
-		// Return the html.
84
-		wp_send_json_success( $html );
85
-	}
83
+        // Return the html.
84
+        wp_send_json_success( $html );
85
+    }
86 86
 
87
-	/**
88
-	 * Modify the field data attributes by adding`country-code`
89
-	 * to existing attributes.
90
-	 *
91
-	 * @param array $attributes Current data attributes.
92
-	 *
93
-	 * @since 3.18.0
94
-	 *
95
-	 * @return array $attributes Modified attributes.
96
-	 */
97
-	public function add_country_codes_data( $attributes ) {
98
-		// Add the country codes.
99
-		$attributes['country-codes'] = wp_json_encode( Wordlift_Countries::get_codes() );
87
+    /**
88
+     * Modify the field data attributes by adding`country-code`
89
+     * to existing attributes.
90
+     *
91
+     * @param array $attributes Current data attributes.
92
+     *
93
+     * @since 3.18.0
94
+     *
95
+     * @return array $attributes Modified attributes.
96
+     */
97
+    public function add_country_codes_data( $attributes ) {
98
+        // Add the country codes.
99
+        $attributes['country-codes'] = wp_json_encode( Wordlift_Countries::get_codes() );
100 100
 
101
-		// Return the attributes.
102
-		return $attributes;
103
-	}
101
+        // Return the attributes.
102
+        return $attributes;
103
+    }
104 104
 
105 105
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -26,34 +26,34 @@  discard block
 block discarded – undo
26 26
 	 */
27 27
 	public function __construct() {
28 28
 		// Adds the country codes as data attribute to allow front-end validation.
29
-		add_filter( 'wl_admin_select_element_data_attributes', array( $this, 'add_country_codes_data' ), 10, 1 );
29
+		add_filter('wl_admin_select_element_data_attributes', array($this, 'add_country_codes_data'), 10, 1);
30 30
 	}
31 31
 
32 32
 	/**
33 33
 	 * @inheritdoc
34 34
 	 */
35
-	public function render_options( $params ) {
35
+	public function render_options($params) {
36 36
 		// Print all the supported countries, preselecting the one configured
37 37
 		// in WP (or United Kingdom if not supported). We now use the `Wordlift_Countries`
38 38
 		// class which provides the list of countries supported by WordLift.
39 39
 		//
40 40
 		// https://github.com/insideout10/wordlift-plugin/issues/713
41 41
 
42
-		$lang = ( isset( $params['lang'] ) ) ? $params['lang'] : false;
42
+		$lang = (isset($params['lang'])) ? $params['lang'] : false;
43 43
 
44 44
 		// Get WordLift's supported countries.
45
-		$countries = Wordlift_Countries::get_countries( $lang );
45
+		$countries = Wordlift_Countries::get_countries($lang);
46 46
 
47 47
 		// If we support WP's configured language, then use that, otherwise use English by default.
48
-		$language = isset( $countries[ $params['value'] ] ) ? $params['value'] : 'uk';
48
+		$language = isset($countries[$params['value']]) ? $params['value'] : 'uk';
49 49
 
50
-		foreach ( $countries as $code => $label ) :
50
+		foreach ($countries as $code => $label) :
51 51
 			?>
52 52
 			<option
53
-					value="<?php echo esc_attr( $code ); ?>"
54
-				<?php echo selected( $code, $language, false ); ?>
53
+					value="<?php echo esc_attr($code); ?>"
54
+				<?php echo selected($code, $language, false); ?>
55 55
 			>
56
-				<?php echo esc_html( $label ); ?>
56
+				<?php echo esc_html($label); ?>
57 57
 			</option>
58 58
 			<?php
59 59
 		endforeach;
@@ -71,17 +71,17 @@  discard block
 block discarded – undo
71 71
 
72 72
 		// Check whether the required params are set.
73 73
         // phpcs:ignore Standard.Category.SniffName.ErrorCode
74
-		if ( ! empty( $_POST['lang'] ) && ! empty( $_POST['value'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Missing
74
+		if ( ! empty($_POST['lang']) && ! empty($_POST['value'])) { //phpcs:ignore WordPress.Security.NonceVerification.Missing
75 75
 			ob_start();
76 76
 			// Get the new options.
77 77
 			// phpcs:ignore Standard.Category.SniffName.ErrorCode
78
-			$this->render_options( $_POST ); //phpcs:ignore WordPress.Security.NonceVerification.Missing
78
+			$this->render_options($_POST); //phpcs:ignore WordPress.Security.NonceVerification.Missing
79 79
 
80 80
 			$html = ob_get_clean();
81 81
 		}
82 82
 
83 83
 		// Return the html.
84
-		wp_send_json_success( $html );
84
+		wp_send_json_success($html);
85 85
 	}
86 86
 
87 87
 	/**
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
 	 *
95 95
 	 * @return array $attributes Modified attributes.
96 96
 	 */
97
-	public function add_country_codes_data( $attributes ) {
97
+	public function add_country_codes_data($attributes) {
98 98
 		// Add the country codes.
99
-		$attributes['country-codes'] = wp_json_encode( Wordlift_Countries::get_codes() );
99
+		$attributes['country-codes'] = wp_json_encode(Wordlift_Countries::get_codes());
100 100
 
101 101
 		// Return the attributes.
102 102
 		return $attributes;
Please login to merge, or discard this patch.
src/admin/elements/class-wordlift-admin-tabs-element.php 2 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -18,48 +18,48 @@  discard block
 block discarded – undo
18 18
  */
19 19
 class Wordlift_Admin_Tabs_Element implements Wordlift_Admin_Element {
20 20
 
21
-	/**
22
-	 * Render the element.
23
-	 *
24
-	 * @param array $args {
25
-	 *      Parameters controlling the html being output.
26
-	 *
27
-	 * @type integer $active The index of the active panel on first render
28
-	 *                              a zero based number of the tab actual placement
29
-	 *
30
-	 * @type array $tabs {
31
-	 *          The array of tabs to be rendered.
32
-	 *          The index of the elements is expected to be an ascending integers
33
-	 *          tabs with lower index values will be render first (on the left)
34
-	 *
35
-	 * @type string $label The label used for the tab.
36
-	 * @type callable $callback The callback to call to render the
37
-	 *                                      Tab "panel".
38
-	 * @type array $args The arguments array passed to the callback.
39
-	 *          }
40
-	 *      }
41
-	 *
42
-	 * @return \Wordlift_Admin_Element The element instance.
43
-	 * @since 3.11.0
44
-	 */
45
-	public function render( $args ) {
21
+    /**
22
+     * Render the element.
23
+     *
24
+     * @param array $args {
25
+     *      Parameters controlling the html being output.
26
+     *
27
+     * @type integer $active The index of the active panel on first render
28
+     *                              a zero based number of the tab actual placement
29
+     *
30
+     * @type array $tabs {
31
+     *          The array of tabs to be rendered.
32
+     *          The index of the elements is expected to be an ascending integers
33
+     *          tabs with lower index values will be render first (on the left)
34
+     *
35
+     * @type string $label The label used for the tab.
36
+     * @type callable $callback The callback to call to render the
37
+     *                                      Tab "panel".
38
+     * @type array $args The arguments array passed to the callback.
39
+     *          }
40
+     *      }
41
+     *
42
+     * @return \Wordlift_Admin_Element The element instance.
43
+     * @since 3.11.0
44
+     */
45
+    public function render( $args ) {
46 46
 
47
-		// Enqueue the jQuery UI Tabs script.
48
-		wp_enqueue_script( 'jquery-ui-tabs' );
47
+        // Enqueue the jQuery UI Tabs script.
48
+        wp_enqueue_script( 'jquery-ui-tabs' );
49 49
 
50
-		// Parse the arguments and merge with default values.
51
-		$params = wp_parse_args(
52
-			$args,
53
-			array(
54
-				'tabs'   => array(),
55
-				'active' => 0,
56
-			)
57
-		);
50
+        // Parse the arguments and merge with default values.
51
+        $params = wp_parse_args(
52
+            $args,
53
+            array(
54
+                'tabs'   => array(),
55
+                'active' => 0,
56
+            )
57
+        );
58 58
 
59
-		// Following is the HTML code:
60
-		// - the labels are printed, using the tab's `label`,
61
-		// - the panels are printed, using the tab's `callback`.
62
-		?>
59
+        // Following is the HTML code:
60
+        // - the labels are printed, using the tab's `label`,
61
+        // - the panels are printed, using the tab's `callback`.
62
+        ?>
63 63
 		<div
64 64
 				class="wl-tabs-element"
65 65
 				data-active="<?php echo esc_attr( $params['active'] ); ?>"
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
 		<?php
84 84
 
85
-		return $this;
86
-	}
85
+        return $this;
86
+    }
87 87
 
88 88
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 	 * @return \Wordlift_Admin_Element The element instance.
43 43
 	 * @since 3.11.0
44 44
 	 */
45
-	public function render( $args ) {
45
+	public function render($args) {
46 46
 
47 47
 		// Enqueue the jQuery UI Tabs script.
48
-		wp_enqueue_script( 'jquery-ui-tabs' );
48
+		wp_enqueue_script('jquery-ui-tabs');
49 49
 
50 50
 		// Parse the arguments and merge with default values.
51 51
 		$params = wp_parse_args(
@@ -62,20 +62,20 @@  discard block
 block discarded – undo
62 62
 		?>
63 63
 		<div
64 64
 				class="wl-tabs-element"
65
-				data-active="<?php echo esc_attr( $params['active'] ); ?>"
65
+				data-active="<?php echo esc_attr($params['active']); ?>"
66 66
 		>
67 67
 			<ul class="nav-tab-wrapper">
68
-				<?php foreach ( $params['tabs'] as $index => $tab ) : ?>
68
+				<?php foreach ($params['tabs'] as $index => $tab) : ?>
69 69
 					<li class="nav-tab">
70
-						<a href="#tabs-<?php echo esc_html( $index + 1 ); ?>">
71
-							<?php echo esc_html( $tab['label'] ); ?>
70
+						<a href="#tabs-<?php echo esc_html($index + 1); ?>">
71
+							<?php echo esc_html($tab['label']); ?>
72 72
 						</a>
73 73
 					</li>
74 74
 				<?php endforeach; ?>
75 75
 			</ul>
76
-			<?php foreach ( $params['tabs'] as $index => $tab ) : ?>
77
-				<div id="tabs-<?php echo esc_html( $index + 1 ); ?>">
78
-					<?php call_user_func( $tab['callback'], $tab['args'] ); ?>
76
+			<?php foreach ($params['tabs'] as $index => $tab) : ?>
77
+				<div id="tabs-<?php echo esc_html($index + 1); ?>">
78
+					<?php call_user_func($tab['callback'], $tab['args']); ?>
79 79
 				</div>
80 80
 			<?php endforeach; ?>
81 81
 		</div>
Please login to merge, or discard this patch.
src/admin/elements/class-wordlift-admin-select2-element.php 2 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -18,13 +18,13 @@  discard block
 block discarded – undo
18 18
  */
19 19
 class Wordlift_Admin_Select2_Element extends Wordlift_Admin_Select_Element {
20 20
 
21
-	/**
22
-	 * @inheritdoc
23
-	 */
24
-	public function render_options( $params ) {
25
-		// Loop through all params and add the options.
26
-		foreach ( $params['options'] as $value => $label ) :
27
-			?>
21
+    /**
22
+     * @inheritdoc
23
+     */
24
+    public function render_options( $params ) {
25
+        // Loop through all params and add the options.
26
+        foreach ( $params['options'] as $value => $label ) :
27
+            ?>
28 28
 			<option
29 29
 					value="<?php echo esc_attr( $value ); ?>"
30 30
 				<?php selected( $params['value'], $value ); ?>
@@ -32,26 +32,26 @@  discard block
 block discarded – undo
32 32
 				<?php echo esc_html( $label ); ?>
33 33
 			</option>
34 34
 			<?php
35
-		endforeach;
36
-	}
35
+        endforeach;
36
+    }
37 37
 
38
-	/**
39
-	 * @inheritdoc
40
-	 */
41
-	protected function enqueue_resources() {
42
-		// Enqueue select2 library js and css.
43
-		// Underscore is needed for Select2's `templateResult` and `templateSelection` templates.
44
-		wp_enqueue_script(
45
-			'wordlift-select2',
46
-			plugin_dir_url( __DIR__ ) . 'js/select2/js/select2' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.js',
47
-			array(
48
-				'jquery',
49
-				'underscore',
50
-			),
51
-			'4.0.3',
52
-			false
53
-		);
54
-		wp_enqueue_style( 'wordlift-select2', plugin_dir_url( __DIR__ ) . 'js/select2/css/select2' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.css', array(), '4.0.3' );
55
-	}
38
+    /**
39
+     * @inheritdoc
40
+     */
41
+    protected function enqueue_resources() {
42
+        // Enqueue select2 library js and css.
43
+        // Underscore is needed for Select2's `templateResult` and `templateSelection` templates.
44
+        wp_enqueue_script(
45
+            'wordlift-select2',
46
+            plugin_dir_url( __DIR__ ) . 'js/select2/js/select2' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.js',
47
+            array(
48
+                'jquery',
49
+                'underscore',
50
+            ),
51
+            '4.0.3',
52
+            false
53
+        );
54
+        wp_enqueue_style( 'wordlift-select2', plugin_dir_url( __DIR__ ) . 'js/select2/css/select2' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.css', array(), '4.0.3' );
55
+    }
56 56
 
57 57
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -21,15 +21,15 @@  discard block
 block discarded – undo
21 21
 	/**
22 22
 	 * @inheritdoc
23 23
 	 */
24
-	public function render_options( $params ) {
24
+	public function render_options($params) {
25 25
 		// Loop through all params and add the options.
26
-		foreach ( $params['options'] as $value => $label ) :
26
+		foreach ($params['options'] as $value => $label) :
27 27
 			?>
28 28
 			<option
29
-					value="<?php echo esc_attr( $value ); ?>"
30
-				<?php selected( $params['value'], $value ); ?>
29
+					value="<?php echo esc_attr($value); ?>"
30
+				<?php selected($params['value'], $value); ?>
31 31
 			>
32
-				<?php echo esc_html( $label ); ?>
32
+				<?php echo esc_html($label); ?>
33 33
 			</option>
34 34
 			<?php
35 35
 		endforeach;
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		// Underscore is needed for Select2's `templateResult` and `templateSelection` templates.
44 44
 		wp_enqueue_script(
45 45
 			'wordlift-select2',
46
-			plugin_dir_url( __DIR__ ) . 'js/select2/js/select2' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.js',
46
+			plugin_dir_url(__DIR__).'js/select2/js/select2'.( ! defined('SCRIPT_DEBUG') || ! SCRIPT_DEBUG ? '.min' : '').'.js',
47 47
 			array(
48 48
 				'jquery',
49 49
 				'underscore',
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 			'4.0.3',
52 52
 			false
53 53
 		);
54
-		wp_enqueue_style( 'wordlift-select2', plugin_dir_url( __DIR__ ) . 'js/select2/css/select2' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.css', array(), '4.0.3' );
54
+		wp_enqueue_style('wordlift-select2', plugin_dir_url(__DIR__).'js/select2/css/select2'.( ! defined('SCRIPT_DEBUG') || ! SCRIPT_DEBUG ? '.min' : '').'.css', array(), '4.0.3');
55 55
 	}
56 56
 
57 57
 }
Please login to merge, or discard this patch.
src/admin/elements/class-wordlift-admin-language-select-element.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
  */
19 19
 class Wordlift_Admin_Language_Select_Element extends Wordlift_Admin_Select_Element {
20 20
 
21
-	/**
22
-	 * @inheritdoc
23
-	 */
24
-	public function render_options( $params ) {
25
-		/*
21
+    /**
22
+     * @inheritdoc
23
+     */
24
+    public function render_options( $params ) {
25
+        /*
26 26
 		 * Print all the supported language, preselecting the one configured
27 27
 		 * in WP (or English if not supported). We now use the `Wordlift_Languages`
28 28
 		 * class which provides the list of languages supported by WordLift.
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
 		 * See https://github.com/insideout10/wordlift-plugin/issues/349
31 31
 		 */
32 32
 
33
-		// Get WordLift's supported languages.
34
-		$languages = Wordlift_Languages::get_languages();
33
+        // Get WordLift's supported languages.
34
+        $languages = Wordlift_Languages::get_languages();
35 35
 
36
-		// If we support WP's configured language, then use that, otherwise use English by default.
37
-		$language = isset( $languages[ $params['value'] ] ) ? $params['value'] : 'en';
36
+        // If we support WP's configured language, then use that, otherwise use English by default.
37
+        $language = isset( $languages[ $params['value'] ] ) ? $params['value'] : 'en';
38 38
 
39
-		foreach ( $languages as $code => $label ) :
40
-			?>
39
+        foreach ( $languages as $code => $label ) :
40
+            ?>
41 41
 			<option
42 42
 					value="<?php echo esc_attr( $code ); ?>"
43 43
 				<?php echo selected( $code, $language, false ); ?>
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 				<?php echo esc_html( $label ); ?>
46 46
 			</option>
47 47
 			<?php
48
-		endforeach;
49
-	}
48
+        endforeach;
49
+    }
50 50
 
51 51
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	/**
22 22
 	 * @inheritdoc
23 23
 	 */
24
-	public function render_options( $params ) {
24
+	public function render_options($params) {
25 25
 		/*
26 26
 		 * Print all the supported language, preselecting the one configured
27 27
 		 * in WP (or English if not supported). We now use the `Wordlift_Languages`
@@ -34,15 +34,15 @@  discard block
 block discarded – undo
34 34
 		$languages = Wordlift_Languages::get_languages();
35 35
 
36 36
 		// If we support WP's configured language, then use that, otherwise use English by default.
37
-		$language = isset( $languages[ $params['value'] ] ) ? $params['value'] : 'en';
37
+		$language = isset($languages[$params['value']]) ? $params['value'] : 'en';
38 38
 
39
-		foreach ( $languages as $code => $label ) :
39
+		foreach ($languages as $code => $label) :
40 40
 			?>
41 41
 			<option
42
-					value="<?php echo esc_attr( $code ); ?>"
43
-				<?php echo selected( $code, $language, false ); ?>
42
+					value="<?php echo esc_attr($code); ?>"
43
+				<?php echo selected($code, $language, false); ?>
44 44
 			>
45
-				<?php echo esc_html( $label ); ?>
45
+				<?php echo esc_html($label); ?>
46 46
 			</option>
47 47
 			<?php
48 48
 		endforeach;
Please login to merge, or discard this patch.
src/admin/wordlift-admin-shortcodes.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * Loads the buttons in TinyMCE.
10 10
  */
11 11
 function wl_admin_shortcode_buttons() {
12
-	// Only add hooks when the current user has permissions AND is in Rich Text editor mode
13
-	if ( ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) && get_user_option( 'rich_editing' ) ) {
14
-		// add_filter( 'mce_external_plugins', 'wl_admin_shortcode_buttons_register_tinymce_javascript' );
15
-		add_filter( 'mce_buttons', 'wl_admin_shortcode_register_buttons' );
16
-	}
12
+    // Only add hooks when the current user has permissions AND is in Rich Text editor mode
13
+    if ( ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) && get_user_option( 'rich_editing' ) ) {
14
+        // add_filter( 'mce_external_plugins', 'wl_admin_shortcode_buttons_register_tinymce_javascript' );
15
+        add_filter( 'mce_buttons', 'wl_admin_shortcode_register_buttons' );
16
+    }
17 17
 }
18 18
 
19 19
 /**
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
  * @return array The buttons array including the *wl_shortcodes_menu*.
25 25
  */
26 26
 function wl_admin_shortcode_register_buttons( $buttons ) {
27
-	array_push( $buttons, 'wl_shortcodes_menu' );
27
+    array_push( $buttons, 'wl_shortcodes_menu' );
28 28
 
29
-	return $buttons;
29
+    return $buttons;
30 30
 }
31 31
 
32 32
 // init process for button control
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,9 +10,9 @@  discard block
 block discarded – undo
10 10
  */
11 11
 function wl_admin_shortcode_buttons() {
12 12
 	// Only add hooks when the current user has permissions AND is in Rich Text editor mode
13
-	if ( ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) && get_user_option( 'rich_editing' ) ) {
13
+	if ((current_user_can('edit_posts') || current_user_can('edit_pages')) && get_user_option('rich_editing')) {
14 14
 		// add_filter( 'mce_external_plugins', 'wl_admin_shortcode_buttons_register_tinymce_javascript' );
15
-		add_filter( 'mce_buttons', 'wl_admin_shortcode_register_buttons' );
15
+		add_filter('mce_buttons', 'wl_admin_shortcode_register_buttons');
16 16
 	}
17 17
 }
18 18
 
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array The buttons array including the *wl_shortcodes_menu*.
25 25
  */
26
-function wl_admin_shortcode_register_buttons( $buttons ) {
27
-	array_push( $buttons, 'wl_shortcodes_menu' );
26
+function wl_admin_shortcode_register_buttons($buttons) {
27
+	array_push($buttons, 'wl_shortcodes_menu');
28 28
 
29 29
 	return $buttons;
30 30
 }
31 31
 
32 32
 // init process for button control
33
-add_action( 'admin_init', 'wl_admin_shortcode_buttons' );
33
+add_action('admin_init', 'wl_admin_shortcode_buttons');
Please login to merge, or discard this patch.
src/admin/class-wordlift-admin-entity-taxonomy-list-page.php 2 patches
Indentation   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 if ( ! defined( 'ABSPATH' ) ) {
16
-	exit;
16
+    exit;
17 17
 }
18 18
 
19 19
 /**
@@ -28,107 +28,107 @@  discard block
 block discarded – undo
28 28
  */
29 29
 class Wordlift_Admin_Entity_Taxonomy_List_Page {
30 30
 
31
-	/**
32
-	 * Hook to `wl_entity_type_row_actions` to add an "action" link to Thread
33
-	 * SEO related settings for the term.
34
-	 *
35
-	 * @see   https://developer.wordpress.org/reference/hooks/taxonomy_row_actions/
36
-	 *
37
-	 * @since 3.11.0
38
-	 *
39
-	 * @param array  $actions An array of action links to be displayed. Default
40
-	 *                        'Edit', 'Quick Edit', 'Delete', and 'View'.
41
-	 * @param object $term    Term object.
42
-	 *
43
-	 * @return array  $actions An array of action links to be displayed. Default
44
-	 *                        'Edit', 'Quick Edit', 'Delete', and 'View'.
45
-	 */
46
-	public function wl_entity_type_row_actions( $actions, $term ) {
47
-
48
-		$url               = admin_url( "admin.php?page=wl_entity_type_settings&tag_ID=$term->term_id" );
49
-		$actions['wl-seo'] = '<a href="' . esc_url( $url ) . '">' . __( 'SEO Settings', 'wordlift' ) . '</a>';
50
-
51
-		// Hacks for pre 4.7 compatibility:
52
-		// * remove the quick edit.
53
-		unset( $actions['inline hide-if-no-js'] );
54
-		// * remove the edit link.
55
-		unset( $actions['edit'] );
56
-
57
-		return $actions;
58
-	}
59
-
60
-	/**
61
-	 * Override the capabilities related to managing the entity type terms
62
-	 * for multisite super admin to prevent it from manipulating it in any
63
-	 * way.
64
-	 *
65
-	 * @since 3.12.0
66
-	 *
67
-	 * @param array  $caps    The user's current capabilities.
68
-	 * @param string $cap     Capability name.
69
-	 *
70
-	 * @return array    Array containing the do_not_allow capability for super admin
71
-	 *                  when editing and deleting entity type terms capabilities
72
-	 *                    are being "approved"
73
-	 */
74
-	public function restrict_super_admin( $caps, $cap ) {
75
-
76
-		switch ( $cap ) {
77
-			case 'wl_entity_type_edit_term':
78
-			case 'wl_entity_type_delete_term':
79
-				$caps[] = 'do_not_allow';
80
-		}
81
-
82
-		return $caps;
83
-	}
84
-
85
-	/**
86
-	 * Override the capabilities related to managing the entity type terms
87
-	 * required for WordPress < 4.7 to get access to the admin page.
88
-	 *
89
-	 * Before 4.7, WordPress checks whether the user has permission to access
90
-	 * the `edit-tags.php` page. So we need to provide temporary the permission
91
-	 * otherwise the user will get an `access not allowed` when trying to access
92
-	 * the page.
93
-	 *
94
-	 * @see   https://github.com/insideout10/wordlift-plugin/issues/512
95
-	 *
96
-	 * @since 3.12.0
97
-	 *
98
-	 * @param array  $caps    The user's current capabilities.
99
-	 * @param string $cap     Capability name.
100
-	 *
101
-	 * @return array    Array containing the manage_options capability
102
-	 */
103
-	public function enable_admin_access_pre_47( $caps, $cap ) {
104
-
105
-		// Bail out if we're not dealing with the `wl_entity_type_edit_term`
106
-		// capability.
107
-		if ( 'wl_entity_type_edit_term' !== $cap || ! isset( $_SERVER['REQUEST_URI'] ) ) {
108
-			return $caps;
109
-		}
110
-
111
-		$path = wp_parse_url( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'], PHP_URL_PATH ) ) );
112
-
113
-		// Bail out if the `path` cannot be determined.
114
-		if ( null === $path ) {
115
-			return $caps;
116
-		}
117
-
118
-		// Bail out if a specific term is being handled.
119
-		if ( isset( $_REQUEST['action'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
120
-			return $caps;
121
-		}
122
-
123
-		// Split the path and check if the page is the `edit-tags.php`. We can't
124
-		// use WP's own function because this is called very early.
125
-		$components = explode( '/', $path );
126
-		if ( 'edit-tags.php' !== $components[ count( $components ) - 1 ] ) {
127
-			return $caps;
128
-		}
129
-
130
-		// Give permission to the user.
131
-		return array( 'manage_options' );
132
-	}
31
+    /**
32
+     * Hook to `wl_entity_type_row_actions` to add an "action" link to Thread
33
+     * SEO related settings for the term.
34
+     *
35
+     * @see   https://developer.wordpress.org/reference/hooks/taxonomy_row_actions/
36
+     *
37
+     * @since 3.11.0
38
+     *
39
+     * @param array  $actions An array of action links to be displayed. Default
40
+     *                        'Edit', 'Quick Edit', 'Delete', and 'View'.
41
+     * @param object $term    Term object.
42
+     *
43
+     * @return array  $actions An array of action links to be displayed. Default
44
+     *                        'Edit', 'Quick Edit', 'Delete', and 'View'.
45
+     */
46
+    public function wl_entity_type_row_actions( $actions, $term ) {
47
+
48
+        $url               = admin_url( "admin.php?page=wl_entity_type_settings&tag_ID=$term->term_id" );
49
+        $actions['wl-seo'] = '<a href="' . esc_url( $url ) . '">' . __( 'SEO Settings', 'wordlift' ) . '</a>';
50
+
51
+        // Hacks for pre 4.7 compatibility:
52
+        // * remove the quick edit.
53
+        unset( $actions['inline hide-if-no-js'] );
54
+        // * remove the edit link.
55
+        unset( $actions['edit'] );
56
+
57
+        return $actions;
58
+    }
59
+
60
+    /**
61
+     * Override the capabilities related to managing the entity type terms
62
+     * for multisite super admin to prevent it from manipulating it in any
63
+     * way.
64
+     *
65
+     * @since 3.12.0
66
+     *
67
+     * @param array  $caps    The user's current capabilities.
68
+     * @param string $cap     Capability name.
69
+     *
70
+     * @return array    Array containing the do_not_allow capability for super admin
71
+     *                  when editing and deleting entity type terms capabilities
72
+     *                    are being "approved"
73
+     */
74
+    public function restrict_super_admin( $caps, $cap ) {
75
+
76
+        switch ( $cap ) {
77
+            case 'wl_entity_type_edit_term':
78
+            case 'wl_entity_type_delete_term':
79
+                $caps[] = 'do_not_allow';
80
+        }
81
+
82
+        return $caps;
83
+    }
84
+
85
+    /**
86
+     * Override the capabilities related to managing the entity type terms
87
+     * required for WordPress < 4.7 to get access to the admin page.
88
+     *
89
+     * Before 4.7, WordPress checks whether the user has permission to access
90
+     * the `edit-tags.php` page. So we need to provide temporary the permission
91
+     * otherwise the user will get an `access not allowed` when trying to access
92
+     * the page.
93
+     *
94
+     * @see   https://github.com/insideout10/wordlift-plugin/issues/512
95
+     *
96
+     * @since 3.12.0
97
+     *
98
+     * @param array  $caps    The user's current capabilities.
99
+     * @param string $cap     Capability name.
100
+     *
101
+     * @return array    Array containing the manage_options capability
102
+     */
103
+    public function enable_admin_access_pre_47( $caps, $cap ) {
104
+
105
+        // Bail out if we're not dealing with the `wl_entity_type_edit_term`
106
+        // capability.
107
+        if ( 'wl_entity_type_edit_term' !== $cap || ! isset( $_SERVER['REQUEST_URI'] ) ) {
108
+            return $caps;
109
+        }
110
+
111
+        $path = wp_parse_url( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'], PHP_URL_PATH ) ) );
112
+
113
+        // Bail out if the `path` cannot be determined.
114
+        if ( null === $path ) {
115
+            return $caps;
116
+        }
117
+
118
+        // Bail out if a specific term is being handled.
119
+        if ( isset( $_REQUEST['action'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
120
+            return $caps;
121
+        }
122
+
123
+        // Split the path and check if the page is the `edit-tags.php`. We can't
124
+        // use WP's own function because this is called very early.
125
+        $components = explode( '/', $path );
126
+        if ( 'edit-tags.php' !== $components[ count( $components ) - 1 ] ) {
127
+            return $caps;
128
+        }
129
+
130
+        // Give permission to the user.
131
+        return array( 'manage_options' );
132
+    }
133 133
 
134 134
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  * @since      3.11.0
13 13
  */
14 14
 
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 	 * @return array  $actions An array of action links to be displayed. Default
44 44
 	 *                        'Edit', 'Quick Edit', 'Delete', and 'View'.
45 45
 	 */
46
-	public function wl_entity_type_row_actions( $actions, $term ) {
46
+	public function wl_entity_type_row_actions($actions, $term) {
47 47
 
48
-		$url               = admin_url( "admin.php?page=wl_entity_type_settings&tag_ID=$term->term_id" );
49
-		$actions['wl-seo'] = '<a href="' . esc_url( $url ) . '">' . __( 'SEO Settings', 'wordlift' ) . '</a>';
48
+		$url               = admin_url("admin.php?page=wl_entity_type_settings&tag_ID=$term->term_id");
49
+		$actions['wl-seo'] = '<a href="'.esc_url($url).'">'.__('SEO Settings', 'wordlift').'</a>';
50 50
 
51 51
 		// Hacks for pre 4.7 compatibility:
52 52
 		// * remove the quick edit.
53
-		unset( $actions['inline hide-if-no-js'] );
53
+		unset($actions['inline hide-if-no-js']);
54 54
 		// * remove the edit link.
55
-		unset( $actions['edit'] );
55
+		unset($actions['edit']);
56 56
 
57 57
 		return $actions;
58 58
 	}
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 	 *                  when editing and deleting entity type terms capabilities
72 72
 	 *                    are being "approved"
73 73
 	 */
74
-	public function restrict_super_admin( $caps, $cap ) {
74
+	public function restrict_super_admin($caps, $cap) {
75 75
 
76
-		switch ( $cap ) {
76
+		switch ($cap) {
77 77
 			case 'wl_entity_type_edit_term':
78 78
 			case 'wl_entity_type_delete_term':
79 79
 				$caps[] = 'do_not_allow';
@@ -100,35 +100,35 @@  discard block
 block discarded – undo
100 100
 	 *
101 101
 	 * @return array    Array containing the manage_options capability
102 102
 	 */
103
-	public function enable_admin_access_pre_47( $caps, $cap ) {
103
+	public function enable_admin_access_pre_47($caps, $cap) {
104 104
 
105 105
 		// Bail out if we're not dealing with the `wl_entity_type_edit_term`
106 106
 		// capability.
107
-		if ( 'wl_entity_type_edit_term' !== $cap || ! isset( $_SERVER['REQUEST_URI'] ) ) {
107
+		if ('wl_entity_type_edit_term' !== $cap || ! isset($_SERVER['REQUEST_URI'])) {
108 108
 			return $caps;
109 109
 		}
110 110
 
111
-		$path = wp_parse_url( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'], PHP_URL_PATH ) ) );
111
+		$path = wp_parse_url(esc_url_raw(wp_unslash($_SERVER['REQUEST_URI'], PHP_URL_PATH)));
112 112
 
113 113
 		// Bail out if the `path` cannot be determined.
114
-		if ( null === $path ) {
114
+		if (null === $path) {
115 115
 			return $caps;
116 116
 		}
117 117
 
118 118
 		// Bail out if a specific term is being handled.
119
-		if ( isset( $_REQUEST['action'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
119
+		if (isset($_REQUEST['action'])) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
120 120
 			return $caps;
121 121
 		}
122 122
 
123 123
 		// Split the path and check if the page is the `edit-tags.php`. We can't
124 124
 		// use WP's own function because this is called very early.
125
-		$components = explode( '/', $path );
126
-		if ( 'edit-tags.php' !== $components[ count( $components ) - 1 ] ) {
125
+		$components = explode('/', $path);
126
+		if ('edit-tags.php' !== $components[count($components) - 1]) {
127 127
 			return $caps;
128 128
 		}
129 129
 
130 130
 		// Give permission to the user.
131
-		return array( 'manage_options' );
131
+		return array('manage_options');
132 132
 	}
133 133
 
134 134
 }
Please login to merge, or discard this patch.
src/admin/class-wordlift-admin-mappings-page.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -16,36 +16,36 @@
 block discarded – undo
16 16
  */
17 17
 class Wordlift_Admin_Mappings_Page extends Wordlift_Admin_Page {
18 18
 
19
-	/**
20
-	 * {@inheritdoc}
21
-	 */
22
-	public function get_page_title() {
19
+    /**
20
+     * {@inheritdoc}
21
+     */
22
+    public function get_page_title() {
23 23
 
24
-		return __( 'Schema.org Types', 'wordlift' );
25
-	}
24
+        return __( 'Schema.org Types', 'wordlift' );
25
+    }
26 26
 
27
-	/**
28
-	 * {@inheritdoc}
29
-	 */
30
-	public function get_menu_title() {
27
+    /**
28
+     * {@inheritdoc}
29
+     */
30
+    public function get_menu_title() {
31 31
 
32
-		return __( 'Schema.org Types', 'wordlift' );
33
-	}
32
+        return __( 'Schema.org Types', 'wordlift' );
33
+    }
34 34
 
35
-	/**
36
-	 * {@inheritdoc}
37
-	 */
38
-	public function get_menu_slug() {
35
+    /**
36
+     * {@inheritdoc}
37
+     */
38
+    public function get_menu_slug() {
39 39
 
40
-		return 'wl_mappings';
41
-	}
40
+        return 'wl_mappings';
41
+    }
42 42
 
43
-	/**
44
-	 * {@inheritdoc}
45
-	 */
46
-	public function get_partial_name() {
43
+    /**
44
+     * {@inheritdoc}
45
+     */
46
+    public function get_partial_name() {
47 47
 
48
-		return 'wordlift-admin-mappings-page.php';
49
-	}
48
+        return 'wordlift-admin-mappings-page.php';
49
+    }
50 50
 
51 51
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function get_page_title() {
23 23
 
24
-		return __( 'Schema.org Types', 'wordlift' );
24
+		return __('Schema.org Types', 'wordlift');
25 25
 	}
26 26
 
27 27
 	/**
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public function get_menu_title() {
31 31
 
32
-		return __( 'Schema.org Types', 'wordlift' );
32
+		return __('Schema.org Types', 'wordlift');
33 33
 	}
34 34
 
35 35
 	/**
Please login to merge, or discard this patch.
src/admin/class-wordlift-dashboard-service.php 2 patches
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	private static $instance;
66 66
 
67 67
 	public static function get_instance() {
68
-		if ( ! isset( self::$instance ) ) {
68
+		if ( ! isset(self::$instance)) {
69 69
 			self::$instance = new self();
70 70
 		}
71 71
 
@@ -78,62 +78,62 @@  discard block
 block discarded – undo
78 78
 	 * @since 3.4.0
79 79
 	 */
80 80
     // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
81
-	public function dashboard_widget_callback( $post ) {
82
-		$caption_kses           = array( 'a' => array( 'href' => array() ) );
83
-		$enriched_posts_title   = __( 'enriched posts', 'wordlift' );
81
+	public function dashboard_widget_callback($post) {
82
+		$caption_kses           = array('a' => array('href' => array()));
83
+		$enriched_posts_title   = __('enriched posts', 'wordlift');
84 84
 		$enriched_posts_caption = sprintf(
85 85
 			wp_kses(
86 86
 				/* translators: 1: Percentage of annotated posts, 2: Link to the edit screen, 3: Number of annotated posts, 4: Total posts. */
87
-				__( '%1$s, of your <a href="%2$s">posts</a> are annotated. This means %3$s annotated posts on %4$s.', 'wordlift' ),
88
-				array( 'a' => array( 'href' => array() ) )
87
+				__('%1$s, of your <a href="%2$s">posts</a> are annotated. This means %3$s annotated posts on %4$s.', 'wordlift'),
88
+				array('a' => array('href' => array()))
89 89
 			),
90
-			$this->render_stat_param( 'annotatedPostsPercentage' ),
91
-			esc_url( admin_url( 'edit.php' ) ),
92
-			$this->render_stat_param( 'annotated_posts' ),
93
-			$this->render_stat_param( 'posts' )
90
+			$this->render_stat_param('annotatedPostsPercentage'),
91
+			esc_url(admin_url('edit.php')),
92
+			$this->render_stat_param('annotated_posts'),
93
+			$this->render_stat_param('posts')
94 94
 		);
95 95
 
96
-		$rating_title   = __( 'average entity rating', 'wordlift' );
96
+		$rating_title   = __('average entity rating', 'wordlift');
97 97
 		$rating_caption = sprintf(
98 98
 			wp_kses(
99 99
 					/* translators: 1: The entities count, 2: The link to the vocabulary, 3: The average rating. */
100
-				__( 'You have %1$s entities in your <a href="%2$s">vocabulary</a> with an average rating of %3$s.', 'wordlift' ),
101
-				array( 'a' => array( 'href' => array() ) )
100
+				__('You have %1$s entities in your <a href="%2$s">vocabulary</a> with an average rating of %3$s.', 'wordlift'),
101
+				array('a' => array('href' => array()))
102 102
 			),
103
-			$this->render_stat_param( 'entities' ),
104
-			esc_url( admin_url( 'edit.php?post_type=entity' ) ),
105
-			$this->render_stat_param( 'rating' )
103
+			$this->render_stat_param('entities'),
104
+			esc_url(admin_url('edit.php?post_type=entity')),
105
+			$this->render_stat_param('rating')
106 106
 		);
107 107
 
108
-		$graph_title   = __( 'triples in your graph', 'wordlift' );
108
+		$graph_title   = __('triples in your graph', 'wordlift');
109 109
 		$graph_caption = sprintf(
110 110
 			wp_kses(
111 111
 					/* translators: 1: The percentage of the graph size compared to Wikidata, 2: The link to Wikidata. */
112
-				__( 'Your graphs size corresponds to %1$s of <a href="%2$s">Wikidata</a>.', 'wordlift' ),
113
-				array( 'a' => array( 'href' => array() ) )
112
+				__('Your graphs size corresponds to %1$s of <a href="%2$s">Wikidata</a>.', 'wordlift'),
113
+				array('a' => array('href' => array()))
114 114
 			),
115
-			$this->render_stat_param( 'wikidata' ),
116
-			esc_url( 'https://www.wikidata.org/' )
115
+			$this->render_stat_param('wikidata'),
116
+			esc_url('https://www.wikidata.org/')
117 117
 		);
118 118
 
119
-		$triples_label = __( 'triples', 'wordlift' );
119
+		$triples_label = __('triples', 'wordlift');
120 120
 
121 121
 		?>
122 122
 		<div id="wl-dashboard-widget-inner-wrapper">
123 123
 			<div class="wl-stat-card">
124 124
 				<div class="wl-stat-graph-wrapper">
125
-					<h4><?php echo esc_html( $enriched_posts_title ); ?> <a
125
+					<h4><?php echo esc_html($enriched_posts_title); ?> <a
126 126
 								href="http://docs.wordlift.it/en/latest/faq.html#what-is-content-enrichment"
127 127
 								target="_blank"><i class="wl-info"></i></a></h4>
128 128
 					<svg id="wl-posts-pie-chart" viewBox="0 0 32 32">
129 129
 						<circle r="16" cx="16" cy="16"/>
130 130
 					</svg>
131 131
 				</div>
132
-				<p><?php echo wp_kses( $enriched_posts_caption, $caption_kses ); ?> </p>
132
+				<p><?php echo wp_kses($enriched_posts_caption, $caption_kses); ?> </p>
133 133
 			</div>
134 134
 			<div class="wl-stat-card">
135 135
 				<div class="wl-stat-graph-wrapper">
136
-					<h4><?php echo esc_html( $rating_title ); ?> <a
136
+					<h4><?php echo esc_html($rating_title); ?> <a
137 137
 								href="http://docs.wordlift.it/en/latest/faq.html#what-factors-determine-the-rating-of-an-entity"
138 138
 								target="_blank"><i class="wl-info"></i></a></h4>
139 139
 					<svg id="wl-entities-gauge-chart" viewBox="0 0 32 32">
@@ -141,18 +141,18 @@  discard block
 block discarded – undo
141 141
 						<circle r="16" cx="16" cy="16" class="stat"/>
142 142
 					</svg>
143 143
 				</div>
144
-				<p><?php echo wp_kses( $rating_caption, $caption_kses ); ?></p>
144
+				<p><?php echo wp_kses($rating_caption, $caption_kses); ?></p>
145 145
 			</div>
146 146
 			<div class="wl-stat-card">
147 147
 				<div class="wl-stat-graph-wrapper">
148
-					<h4><?php echo esc_html( $graph_title ); ?><a href="http://docs.wordlift.it/en/latest/faq.html#what-is-a-triple"
148
+					<h4><?php echo esc_html($graph_title); ?><a href="http://docs.wordlift.it/en/latest/faq.html#what-is-a-triple"
149 149
 										target="_blank"><i class="wl-info"></i></a></h4>
150 150
 					<div class="wl-triples">
151 151
 						<span id="wl-dashboard-widget-triples"></span>
152
-						<span class="wl-triples-label"><?php echo esc_html( $triples_label ); ?></span>
152
+						<span class="wl-triples-label"><?php echo esc_html($triples_label); ?></span>
153 153
 					</div>
154 154
 				</div>
155
-				<p><?php echo wp_kses( $graph_caption, $caption_kses ); ?></p>
155
+				<p><?php echo wp_kses($graph_caption, $caption_kses); ?></p>
156 156
 			</div>
157 157
 		</div>
158 158
 		<?php
@@ -185,14 +185,14 @@  discard block
 block discarded – undo
185 185
 	public function ajax_get_stats() {
186 186
 
187 187
 		// If needed, the transient is force to reloaded.
188
-		if ( isset( $_GET['force_reload'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
189
-			delete_transient( self::TRANSIENT_NAME );
188
+		if (isset($_GET['force_reload'])) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
189
+			delete_transient(self::TRANSIENT_NAME);
190 190
 		}
191 191
 
192 192
 		// Try to retrieve the transient
193
-		$stats = get_transient( self::TRANSIENT_NAME );
193
+		$stats = get_transient(self::TRANSIENT_NAME);
194 194
 
195
-		if ( ! $stats ) {
195
+		if ( ! $stats) {
196 196
 			// Calculate stats
197 197
 			$count_triples = $this->count_triples();
198 198
 			$stats         = array(
@@ -203,10 +203,10 @@  discard block
 block discarded – undo
203 203
 				'rating'          => $this->average_entities_rating(),
204 204
 			);
205 205
 			// Cache stats results trough transient
206
-			set_transient( self::TRANSIENT_NAME, $stats, self::TRANSIENT_EXPIRATION );
206
+			set_transient(self::TRANSIENT_NAME, $stats, self::TRANSIENT_EXPIRATION);
207 207
 		}
208 208
 		// Return stats as json object
209
-		wl_core_send_json( $stats );
209
+		wl_core_send_json($stats);
210 210
 	}
211 211
 
212 212
 	/**
Please login to merge, or discard this patch.
Indentation   +181 added lines, -181 removed lines patch added patch discarded remove patch
@@ -18,106 +18,106 @@  discard block
 block discarded – undo
18 18
  */
19 19
 class Wordlift_Dashboard_Service {
20 20
 
21
-	/**
22
-	 * Transient Name
23
-	 *
24
-	 * @since  3.4.0
25
-	 */
26
-	const TRANSIENT_NAME = 'wl_dashboard_stats';
21
+    /**
22
+     * Transient Name
23
+     *
24
+     * @since  3.4.0
25
+     */
26
+    const TRANSIENT_NAME = 'wl_dashboard_stats';
27 27
 
28
-	/**
29
-	 * Transient Expiration (in seconds)
30
-	 *
31
-	 * @since  3.4.0
32
-	 */
33
-	const TRANSIENT_EXPIRATION = 86400;
28
+    /**
29
+     * Transient Expiration (in seconds)
30
+     *
31
+     * @since  3.4.0
32
+     */
33
+    const TRANSIENT_EXPIRATION = 86400;
34 34
 
35
-	/**
36
-	 * A {@link Wordlift_Rating_Service} instance.
37
-	 *
38
-	 * @since  3.10.0
39
-	 * @access private
40
-	 * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
41
-	 */
42
-	private $rating_service;
35
+    /**
36
+     * A {@link Wordlift_Rating_Service} instance.
37
+     *
38
+     * @since  3.10.0
39
+     * @access private
40
+     * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
41
+     */
42
+    private $rating_service;
43 43
 
44
-	/**
45
-	 * The {@link Wordlift_Entity_Service} instance.
46
-	 *
47
-	 * @since  3.15.0
48
-	 * @access private
49
-	 * @var \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance.
50
-	 */
51
-	private $entity_service;
44
+    /**
45
+     * The {@link Wordlift_Entity_Service} instance.
46
+     *
47
+     * @since  3.15.0
48
+     * @access private
49
+     * @var \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance.
50
+     */
51
+    private $entity_service;
52 52
 
53
-	/**
54
-	 * Create a Wordlift_Entity_List_Service.
55
-	 *
56
-	 * @since 3.4.0
57
-	 */
58
-	protected function __construct() {
53
+    /**
54
+     * Create a Wordlift_Entity_List_Service.
55
+     *
56
+     * @since 3.4.0
57
+     */
58
+    protected function __construct() {
59 59
 
60
-		$this->rating_service = Wordlift_Rating_Service::get_instance();
61
-		$this->entity_service = Wordlift_Entity_Service::get_instance();
62
-	}
60
+        $this->rating_service = Wordlift_Rating_Service::get_instance();
61
+        $this->entity_service = Wordlift_Entity_Service::get_instance();
62
+    }
63 63
 
64
-	private static $instance;
64
+    private static $instance;
65 65
 
66
-	public static function get_instance() {
67
-		if ( ! isset( self::$instance ) ) {
68
-			self::$instance = new self();
69
-		}
66
+    public static function get_instance() {
67
+        if ( ! isset( self::$instance ) ) {
68
+            self::$instance = new self();
69
+        }
70 70
 
71
-		return self::$instance;
72
-	}
71
+        return self::$instance;
72
+    }
73 73
 
74
-	/**
75
-	 * Return stats layout
76
-	 *
77
-	 * @since 3.4.0
78
-	 */
74
+    /**
75
+     * Return stats layout
76
+     *
77
+     * @since 3.4.0
78
+     */
79 79
     // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
80
-	public function dashboard_widget_callback( $post ) {
81
-		$caption_kses           = array( 'a' => array( 'href' => array() ) );
82
-		$enriched_posts_title   = __( 'enriched posts', 'wordlift' );
83
-		$enriched_posts_caption = sprintf(
84
-			wp_kses(
85
-				/* translators: 1: Percentage of annotated posts, 2: Link to the edit screen, 3: Number of annotated posts, 4: Total posts. */
86
-				__( '%1$s, of your <a href="%2$s">posts</a> are annotated. This means %3$s annotated posts on %4$s.', 'wordlift' ),
87
-				array( 'a' => array( 'href' => array() ) )
88
-			),
89
-			$this->render_stat_param( 'annotatedPostsPercentage' ),
90
-			esc_url( admin_url( 'edit.php' ) ),
91
-			$this->render_stat_param( 'annotated_posts' ),
92
-			$this->render_stat_param( 'posts' )
93
-		);
80
+    public function dashboard_widget_callback( $post ) {
81
+        $caption_kses           = array( 'a' => array( 'href' => array() ) );
82
+        $enriched_posts_title   = __( 'enriched posts', 'wordlift' );
83
+        $enriched_posts_caption = sprintf(
84
+            wp_kses(
85
+                /* translators: 1: Percentage of annotated posts, 2: Link to the edit screen, 3: Number of annotated posts, 4: Total posts. */
86
+                __( '%1$s, of your <a href="%2$s">posts</a> are annotated. This means %3$s annotated posts on %4$s.', 'wordlift' ),
87
+                array( 'a' => array( 'href' => array() ) )
88
+            ),
89
+            $this->render_stat_param( 'annotatedPostsPercentage' ),
90
+            esc_url( admin_url( 'edit.php' ) ),
91
+            $this->render_stat_param( 'annotated_posts' ),
92
+            $this->render_stat_param( 'posts' )
93
+        );
94 94
 
95
-		$rating_title   = __( 'average entity rating', 'wordlift' );
96
-		$rating_caption = sprintf(
97
-			wp_kses(
98
-					/* translators: 1: The entities count, 2: The link to the vocabulary, 3: The average rating. */
99
-				__( 'You have %1$s entities in your <a href="%2$s">vocabulary</a> with an average rating of %3$s.', 'wordlift' ),
100
-				array( 'a' => array( 'href' => array() ) )
101
-			),
102
-			$this->render_stat_param( 'entities' ),
103
-			esc_url( admin_url( 'edit.php?post_type=entity' ) ),
104
-			$this->render_stat_param( 'rating' )
105
-		);
95
+        $rating_title   = __( 'average entity rating', 'wordlift' );
96
+        $rating_caption = sprintf(
97
+            wp_kses(
98
+                    /* translators: 1: The entities count, 2: The link to the vocabulary, 3: The average rating. */
99
+                __( 'You have %1$s entities in your <a href="%2$s">vocabulary</a> with an average rating of %3$s.', 'wordlift' ),
100
+                array( 'a' => array( 'href' => array() ) )
101
+            ),
102
+            $this->render_stat_param( 'entities' ),
103
+            esc_url( admin_url( 'edit.php?post_type=entity' ) ),
104
+            $this->render_stat_param( 'rating' )
105
+        );
106 106
 
107
-		$graph_title   = __( 'triples in your graph', 'wordlift' );
108
-		$graph_caption = sprintf(
109
-			wp_kses(
110
-					/* translators: 1: The percentage of the graph size compared to Wikidata, 2: The link to Wikidata. */
111
-				__( 'Your graphs size corresponds to %1$s of <a href="%2$s">Wikidata</a>.', 'wordlift' ),
112
-				array( 'a' => array( 'href' => array() ) )
113
-			),
114
-			$this->render_stat_param( 'wikidata' ),
115
-			esc_url( 'https://www.wikidata.org/' )
116
-		);
107
+        $graph_title   = __( 'triples in your graph', 'wordlift' );
108
+        $graph_caption = sprintf(
109
+            wp_kses(
110
+                    /* translators: 1: The percentage of the graph size compared to Wikidata, 2: The link to Wikidata. */
111
+                __( 'Your graphs size corresponds to %1$s of <a href="%2$s">Wikidata</a>.', 'wordlift' ),
112
+                array( 'a' => array( 'href' => array() ) )
113
+            ),
114
+            $this->render_stat_param( 'wikidata' ),
115
+            esc_url( 'https://www.wikidata.org/' )
116
+        );
117 117
 
118
-		$triples_label = __( 'triples', 'wordlift' );
118
+        $triples_label = __( 'triples', 'wordlift' );
119 119
 
120
-		?>
120
+        ?>
121 121
 		<div id="wl-dashboard-widget-inner-wrapper">
122 122
 			<div class="wl-stat-card">
123 123
 				<div class="wl-stat-graph-wrapper">
@@ -155,112 +155,112 @@  discard block
 block discarded – undo
155 155
 			</div>
156 156
 		</div>
157 157
 		<?php
158
-	}
158
+    }
159 159
 
160
-	/**
161
-	 * Return stats
162
-	 *
163
-	 * @since 3.4.0
164
-	 */
165
-	public function add_dashboard_widgets() {
166
-		wp_add_dashboard_widget(
167
-			'wordlift-dashboard-widget',
168
-			'WordLift Dashboard',
169
-			array(
170
-				$this,
171
-				'dashboard_widget_callback',
172
-			)
173
-		);
174
-	}
160
+    /**
161
+     * Return stats
162
+     *
163
+     * @since 3.4.0
164
+     */
165
+    public function add_dashboard_widgets() {
166
+        wp_add_dashboard_widget(
167
+            'wordlift-dashboard-widget',
168
+            'WordLift Dashboard',
169
+            array(
170
+                $this,
171
+                'dashboard_widget_callback',
172
+            )
173
+        );
174
+    }
175 175
 
176
-	/**
177
-	 * Return stats
178
-	 *
179
-	 * @uses  https://codex.wordpress.org/Function_Reference/set_transient
180
-	 *
181
-	 * @since 3.4.0
182
-	 */
183
-	public function ajax_get_stats() {
176
+    /**
177
+     * Return stats
178
+     *
179
+     * @uses  https://codex.wordpress.org/Function_Reference/set_transient
180
+     *
181
+     * @since 3.4.0
182
+     */
183
+    public function ajax_get_stats() {
184 184
 
185
-		// If needed, the transient is force to reloaded.
186
-		if ( isset( $_GET['force_reload'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
187
-			delete_transient( self::TRANSIENT_NAME );
188
-		}
185
+        // If needed, the transient is force to reloaded.
186
+        if ( isset( $_GET['force_reload'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
187
+            delete_transient( self::TRANSIENT_NAME );
188
+        }
189 189
 
190
-		// Try to retrieve the transient
191
-		$stats = get_transient( self::TRANSIENT_NAME );
190
+        // Try to retrieve the transient
191
+        $stats = get_transient( self::TRANSIENT_NAME );
192 192
 
193
-		if ( ! $stats ) {
194
-			// Calculate stats
195
-			$count_triples = $this->count_triples();
196
-			$stats         = array(
197
-				'entities'        => $this->entity_service->count(),
198
-				'posts'           => $this->count_posts(),
199
-				'annotated_posts' => $this->count_annotated_posts(),
200
-				'triples'         => $count_triples ? $count_triples : '-',
201
-				'rating'          => $this->average_entities_rating(),
202
-			);
203
-			// Cache stats results trough transient
204
-			set_transient( self::TRANSIENT_NAME, $stats, self::TRANSIENT_EXPIRATION );
205
-		}
206
-		// Return stats as json object
207
-		wl_core_send_json( $stats );
208
-	}
193
+        if ( ! $stats ) {
194
+            // Calculate stats
195
+            $count_triples = $this->count_triples();
196
+            $stats         = array(
197
+                'entities'        => $this->entity_service->count(),
198
+                'posts'           => $this->count_posts(),
199
+                'annotated_posts' => $this->count_annotated_posts(),
200
+                'triples'         => $count_triples ? $count_triples : '-',
201
+                'rating'          => $this->average_entities_rating(),
202
+            );
203
+            // Cache stats results trough transient
204
+            set_transient( self::TRANSIENT_NAME, $stats, self::TRANSIENT_EXPIRATION );
205
+        }
206
+        // Return stats as json object
207
+        wl_core_send_json( $stats );
208
+    }
209 209
 
210
-	/**
211
-	 * Calculate total number of published posts
212
-	 *
213
-	 * @uses  https://codex.wordpress.org/it:Riferimento_funzioni/wp_count_posts
214
-	 * @since 3.4.0
215
-	 *
216
-	 * @return int Total number of published posts.
217
-	 */
218
-	public function count_posts() {
210
+    /**
211
+     * Calculate total number of published posts
212
+     *
213
+     * @uses  https://codex.wordpress.org/it:Riferimento_funzioni/wp_count_posts
214
+     * @since 3.4.0
215
+     *
216
+     * @return int Total number of published posts.
217
+     */
218
+    public function count_posts() {
219 219
 
220
-		return (int) wp_count_posts()->publish;
221
-	}
220
+        return (int) wp_count_posts()->publish;
221
+    }
222 222
 
223
-	/**
224
-	 * Calculate total number of annotated published posts
225
-	 *
226
-	 * @return int Total number of annotated published posts.
227
-	 * @since 3.4.0
228
-	 */
229
-	public function count_annotated_posts() {
223
+    /**
224
+     * Calculate total number of annotated published posts
225
+     *
226
+     * @return int Total number of annotated published posts.
227
+     * @since 3.4.0
228
+     */
229
+    public function count_annotated_posts() {
230 230
 
231
-		// Prepare interaction with db
232
-		global $wpdb;
233
-		// Retrieve Wordlift relation instances table name
234
-		// $table_name = wl_core_get_relation_instances_table_name();
235
-		// Calculate sql statement
231
+        // Prepare interaction with db
232
+        global $wpdb;
233
+        // Retrieve Wordlift relation instances table name
234
+        // $table_name = wl_core_get_relation_instances_table_name();
235
+        // Calculate sql statement
236 236
 
237
-		// Perform the query
238
-		return (int) $wpdb->get_var(
239
-			"SELECT COUNT(distinct(p.id)) FROM $wpdb->posts as p JOIN {$wpdb->prefix}wl_relation_instances as r ON p.id = r.subject_id AND p.post_type = 'post' AND p.post_status = 'publish'"
240
-		);
241
-	}
237
+        // Perform the query
238
+        return (int) $wpdb->get_var(
239
+            "SELECT COUNT(distinct(p.id)) FROM $wpdb->posts as p JOIN {$wpdb->prefix}wl_relation_instances as r ON p.id = r.subject_id AND p.post_type = 'post' AND p.post_status = 'publish'"
240
+        );
241
+    }
242 242
 
243
-	/**
244
-	 * Calculate the average entities rating.
245
-	 *
246
-	 * @return int Average entities rating.
247
-	 * @since 3.4.0
248
-	 *
249
-	 * @since 3.20.0 this method is public.
250
-	 */
251
-	public function average_entities_rating() {
243
+    /**
244
+     * Calculate the average entities rating.
245
+     *
246
+     * @return int Average entities rating.
247
+     * @since 3.4.0
248
+     *
249
+     * @since 3.20.0 this method is public.
250
+     */
251
+    public function average_entities_rating() {
252 252
 
253
-		// Prepare interaction with db
254
-		global $wpdb;
253
+        // Prepare interaction with db
254
+        global $wpdb;
255 255
 
256
-		// Perform the query.
257
-		return $this->rating_service->convert_raw_score_to_percentage(
258
-			$wpdb->get_var(
259
-				$wpdb->prepare(
260
-					"SELECT AVG(meta_value) FROM $wpdb->postmeta where meta_key = %s",
261
-					Wordlift_Rating_Service::RATING_RAW_SCORE_META_KEY
262
-				)
263
-			)
264
-		);
265
-	}
256
+        // Perform the query.
257
+        return $this->rating_service->convert_raw_score_to_percentage(
258
+            $wpdb->get_var(
259
+                $wpdb->prepare(
260
+                    "SELECT AVG(meta_value) FROM $wpdb->postmeta where meta_key = %s",
261
+                    Wordlift_Rating_Service::RATING_RAW_SCORE_META_KEY
262
+                )
263
+            )
264
+        );
265
+    }
266 266
 }
Please login to merge, or discard this patch.
src/admin/class-wordlift-entity-type-admin-service.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public function __construct() {
31 31
 
32
-		add_action( 'admin_init', array( $this, 'hide_entity_type_metabox' ) );
32
+		add_action('admin_init', array($this, 'hide_entity_type_metabox'));
33 33
 		add_action(
34 34
 			'admin_init',
35 35
 			array(
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 	public function hide_entity_type_metabox() {
49 49
 
50 50
 		// Bail out if the user can edit entities.
51
-		if ( current_user_can( 'edit_wordlift_entity' ) ) {
51
+		if (current_user_can('edit_wordlift_entity')) {
52 52
 			return;
53 53
 		}
54 54
 
55 55
 		// Loop over all the non entity post types which support entities and turn off the metabox.
56
-		foreach ( $this->get_types_no_entity() as $type ) {
57
-			remove_meta_box( Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME . 'div', $type, 'side' );
56
+		foreach ($this->get_types_no_entity() as $type) {
57
+			remove_meta_box(Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME.'div', $type, 'side');
58 58
 		}
59 59
 
60 60
 	}
@@ -68,16 +68,16 @@  discard block
 block discarded – undo
68 68
 	public function set_filters_to_hide_entity_type_from_lists() {
69 69
 
70 70
 		// Bail out if the user can edit entities.
71
-		if ( current_user_can( 'edit_wordlift_entity' ) ) {
71
+		if (current_user_can('edit_wordlift_entity')) {
72 72
 			return;
73 73
 		}
74 74
 
75 75
 		// Loop over all the non entity post types which support entities and turn off the taxonomy column.
76
-		foreach ( $this->get_types_no_entity() as $type ) {
76
+		foreach ($this->get_types_no_entity() as $type) {
77 77
 			add_filter(
78
-				'manage_taxonomies_for_' . $type . '_columns',
79
-				function ( $taxonomies ) {
80
-					unset( $taxonomies[ Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ] );
78
+				'manage_taxonomies_for_'.$type.'_columns',
79
+				function($taxonomies) {
80
+					unset($taxonomies[Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME]);
81 81
 
82 82
 					return $taxonomies;
83 83
 				}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	private function get_types_no_entity() {
97 97
 
98
-		return array_diff( Wordlift_Entity_Service::valid_entity_post_types(), (array) Wordlift_Entity_Service::TYPE_NAME );
98
+		return array_diff(Wordlift_Entity_Service::valid_entity_post_types(), (array) Wordlift_Entity_Service::TYPE_NAME);
99 99
 	}
100 100
 
101 101
 }
Please login to merge, or discard this patch.
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -20,79 +20,79 @@
 block discarded – undo
20 20
  */
21 21
 class Wordlift_Entity_Type_Admin_Service {
22 22
 
23
-	/**
24
-	 * Create a {@link Wordlift_Entity_List_Service} instance.
25
-	 *
26
-	 * Set up the relevant filters and actions.
27
-	 *
28
-	 * @since 3.15.0
29
-	 */
30
-	public function __construct() {
23
+    /**
24
+     * Create a {@link Wordlift_Entity_List_Service} instance.
25
+     *
26
+     * Set up the relevant filters and actions.
27
+     *
28
+     * @since 3.15.0
29
+     */
30
+    public function __construct() {
31 31
 
32
-		add_action( 'admin_init', array( $this, 'hide_entity_type_metabox' ) );
33
-		add_action(
34
-			'admin_init',
35
-			array(
36
-				$this,
37
-				'set_filters_to_hide_entity_type_from_lists',
38
-			)
39
-		);
40
-	}
32
+        add_action( 'admin_init', array( $this, 'hide_entity_type_metabox' ) );
33
+        add_action(
34
+            'admin_init',
35
+            array(
36
+                $this,
37
+                'set_filters_to_hide_entity_type_from_lists',
38
+            )
39
+        );
40
+    }
41 41
 
42
-	/**
43
-	 * Hide the entity type metabox from non entity edit screens if user is not
44
-	 * allowed to configure entity types.
45
-	 *
46
-	 * @since 3.15.0
47
-	 */
48
-	public function hide_entity_type_metabox() {
42
+    /**
43
+     * Hide the entity type metabox from non entity edit screens if user is not
44
+     * allowed to configure entity types.
45
+     *
46
+     * @since 3.15.0
47
+     */
48
+    public function hide_entity_type_metabox() {
49 49
 
50
-		// Bail out if the user can edit entities.
51
-		if ( current_user_can( 'edit_wordlift_entity' ) ) {
52
-			return;
53
-		}
50
+        // Bail out if the user can edit entities.
51
+        if ( current_user_can( 'edit_wordlift_entity' ) ) {
52
+            return;
53
+        }
54 54
 
55
-		// Loop over all the non entity post types which support entities and turn off the metabox.
56
-		foreach ( $this->get_types_no_entity() as $type ) {
57
-			remove_meta_box( Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME . 'div', $type, 'side' );
58
-		}
59
-	}
55
+        // Loop over all the non entity post types which support entities and turn off the metabox.
56
+        foreach ( $this->get_types_no_entity() as $type ) {
57
+            remove_meta_box( Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME . 'div', $type, 'side' );
58
+        }
59
+    }
60 60
 
61
-	/**
62
-	 * Hide the entity type metabox from non entity list screens if user is not
63
-	 * allowed to configure entity types.
64
-	 *
65
-	 * @since 3.15.0
66
-	 */
67
-	public function set_filters_to_hide_entity_type_from_lists() {
61
+    /**
62
+     * Hide the entity type metabox from non entity list screens if user is not
63
+     * allowed to configure entity types.
64
+     *
65
+     * @since 3.15.0
66
+     */
67
+    public function set_filters_to_hide_entity_type_from_lists() {
68 68
 
69
-		// Bail out if the user can edit entities.
70
-		if ( current_user_can( 'edit_wordlift_entity' ) ) {
71
-			return;
72
-		}
69
+        // Bail out if the user can edit entities.
70
+        if ( current_user_can( 'edit_wordlift_entity' ) ) {
71
+            return;
72
+        }
73 73
 
74
-		// Loop over all the non entity post types which support entities and turn off the taxonomy column.
75
-		foreach ( $this->get_types_no_entity() as $type ) {
76
-			add_filter(
77
-				'manage_taxonomies_for_' . $type . '_columns',
78
-				function ( $taxonomies ) {
79
-					unset( $taxonomies[ Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ] );
74
+        // Loop over all the non entity post types which support entities and turn off the taxonomy column.
75
+        foreach ( $this->get_types_no_entity() as $type ) {
76
+            add_filter(
77
+                'manage_taxonomies_for_' . $type . '_columns',
78
+                function ( $taxonomies ) {
79
+                    unset( $taxonomies[ Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ] );
80 80
 
81
-					return $taxonomies;
82
-				}
83
-			);
84
-		}
85
-	}
81
+                    return $taxonomies;
82
+                }
83
+            );
84
+        }
85
+    }
86 86
 
87
-	/**
88
-	 * Get the types which are not the entity post type.
89
-	 *
90
-	 * @since 3.15.0
91
-	 *
92
-	 * @return array An array of types' names.
93
-	 */
94
-	private function get_types_no_entity() {
87
+    /**
88
+     * Get the types which are not the entity post type.
89
+     *
90
+     * @since 3.15.0
91
+     *
92
+     * @return array An array of types' names.
93
+     */
94
+    private function get_types_no_entity() {
95 95
 
96
-		return array_diff( Wordlift_Entity_Service::valid_entity_post_types(), (array) Wordlift_Entity_Service::TYPE_NAME );
97
-	}
96
+        return array_diff( Wordlift_Entity_Service::valid_entity_post_types(), (array) Wordlift_Entity_Service::TYPE_NAME );
97
+    }
98 98
 }
Please login to merge, or discard this patch.