Completed
Push — develop ( 448679...1158c5 )
by David
03:44
created
src/wordlift/dataset/class-sync-hooks-wordpress-ontology.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -6,50 +6,50 @@
 block discarded – undo
6 6
 
7 7
 class Sync_Hooks_Wordpress_Ontology {
8 8
 
9
-	const HTTP_PURL_ORG_WORDPRESS_1_0 = 'http://purl.org/wordpress/1.0/';
9
+    const HTTP_PURL_ORG_WORDPRESS_1_0 = 'http://purl.org/wordpress/1.0/';
10 10
 
11
-	public function __construct() {
12
-		add_filter( 'wl_dataset__sync_service__sync_item__jsonld', array( $this, 'jsonld' ), 10, 3 );
13
-	}
11
+    public function __construct() {
12
+        add_filter( 'wl_dataset__sync_service__sync_item__jsonld', array( $this, 'jsonld' ), 10, 3 );
13
+    }
14 14
 
15
-	public function jsonld( $jsonld, $type, $object_id ) {
15
+    public function jsonld( $jsonld, $type, $object_id ) {
16 16
 
17
-		$jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'id' ] = $object_id;
17
+        $jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'id' ] = $object_id;
18 18
 
19
-		switch ( $type ) {
19
+        switch ( $type ) {
20 20
 
21
-			case Object_Type_Enum::TERM:
22
-				$term = get_term( $object_id );
21
+            case Object_Type_Enum::TERM:
22
+                $term = get_term( $object_id );
23 23
 
24
-				$jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'type' ]        = 'term';
25
-				$jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'name' ]        = $term->name;
26
-				$jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'description' ] = $term->description;
27
-				break;
24
+                $jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'type' ]        = 'term';
25
+                $jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'name' ]        = $term->name;
26
+                $jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'description' ] = $term->description;
27
+                break;
28 28
 
29
-			case Object_Type_Enum::USER:
30
-				$user = get_userdata( $object_id );
29
+            case Object_Type_Enum::USER:
30
+                $user = get_userdata( $object_id );
31 31
 
32
-				$jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'type' ]        = 'user';
33
-				$jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'displayName' ] = $user->display_name;
34
-				break;
32
+                $jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'type' ]        = 'user';
33
+                $jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'displayName' ] = $user->display_name;
34
+                break;
35 35
 
36
-			case Object_Type_Enum::POST:
37
-				$post = get_post( $object_id );
36
+            case Object_Type_Enum::POST:
37
+                $post = get_post( $object_id );
38 38
 
39
-				$jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'type' ]       = 'post';
40
-				$jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'customType' ] = $post->post_type;
41
-				$jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'title' ]      = $post->post_title;
42
-				$jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'status' ]     = $post->post_status;
43
-				$content   = has_blocks( $post ) ? do_blocks( $post->post_content ) : do_shortcode( $post->post_content );
44
-				$jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'content' ]    = $content;
45
-				$jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'permalink' ]  = get_permalink( $post );
46
-				break;
39
+                $jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'type' ]       = 'post';
40
+                $jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'customType' ] = $post->post_type;
41
+                $jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'title' ]      = $post->post_title;
42
+                $jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'status' ]     = $post->post_status;
43
+                $content   = has_blocks( $post ) ? do_blocks( $post->post_content ) : do_shortcode( $post->post_content );
44
+                $jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'content' ]    = $content;
45
+                $jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'permalink' ]  = get_permalink( $post );
46
+                break;
47 47
 
48
-			default:
48
+            default:
49 49
 
50
-		}
50
+        }
51 51
 
52
-		return $jsonld;
53
-	}
52
+        return $jsonld;
53
+    }
54 54
 
55 55
 }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -9,40 +9,40 @@
 block discarded – undo
9 9
 	const HTTP_PURL_ORG_WORDPRESS_1_0 = 'http://purl.org/wordpress/1.0/';
10 10
 
11 11
 	public function __construct() {
12
-		add_filter( 'wl_dataset__sync_service__sync_item__jsonld', array( $this, 'jsonld' ), 10, 3 );
12
+		add_filter('wl_dataset__sync_service__sync_item__jsonld', array($this, 'jsonld'), 10, 3);
13 13
 	}
14 14
 
15
-	public function jsonld( $jsonld, $type, $object_id ) {
15
+	public function jsonld($jsonld, $type, $object_id) {
16 16
 
17
-		$jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'id' ] = $object_id;
17
+		$jsonld[0][self::HTTP_PURL_ORG_WORDPRESS_1_0.'id'] = $object_id;
18 18
 
19
-		switch ( $type ) {
19
+		switch ($type) {
20 20
 
21 21
 			case Object_Type_Enum::TERM:
22
-				$term = get_term( $object_id );
22
+				$term = get_term($object_id);
23 23
 
24
-				$jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'type' ]        = 'term';
25
-				$jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'name' ]        = $term->name;
26
-				$jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'description' ] = $term->description;
24
+				$jsonld[0][self::HTTP_PURL_ORG_WORDPRESS_1_0.'type']        = 'term';
25
+				$jsonld[0][self::HTTP_PURL_ORG_WORDPRESS_1_0.'name']        = $term->name;
26
+				$jsonld[0][self::HTTP_PURL_ORG_WORDPRESS_1_0.'description'] = $term->description;
27 27
 				break;
28 28
 
29 29
 			case Object_Type_Enum::USER:
30
-				$user = get_userdata( $object_id );
30
+				$user = get_userdata($object_id);
31 31
 
32
-				$jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'type' ]        = 'user';
33
-				$jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'displayName' ] = $user->display_name;
32
+				$jsonld[0][self::HTTP_PURL_ORG_WORDPRESS_1_0.'type']        = 'user';
33
+				$jsonld[0][self::HTTP_PURL_ORG_WORDPRESS_1_0.'displayName'] = $user->display_name;
34 34
 				break;
35 35
 
36 36
 			case Object_Type_Enum::POST:
37
-				$post = get_post( $object_id );
38
-
39
-				$jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'type' ]       = 'post';
40
-				$jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'customType' ] = $post->post_type;
41
-				$jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'title' ]      = $post->post_title;
42
-				$jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'status' ]     = $post->post_status;
43
-				$content   = has_blocks( $post ) ? do_blocks( $post->post_content ) : do_shortcode( $post->post_content );
44
-				$jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'content' ]    = $content;
45
-				$jsonld[0][ self::HTTP_PURL_ORG_WORDPRESS_1_0 . 'permalink' ]  = get_permalink( $post );
37
+				$post = get_post($object_id);
38
+
39
+				$jsonld[0][self::HTTP_PURL_ORG_WORDPRESS_1_0.'type']       = 'post';
40
+				$jsonld[0][self::HTTP_PURL_ORG_WORDPRESS_1_0.'customType'] = $post->post_type;
41
+				$jsonld[0][self::HTTP_PURL_ORG_WORDPRESS_1_0.'title']      = $post->post_title;
42
+				$jsonld[0][self::HTTP_PURL_ORG_WORDPRESS_1_0.'status']     = $post->post_status;
43
+				$content = has_blocks($post) ? do_blocks($post->post_content) : do_shortcode($post->post_content);
44
+				$jsonld[0][self::HTTP_PURL_ORG_WORDPRESS_1_0.'content']    = $content;
45
+				$jsonld[0][self::HTTP_PURL_ORG_WORDPRESS_1_0.'permalink']  = get_permalink($post);
46 46
 				break;
47 47
 
48 48
 			default:
Please login to merge, or discard this patch.