Completed
Pull Request — develop (#1553)
by Naveen
01:05
created
src/public/class-wordlift-related-entities-cloud-widget.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -16,33 +16,33 @@  discard block
 block discarded – undo
16 16
  */
17 17
 class Wordlift_Related_Entities_Cloud_Widget extends Wordlift_Widget {
18 18
 
19
-	/**
20
-	 * Create an {@link Wordlift_Related_Entities_Cloud_Widget} instance.
21
-	 *
22
-	 * @since 3.11.0
23
-	 */
24
-	public function __construct() {
25
-		parent::__construct(
26
-			'wl_related_entities_cloud',
27
-			__( 'WordLift Entities Cloud', 'wordlift' ),
28
-			array(
29
-				'classname'   => 'wl_related_entities_cloud',
30
-				'description' => __( 'Display entities related to the current post/entity in a tag cloud.', 'wordlift' ),
31
-			)
32
-		);
33
-
34
-	}
35
-
36
-	/**
37
-	 * @inheritdoc
38
-	 */
39
-	public function form( $instance ) {
40
-		$title_id          = $this->get_field_id( 'title' );
41
-		$instance['title'] = ! empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
42
-		?>
19
+    /**
20
+     * Create an {@link Wordlift_Related_Entities_Cloud_Widget} instance.
21
+     *
22
+     * @since 3.11.0
23
+     */
24
+    public function __construct() {
25
+        parent::__construct(
26
+            'wl_related_entities_cloud',
27
+            __( 'WordLift Entities Cloud', 'wordlift' ),
28
+            array(
29
+                'classname'   => 'wl_related_entities_cloud',
30
+                'description' => __( 'Display entities related to the current post/entity in a tag cloud.', 'wordlift' ),
31
+            )
32
+        );
33
+
34
+    }
35
+
36
+    /**
37
+     * @inheritdoc
38
+     */
39
+    public function form( $instance ) {
40
+        $title_id          = $this->get_field_id( 'title' );
41
+        $instance['title'] = ! empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
42
+        ?>
43 43
 
44 44
 		<p><label for="<?php echo esc_attr( $title_id ); ?>"><?php
45
-				esc_html_e( 'Title:' ); ?></label>
45
+                esc_html_e( 'Title:' ); ?></label>
46 46
 			<input type="text" class="widefat"
47 47
 			       id="<?php echo esc_attr( $title_id ); ?>"
48 48
 			       name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
@@ -51,46 +51,46 @@  discard block
 block discarded – undo
51 51
 
52 52
 		<?php
53 53
 
54
-		return 'wl_related_entities_cloud_form';
55
-	}
54
+        return 'wl_related_entities_cloud_form';
55
+    }
56 56
 
57
-	/**
58
-	 * @inheritdoc
59
-	 */
60
-	public function update( $new_instance, $old_instance ) {
57
+    /**
58
+     * @inheritdoc
59
+     */
60
+    public function update( $new_instance, $old_instance ) {
61 61
 
62
-		return array( 'title' => sanitize_text_field( $new_instance['title'] ) );
63
-	}
62
+        return array( 'title' => sanitize_text_field( $new_instance['title'] ) );
63
+    }
64 64
 
65
-	/**
66
-	 * @inheritdoc
67
-	 */
68
-	public function widget( $args, $instance ) {
65
+    /**
66
+     * @inheritdoc
67
+     */
68
+    public function widget( $args, $instance ) {
69 69
 
70
-		/*
70
+        /*
71 71
 		 * Use the shortcode to calculate the HTML required to show the cloud
72 72
 		 * if there is no such html do not render the widget at all.
73 73
 		 */
74
-		$cloud_html = do_shortcode( '[wl_cloud]' );
75
-		if ( empty( $cloud_html ) ) {
76
-			return false;
77
-		}
74
+        $cloud_html = do_shortcode( '[wl_cloud]' );
75
+        if ( empty( $cloud_html ) ) {
76
+            return false;
77
+        }
78 78
 
79
-		// The widget title.
80
-		$title = empty( $instance['title'] ) ? __( 'Related Entities', 'wordlift' ) : $instance['title'];
79
+        // The widget title.
80
+        $title = empty( $instance['title'] ) ? __( 'Related Entities', 'wordlift' ) : $instance['title'];
81 81
 
82
-		// Standard filter all widgets should apply
83
-		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
82
+        // Standard filter all widgets should apply
83
+        $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
84 84
 
85
-		echo $args['before_widget'];
85
+        echo $args['before_widget'];
86 86
 
87
-		if ( $title ) {
88
-			echo $args['before_title'] . $title . $args['after_title'];
89
-		}
87
+        if ( $title ) {
88
+            echo $args['before_title'] . $title . $args['after_title'];
89
+        }
90 90
 
91
-		echo $cloud_html;
92
-		echo $args['after_widget'];
91
+        echo $cloud_html;
92
+        echo $args['after_widget'];
93 93
 
94
-	}
94
+    }
95 95
 
96 96
 }
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 	public function __construct() {
25 25
 		parent::__construct(
26 26
 			'wl_related_entities_cloud',
27
-			__( 'WordLift Entities Cloud', 'wordlift' ),
27
+			__('WordLift Entities Cloud', 'wordlift'),
28 28
 			array(
29 29
 				'classname'   => 'wl_related_entities_cloud',
30
-				'description' => __( 'Display entities related to the current post/entity in a tag cloud.', 'wordlift' ),
30
+				'description' => __('Display entities related to the current post/entity in a tag cloud.', 'wordlift'),
31 31
 			)
32 32
 		);
33 33
 
@@ -36,17 +36,17 @@  discard block
 block discarded – undo
36 36
 	/**
37 37
 	 * @inheritdoc
38 38
 	 */
39
-	public function form( $instance ) {
40
-		$title_id          = $this->get_field_id( 'title' );
41
-		$instance['title'] = ! empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
39
+	public function form($instance) {
40
+		$title_id          = $this->get_field_id('title');
41
+		$instance['title'] = ! empty($instance['title']) ? esc_attr($instance['title']) : '';
42 42
 		?>
43 43
 
44
-		<p><label for="<?php echo esc_attr( $title_id ); ?>"><?php
45
-				esc_html_e( 'Title:' ); ?></label>
44
+		<p><label for="<?php echo esc_attr($title_id); ?>"><?php
45
+				esc_html_e('Title:'); ?></label>
46 46
 			<input type="text" class="widefat"
47
-			       id="<?php echo esc_attr( $title_id ); ?>"
48
-			       name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
49
-			       value="<?php echo esc_attr( $instance['title'] ); ?>" />
47
+			       id="<?php echo esc_attr($title_id); ?>"
48
+			       name="<?php echo esc_attr($this->get_field_name('title')); ?>"
49
+			       value="<?php echo esc_attr($instance['title']); ?>" />
50 50
 		</p>
51 51
 
52 52
 		<?php
@@ -57,35 +57,35 @@  discard block
 block discarded – undo
57 57
 	/**
58 58
 	 * @inheritdoc
59 59
 	 */
60
-	public function update( $new_instance, $old_instance ) {
60
+	public function update($new_instance, $old_instance) {
61 61
 
62
-		return array( 'title' => sanitize_text_field( $new_instance['title'] ) );
62
+		return array('title' => sanitize_text_field($new_instance['title']));
63 63
 	}
64 64
 
65 65
 	/**
66 66
 	 * @inheritdoc
67 67
 	 */
68
-	public function widget( $args, $instance ) {
68
+	public function widget($args, $instance) {
69 69
 
70 70
 		/*
71 71
 		 * Use the shortcode to calculate the HTML required to show the cloud
72 72
 		 * if there is no such html do not render the widget at all.
73 73
 		 */
74
-		$cloud_html = do_shortcode( '[wl_cloud]' );
75
-		if ( empty( $cloud_html ) ) {
74
+		$cloud_html = do_shortcode('[wl_cloud]');
75
+		if (empty($cloud_html)) {
76 76
 			return false;
77 77
 		}
78 78
 
79 79
 		// The widget title.
80
-		$title = empty( $instance['title'] ) ? __( 'Related Entities', 'wordlift' ) : $instance['title'];
80
+		$title = empty($instance['title']) ? __('Related Entities', 'wordlift') : $instance['title'];
81 81
 
82 82
 		// Standard filter all widgets should apply
83
-		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
83
+		$title = apply_filters('widget_title', $title, $instance, $this->id_base);
84 84
 
85 85
 		echo $args['before_widget'];
86 86
 
87
-		if ( $title ) {
88
-			echo $args['before_title'] . $title . $args['after_title'];
87
+		if ($title) {
88
+			echo $args['before_title'].$title.$args['after_title'];
89 89
 		}
90 90
 
91 91
 		echo $cloud_html;
Please login to merge, or discard this patch.
src/includes/class-wordlift-topic-taxonomy-service.php 2 patches
Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -7,174 +7,174 @@
 block discarded – undo
7 7
  */
8 8
 class Wordlift_Topic_Taxonomy_Service {
9 9
 
10
-	/**
11
-	 * The Log service.
12
-	 *
13
-	 * @since 3.5.0
14
-	 * @access private
15
-	 * @var \Wordlift_Log_Service $log_service The Log service.
16
-	 */
17
-	private $log_service;
18
-
19
-	/**
20
-	 * Taxonomy name.
21
-	 *
22
-	 * @since 3.5.0
23
-	 */
24
-	const TAXONOMY_NAME = 'wl_topic';
25
-
26
-	/**
27
-	 * Taxonomy object type.
28
-	 *
29
-	 * @since 3.5.0
30
-	 */
31
-	const TAXONOMY_OBJECT_TYPE = 'post';
32
-
33
-	/**
34
-	 * Taxonomy slug.
35
-	 *
36
-	 * @since 3.5.0
37
-	 */
38
-	const TAXONOMY_SLUG = 'wl_topic';
39
-
40
-	/**
41
-	 * A singleton instance of the Wordlift_Topic_Taxonomy_Service service.
42
-	 *
43
-	 * @since 3.5.0
44
-	 * @access private
45
-	 * @var \Wordlift_Topic_Taxonomy_Service $instance A singleton instance of Wordlift_Topic_Taxonomy_Service.
46
-	 */
47
-	private static $instance;
48
-
49
-	/**
50
-	 * Create a Wordlift_Topic_Taxonomy_Service instance.
51
-	 *
52
-	 * @since 3.5.0
53
-	 *
54
-	 */
55
-	public function __construct() {
56
-
57
-		$this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' );
58
-
59
-		// Set the singleton instance.
60
-		self::$instance = $this;
61
-
62
-	}
63
-
64
-	/**
65
-	 * Get the singleton instance of the Entity service.
66
-	 *
67
-	 * @since 3.5.0
68
-	 * @return Wordlift_Topic_Taxonomy_Service
69
-	 */
70
-	public static function get_instance() {
71
-
72
-		return self::$instance;
73
-	}
74
-
75
-	/**
76
-	 * Just register the topic taxonomy.
77
-	 *
78
-	 * @since 3.5.0
79
-	 *
80
-	 */
81
-	public function init() {
82
-
83
-		// See https://codex.wordpress.org/Function_Reference/register_taxonomy
84
-		$labels = array(
85
-			'name'              => _x( 'Topics', 'taxonomy general name', 'wordlift' ),
86
-			'singular_name'     => _x( 'Topic', 'taxonomy singular name', 'wordlift' ),
87
-			'search_items'      => __( 'Search Topics', 'wordlift' ),
88
-			'all_items'         => __( 'All Topics', 'wordlift' ),
89
-			'parent_item'       => __( 'Parent Topic', 'wordlift' ),
90
-			'parent_item_colon' => __( 'Parent Topic:', 'wordlift' ),
91
-			'edit_item'         => __( 'Edit Topic', 'wordlift' ),
92
-			'update_item'       => __( 'Update Topic', 'wordlift' ),
93
-			'add_new_item'      => __( 'Add New Topic', 'wordlift' ),
94
-			'new_item_name'     => __( 'New Topic', 'wordlift' ),
95
-			'menu_name'         => __( 'Topics', 'wordlift' ),
96
-		);
97
-
98
-		$capabilities = array(
99
-			'manage_terms' => null,
100
-			'edit_terms'   => null,
101
-			'delete_terms' => null,
102
-			'assign_terms' => 'edit_posts',
103
-		);
104
-
105
-		$args = array(
106
-			'labels'            => $labels,
107
-			'capabilities'      => $capabilities,
108
-			'hierarchical'      => true,
109
-			'show_admin_column' => false,
110
-			'show_ui'			=> false,
111
-			'rewrite'			=> array(
112
-				'slug'	=> self::TAXONOMY_SLUG,
113
-			),
114
-		);
115
-
116
-		// Register taxonomy
117
-		register_taxonomy(
118
-			self::TAXONOMY_NAME, self::TAXONOMY_OBJECT_TYPE, $args
119
-		);
120
-
121
-	}
122
-
123
-	/**
124
-	 * Get or create a taxonomy term from a given entity topic.
125
-	 *
126
-	 * @since 3.5.0
127
-	 *
128
-	 */
129
-	public function get_or_create_term_from_topic_entity( $topic ) {
130
-
131
-		// Define taxonomy term slug
132
-		$term_slug = sanitize_title( $topic->post_title );
133
-		// Look for an existing taxonomy term with a given slug
134
-		if ( $term = get_term_by( 'slug', $term_slug, self::TAXONOMY_NAME ) ) {
135
-			return (int) $term->term_id;
136
-		}
137
-		// Otherwise create a new term and return it
138
-		$result = wp_insert_term(
139
-			$topic->post_title,
140
-			self::TAXONOMY_NAME,
141
-			array(
142
-				'slug'			=> $term_slug,
143
-				'description'	=> $topic->post_content,
144
-			)
145
-		);
146
-
147
-		return  (int) $result['term_id'];
148
-	}
149
-
150
-	/**
151
-	 * Set a topic for a given post.
152
-	 *
153
-	 * @since 3.5.0
154
-	 *
155
-	 */
156
-	public function set_topic_for( $post_id, $topic_id ) {
157
-		// Retrieve the topic entity post
158
-		$topic_entity_post = get_post( $topic_id );
159
-		// If current topic does not exist in db false is returned
160
-		if ( null === $topic_entity_post ) {
161
-			return false;
162
-		}
163
-		// Create the proper taxonomy term if needed
164
-		$term_id = $this->get_or_create_term_from_topic_entity( $topic_entity_post );
165
-		// Link the term to the current post
166
-		wp_set_post_terms( $post_id, $term_id, self::TAXONOMY_NAME, false );
167
-		return true;
168
-	}
169
-
170
-	/**
171
-	 * Unlink any topic for a given post.
172
-	 *
173
-	 * @since 3.5.0
174
-	 *
175
-	 */
176
-	public function unlink_topic_for( $post_id ) {
177
-		wp_delete_object_term_relationships( $post_id, self::TAXONOMY_NAME );
178
-	}
10
+    /**
11
+     * The Log service.
12
+     *
13
+     * @since 3.5.0
14
+     * @access private
15
+     * @var \Wordlift_Log_Service $log_service The Log service.
16
+     */
17
+    private $log_service;
18
+
19
+    /**
20
+     * Taxonomy name.
21
+     *
22
+     * @since 3.5.0
23
+     */
24
+    const TAXONOMY_NAME = 'wl_topic';
25
+
26
+    /**
27
+     * Taxonomy object type.
28
+     *
29
+     * @since 3.5.0
30
+     */
31
+    const TAXONOMY_OBJECT_TYPE = 'post';
32
+
33
+    /**
34
+     * Taxonomy slug.
35
+     *
36
+     * @since 3.5.0
37
+     */
38
+    const TAXONOMY_SLUG = 'wl_topic';
39
+
40
+    /**
41
+     * A singleton instance of the Wordlift_Topic_Taxonomy_Service service.
42
+     *
43
+     * @since 3.5.0
44
+     * @access private
45
+     * @var \Wordlift_Topic_Taxonomy_Service $instance A singleton instance of Wordlift_Topic_Taxonomy_Service.
46
+     */
47
+    private static $instance;
48
+
49
+    /**
50
+     * Create a Wordlift_Topic_Taxonomy_Service instance.
51
+     *
52
+     * @since 3.5.0
53
+     *
54
+     */
55
+    public function __construct() {
56
+
57
+        $this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' );
58
+
59
+        // Set the singleton instance.
60
+        self::$instance = $this;
61
+
62
+    }
63
+
64
+    /**
65
+     * Get the singleton instance of the Entity service.
66
+     *
67
+     * @since 3.5.0
68
+     * @return Wordlift_Topic_Taxonomy_Service
69
+     */
70
+    public static function get_instance() {
71
+
72
+        return self::$instance;
73
+    }
74
+
75
+    /**
76
+     * Just register the topic taxonomy.
77
+     *
78
+     * @since 3.5.0
79
+     *
80
+     */
81
+    public function init() {
82
+
83
+        // See https://codex.wordpress.org/Function_Reference/register_taxonomy
84
+        $labels = array(
85
+            'name'              => _x( 'Topics', 'taxonomy general name', 'wordlift' ),
86
+            'singular_name'     => _x( 'Topic', 'taxonomy singular name', 'wordlift' ),
87
+            'search_items'      => __( 'Search Topics', 'wordlift' ),
88
+            'all_items'         => __( 'All Topics', 'wordlift' ),
89
+            'parent_item'       => __( 'Parent Topic', 'wordlift' ),
90
+            'parent_item_colon' => __( 'Parent Topic:', 'wordlift' ),
91
+            'edit_item'         => __( 'Edit Topic', 'wordlift' ),
92
+            'update_item'       => __( 'Update Topic', 'wordlift' ),
93
+            'add_new_item'      => __( 'Add New Topic', 'wordlift' ),
94
+            'new_item_name'     => __( 'New Topic', 'wordlift' ),
95
+            'menu_name'         => __( 'Topics', 'wordlift' ),
96
+        );
97
+
98
+        $capabilities = array(
99
+            'manage_terms' => null,
100
+            'edit_terms'   => null,
101
+            'delete_terms' => null,
102
+            'assign_terms' => 'edit_posts',
103
+        );
104
+
105
+        $args = array(
106
+            'labels'            => $labels,
107
+            'capabilities'      => $capabilities,
108
+            'hierarchical'      => true,
109
+            'show_admin_column' => false,
110
+            'show_ui'			=> false,
111
+            'rewrite'			=> array(
112
+                'slug'	=> self::TAXONOMY_SLUG,
113
+            ),
114
+        );
115
+
116
+        // Register taxonomy
117
+        register_taxonomy(
118
+            self::TAXONOMY_NAME, self::TAXONOMY_OBJECT_TYPE, $args
119
+        );
120
+
121
+    }
122
+
123
+    /**
124
+     * Get or create a taxonomy term from a given entity topic.
125
+     *
126
+     * @since 3.5.0
127
+     *
128
+     */
129
+    public function get_or_create_term_from_topic_entity( $topic ) {
130
+
131
+        // Define taxonomy term slug
132
+        $term_slug = sanitize_title( $topic->post_title );
133
+        // Look for an existing taxonomy term with a given slug
134
+        if ( $term = get_term_by( 'slug', $term_slug, self::TAXONOMY_NAME ) ) {
135
+            return (int) $term->term_id;
136
+        }
137
+        // Otherwise create a new term and return it
138
+        $result = wp_insert_term(
139
+            $topic->post_title,
140
+            self::TAXONOMY_NAME,
141
+            array(
142
+                'slug'			=> $term_slug,
143
+                'description'	=> $topic->post_content,
144
+            )
145
+        );
146
+
147
+        return  (int) $result['term_id'];
148
+    }
149
+
150
+    /**
151
+     * Set a topic for a given post.
152
+     *
153
+     * @since 3.5.0
154
+     *
155
+     */
156
+    public function set_topic_for( $post_id, $topic_id ) {
157
+        // Retrieve the topic entity post
158
+        $topic_entity_post = get_post( $topic_id );
159
+        // If current topic does not exist in db false is returned
160
+        if ( null === $topic_entity_post ) {
161
+            return false;
162
+        }
163
+        // Create the proper taxonomy term if needed
164
+        $term_id = $this->get_or_create_term_from_topic_entity( $topic_entity_post );
165
+        // Link the term to the current post
166
+        wp_set_post_terms( $post_id, $term_id, self::TAXONOMY_NAME, false );
167
+        return true;
168
+    }
169
+
170
+    /**
171
+     * Unlink any topic for a given post.
172
+     *
173
+     * @since 3.5.0
174
+     *
175
+     */
176
+    public function unlink_topic_for( $post_id ) {
177
+        wp_delete_object_term_relationships( $post_id, self::TAXONOMY_NAME );
178
+    }
179 179
 
180 180
 }
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function __construct() {
56 56
 
57
-		$this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' );
57
+		$this->log_service = Wordlift_Log_Service::get_logger('Wordlift_Entity_Service');
58 58
 
59 59
 		// Set the singleton instance.
60 60
 		self::$instance = $this;
@@ -82,17 +82,17 @@  discard block
 block discarded – undo
82 82
 
83 83
 		// See https://codex.wordpress.org/Function_Reference/register_taxonomy
84 84
 		$labels = array(
85
-			'name'              => _x( 'Topics', 'taxonomy general name', 'wordlift' ),
86
-			'singular_name'     => _x( 'Topic', 'taxonomy singular name', 'wordlift' ),
87
-			'search_items'      => __( 'Search Topics', 'wordlift' ),
88
-			'all_items'         => __( 'All Topics', 'wordlift' ),
89
-			'parent_item'       => __( 'Parent Topic', 'wordlift' ),
90
-			'parent_item_colon' => __( 'Parent Topic:', 'wordlift' ),
91
-			'edit_item'         => __( 'Edit Topic', 'wordlift' ),
92
-			'update_item'       => __( 'Update Topic', 'wordlift' ),
93
-			'add_new_item'      => __( 'Add New Topic', 'wordlift' ),
94
-			'new_item_name'     => __( 'New Topic', 'wordlift' ),
95
-			'menu_name'         => __( 'Topics', 'wordlift' ),
85
+			'name'              => _x('Topics', 'taxonomy general name', 'wordlift'),
86
+			'singular_name'     => _x('Topic', 'taxonomy singular name', 'wordlift'),
87
+			'search_items'      => __('Search Topics', 'wordlift'),
88
+			'all_items'         => __('All Topics', 'wordlift'),
89
+			'parent_item'       => __('Parent Topic', 'wordlift'),
90
+			'parent_item_colon' => __('Parent Topic:', 'wordlift'),
91
+			'edit_item'         => __('Edit Topic', 'wordlift'),
92
+			'update_item'       => __('Update Topic', 'wordlift'),
93
+			'add_new_item'      => __('Add New Topic', 'wordlift'),
94
+			'new_item_name'     => __('New Topic', 'wordlift'),
95
+			'menu_name'         => __('Topics', 'wordlift'),
96 96
 		);
97 97
 
98 98
 		$capabilities = array(
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
 	 * @since 3.5.0
127 127
 	 *
128 128
 	 */
129
-	public function get_or_create_term_from_topic_entity( $topic ) {
129
+	public function get_or_create_term_from_topic_entity($topic) {
130 130
 
131 131
 		// Define taxonomy term slug
132
-		$term_slug = sanitize_title( $topic->post_title );
132
+		$term_slug = sanitize_title($topic->post_title);
133 133
 		// Look for an existing taxonomy term with a given slug
134
-		if ( $term = get_term_by( 'slug', $term_slug, self::TAXONOMY_NAME ) ) {
134
+		if ($term = get_term_by('slug', $term_slug, self::TAXONOMY_NAME)) {
135 135
 			return (int) $term->term_id;
136 136
 		}
137 137
 		// Otherwise create a new term and return it
@@ -153,17 +153,17 @@  discard block
 block discarded – undo
153 153
 	 * @since 3.5.0
154 154
 	 *
155 155
 	 */
156
-	public function set_topic_for( $post_id, $topic_id ) {
156
+	public function set_topic_for($post_id, $topic_id) {
157 157
 		// Retrieve the topic entity post
158
-		$topic_entity_post = get_post( $topic_id );
158
+		$topic_entity_post = get_post($topic_id);
159 159
 		// If current topic does not exist in db false is returned
160
-		if ( null === $topic_entity_post ) {
160
+		if (null === $topic_entity_post) {
161 161
 			return false;
162 162
 		}
163 163
 		// Create the proper taxonomy term if needed
164
-		$term_id = $this->get_or_create_term_from_topic_entity( $topic_entity_post );
164
+		$term_id = $this->get_or_create_term_from_topic_entity($topic_entity_post);
165 165
 		// Link the term to the current post
166
-		wp_set_post_terms( $post_id, $term_id, self::TAXONOMY_NAME, false );
166
+		wp_set_post_terms($post_id, $term_id, self::TAXONOMY_NAME, false);
167 167
 		return true;
168 168
 	}
169 169
 
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	 * @since 3.5.0
174 174
 	 *
175 175
 	 */
176
-	public function unlink_topic_for( $post_id ) {
177
-		wp_delete_object_term_relationships( $post_id, self::TAXONOMY_NAME );
176
+	public function unlink_topic_for($post_id) {
177
+		wp_delete_object_term_relationships($post_id, self::TAXONOMY_NAME);
178 178
 	}
179 179
 
180 180
 }
Please login to merge, or discard this patch.
src/includes/class-wordlift-newrelic-adapter.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -16,20 +16,20 @@
 block discarded – undo
16 16
  */
17 17
 class Wordlift_NewRelic_Adapter {
18 18
 
19
-	/**
20
-	 * Tell NewRelic to ignore this "transaction" for the Apdex.
21
-	 *
22
-	 * @see   https://github.com/insideout10/wordlift-plugin/issues/521
23
-	 *
24
-	 * @since 3.11.3
25
-	 */
26
-	static function ignore_apdex() {
19
+    /**
20
+     * Tell NewRelic to ignore this "transaction" for the Apdex.
21
+     *
22
+     * @see   https://github.com/insideout10/wordlift-plugin/issues/521
23
+     *
24
+     * @since 3.11.3
25
+     */
26
+    static function ignore_apdex() {
27 27
 
28
-		// Ensure PHP agent and the function are available.
29
-		if ( extension_loaded( 'newrelic' ) && function_exists( 'newrelic_ignore_apdex' ) ) {
30
-			newrelic_ignore_apdex();
31
-		}
28
+        // Ensure PHP agent and the function are available.
29
+        if ( extension_loaded( 'newrelic' ) && function_exists( 'newrelic_ignore_apdex' ) ) {
30
+            newrelic_ignore_apdex();
31
+        }
32 32
 
33
-	}
33
+    }
34 34
 
35 35
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 	static function ignore_apdex() {
27 27
 
28 28
 		// Ensure PHP agent and the function are available.
29
-		if ( extension_loaded( 'newrelic' ) && function_exists( 'newrelic_ignore_apdex' ) ) {
29
+		if (extension_loaded('newrelic') && function_exists('newrelic_ignore_apdex')) {
30 30
 			newrelic_ignore_apdex();
31 31
 		}
32 32
 
Please login to merge, or discard this patch.
src/admin/class-wordlift-admin-entity-taxonomy-list-page.php 2 patches
Indentation   +109 added lines, -109 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,113 +28,113 @@  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
-	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
-	 * @param int    $user_id The user ID.
70
-	 * @param array  $args    Adds the context to the cap. Typically the object ID.
71
-	 *
72
-	 * @return array    Array containing the do_not_allow capability for super admin
73
-	 *                  when editing and deleting entity type terms capabilities
74
-	 *                    are being "approved"
75
-	 */
76
-	function restrict_super_admin( $caps, $cap, $user_id, $args ) {
77
-
78
-		switch ( $cap ) {
79
-			case 'wl_entity_type_edit_term':
80
-			case 'wl_entity_type_delete_term':
81
-				$caps[] = 'do_not_allow';
82
-		}
83
-
84
-		return $caps;
85
-	}
86
-
87
-	/**
88
-	 * Override the capabilities related to managing the entity type terms
89
-	 * required for WordPress < 4.7 to get access to the admin page.
90
-	 *
91
-	 * Before 4.7, WordPress checks whether the user has permission to access
92
-	 * the `edit-tags.php` page. So we need to provide temporary the permission
93
-	 * otherwise the user will get an `access not allowed` when trying to access
94
-	 * the page.
95
-	 *
96
-	 * @see   https://github.com/insideout10/wordlift-plugin/issues/512
97
-	 *
98
-	 * @since 3.12.0
99
-	 *
100
-	 * @param array  $caps    The user's current capabilities.
101
-	 * @param string $cap     Capability name.
102
-	 * @param int    $user_id The user ID.
103
-	 * @param array  $args    Adds the context to the cap. Typically the object ID.
104
-	 *
105
-	 * @return array    Array containing the manage_options capability
106
-	 */
107
-	function enable_admin_access_pre_47( $caps, $cap, $user_id, $args ) {
108
-
109
-		// Bail out if we're not dealing with the `wl_entity_type_edit_term`
110
-		// capability.
111
-		if ( 'wl_entity_type_edit_term' !== $cap ) {
112
-			return $caps;
113
-		}
114
-
115
-		$path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
116
-
117
-		// Bail out if the `path` cannot be determined.
118
-		if ( null === $path ) {
119
-			return $caps;
120
-		}
121
-
122
-		// Bail out if a specific term is being handled.
123
-		if ( isset( $_REQUEST['action'] ) ) {
124
-			return $caps;
125
-		}
126
-
127
-		// Split the path and check if the page is the `edit-tags.php`. We can't
128
-		// use WP's own function because this is called very early.
129
-		$components = explode( '/', $path );
130
-		if ( 'edit-tags.php' !== $components[ count( $components ) - 1 ] ) {
131
-			return $caps;
132
-		}
133
-
134
-		// Give permission to the user.
135
-		$mapped[] = 'manage_options';
136
-
137
-		return $mapped;
138
-	}
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
+    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
+     * @param int    $user_id The user ID.
70
+     * @param array  $args    Adds the context to the cap. Typically the object ID.
71
+     *
72
+     * @return array    Array containing the do_not_allow capability for super admin
73
+     *                  when editing and deleting entity type terms capabilities
74
+     *                    are being "approved"
75
+     */
76
+    function restrict_super_admin( $caps, $cap, $user_id, $args ) {
77
+
78
+        switch ( $cap ) {
79
+            case 'wl_entity_type_edit_term':
80
+            case 'wl_entity_type_delete_term':
81
+                $caps[] = 'do_not_allow';
82
+        }
83
+
84
+        return $caps;
85
+    }
86
+
87
+    /**
88
+     * Override the capabilities related to managing the entity type terms
89
+     * required for WordPress < 4.7 to get access to the admin page.
90
+     *
91
+     * Before 4.7, WordPress checks whether the user has permission to access
92
+     * the `edit-tags.php` page. So we need to provide temporary the permission
93
+     * otherwise the user will get an `access not allowed` when trying to access
94
+     * the page.
95
+     *
96
+     * @see   https://github.com/insideout10/wordlift-plugin/issues/512
97
+     *
98
+     * @since 3.12.0
99
+     *
100
+     * @param array  $caps    The user's current capabilities.
101
+     * @param string $cap     Capability name.
102
+     * @param int    $user_id The user ID.
103
+     * @param array  $args    Adds the context to the cap. Typically the object ID.
104
+     *
105
+     * @return array    Array containing the manage_options capability
106
+     */
107
+    function enable_admin_access_pre_47( $caps, $cap, $user_id, $args ) {
108
+
109
+        // Bail out if we're not dealing with the `wl_entity_type_edit_term`
110
+        // capability.
111
+        if ( 'wl_entity_type_edit_term' !== $cap ) {
112
+            return $caps;
113
+        }
114
+
115
+        $path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
116
+
117
+        // Bail out if the `path` cannot be determined.
118
+        if ( null === $path ) {
119
+            return $caps;
120
+        }
121
+
122
+        // Bail out if a specific term is being handled.
123
+        if ( isset( $_REQUEST['action'] ) ) {
124
+            return $caps;
125
+        }
126
+
127
+        // Split the path and check if the page is the `edit-tags.php`. We can't
128
+        // use WP's own function because this is called very early.
129
+        $components = explode( '/', $path );
130
+        if ( 'edit-tags.php' !== $components[ count( $components ) - 1 ] ) {
131
+            return $caps;
132
+        }
133
+
134
+        // Give permission to the user.
135
+        $mapped[] = 'manage_options';
136
+
137
+        return $mapped;
138
+    }
139 139
 
140 140
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 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
-	function wl_entity_type_row_actions( $actions, $term ) {
46
+	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
 	}
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
 	 *                  when editing and deleting entity type terms capabilities
74 74
 	 *                    are being "approved"
75 75
 	 */
76
-	function restrict_super_admin( $caps, $cap, $user_id, $args ) {
76
+	function restrict_super_admin($caps, $cap, $user_id, $args) {
77 77
 
78
-		switch ( $cap ) {
78
+		switch ($cap) {
79 79
 			case 'wl_entity_type_edit_term':
80 80
 			case 'wl_entity_type_delete_term':
81 81
 				$caps[] = 'do_not_allow';
@@ -104,30 +104,30 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @return array    Array containing the manage_options capability
106 106
 	 */
107
-	function enable_admin_access_pre_47( $caps, $cap, $user_id, $args ) {
107
+	function enable_admin_access_pre_47($caps, $cap, $user_id, $args) {
108 108
 
109 109
 		// Bail out if we're not dealing with the `wl_entity_type_edit_term`
110 110
 		// capability.
111
-		if ( 'wl_entity_type_edit_term' !== $cap ) {
111
+		if ('wl_entity_type_edit_term' !== $cap) {
112 112
 			return $caps;
113 113
 		}
114 114
 
115
-		$path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
115
+		$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
116 116
 
117 117
 		// Bail out if the `path` cannot be determined.
118
-		if ( null === $path ) {
118
+		if (null === $path) {
119 119
 			return $caps;
120 120
 		}
121 121
 
122 122
 		// Bail out if a specific term is being handled.
123
-		if ( isset( $_REQUEST['action'] ) ) {
123
+		if (isset($_REQUEST['action'])) {
124 124
 			return $caps;
125 125
 		}
126 126
 
127 127
 		// Split the path and check if the page is the `edit-tags.php`. We can't
128 128
 		// use WP's own function because this is called very early.
129
-		$components = explode( '/', $path );
130
-		if ( 'edit-tags.php' !== $components[ count( $components ) - 1 ] ) {
129
+		$components = explode('/', $path);
130
+		if ('edit-tags.php' !== $components[count($components) - 1]) {
131 131
 			return $caps;
132 132
 		}
133 133
 
Please login to merge, or discard this patch.
src/modules/configuration/wordlift_configuration_settings.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 function wl_configuration_get_key() {
13 13
 
14
-	return Wordlift_Configuration_Service::get_instance()->get_key();
14
+    return Wordlift_Configuration_Service::get_instance()->get_key();
15 15
 }
16 16
 
17 17
 /**
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  */
27 27
 function wl_configuration_get_redlink_dataset_uri() {
28 28
 
29
-	return Wordlift_Configuration_Service::get_instance()->get_dataset_uri();
29
+    return Wordlift_Configuration_Service::get_instance()->get_dataset_uri();
30 30
 }
31 31
 
32 32
 /**
@@ -41,16 +41,16 @@  discard block
 block discarded – undo
41 41
  */
42 42
 function wl_configuration_get_analyzer_url() {
43 43
 
44
-	// If the WordLift Key is set, we use WordLift.
45
-	$key = Wordlift_Configuration_Service::get_instance()->get_key();
44
+    // If the WordLift Key is set, we use WordLift.
45
+    $key = Wordlift_Configuration_Service::get_instance()->get_key();
46 46
 
47
-	// Return a NULL URL if the key isn't set.
48
-	if ( empty( $key ) ) {
49
-		return null;
50
-	}
47
+    // Return a NULL URL if the key isn't set.
48
+    if ( empty( $key ) ) {
49
+        return null;
50
+    }
51 51
 
52
-	return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "analyses?key=$key"
53
-	       . ( defined( 'WL_EXCLUDE_IMAGES_REGEX' ) ? '&exclimage=' . urlencode( WL_EXCLUDE_IMAGES_REGEX ) : '' );
52
+    return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "analyses?key=$key"
53
+            . ( defined( 'WL_EXCLUDE_IMAGES_REGEX' ) ? '&exclimage=' . urlencode( WL_EXCLUDE_IMAGES_REGEX ) : '' );
54 54
 
55 55
 }
56 56
 
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
  */
64 64
 function wl_configuration_get_query_select_url() {
65 65
 
66
-	// If the WordLift Key is set, we use WordLift.
67
-	$key = Wordlift_Configuration_Service::get_instance()->get_key();
66
+    // If the WordLift Key is set, we use WordLift.
67
+    $key = Wordlift_Configuration_Service::get_instance()->get_key();
68 68
 
69
-	if ( empty( $key ) ) {
70
-		return null;
71
-	}
69
+    if ( empty( $key ) ) {
70
+        return null;
71
+    }
72 72
 
73
-	return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "datasets/key=$key/queries?q=";
73
+    return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "datasets/key=$key/queries?q=";
74 74
 }
75 75
 
76 76
 /**
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
  */
83 83
 function wl_configuration_get_query_update_url() {
84 84
 
85
-	// If the WordLift Key is set, we use WordLift.
86
-	$key = Wordlift_Configuration_Service::get_instance()->get_key();
87
-	if ( empty( $key ) ) {
88
-		return null;
89
-	}
85
+    // If the WordLift Key is set, we use WordLift.
86
+    $key = Wordlift_Configuration_Service::get_instance()->get_key();
87
+    if ( empty( $key ) ) {
88
+        return null;
89
+    }
90 90
 
91
-	return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "datasets/key=$key/queries";
91
+    return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "datasets/key=$key/queries";
92 92
 }
93 93
 
94 94
 
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
  */
102 102
 function wl_configuration_get_dataset_index_url() {
103 103
 
104
-	// If the WordLift Key is set, we use WordLift.
105
-	$key = Wordlift_Configuration_Service::get_instance()->get_key();
106
-	if ( empty( $key ) ) {
107
-		return null;
108
-	}
104
+    // If the WordLift Key is set, we use WordLift.
105
+    $key = Wordlift_Configuration_Service::get_instance()->get_key();
106
+    if ( empty( $key ) ) {
107
+        return null;
108
+    }
109 109
 
110
-	return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "datasets/key=$key/index";
110
+    return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "datasets/key=$key/index";
111 111
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
 	$key = Wordlift_Configuration_Service::get_instance()->get_key();
46 46
 
47 47
 	// Return a NULL URL if the key isn't set.
48
-	if ( empty( $key ) ) {
48
+	if (empty($key)) {
49 49
 		return null;
50 50
 	}
51 51
 
52
-	return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "analyses?key=$key"
53
-	       . ( defined( 'WL_EXCLUDE_IMAGES_REGEX' ) ? '&exclimage=' . urlencode( WL_EXCLUDE_IMAGES_REGEX ) : '' );
52
+	return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE."analyses?key=$key"
53
+	       . (defined('WL_EXCLUDE_IMAGES_REGEX') ? '&exclimage='.urlencode(WL_EXCLUDE_IMAGES_REGEX) : '');
54 54
 
55 55
 }
56 56
 
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 	// If the WordLift Key is set, we use WordLift.
67 67
 	$key = Wordlift_Configuration_Service::get_instance()->get_key();
68 68
 
69
-	if ( empty( $key ) ) {
69
+	if (empty($key)) {
70 70
 		return null;
71 71
 	}
72 72
 
73
-	return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "datasets/key=$key/queries?q=";
73
+	return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE."datasets/key=$key/queries?q=";
74 74
 }
75 75
 
76 76
 /**
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
 
85 85
 	// If the WordLift Key is set, we use WordLift.
86 86
 	$key = Wordlift_Configuration_Service::get_instance()->get_key();
87
-	if ( empty( $key ) ) {
87
+	if (empty($key)) {
88 88
 		return null;
89 89
 	}
90 90
 
91
-	return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "datasets/key=$key/queries";
91
+	return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE."datasets/key=$key/queries";
92 92
 }
93 93
 
94 94
 
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
 
104 104
 	// If the WordLift Key is set, we use WordLift.
105 105
 	$key = Wordlift_Configuration_Service::get_instance()->get_key();
106
-	if ( empty( $key ) ) {
106
+	if (empty($key)) {
107 107
 		return null;
108 108
 	}
109 109
 
110
-	return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "datasets/key=$key/index";
110
+	return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE."datasets/key=$key/index";
111 111
 }
Please login to merge, or discard this patch.
src/includes/class-wordlift-sample-data-ajax-adapter.php 2 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -17,58 +17,58 @@
 block discarded – undo
17 17
  */
18 18
 class Wordlift_Sample_Data_Ajax_Adapter {
19 19
 
20
-	/**
21
-	 * The {@link Wordlift_Sample_Data_Service} instance.
22
-	 *
23
-	 * @since  3.12.0
24
-	 * @access private
25
-	 * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance.
26
-	 */
27
-	private $sample_data_service;
20
+    /**
21
+     * The {@link Wordlift_Sample_Data_Service} instance.
22
+     *
23
+     * @since  3.12.0
24
+     * @access private
25
+     * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance.
26
+     */
27
+    private $sample_data_service;
28 28
 
29
-	/**
30
-	 * Create a {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
31
-	 *
32
-	 * @since 3.12.0
33
-	 *
34
-	 * @param \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance.
35
-	 */
36
-	function __construct( $sample_data_service ) {
29
+    /**
30
+     * Create a {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
31
+     *
32
+     * @since 3.12.0
33
+     *
34
+     * @param \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance.
35
+     */
36
+    function __construct( $sample_data_service ) {
37 37
 
38
-		$this->sample_data_service = $sample_data_service;
38
+        $this->sample_data_service = $sample_data_service;
39 39
 
40
-	}
40
+    }
41 41
 
42
-	/**
43
-	 * Handle the `wl_sample_data_create` ajax action.
44
-	 *
45
-	 * @since 3.12.0
46
-	 */
47
-	function create() {
42
+    /**
43
+     * Handle the `wl_sample_data_create` ajax action.
44
+     *
45
+     * @since 3.12.0
46
+     */
47
+    function create() {
48 48
 
49
-		// Clean any potential garbage before us.
50
-		ob_clean();
49
+        // Clean any potential garbage before us.
50
+        ob_clean();
51 51
 
52
-		// Create the sample data.
53
-		$this->sample_data_service->create();
52
+        // Create the sample data.
53
+        $this->sample_data_service->create();
54 54
 
55
-		// Send success.
56
-		wp_send_json_success();
55
+        // Send success.
56
+        wp_send_json_success();
57 57
 
58
-	}
58
+    }
59 59
 
60
-	function delete() {
60
+    function delete() {
61 61
 
62
-		// Clean any potential garbage before us.
63
-		ob_clean();
62
+        // Clean any potential garbage before us.
63
+        ob_clean();
64 64
 
65
-		// Create the sample data.
66
-		$this->sample_data_service->delete();
65
+        // Create the sample data.
66
+        $this->sample_data_service->delete();
67 67
 
68
-		// Send success.
69
-		@header( 'Content-Disposition: inline' );
70
-		wp_send_json_success();
68
+        // Send success.
69
+        @header( 'Content-Disposition: inline' );
70
+        wp_send_json_success();
71 71
 
72
-	}
72
+    }
73 73
 
74 74
 }
75 75
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 *
34 34
 	 * @param \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance.
35 35
 	 */
36
-	function __construct( $sample_data_service ) {
36
+	function __construct($sample_data_service) {
37 37
 
38 38
 		$this->sample_data_service = $sample_data_service;
39 39
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		$this->sample_data_service->delete();
67 67
 
68 68
 		// Send success.
69
-		@header( 'Content-Disposition: inline' );
69
+		@header('Content-Disposition: inline');
70 70
 		wp_send_json_success();
71 71
 
72 72
 	}
Please login to merge, or discard this patch.
src/modules/core/wordlift_core_functions.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@
 block discarded – undo
7 7
  * @param mixed $response The response to send to the client as JSON.
8 8
  */
9 9
 function wl_core_send_json( $response ) {
10
-	if ( ob_get_contents() ) {
11
-		ob_clean();
12
-	}
10
+    if ( ob_get_contents() ) {
11
+        ob_clean();
12
+    }
13 13
 
14
-	wp_send_json( $response );
14
+    wp_send_json( $response );
15 15
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,10 +6,10 @@
 block discarded – undo
6 6
  *
7 7
  * @param mixed $response The response to send to the client as JSON.
8 8
  */
9
-function wl_core_send_json( $response ) {
10
-	if ( ob_get_contents() ) {
9
+function wl_core_send_json($response) {
10
+	if (ob_get_contents()) {
11 11
 		ob_clean();
12 12
 	}
13 13
 
14
-	wp_send_json( $response );
14
+	wp_send_json($response);
15 15
 }
Please login to merge, or discard this patch.
src/modules/core/wordlift_core_schema_api.php 2 patches
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -17,34 +17,34 @@  discard block
 block discarded – undo
17 17
  */
18 18
 function wl_schema_get_value( $post_id, $property_name ) {
19 19
 
20
-	// Property name must be defined.
21
-	if ( ! isset( $property_name ) || is_null( $property_name ) ) {
22
-		return null;
23
-	}
24
-
25
-	// store eventual schema name in  different variable
26
-	$property_schema_name = wl_build_full_schema_uri_from_schema_slug( $property_name );
27
-
28
-	// Establish entity id.
29
-	if ( is_null( $post_id ) || ! is_numeric( $post_id ) ) {
30
-		$post_id = get_the_ID();
31
-		if ( is_null( $post_id ) || ! is_numeric( $post_id ) ) {
32
-			return null;
33
-		}
34
-	}
35
-
36
-	// Get custom fields.
37
-	$term_mapping = wl_entity_taxonomy_get_custom_fields( $post_id );
38
-	// Search for the required meta value (by constant name or schema name)
39
-	foreach ( $term_mapping as $wl_constant => $property_info ) {
40
-		$found_constant  = ( $wl_constant == $property_name );
41
-		$found_predicate = ( isset( $property_info['predicate'] ) && $property_info['predicate'] == $property_schema_name );
42
-		if ( $found_constant || $found_predicate ) {
43
-			return get_post_meta( $post_id, $wl_constant );
44
-		}
45
-	}
46
-
47
-	return null;
20
+    // Property name must be defined.
21
+    if ( ! isset( $property_name ) || is_null( $property_name ) ) {
22
+        return null;
23
+    }
24
+
25
+    // store eventual schema name in  different variable
26
+    $property_schema_name = wl_build_full_schema_uri_from_schema_slug( $property_name );
27
+
28
+    // Establish entity id.
29
+    if ( is_null( $post_id ) || ! is_numeric( $post_id ) ) {
30
+        $post_id = get_the_ID();
31
+        if ( is_null( $post_id ) || ! is_numeric( $post_id ) ) {
32
+            return null;
33
+        }
34
+    }
35
+
36
+    // Get custom fields.
37
+    $term_mapping = wl_entity_taxonomy_get_custom_fields( $post_id );
38
+    // Search for the required meta value (by constant name or schema name)
39
+    foreach ( $term_mapping as $wl_constant => $property_info ) {
40
+        $found_constant  = ( $wl_constant == $property_name );
41
+        $found_predicate = ( isset( $property_info['predicate'] ) && $property_info['predicate'] == $property_schema_name );
42
+        if ( $found_constant || $found_predicate ) {
43
+            return get_post_meta( $post_id, $wl_constant );
44
+        }
45
+    }
46
+
47
+    return null;
48 48
 }
49 49
 
50 50
 /**
@@ -58,38 +58,38 @@  discard block
 block discarded – undo
58 58
  */
59 59
 function wl_schema_set_value( $post_id, $property_name, $property_value ) {
60 60
 
61
-	// Some checks on the parameters
62
-	if ( ! is_numeric( $post_id ) || is_null( $property_name ) || empty( $property_value ) || is_null( $property_value ) ) {
63
-		return false;
64
-	}
61
+    // Some checks on the parameters
62
+    if ( ! is_numeric( $post_id ) || is_null( $property_name ) || empty( $property_value ) || is_null( $property_value ) ) {
63
+        return false;
64
+    }
65 65
 
66
-	// Build full schema uri if necessary
67
-	$property_name = wl_build_full_schema_uri_from_schema_slug( $property_name );
66
+    // Build full schema uri if necessary
67
+    $property_name = wl_build_full_schema_uri_from_schema_slug( $property_name );
68 68
 
69
-	// Get accepted properties
70
-	$accepted_fields = wl_entity_taxonomy_get_custom_fields( $post_id );
69
+    // Get accepted properties
70
+    $accepted_fields = wl_entity_taxonomy_get_custom_fields( $post_id );
71 71
 
72
-	// Find the name of the custom-field managing the schema property
73
-	foreach ( $accepted_fields as $wl_constant => $field ) {
74
-		if ( $field['predicate'] == $property_name ) {
72
+    // Find the name of the custom-field managing the schema property
73
+    foreach ( $accepted_fields as $wl_constant => $field ) {
74
+        if ( $field['predicate'] == $property_name ) {
75 75
 
76
-			// Deal with single values
77
-			if ( ! is_array( $property_value ) ) {
78
-				$property_value = array( $property_value );
79
-			}
76
+            // Deal with single values
77
+            if ( ! is_array( $property_value ) ) {
78
+                $property_value = array( $property_value );
79
+            }
80 80
 
81
-			// Delete present meta
82
-			delete_post_meta( $post_id, $wl_constant );
81
+            // Delete present meta
82
+            delete_post_meta( $post_id, $wl_constant );
83 83
 
84
-			foreach ( $property_value as $value ) {
85
-				add_post_meta( $post_id, $wl_constant, $value );
86
-			}
84
+            foreach ( $property_value as $value ) {
85
+                add_post_meta( $post_id, $wl_constant, $value );
86
+            }
87 87
 
88
-			return true;
89
-		}
90
-	}
88
+            return true;
89
+        }
90
+    }
91 91
 
92
-	return false;
92
+    return false;
93 93
 }
94 94
 
95 95
 /**
@@ -102,18 +102,18 @@  discard block
 block discarded – undo
102 102
  */
103 103
 function wl_schema_get_types( $post_id ) {
104 104
 
105
-	// Some checks on the parameters
106
-	if ( ! is_numeric( $post_id ) ) {
107
-		return null;
108
-	}
105
+    // Some checks on the parameters
106
+    if ( ! is_numeric( $post_id ) ) {
107
+        return null;
108
+    }
109 109
 
110
-	$type = Wordlift_Entity_Type_Service::get_instance()->get( $post_id );
110
+    $type = Wordlift_Entity_Type_Service::get_instance()->get( $post_id );
111 111
 
112
-	if ( isset( $type['uri'] ) ) {
113
-		return array( $type['uri'] );
114
-	}
112
+    if ( isset( $type['uri'] ) ) {
113
+        return array( $type['uri'] );
114
+    }
115 115
 
116
-	return null;
116
+    return null;
117 117
 }
118 118
 
119 119
 /**
@@ -126,21 +126,21 @@  discard block
 block discarded – undo
126 126
  */
127 127
 function wl_schema_set_types( $post_id, $type_names ) {
128 128
 
129
-	// Some checks on the parameters
130
-	if ( ! is_numeric( $post_id ) || empty( $type_names ) || is_null( $type_names ) ) {
131
-		return null;
132
-	}
129
+    // Some checks on the parameters
130
+    if ( ! is_numeric( $post_id ) || empty( $type_names ) || is_null( $type_names ) ) {
131
+        return null;
132
+    }
133 133
 
134
-	// TODO: support more than one type.
135
-	if ( is_array( $type_names ) ) {
136
-		$type_names = $type_names[0];
137
-	}
134
+    // TODO: support more than one type.
135
+    if ( is_array( $type_names ) ) {
136
+        $type_names = $type_names[0];
137
+    }
138 138
 
139
-	// Get the schema URI (e.g. http://schema.org/Thing)
140
-	$type_names = wl_build_full_schema_uri_from_schema_slug( $type_names );
139
+    // Get the schema URI (e.g. http://schema.org/Thing)
140
+    $type_names = wl_build_full_schema_uri_from_schema_slug( $type_names );
141 141
 
142
-	// Actually sets the taxonomy type
143
-	wl_set_entity_main_type( $post_id, $type_names );
142
+    // Actually sets the taxonomy type
143
+    wl_set_entity_main_type( $post_id, $type_names );
144 144
 
145 145
 }
146 146
 
@@ -153,11 +153,11 @@  discard block
 block discarded – undo
153 153
  */
154 154
 function wl_build_full_schema_uri_from_schema_slug( $schema_name ) {
155 155
 
156
-	$schema_root_address = 'http://schema.org/';
156
+    $schema_root_address = 'http://schema.org/';
157 157
 
158
-	if ( strpos( $schema_name, $schema_root_address ) === false ) {   // === necessary
159
-		$schema_name = $schema_root_address . $schema_name;
160
-	}
158
+    if ( strpos( $schema_name, $schema_root_address ) === false ) {   // === necessary
159
+        $schema_name = $schema_root_address . $schema_name;
160
+    }
161 161
 
162
-	return $schema_name;
162
+    return $schema_name;
163 163
 }
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -15,32 +15,32 @@  discard block
 block discarded – undo
15 15
  *
16 16
  * @return array|null An array of values or NULL in case of no values (or error).
17 17
  */
18
-function wl_schema_get_value( $post_id, $property_name ) {
18
+function wl_schema_get_value($post_id, $property_name) {
19 19
 
20 20
 	// Property name must be defined.
21
-	if ( ! isset( $property_name ) || is_null( $property_name ) ) {
21
+	if ( ! isset($property_name) || is_null($property_name)) {
22 22
 		return null;
23 23
 	}
24 24
 
25 25
 	// store eventual schema name in  different variable
26
-	$property_schema_name = wl_build_full_schema_uri_from_schema_slug( $property_name );
26
+	$property_schema_name = wl_build_full_schema_uri_from_schema_slug($property_name);
27 27
 
28 28
 	// Establish entity id.
29
-	if ( is_null( $post_id ) || ! is_numeric( $post_id ) ) {
29
+	if (is_null($post_id) || ! is_numeric($post_id)) {
30 30
 		$post_id = get_the_ID();
31
-		if ( is_null( $post_id ) || ! is_numeric( $post_id ) ) {
31
+		if (is_null($post_id) || ! is_numeric($post_id)) {
32 32
 			return null;
33 33
 		}
34 34
 	}
35 35
 
36 36
 	// Get custom fields.
37
-	$term_mapping = wl_entity_taxonomy_get_custom_fields( $post_id );
37
+	$term_mapping = wl_entity_taxonomy_get_custom_fields($post_id);
38 38
 	// Search for the required meta value (by constant name or schema name)
39
-	foreach ( $term_mapping as $wl_constant => $property_info ) {
40
-		$found_constant  = ( $wl_constant == $property_name );
41
-		$found_predicate = ( isset( $property_info['predicate'] ) && $property_info['predicate'] == $property_schema_name );
42
-		if ( $found_constant || $found_predicate ) {
43
-			return get_post_meta( $post_id, $wl_constant );
39
+	foreach ($term_mapping as $wl_constant => $property_info) {
40
+		$found_constant  = ($wl_constant == $property_name);
41
+		$found_predicate = (isset($property_info['predicate']) && $property_info['predicate'] == $property_schema_name);
42
+		if ($found_constant || $found_predicate) {
43
+			return get_post_meta($post_id, $wl_constant);
44 44
 		}
45 45
 	}
46 46
 
@@ -56,33 +56,33 @@  discard block
 block discarded – undo
56 56
  *
57 57
  * @return boolean The method returns true if everything went ok, an error string otherwise.
58 58
  */
59
-function wl_schema_set_value( $post_id, $property_name, $property_value ) {
59
+function wl_schema_set_value($post_id, $property_name, $property_value) {
60 60
 
61 61
 	// Some checks on the parameters
62
-	if ( ! is_numeric( $post_id ) || is_null( $property_name ) || empty( $property_value ) || is_null( $property_value ) ) {
62
+	if ( ! is_numeric($post_id) || is_null($property_name) || empty($property_value) || is_null($property_value)) {
63 63
 		return false;
64 64
 	}
65 65
 
66 66
 	// Build full schema uri if necessary
67
-	$property_name = wl_build_full_schema_uri_from_schema_slug( $property_name );
67
+	$property_name = wl_build_full_schema_uri_from_schema_slug($property_name);
68 68
 
69 69
 	// Get accepted properties
70
-	$accepted_fields = wl_entity_taxonomy_get_custom_fields( $post_id );
70
+	$accepted_fields = wl_entity_taxonomy_get_custom_fields($post_id);
71 71
 
72 72
 	// Find the name of the custom-field managing the schema property
73
-	foreach ( $accepted_fields as $wl_constant => $field ) {
74
-		if ( $field['predicate'] == $property_name ) {
73
+	foreach ($accepted_fields as $wl_constant => $field) {
74
+		if ($field['predicate'] == $property_name) {
75 75
 
76 76
 			// Deal with single values
77
-			if ( ! is_array( $property_value ) ) {
78
-				$property_value = array( $property_value );
77
+			if ( ! is_array($property_value)) {
78
+				$property_value = array($property_value);
79 79
 			}
80 80
 
81 81
 			// Delete present meta
82
-			delete_post_meta( $post_id, $wl_constant );
82
+			delete_post_meta($post_id, $wl_constant);
83 83
 
84
-			foreach ( $property_value as $value ) {
85
-				add_post_meta( $post_id, $wl_constant, $value );
84
+			foreach ($property_value as $value) {
85
+				add_post_meta($post_id, $wl_constant, $value);
86 86
 			}
87 87
 
88 88
 			return true;
@@ -100,17 +100,17 @@  discard block
 block discarded – undo
100 100
  * @return array Array of type(s) (e.g. Type, for the http://schema.org/Type)
101 101
  *               or NULL in case of no values (or error).
102 102
  */
103
-function wl_schema_get_types( $post_id ) {
103
+function wl_schema_get_types($post_id) {
104 104
 
105 105
 	// Some checks on the parameters
106
-	if ( ! is_numeric( $post_id ) ) {
106
+	if ( ! is_numeric($post_id)) {
107 107
 		return null;
108 108
 	}
109 109
 
110
-	$type = Wordlift_Entity_Type_Service::get_instance()->get( $post_id );
110
+	$type = Wordlift_Entity_Type_Service::get_instance()->get($post_id);
111 111
 
112
-	if ( isset( $type['uri'] ) ) {
113
-		return array( $type['uri'] );
112
+	if (isset($type['uri'])) {
113
+		return array($type['uri']);
114 114
 	}
115 115
 
116 116
 	return null;
@@ -124,23 +124,23 @@  discard block
 block discarded – undo
124 124
  *
125 125
  * @return boolean True if everything went ok, an error string otherwise.
126 126
  */
127
-function wl_schema_set_types( $post_id, $type_names ) {
127
+function wl_schema_set_types($post_id, $type_names) {
128 128
 
129 129
 	// Some checks on the parameters
130
-	if ( ! is_numeric( $post_id ) || empty( $type_names ) || is_null( $type_names ) ) {
130
+	if ( ! is_numeric($post_id) || empty($type_names) || is_null($type_names)) {
131 131
 		return null;
132 132
 	}
133 133
 
134 134
 	// TODO: support more than one type.
135
-	if ( is_array( $type_names ) ) {
135
+	if (is_array($type_names)) {
136 136
 		$type_names = $type_names[0];
137 137
 	}
138 138
 
139 139
 	// Get the schema URI (e.g. http://schema.org/Thing)
140
-	$type_names = wl_build_full_schema_uri_from_schema_slug( $type_names );
140
+	$type_names = wl_build_full_schema_uri_from_schema_slug($type_names);
141 141
 
142 142
 	// Actually sets the taxonomy type
143
-	wl_set_entity_main_type( $post_id, $type_names );
143
+	wl_set_entity_main_type($post_id, $type_names);
144 144
 
145 145
 }
146 146
 
@@ -151,12 +151,12 @@  discard block
 block discarded – undo
151 151
  *
152 152
  * @return string The full schema uri (es. 'latitude' returns 'http://schema.org/latitude')
153 153
  */
154
-function wl_build_full_schema_uri_from_schema_slug( $schema_name ) {
154
+function wl_build_full_schema_uri_from_schema_slug($schema_name) {
155 155
 
156 156
 	$schema_root_address = 'http://schema.org/';
157 157
 
158
-	if ( strpos( $schema_name, $schema_root_address ) === false ) {   // === necessary
159
-		$schema_name = $schema_root_address . $schema_name;
158
+	if (strpos($schema_name, $schema_root_address) === false) {   // === necessary
159
+		$schema_name = $schema_root_address.$schema_name;
160 160
 	}
161 161
 
162 162
 	return $schema_name;
Please login to merge, or discard this patch.
src/includes/linked-data/storage/class-wordlift-post-author-storage.php 2 patches
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -18,63 +18,63 @@
 block discarded – undo
18 18
  */
19 19
 class Wordlift_Post_Author_Storage extends Wordlift_Post_Property_Storage {
20 20
 
21
-	/**
22
-	 * The {@link Wordlift_Entity_Service} instance.
23
-	 *
24
-	 * @since  3.15.0
25
-	 * @access private
26
-	 * @var \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance.
27
-	 */
28
-	private $entity_service;
21
+    /**
22
+     * The {@link Wordlift_Entity_Service} instance.
23
+     *
24
+     * @since  3.15.0
25
+     * @access private
26
+     * @var \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance.
27
+     */
28
+    private $entity_service;
29 29
 
30
-	/**
31
-	 * The {@link Wordlift_User_Service} instance.
32
-	 *
33
-	 * @since  3.15.0
34
-	 * @access private
35
-	 * @var \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance.
36
-	 */
37
-	private $user_service;
30
+    /**
31
+     * The {@link Wordlift_User_Service} instance.
32
+     *
33
+     * @since  3.15.0
34
+     * @access private
35
+     * @var \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance.
36
+     */
37
+    private $user_service;
38 38
 
39
-	/**
40
-	 * Create a {@link Wordlift_Post_Author_Storage} instance.
41
-	 *
42
-	 * @since 3.15.0
43
-	 *
44
-	 * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance.
45
-	 * @param \Wordlift_User_Service   $user_service   The {@link Wordlift_User_Service} instance.
46
-	 */
47
-	public function __construct( $entity_service, $user_service ) {
48
-		parent::__construct( Wordlift_Post_Property_Storage::AUTHOR );
39
+    /**
40
+     * Create a {@link Wordlift_Post_Author_Storage} instance.
41
+     *
42
+     * @since 3.15.0
43
+     *
44
+     * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance.
45
+     * @param \Wordlift_User_Service   $user_service   The {@link Wordlift_User_Service} instance.
46
+     */
47
+    public function __construct( $entity_service, $user_service ) {
48
+        parent::__construct( Wordlift_Post_Property_Storage::AUTHOR );
49 49
 
50
-		$this->entity_service = $entity_service;
51
-		$this->user_service   = $user_service;
50
+        $this->entity_service = $entity_service;
51
+        $this->user_service   = $user_service;
52 52
 
53
-	}
53
+    }
54 54
 
55
-	/**
56
-	 * Get the property value.
57
-	 *
58
-	 * @since 3.15.0
59
-	 *
60
-	 * @param int $post_id The {@link WP_Post}'s id.
61
-	 *
62
-	 * @return array|string|null A single string, or an array of values or null
63
-	 *                           if the property isn't recognized.
64
-	 */
65
-	public function get( $post_id ) {
66
-		$author_id = parent::get( $post_id );
55
+    /**
56
+     * Get the property value.
57
+     *
58
+     * @since 3.15.0
59
+     *
60
+     * @param int $post_id The {@link WP_Post}'s id.
61
+     *
62
+     * @return array|string|null A single string, or an array of values or null
63
+     *                           if the property isn't recognized.
64
+     */
65
+    public function get( $post_id ) {
66
+        $author_id = parent::get( $post_id );
67 67
 
68
-		// Get the entity bound to this user.
69
-		$entity_id = $this->user_service->get_entity( $author_id );
68
+        // Get the entity bound to this user.
69
+        $entity_id = $this->user_service->get_entity( $author_id );
70 70
 
71
-		// If there's no entity bound return a simple author structure.
72
-		if ( empty( $entity_id ) ) {
73
-			return $this->user_service->get_uri( $author_id );
74
-		}
71
+        // If there's no entity bound return a simple author structure.
72
+        if ( empty( $entity_id ) ) {
73
+            return $this->user_service->get_uri( $author_id );
74
+        }
75 75
 
76
-		// Return the entity URI.
77
-		return $this->entity_service->get_uri( $entity_id );
78
-	}
76
+        // Return the entity URI.
77
+        return $this->entity_service->get_uri( $entity_id );
78
+    }
79 79
 
80 80
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 	 * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance.
45 45
 	 * @param \Wordlift_User_Service   $user_service   The {@link Wordlift_User_Service} instance.
46 46
 	 */
47
-	public function __construct( $entity_service, $user_service ) {
48
-		parent::__construct( Wordlift_Post_Property_Storage::AUTHOR );
47
+	public function __construct($entity_service, $user_service) {
48
+		parent::__construct(Wordlift_Post_Property_Storage::AUTHOR);
49 49
 
50 50
 		$this->entity_service = $entity_service;
51 51
 		$this->user_service   = $user_service;
@@ -62,19 +62,19 @@  discard block
 block discarded – undo
62 62
 	 * @return array|string|null A single string, or an array of values or null
63 63
 	 *                           if the property isn't recognized.
64 64
 	 */
65
-	public function get( $post_id ) {
66
-		$author_id = parent::get( $post_id );
65
+	public function get($post_id) {
66
+		$author_id = parent::get($post_id);
67 67
 
68 68
 		// Get the entity bound to this user.
69
-		$entity_id = $this->user_service->get_entity( $author_id );
69
+		$entity_id = $this->user_service->get_entity($author_id);
70 70
 
71 71
 		// If there's no entity bound return a simple author structure.
72
-		if ( empty( $entity_id ) ) {
73
-			return $this->user_service->get_uri( $author_id );
72
+		if (empty($entity_id)) {
73
+			return $this->user_service->get_uri($author_id);
74 74
 		}
75 75
 
76 76
 		// Return the entity URI.
77
-		return $this->entity_service->get_uri( $entity_id );
77
+		return $this->entity_service->get_uri($entity_id);
78 78
 	}
79 79
 
80 80
 }
Please login to merge, or discard this patch.