Completed
Push — develop ( f5cfcc...e2baaf )
by Naveen
01:17
created
linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance.
37 37
 	 */
38
-	public function __construct( $entity_service ) {
38
+	public function __construct($entity_service) {
39 39
 
40 40
 		$this->entity_service = $entity_service;
41 41
 
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @return \Wordlift_Default_Sparql_Tuple_Rendition A {@link Wordlift_Default_Sparql_Tuple_Rendition} instance.
56 56
 	 */
57
-	public function create( $storage, $predicate, $data_type = null, $language = null, $uri_suffix = null ) {
57
+	public function create($storage, $predicate, $data_type = null, $language = null, $uri_suffix = null) {
58 58
 
59
-		return new Wordlift_Default_Sparql_Tuple_Rendition( $this->entity_service, $storage, $predicate, $data_type, $language, $uri_suffix );
59
+		return new Wordlift_Default_Sparql_Tuple_Rendition($this->entity_service, $storage, $predicate, $data_type, $language, $uri_suffix);
60 60
 	}
61 61
 
62 62
 	/**
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 	 *
70 70
 	 * @return \Wordlift_Address_Sparql_Tuple_Rendition A {@link Wordlift_Address_Sparql_Tuple_Rendition} instance.
71 71
 	 */
72
-	public function create_address( $storage, $language = null ) {
72
+	public function create_address($storage, $language = null) {
73 73
 
74
-		return new Wordlift_Address_Sparql_Tuple_Rendition( $this->entity_service, $this, $storage, $language );
74
+		return new Wordlift_Address_Sparql_Tuple_Rendition($this->entity_service, $this, $storage, $language);
75 75
 	}
76 76
 }
Please login to merge, or discard this patch.
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -19,81 +19,81 @@
 block discarded – undo
19 19
  */
20 20
 class Wordlift_Sparql_Tuple_Rendition_Factory {
21 21
 
22
-	/**
23
-	 * The {@link Wordlift_Entity_Service} instance.
24
-	 *
25
-	 * @since  3.15.0
26
-	 * @access private
27
-	 * @var \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance.
28
-	 */
29
-	private $entity_service;
22
+    /**
23
+     * The {@link Wordlift_Entity_Service} instance.
24
+     *
25
+     * @since  3.15.0
26
+     * @access private
27
+     * @var \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance.
28
+     */
29
+    private $entity_service;
30 30
 
31
-	/**
32
-	 * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} singleton instance.
33
-	 *
34
-	 * @since 3.19.1
35
-	 * @access private
36
-	 * @var \Wordlift_Sparql_Tuple_Rendition_Factory $instance The {@link Wordlift_Sparql_Tuple_Rendition_Factory} singleton instance.
37
-	 */
38
-	private static $instance;
31
+    /**
32
+     * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} singleton instance.
33
+     *
34
+     * @since 3.19.1
35
+     * @access private
36
+     * @var \Wordlift_Sparql_Tuple_Rendition_Factory $instance The {@link Wordlift_Sparql_Tuple_Rendition_Factory} singleton instance.
37
+     */
38
+    private static $instance;
39 39
 
40
-	/**
41
-	 * Create a a {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
42
-	 *
43
-	 * @since 3.15.0
44
-	 *
45
-	 * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance.
46
-	 */
47
-	public function __construct( $entity_service ) {
40
+    /**
41
+     * Create a a {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
42
+     *
43
+     * @since 3.15.0
44
+     *
45
+     * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance.
46
+     */
47
+    public function __construct( $entity_service ) {
48 48
 
49
-		$this->entity_service = $entity_service;
49
+        $this->entity_service = $entity_service;
50 50
 
51
-		self::$instance = $this;
51
+        self::$instance = $this;
52 52
 
53
-	}
53
+    }
54 54
 
55
-	/**
56
-	 * Get the {@link Wordlift_Sparql_Tuple_Rendition_Factory} singleton instance.
57
-	 *
58
-	 * @since 3.19.1
59
-	 *
60
-	 * @return \Wordlift_Sparql_Tuple_Rendition_Factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} singleton instance.
61
-	 */
62
-	public static function get_instance() {
55
+    /**
56
+     * Get the {@link Wordlift_Sparql_Tuple_Rendition_Factory} singleton instance.
57
+     *
58
+     * @since 3.19.1
59
+     *
60
+     * @return \Wordlift_Sparql_Tuple_Rendition_Factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} singleton instance.
61
+     */
62
+    public static function get_instance() {
63 63
 
64
-		return self::$instance;
65
-	}
64
+        return self::$instance;
65
+    }
66 66
 
67
-	/**
68
-	 * Create a rendition.
69
-	 *
70
-	 * @since 3.15.0
71
-	 *
72
-	 * @param \Wordlift_Storage $storage A {@link Wordlift_Storage} instance.
73
-	 * @param string $predicate A predicate (e.g. `http://schema.org/name`).
74
-	 * @param string|null $data_type A data-type.
75
-	 * @param string|null $language A language code (e.g. `en`).
76
-	 * @param string|null $uri_suffix The URI suffix.
77
-	 *
78
-	 * @return \Wordlift_Default_Sparql_Tuple_Rendition A {@link Wordlift_Default_Sparql_Tuple_Rendition} instance.
79
-	 */
80
-	public function create( $storage, $predicate, $data_type = null, $language = null, $uri_suffix = null ) {
67
+    /**
68
+     * Create a rendition.
69
+     *
70
+     * @since 3.15.0
71
+     *
72
+     * @param \Wordlift_Storage $storage A {@link Wordlift_Storage} instance.
73
+     * @param string $predicate A predicate (e.g. `http://schema.org/name`).
74
+     * @param string|null $data_type A data-type.
75
+     * @param string|null $language A language code (e.g. `en`).
76
+     * @param string|null $uri_suffix The URI suffix.
77
+     *
78
+     * @return \Wordlift_Default_Sparql_Tuple_Rendition A {@link Wordlift_Default_Sparql_Tuple_Rendition} instance.
79
+     */
80
+    public function create( $storage, $predicate, $data_type = null, $language = null, $uri_suffix = null ) {
81 81
 
82
-		return new Wordlift_Default_Sparql_Tuple_Rendition( $this->entity_service, $storage, $predicate, $data_type, $language, $uri_suffix );
83
-	}
82
+        return new Wordlift_Default_Sparql_Tuple_Rendition( $this->entity_service, $storage, $predicate, $data_type, $language, $uri_suffix );
83
+    }
84 84
 
85
-	/**
86
-	 * Create an address rendition.
87
-	 *
88
-	 * @since 3.18.0
89
-	 *
90
-	 * @param \Wordlift_Storage $storage A {@link Wordlift_Storage} instance.
91
-	 * @param string|null $language A language code (e.g. `en`).
92
-	 *
93
-	 * @return \Wordlift_Address_Sparql_Tuple_Rendition A {@link Wordlift_Address_Sparql_Tuple_Rendition} instance.
94
-	 */
95
-	public function create_address( $storage, $language = null ) {
85
+    /**
86
+     * Create an address rendition.
87
+     *
88
+     * @since 3.18.0
89
+     *
90
+     * @param \Wordlift_Storage $storage A {@link Wordlift_Storage} instance.
91
+     * @param string|null $language A language code (e.g. `en`).
92
+     *
93
+     * @return \Wordlift_Address_Sparql_Tuple_Rendition A {@link Wordlift_Address_Sparql_Tuple_Rendition} instance.
94
+     */
95
+    public function create_address( $storage, $language = null ) {
96 96
 
97
-		return new Wordlift_Address_Sparql_Tuple_Rendition( $this->entity_service, $this, $storage, $language );
98
-	}
97
+        return new Wordlift_Address_Sparql_Tuple_Rendition( $this->entity_service, $this, $storage, $language );
98
+    }
99 99
 }
Please login to merge, or discard this patch.
src/includes/class-wordlift-publisher-service.php 2 patches
Indentation   +214 added lines, -214 removed lines patch added patch discarded remove patch
@@ -18,222 +18,222 @@
 block discarded – undo
18 18
  */
19 19
 class Wordlift_Publisher_Service {
20 20
 
21
-	/**
22
-	 * The {@link Wordlift_Configuration_Service} instance.
23
-	 *
24
-	 * @since  3.19.0
25
-	 * @access private
26
-	 * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
27
-	 */
28
-	private $configuration_service;
29
-
30
-	/**
31
-	 * The {@link Wordlift_Publisher_Service} instance.
32
-	 *
33
-	 * @since 3.19.0
34
-	 *
35
-	 * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
36
-	 */
37
-	public function __construct( $configuration_service ) {
38
-		$this->configuration_service = $configuration_service;
39
-	}
40
-
41
-	/**
42
-	 * Counts the number of potential publishers.
43
-	 *
44
-	 * @since 3.11.0
45
-	 *
46
-	 * @return int The number of potential publishers.
47
-	 */
48
-	public function count() {
49
-
50
-		// Search for entities which are either a Person
51
-		// or Organization.
52
-
53
-		// Get only the ids as all we need is the count.
54
-		$entities = get_posts( array(
55
-			'post_type'      => Wordlift_Entity_Service::valid_entity_post_types(),
56
-			'post_status'    => 'publish',
57
-			'posts_per_page' => - 1,
58
-			'tax_query'      => array(
59
-				array(
60
-					'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
61
-					'field'    => 'slug',
62
-					'terms'    => array( 'organization', 'person' ),
63
-				),
64
-			),
65
-			'fields'         => 'ids',
66
-		) );
67
-
68
-		// Finally return the count.
69
-		return count( $entities );
70
-	}
71
-
72
-	/**
73
-	 * Search SQL filter for matching against post title only.
74
-	 *
75
-	 * @link    http://wordpress.stackexchange.com/a/11826/1685
76
-	 *
77
-	 * @since   3.15.0
78
-	 *
79
-	 * @param   string   $search   The search string.
80
-	 * @param   WP_Query $wp_query The {@link WP_Query} instance.
81
-	 *
82
-	 * @return array|string An array of results.
83
-	 */
84
-	public function limit_search_to_title( $search, $wp_query ) {
85
-
86
-		// Bail out if the search or the `search_terms` haven't been set.
87
-		if ( empty( $search ) || empty( $wp_query->query_vars['search_terms'] ) ) {
88
-			return $search;
89
-		}
90
-
91
-		global $wpdb;
92
-
93
-		$query_vars = $wp_query->query_vars;
94
-		$percent    = ! empty( $query_vars['exact'] ) ? '' : '%';
95
-		$search     = array();
96
-
97
-		foreach ( (array) $query_vars['search_terms'] as $term ) {
98
-			$search[] = $wpdb->prepare( "$wpdb->posts.post_title LIKE %s", $percent . $wpdb->esc_like( $term ) . $percent );
99
-		}
100
-
101
-		if ( ! is_user_logged_in() ) {
102
-			$search[] = "$wpdb->posts.post_password = ''";
103
-		}
104
-
105
-		$search = ' AND ' . implode( ' AND ', $search );
106
-
107
-		return $search;
108
-	}
109
-
110
-	/**
111
-	 * Query WP for potential publishers, i.e. {@link WP_Post}s which are associated`
112
-	 * with `wl_entity_type` (taxonomy) terms of `Organization` or `Person`.
113
-	 *
114
-	 * @since 3.11.0
115
-	 *
116
-	 * @param string $filter The title filter.
117
-	 *
118
-	 * @return array An array of results in a select2 friendly format.
119
-	 */
120
-	public function query( $filter = '' ) {
121
-
122
-		// Search for the filter in the titles only.
123
-		add_filter( 'posts_search', array(
124
-			$this,
125
-			'limit_search_to_title',
126
-		), 10, 2 );
127
-
128
-		/*
21
+    /**
22
+     * The {@link Wordlift_Configuration_Service} instance.
23
+     *
24
+     * @since  3.19.0
25
+     * @access private
26
+     * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
27
+     */
28
+    private $configuration_service;
29
+
30
+    /**
31
+     * The {@link Wordlift_Publisher_Service} instance.
32
+     *
33
+     * @since 3.19.0
34
+     *
35
+     * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
36
+     */
37
+    public function __construct( $configuration_service ) {
38
+        $this->configuration_service = $configuration_service;
39
+    }
40
+
41
+    /**
42
+     * Counts the number of potential publishers.
43
+     *
44
+     * @since 3.11.0
45
+     *
46
+     * @return int The number of potential publishers.
47
+     */
48
+    public function count() {
49
+
50
+        // Search for entities which are either a Person
51
+        // or Organization.
52
+
53
+        // Get only the ids as all we need is the count.
54
+        $entities = get_posts( array(
55
+            'post_type'      => Wordlift_Entity_Service::valid_entity_post_types(),
56
+            'post_status'    => 'publish',
57
+            'posts_per_page' => - 1,
58
+            'tax_query'      => array(
59
+                array(
60
+                    'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
61
+                    'field'    => 'slug',
62
+                    'terms'    => array( 'organization', 'person' ),
63
+                ),
64
+            ),
65
+            'fields'         => 'ids',
66
+        ) );
67
+
68
+        // Finally return the count.
69
+        return count( $entities );
70
+    }
71
+
72
+    /**
73
+     * Search SQL filter for matching against post title only.
74
+     *
75
+     * @link    http://wordpress.stackexchange.com/a/11826/1685
76
+     *
77
+     * @since   3.15.0
78
+     *
79
+     * @param   string   $search   The search string.
80
+     * @param   WP_Query $wp_query The {@link WP_Query} instance.
81
+     *
82
+     * @return array|string An array of results.
83
+     */
84
+    public function limit_search_to_title( $search, $wp_query ) {
85
+
86
+        // Bail out if the search or the `search_terms` haven't been set.
87
+        if ( empty( $search ) || empty( $wp_query->query_vars['search_terms'] ) ) {
88
+            return $search;
89
+        }
90
+
91
+        global $wpdb;
92
+
93
+        $query_vars = $wp_query->query_vars;
94
+        $percent    = ! empty( $query_vars['exact'] ) ? '' : '%';
95
+        $search     = array();
96
+
97
+        foreach ( (array) $query_vars['search_terms'] as $term ) {
98
+            $search[] = $wpdb->prepare( "$wpdb->posts.post_title LIKE %s", $percent . $wpdb->esc_like( $term ) . $percent );
99
+        }
100
+
101
+        if ( ! is_user_logged_in() ) {
102
+            $search[] = "$wpdb->posts.post_password = ''";
103
+        }
104
+
105
+        $search = ' AND ' . implode( ' AND ', $search );
106
+
107
+        return $search;
108
+    }
109
+
110
+    /**
111
+     * Query WP for potential publishers, i.e. {@link WP_Post}s which are associated`
112
+     * with `wl_entity_type` (taxonomy) terms of `Organization` or `Person`.
113
+     *
114
+     * @since 3.11.0
115
+     *
116
+     * @param string $filter The title filter.
117
+     *
118
+     * @return array An array of results in a select2 friendly format.
119
+     */
120
+    public function query( $filter = '' ) {
121
+
122
+        // Search for the filter in the titles only.
123
+        add_filter( 'posts_search', array(
124
+            $this,
125
+            'limit_search_to_title',
126
+        ), 10, 2 );
127
+
128
+        /*
129 129
 		 * Search for entities which are either a Person
130 130
 		 * or Organization. Sort the results by title in ascending order.
131 131
 		 */
132
-		$entities = get_posts( array(
133
-			'post_type'      => Wordlift_Entity_Service::valid_entity_post_types(),
134
-			'post_status'    => 'publish',
135
-			'posts_per_page' => - 1,
136
-			'tax_query'      => array(
137
-				array(
138
-					'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
139
-					'field'    => 'slug',
140
-					'terms'    => array( 'organization', 'person' ),
141
-				),
142
-			),
143
-			's'              => $filter,
144
-			'orderby'        => 'title',
145
-			'order'          => 'ASC',
146
-		) );
147
-
148
-		// Remove the search filter added before the query.
149
-		remove_filter( 'posts_search', array(
150
-			$this,
151
-			'limit_search_to_title',
152
-		), 10, 2 );
153
-
154
-		// Set a reference to ourselves to pass to the closure.
155
-		$publisher_service = $this;
156
-
157
-		// Map the results in a `Select2` compatible array.
158
-		return array_map( function ( $entity ) use ( $publisher_service ) {
159
-			$type     = wp_get_post_terms( $entity->ID, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
160
-			$thumb_id = get_post_thumbnail_id( $entity->ID );
161
-
162
-			return array(
163
-				'id'            => $entity->ID,
164
-				'text'          => $entity->post_title,
165
-				'type'          => $type[0]->name,
166
-				'thumbnail_url' => $publisher_service->get_attachment_image_url( $thumb_id ),
167
-			);
168
-		}, $entities );
169
-	}
170
-
171
-	/**
172
-	 * Get the thumbnail's URL.
173
-	 *
174
-	 * @since 3.11.0
175
-	 *
176
-	 * @param int    $attachment_id The attachment id.
177
-	 * @param string $size          The attachment size (default = 'thumbnail').
178
-	 *
179
-	 * @return string|bool The image URL or false if not found.
180
-	 */
181
-	public function get_attachment_image_url( $attachment_id, $size = 'thumbnail' ) {
182
-
183
-		$image = wp_get_attachment_image_src( $attachment_id, $size );
184
-
185
-		return isset( $image['0'] ) ? $image['0'] : false;
186
-	}
187
-
188
-	/**
189
-	 * Add additional instructions to featured image metabox
190
-	 * when the entity type is the publisher.
191
-	 *
192
-	 * @since  3.19.0
193
-	 *
194
-	 * @param  string $content Current metabox content.
195
-	 *
196
-	 * @return string $content metabox content with additional instructions.
197
-	 */
198
-	public function add_featured_image_instruction( $content ) {
199
-		// Get the current post ID.
200
-		$post_id = get_the_ID();
201
-
202
-		// Get the publisher id.
203
-		$publisher_id = $this->configuration_service->get_publisher_id();
204
-
205
-
206
-		// Bail if for some reason the post id is not set.
207
-		if (
208
-			empty( $post_id ) ||
209
-			$post_id !== (int) $publisher_id
210
-		) {
211
-			return $content;
212
-		}
213
-
214
-		$terms = wp_get_post_terms(
215
-			$post_id, // The post id.
216
-			Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, // The taxonomy slug.
217
-			array(
218
-				'fields' => 'slugs',
219
-				// We don't need all fields, but only slugs.
220
-			)
221
-		);
222
-
223
-		// Check that the entity type is "Organization".
224
-		if ( in_array( 'organization', $terms, true ) ) {
225
-			// Add the featured image description when the type is "Organization".
226
-
227
-			$link = sprintf( '<a target="_blank" href="%s">%s</a>',
228
-				esc_attr__( 'https://developers.google.com/search/docs/data-types/article#logo-guidelines', 'wordlift' ),
229
-				esc_html__( 'AMP logo guidelines', 'wordlift' ) );
230
-			$content .= sprintf( '<p>'
231
-								 . esc_html_x( 'According to the %s, the logo should fit in a 60x600px rectangle, and either be exactly 60px high (preferred), or exactly 600px wide. For example, 450x45px would not be acceptable, even though it fits in the 600x60px rectangle. To comply with the guidelines, WordLift will automatically resize the Featured Image for structured data formats.', 'After "According to the" goes the link to the "AMP logo guidelines".', 'wordlift' )
232
-								 . '</p>', $link );
233
-		}
234
-
235
-		// Finally return the content.
236
-		return $content;
237
-	}
132
+        $entities = get_posts( array(
133
+            'post_type'      => Wordlift_Entity_Service::valid_entity_post_types(),
134
+            'post_status'    => 'publish',
135
+            'posts_per_page' => - 1,
136
+            'tax_query'      => array(
137
+                array(
138
+                    'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
139
+                    'field'    => 'slug',
140
+                    'terms'    => array( 'organization', 'person' ),
141
+                ),
142
+            ),
143
+            's'              => $filter,
144
+            'orderby'        => 'title',
145
+            'order'          => 'ASC',
146
+        ) );
147
+
148
+        // Remove the search filter added before the query.
149
+        remove_filter( 'posts_search', array(
150
+            $this,
151
+            'limit_search_to_title',
152
+        ), 10, 2 );
153
+
154
+        // Set a reference to ourselves to pass to the closure.
155
+        $publisher_service = $this;
156
+
157
+        // Map the results in a `Select2` compatible array.
158
+        return array_map( function ( $entity ) use ( $publisher_service ) {
159
+            $type     = wp_get_post_terms( $entity->ID, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
160
+            $thumb_id = get_post_thumbnail_id( $entity->ID );
161
+
162
+            return array(
163
+                'id'            => $entity->ID,
164
+                'text'          => $entity->post_title,
165
+                'type'          => $type[0]->name,
166
+                'thumbnail_url' => $publisher_service->get_attachment_image_url( $thumb_id ),
167
+            );
168
+        }, $entities );
169
+    }
170
+
171
+    /**
172
+     * Get the thumbnail's URL.
173
+     *
174
+     * @since 3.11.0
175
+     *
176
+     * @param int    $attachment_id The attachment id.
177
+     * @param string $size          The attachment size (default = 'thumbnail').
178
+     *
179
+     * @return string|bool The image URL or false if not found.
180
+     */
181
+    public function get_attachment_image_url( $attachment_id, $size = 'thumbnail' ) {
182
+
183
+        $image = wp_get_attachment_image_src( $attachment_id, $size );
184
+
185
+        return isset( $image['0'] ) ? $image['0'] : false;
186
+    }
187
+
188
+    /**
189
+     * Add additional instructions to featured image metabox
190
+     * when the entity type is the publisher.
191
+     *
192
+     * @since  3.19.0
193
+     *
194
+     * @param  string $content Current metabox content.
195
+     *
196
+     * @return string $content metabox content with additional instructions.
197
+     */
198
+    public function add_featured_image_instruction( $content ) {
199
+        // Get the current post ID.
200
+        $post_id = get_the_ID();
201
+
202
+        // Get the publisher id.
203
+        $publisher_id = $this->configuration_service->get_publisher_id();
204
+
205
+
206
+        // Bail if for some reason the post id is not set.
207
+        if (
208
+            empty( $post_id ) ||
209
+            $post_id !== (int) $publisher_id
210
+        ) {
211
+            return $content;
212
+        }
213
+
214
+        $terms = wp_get_post_terms(
215
+            $post_id, // The post id.
216
+            Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, // The taxonomy slug.
217
+            array(
218
+                'fields' => 'slugs',
219
+                // We don't need all fields, but only slugs.
220
+            )
221
+        );
222
+
223
+        // Check that the entity type is "Organization".
224
+        if ( in_array( 'organization', $terms, true ) ) {
225
+            // Add the featured image description when the type is "Organization".
226
+
227
+            $link = sprintf( '<a target="_blank" href="%s">%s</a>',
228
+                esc_attr__( 'https://developers.google.com/search/docs/data-types/article#logo-guidelines', 'wordlift' ),
229
+                esc_html__( 'AMP logo guidelines', 'wordlift' ) );
230
+            $content .= sprintf( '<p>'
231
+                                    . esc_html_x( 'According to the %s, the logo should fit in a 60x600px rectangle, and either be exactly 60px high (preferred), or exactly 600px wide. For example, 450x45px would not be acceptable, even though it fits in the 600x60px rectangle. To comply with the guidelines, WordLift will automatically resize the Featured Image for structured data formats.', 'After "According to the" goes the link to the "AMP logo guidelines".', 'wordlift' )
232
+                                    . '</p>', $link );
233
+        }
234
+
235
+        // Finally return the content.
236
+        return $content;
237
+    }
238 238
 
239 239
 }
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 *
35 35
 	 * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
36 36
 	 */
37
-	public function __construct( $configuration_service ) {
37
+	public function __construct($configuration_service) {
38 38
 		$this->configuration_service = $configuration_service;
39 39
 	}
40 40
 
@@ -51,22 +51,22 @@  discard block
 block discarded – undo
51 51
 		// or Organization.
52 52
 
53 53
 		// Get only the ids as all we need is the count.
54
-		$entities = get_posts( array(
54
+		$entities = get_posts(array(
55 55
 			'post_type'      => Wordlift_Entity_Service::valid_entity_post_types(),
56 56
 			'post_status'    => 'publish',
57
-			'posts_per_page' => - 1,
57
+			'posts_per_page' => -1,
58 58
 			'tax_query'      => array(
59 59
 				array(
60 60
 					'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
61 61
 					'field'    => 'slug',
62
-					'terms'    => array( 'organization', 'person' ),
62
+					'terms'    => array('organization', 'person'),
63 63
 				),
64 64
 			),
65 65
 			'fields'         => 'ids',
66
-		) );
66
+		));
67 67
 
68 68
 		// Finally return the count.
69
-		return count( $entities );
69
+		return count($entities);
70 70
 	}
71 71
 
72 72
 	/**
@@ -81,28 +81,28 @@  discard block
 block discarded – undo
81 81
 	 *
82 82
 	 * @return array|string An array of results.
83 83
 	 */
84
-	public function limit_search_to_title( $search, $wp_query ) {
84
+	public function limit_search_to_title($search, $wp_query) {
85 85
 
86 86
 		// Bail out if the search or the `search_terms` haven't been set.
87
-		if ( empty( $search ) || empty( $wp_query->query_vars['search_terms'] ) ) {
87
+		if (empty($search) || empty($wp_query->query_vars['search_terms'])) {
88 88
 			return $search;
89 89
 		}
90 90
 
91 91
 		global $wpdb;
92 92
 
93 93
 		$query_vars = $wp_query->query_vars;
94
-		$percent    = ! empty( $query_vars['exact'] ) ? '' : '%';
94
+		$percent    = ! empty($query_vars['exact']) ? '' : '%';
95 95
 		$search     = array();
96 96
 
97
-		foreach ( (array) $query_vars['search_terms'] as $term ) {
98
-			$search[] = $wpdb->prepare( "$wpdb->posts.post_title LIKE %s", $percent . $wpdb->esc_like( $term ) . $percent );
97
+		foreach ((array) $query_vars['search_terms'] as $term) {
98
+			$search[] = $wpdb->prepare("$wpdb->posts.post_title LIKE %s", $percent.$wpdb->esc_like($term).$percent);
99 99
 		}
100 100
 
101
-		if ( ! is_user_logged_in() ) {
101
+		if ( ! is_user_logged_in()) {
102 102
 			$search[] = "$wpdb->posts.post_password = ''";
103 103
 		}
104 104
 
105
-		$search = ' AND ' . implode( ' AND ', $search );
105
+		$search = ' AND '.implode(' AND ', $search);
106 106
 
107 107
 		return $search;
108 108
 	}
@@ -117,55 +117,55 @@  discard block
 block discarded – undo
117 117
 	 *
118 118
 	 * @return array An array of results in a select2 friendly format.
119 119
 	 */
120
-	public function query( $filter = '' ) {
120
+	public function query($filter = '') {
121 121
 
122 122
 		// Search for the filter in the titles only.
123
-		add_filter( 'posts_search', array(
123
+		add_filter('posts_search', array(
124 124
 			$this,
125 125
 			'limit_search_to_title',
126
-		), 10, 2 );
126
+		), 10, 2);
127 127
 
128 128
 		/*
129 129
 		 * Search for entities which are either a Person
130 130
 		 * or Organization. Sort the results by title in ascending order.
131 131
 		 */
132
-		$entities = get_posts( array(
132
+		$entities = get_posts(array(
133 133
 			'post_type'      => Wordlift_Entity_Service::valid_entity_post_types(),
134 134
 			'post_status'    => 'publish',
135
-			'posts_per_page' => - 1,
135
+			'posts_per_page' => -1,
136 136
 			'tax_query'      => array(
137 137
 				array(
138 138
 					'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
139 139
 					'field'    => 'slug',
140
-					'terms'    => array( 'organization', 'person' ),
140
+					'terms'    => array('organization', 'person'),
141 141
 				),
142 142
 			),
143 143
 			's'              => $filter,
144 144
 			'orderby'        => 'title',
145 145
 			'order'          => 'ASC',
146
-		) );
146
+		));
147 147
 
148 148
 		// Remove the search filter added before the query.
149
-		remove_filter( 'posts_search', array(
149
+		remove_filter('posts_search', array(
150 150
 			$this,
151 151
 			'limit_search_to_title',
152
-		), 10, 2 );
152
+		), 10, 2);
153 153
 
154 154
 		// Set a reference to ourselves to pass to the closure.
155 155
 		$publisher_service = $this;
156 156
 
157 157
 		// Map the results in a `Select2` compatible array.
158
-		return array_map( function ( $entity ) use ( $publisher_service ) {
159
-			$type     = wp_get_post_terms( $entity->ID, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
160
-			$thumb_id = get_post_thumbnail_id( $entity->ID );
158
+		return array_map(function($entity) use ($publisher_service) {
159
+			$type     = wp_get_post_terms($entity->ID, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME);
160
+			$thumb_id = get_post_thumbnail_id($entity->ID);
161 161
 
162 162
 			return array(
163 163
 				'id'            => $entity->ID,
164 164
 				'text'          => $entity->post_title,
165 165
 				'type'          => $type[0]->name,
166
-				'thumbnail_url' => $publisher_service->get_attachment_image_url( $thumb_id ),
166
+				'thumbnail_url' => $publisher_service->get_attachment_image_url($thumb_id),
167 167
 			);
168
-		}, $entities );
168
+		}, $entities);
169 169
 	}
170 170
 
171 171
 	/**
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
 	 *
179 179
 	 * @return string|bool The image URL or false if not found.
180 180
 	 */
181
-	public function get_attachment_image_url( $attachment_id, $size = 'thumbnail' ) {
181
+	public function get_attachment_image_url($attachment_id, $size = 'thumbnail') {
182 182
 
183
-		$image = wp_get_attachment_image_src( $attachment_id, $size );
183
+		$image = wp_get_attachment_image_src($attachment_id, $size);
184 184
 
185
-		return isset( $image['0'] ) ? $image['0'] : false;
185
+		return isset($image['0']) ? $image['0'] : false;
186 186
 	}
187 187
 
188 188
 	/**
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 *
196 196
 	 * @return string $content metabox content with additional instructions.
197 197
 	 */
198
-	public function add_featured_image_instruction( $content ) {
198
+	public function add_featured_image_instruction($content) {
199 199
 		// Get the current post ID.
200 200
 		$post_id = get_the_ID();
201 201
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 
206 206
 		// Bail if for some reason the post id is not set.
207 207
 		if (
208
-			empty( $post_id ) ||
208
+			empty($post_id) ||
209 209
 			$post_id !== (int) $publisher_id
210 210
 		) {
211 211
 			return $content;
@@ -221,15 +221,15 @@  discard block
 block discarded – undo
221 221
 		);
222 222
 
223 223
 		// Check that the entity type is "Organization".
224
-		if ( in_array( 'organization', $terms, true ) ) {
224
+		if (in_array('organization', $terms, true)) {
225 225
 			// Add the featured image description when the type is "Organization".
226 226
 
227
-			$link = sprintf( '<a target="_blank" href="%s">%s</a>',
228
-				esc_attr__( 'https://developers.google.com/search/docs/data-types/article#logo-guidelines', 'wordlift' ),
229
-				esc_html__( 'AMP logo guidelines', 'wordlift' ) );
230
-			$content .= sprintf( '<p>'
231
-								 . esc_html_x( 'According to the %s, the logo should fit in a 60x600px rectangle, and either be exactly 60px high (preferred), or exactly 600px wide. For example, 450x45px would not be acceptable, even though it fits in the 600x60px rectangle. To comply with the guidelines, WordLift will automatically resize the Featured Image for structured data formats.', 'After "According to the" goes the link to the "AMP logo guidelines".', 'wordlift' )
232
-								 . '</p>', $link );
227
+			$link = sprintf('<a target="_blank" href="%s">%s</a>',
228
+				esc_attr__('https://developers.google.com/search/docs/data-types/article#logo-guidelines', 'wordlift'),
229
+				esc_html__('AMP logo guidelines', 'wordlift'));
230
+			$content .= sprintf('<p>'
231
+								 . esc_html_x('According to the %s, the logo should fit in a 60x600px rectangle, and either be exactly 60px high (preferred), or exactly 600px wide. For example, 450x45px would not be acceptable, even though it fits in the 600x60px rectangle. To comply with the guidelines, WordLift will automatically resize the Featured Image for structured data formats.', 'After "According to the" goes the link to the "AMP logo guidelines".', 'wordlift')
232
+								 . '</p>', $link);
233 233
 		}
234 234
 
235 235
 		// Finally return the content.
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/install/class-wordlift-install-3-18-3.php 2 patches
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -15,47 +15,47 @@  discard block
 block discarded – undo
15 15
  * @subpackage Wordlift/install
16 16
  */
17 17
 class Wordlift_Install_3_18_3 extends Wordlift_Install {
18
-	/**
19
-	 * @inheritdoc
20
-	 */
21
-	protected static $version = '3.18.3';
18
+    /**
19
+     * @inheritdoc
20
+     */
21
+    protected static $version = '3.18.3';
22 22
 
23
-	/**
24
-	 * @inheritdoc
25
-	 */
26
-	public function install() {
27
-		$this->set_article_term_to_posts();
28
-	}
23
+    /**
24
+     * @inheritdoc
25
+     */
26
+    public function install() {
27
+        $this->set_article_term_to_posts();
28
+    }
29 29
 
30
-	/**
31
-	 * Set default article term to posts
32
-	 * that exists in `wl_relation_instances` table.
33
-	 *
34
-	 * @since 3.18.3
35
-	 *
36
-	 * @return mixed False if the `article` doesn't exists.
37
-	 */
38
-	public function set_article_term_to_posts() {
39
-		// Load the global $wpdb;
40
-		global $wpdb;
30
+    /**
31
+     * Set default article term to posts
32
+     * that exists in `wl_relation_instances` table.
33
+     *
34
+     * @since 3.18.3
35
+     *
36
+     * @return mixed False if the `article` doesn't exists.
37
+     */
38
+    public function set_article_term_to_posts() {
39
+        // Load the global $wpdb;
40
+        global $wpdb;
41 41
 
42
-		// Get the article term.
43
-		$term = get_term_by(
44
-			'slug',
45
-			'article',
46
-			Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME
47
-		);
42
+        // Get the article term.
43
+        $term = get_term_by(
44
+            'slug',
45
+            'article',
46
+            Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME
47
+        );
48 48
 
49
-		// Bail if term doesn't exist.
50
-		if ( empty( $term ) ) {
51
-			return false;
52
-		}
49
+        // Bail if term doesn't exist.
50
+        if ( empty( $term ) ) {
51
+            return false;
52
+        }
53 53
 
54
-		// Set `article` term to all posts that exists in
55
-		// `wl_relation_instances` table and don't have `article` term set.
56
-		$post_ids = $wpdb->get_results(
57
-			$wpdb->prepare(
58
-				"
54
+        // Set `article` term to all posts that exists in
55
+        // `wl_relation_instances` table and don't have `article` term set.
56
+        $post_ids = $wpdb->get_results(
57
+            $wpdb->prepare(
58
+                "
59 59
 				SELECT DISTINCT p.ID
60 60
 				FROM $wpdb->posts AS p
61 61
 				INNER JOIN {$wpdb->prefix}wl_relation_instances AS ri
@@ -70,19 +70,19 @@  discard block
 block discarded – undo
70 70
 					)
71 71
 				)
72 72
 				",
73
-				'post',
74
-				$term->term_id
75
-			)
76
-		);
73
+                'post',
74
+                $term->term_id
75
+            )
76
+        );
77 77
 
78
-		// Loop through all posts and set `article` term for each one.
79
-		foreach ($post_ids as $p) {
80
-			wp_set_object_terms(
81
-				(int) $p->ID,
82
-				$term->term_id,
83
-				Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME
84
-			);
85
-		}
86
-	}
78
+        // Loop through all posts and set `article` term for each one.
79
+        foreach ($post_ids as $p) {
80
+            wp_set_object_terms(
81
+                (int) $p->ID,
82
+                $term->term_id,
83
+                Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME
84
+            );
85
+        }
86
+    }
87 87
 
88 88
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
 		);
48 48
 
49 49
 		// Bail if term doesn't exist.
50
-		if ( empty( $term ) ) {
50
+		if (empty($term)) {
51 51
 			return false;
52 52
 		}
53 53
 
Please login to merge, or discard this patch.
src/includes/class-wordlift-jsonld-website-converter.php 2 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -15,68 +15,68 @@
 block discarded – undo
15 15
  */
16 16
 class Wordlift_Website_Jsonld_Converter extends Wordlift_Post_To_Jsonld_Converter {
17 17
 
18
-	/**
19
-	 * Convert the home/blog page to a JSON-LD array.
20
-	 *
21
-	 * @since 3.14.0
22
-	 *
23
-	 * @return array A JSON-LD array.
24
-	 */
25
-	public function create_schema() {
18
+    /**
19
+     * Convert the home/blog page to a JSON-LD array.
20
+     *
21
+     * @since 3.14.0
22
+     *
23
+     * @return array A JSON-LD array.
24
+     */
25
+    public function create_schema() {
26 26
 
27
-		// Create new jsonld.
28
-		$home_url = home_url( '/' );
27
+        // Create new jsonld.
28
+        $home_url = home_url( '/' );
29 29
 
30
-		$jsonld = array(
31
-			'@context'      => 'http://schema.org',
32
-			'@type'         => 'WebSite',
33
-			'@id'           => "$home_url#website",
34
-			'name'          => html_entity_decode( get_bloginfo( 'name' ), ENT_QUOTES ),
35
-			'alternateName' => html_entity_decode( get_bloginfo( 'description' ), ENT_QUOTES ),
36
-			'url'           => $home_url,
37
-		);
30
+        $jsonld = array(
31
+            '@context'      => 'http://schema.org',
32
+            '@type'         => 'WebSite',
33
+            '@id'           => "$home_url#website",
34
+            'name'          => html_entity_decode( get_bloginfo( 'name' ), ENT_QUOTES ),
35
+            'alternateName' => html_entity_decode( get_bloginfo( 'description' ), ENT_QUOTES ),
36
+            'url'           => $home_url,
37
+        );
38 38
 
39
-		// Add publisher information.
40
-		$this->set_publisher( $jsonld );
39
+        // Add publisher information.
40
+        $this->set_publisher( $jsonld );
41 41
 
42
-		// Add search action.
43
-		$this->set_search_action( $jsonld );
42
+        // Add search action.
43
+        $this->set_search_action( $jsonld );
44 44
 
45
-		/**
46
-		 * Call the `wl_website_jsonld` filter.
47
-		 *
48
-		 * @api
49
-		 *
50
-		 * @since 3.14.0
51
-		 *
52
-		 * @param array $jsonld The JSON-LD structure.
53
-		 */
54
-		return apply_filters( 'wl_website_jsonld', $jsonld );
55
-	}
45
+        /**
46
+         * Call the `wl_website_jsonld` filter.
47
+         *
48
+         * @api
49
+         *
50
+         * @since 3.14.0
51
+         *
52
+         * @param array $jsonld The JSON-LD structure.
53
+         */
54
+        return apply_filters( 'wl_website_jsonld', $jsonld );
55
+    }
56 56
 
57
-	/**
58
-	 * Add SearchAction part to the schema
59
-	 *
60
-	 * @since 3.14.0
61
-	 *
62
-	 * @param array $params The parameters array.
63
-	 */
64
-	private function set_search_action( &$params ) {
65
-		/**
66
-		 * Filter: 'wl_jsonld_search_url' - Allows filtering of the search URL.
67
-		 *
68
-		 * @since  3.14.0
69
-		 * @api    string $search_url The search URL for this site with a `{search_term_string}` variable.
70
-		 */
71
-		$search_url = apply_filters( 'wl_jsonld_search_url', home_url( '/' ) . '?s={search_term_string}' );
57
+    /**
58
+     * Add SearchAction part to the schema
59
+     *
60
+     * @since 3.14.0
61
+     *
62
+     * @param array $params The parameters array.
63
+     */
64
+    private function set_search_action( &$params ) {
65
+        /**
66
+         * Filter: 'wl_jsonld_search_url' - Allows filtering of the search URL.
67
+         *
68
+         * @since  3.14.0
69
+         * @api    string $search_url The search URL for this site with a `{search_term_string}` variable.
70
+         */
71
+        $search_url = apply_filters( 'wl_jsonld_search_url', home_url( '/' ) . '?s={search_term_string}' );
72 72
 
73
-		// Add search action
74
-		$params['potentialAction'] = array(
75
-			'@type'       => 'SearchAction',
76
-			'target'      => $search_url,
77
-			'query-input' => 'required name=search_term_string',
78
-		);
73
+        // Add search action
74
+        $params['potentialAction'] = array(
75
+            '@type'       => 'SearchAction',
76
+            'target'      => $search_url,
77
+            'query-input' => 'required name=search_term_string',
78
+        );
79 79
 
80
-	}
80
+    }
81 81
 
82 82
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,22 +25,22 @@  discard block
 block discarded – undo
25 25
 	public function create_schema() {
26 26
 
27 27
 		// Create new jsonld.
28
-		$home_url = home_url( '/' );
28
+		$home_url = home_url('/');
29 29
 
30 30
 		$jsonld = array(
31 31
 			'@context'      => 'http://schema.org',
32 32
 			'@type'         => 'WebSite',
33 33
 			'@id'           => "$home_url#website",
34
-			'name'          => html_entity_decode( get_bloginfo( 'name' ), ENT_QUOTES ),
35
-			'alternateName' => html_entity_decode( get_bloginfo( 'description' ), ENT_QUOTES ),
34
+			'name'          => html_entity_decode(get_bloginfo('name'), ENT_QUOTES),
35
+			'alternateName' => html_entity_decode(get_bloginfo('description'), ENT_QUOTES),
36 36
 			'url'           => $home_url,
37 37
 		);
38 38
 
39 39
 		// Add publisher information.
40
-		$this->set_publisher( $jsonld );
40
+		$this->set_publisher($jsonld);
41 41
 
42 42
 		// Add search action.
43
-		$this->set_search_action( $jsonld );
43
+		$this->set_search_action($jsonld);
44 44
 
45 45
 		/**
46 46
 		 * Call the `wl_website_jsonld` filter.
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		 *
52 52
 		 * @param array $jsonld The JSON-LD structure.
53 53
 		 */
54
-		return apply_filters( 'wl_website_jsonld', $jsonld );
54
+		return apply_filters('wl_website_jsonld', $jsonld);
55 55
 	}
56 56
 
57 57
 	/**
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
 	 *
62 62
 	 * @param array $params The parameters array.
63 63
 	 */
64
-	private function set_search_action( &$params ) {
64
+	private function set_search_action(&$params) {
65 65
 		/**
66 66
 		 * Filter: 'wl_jsonld_search_url' - Allows filtering of the search URL.
67 67
 		 *
68 68
 		 * @since  3.14.0
69 69
 		 * @api    string $search_url The search URL for this site with a `{search_term_string}` variable.
70 70
 		 */
71
-		$search_url = apply_filters( 'wl_jsonld_search_url', home_url( '/' ) . '?s={search_term_string}' );
71
+		$search_url = apply_filters('wl_jsonld_search_url', home_url('/').'?s={search_term_string}');
72 72
 
73 73
 		// Add search action
74 74
 		$params['potentialAction'] = array(
Please login to merge, or discard this patch.
src/admin/partials/wordlift-admin-news-widget.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <?php $articles = $this->get_last_wordlift_articles(); ?>
2 2
 <div id='news_container'>
3
-	<?php if ( ! empty( $articles['posts_data'] ) ) { ?>
4
-		<?php foreach ( $articles['posts_data'] as $key => $item ) { ?>
3
+	<?php if ( ! empty($articles['posts_data'])) { ?>
4
+		<?php foreach ($articles['posts_data'] as $key => $item) { ?>
5 5
             <div>
6 6
                 <a target="_blank"
7
-                   href="<?php echo esc_url( $item['post_url'] ); ?>"><?php echo esc_html( $item['post_title'] ); ?></a>
7
+                   href="<?php echo esc_url($item['post_url']); ?>"><?php echo esc_html($item['post_title']); ?></a>
8 8
                 <p><?php echo $item['post_description']; ?></p>
9 9
             </div>
10 10
 		<?php } ?>
11 11
 	<?php } ?>
12 12
     <div>
13 13
         <a href="#" id="max_posts_count_3"
14
-           class="wl_more_posts"><?php echo esc_html__( 'More posts', 'wordlift' ); ?></a>
14
+           class="wl_more_posts"><?php echo esc_html__('More posts', 'wordlift'); ?></a>
15 15
     </div>
16 16
 </div>
Please login to merge, or discard this patch.
src/admin/partials/admin-setup/step-1.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,42 +1,42 @@  discard block
 block discarded – undo
1 1
 <!-- Pane 1 content -->
2 2
 <script type="text/html" id="page-0">
3 3
 	<h2 class="page-title">
4
-		<?php esc_html_e( 'Welcome', 'wordlift' ); ?>
4
+		<?php esc_html_e('Welcome', 'wordlift'); ?>
5 5
 	</h2>
6 6
 
7 7
 	<p class="page-txt">
8
-		   <?php esc_html_e( 'Thank you for downloading WordLift. Now you can boost your website with a double-digit growth. WordLift helps you with:', 'wordlift' ); ?>
8
+		   <?php esc_html_e('Thank you for downloading WordLift. Now you can boost your website with a double-digit growth. WordLift helps you with:', 'wordlift'); ?>
9 9
 	</p>
10 10
 
11 11
 	<ul class="page-list">
12 12
 		<li>
13 13
 			<span class="fa fa-university"></span>
14
-			<?php esc_html_e( 'Trustworthiness', 'wordlift' ); ?>
14
+			<?php esc_html_e('Trustworthiness', 'wordlift'); ?>
15 15
 		</li>
16 16
 
17 17
 		<li>
18 18
 			<span class="fa fa-map-marker"></span>
19
-			<?php esc_html_e( 'Enrichment', 'wordlift' ); ?>
19
+			<?php esc_html_e('Enrichment', 'wordlift'); ?>
20 20
 		</li>
21 21
 
22 22
 		<li>
23 23
 			<span class="fa fa-heart"></span>
24
-			<?php esc_html_e( 'Engagement', 'wordlift' ); ?>
24
+			<?php esc_html_e('Engagement', 'wordlift'); ?>
25 25
 		</li>
26 26
 
27 27
 		<li>
28 28
 			<span class="fa fa-hand-o-right"></span>
29
-			<?php esc_html_e( 'Smart Navigation', 'wordlift' ); ?>
29
+			<?php esc_html_e('Smart Navigation', 'wordlift'); ?>
30 30
 		</li>
31 31
 
32 32
 		<li>
33 33
 			<span class="fa fa-google"></span>
34
-			<?php esc_html_e( 'SEO Optimization', 'wordlift' ); ?>
34
+			<?php esc_html_e('SEO Optimization', 'wordlift'); ?>
35 35
 		</li>
36 36
 
37 37
 		<li>
38 38
 			<span class="fa fa-group"></span>
39
-			<?php esc_html_e( 'Content Marketing', 'wordlift' ); ?>
39
+			<?php esc_html_e('Content Marketing', 'wordlift'); ?>
40 40
 		</li>
41 41
 	</ul>
42 42
 
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
 				target="_tab"
47 47
 				class="button"
48 48
 			>
49
-				<?php esc_html_e( 'Learn More', 'wordlift' ); ?>
49
+				<?php esc_html_e('Learn More', 'wordlift'); ?>
50 50
 			</a>
51 51
 			<input
52 52
 				type="button"
53 53
 				data-wl-next="wl-next"
54 54
 				class="wl-default-action"
55
-				value="<?php esc_attr_e( 'Next', 'wordlift' ); ?>"
55
+				value="<?php esc_attr_e('Next', 'wordlift'); ?>"
56 56
 			>
57 57
 	</div>
58 58
 </script>
59 59
\ No newline at end of file
Please login to merge, or discard this patch.
src/admin/partials/admin-setup/step-4.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <!-- Pane 4 content -->
2 2
 <script type="text/html" id="page-3">
3 3
 	<h2 class="page-title">
4
-		<?php esc_html_e( 'Vocabulary', 'wordlift' ); ?>	
4
+		<?php esc_html_e('Vocabulary', 'wordlift'); ?>	
5 5
 	</h2>
6 6
 
7 7
 	<p class="page-txt">
8
-		<?php esc_html_e( 'All new pages created with WordLift, will be stored inside your internal vocabulary. You can customize the url pattern of these pages in the field below. Check our FAQs if you need more info.', 'wordlift' ); ?>
8
+		<?php esc_html_e('All new pages created with WordLift, will be stored inside your internal vocabulary. You can customize the url pattern of these pages in the field below. Check our FAQs if you need more info.', 'wordlift'); ?>
9 9
 	</p>
10 10
 
11 11
 	<input
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	>
20 20
 	
21 21
 	<p class="page-det">
22
-		<?php esc_html_e( 'Leave it empty to place your entities in the root folder of your website', 'wordlift' ); ?>
22
+		<?php esc_html_e('Leave it empty to place your entities in the root folder of your website', 'wordlift'); ?>
23 23
 	</p>
24 24
 	
25 25
 	<div class="btn-wrapper">
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 			type="button"
28 28
 			data-wl-next="wl-next"
29 29
 			class="wl-default-action"
30
-			value="<?php esc_attr_e( 'Next', 'wordlift' ); ?>"
30
+			value="<?php esc_attr_e('Next', 'wordlift'); ?>"
31 31
 		>
32 32
 	</div>
33 33
 </script>
Please login to merge, or discard this patch.
src/admin/partials/admin-setup/step-2.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
 	<br>
7 7
 	<p class="page-txt">
8 8
 		<?php
9
-			esc_html_e( 'Help us improve our product by automatically sending diagnostic and usage data.', 'wordlift' ); 
10
-		?>
9
+            esc_html_e( 'Help us improve our product by automatically sending diagnostic and usage data.', 'wordlift' ); 
10
+        ?>
11 11
 	</p>
12 12
 	<input
13 13
 		type="checkbox"
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <!-- Pane 2 content -->
2 2
 <script type="text/html" id="page-1">
3 3
 	<h2 class="page-title">
4
-		<?php esc_html_e( 'Diagnostic', 'wordlift' ); ?>
4
+		<?php esc_html_e('Diagnostic', 'wordlift'); ?>
5 5
 	</h2>
6 6
 	<br>
7 7
 	<p class="page-txt">
8 8
 		<?php
9
-			esc_html_e( 'Help us improve our product by automatically sending diagnostic and usage data.', 'wordlift' ); 
9
+			esc_html_e('Help us improve our product by automatically sending diagnostic and usage data.', 'wordlift'); 
10 10
 		?>
11 11
 	</p>
12 12
 	<input
@@ -17,12 +17,12 @@  discard block
 block discarded – undo
17 17
 		checked
18 18
 	>
19 19
 	<label for="share-diagnostic">
20
-		<?php esc_html_e( 'Share diagnostic data', 'wordlift' ); ?>
20
+		<?php esc_html_e('Share diagnostic data', 'wordlift'); ?>
21 21
 	</label>
22 22
 	
23 23
 	<p class="privacy-policy-details">
24 24
 		<a href="https://wordlift.io/privacy-policy/" target="_blank">
25
-			<?php esc_html_e( 'About our privacy policy...', 'wordlift' ); ?>	
25
+			<?php esc_html_e('About our privacy policy...', 'wordlift'); ?>	
26 26
 		</a>
27 27
 	</p>
28 28
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 			type="button"
32 32
 			data-wl-next="wl-next"
33 33
 			class="wl-default-action"
34
-			value="<?php esc_attr_e( 'Next', 'wordlift' ); ?>"
34
+			value="<?php esc_attr_e('Next', 'wordlift'); ?>"
35 35
 		>
36 36
 	</div>
37 37
 </script>
Please login to merge, or discard this patch.