Completed
Pull Request — develop (#1707)
by
unknown
01:18
created
src/classes/content/wordpress/class-abstract-wordpress-content-service.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -16,33 +16,33 @@  discard block
 block discarded – undo
16 16
 	}
17 17
 
18 18
 	protected function get_dataset_uri() {
19
-		return trailingslashit( Wordlift_Configuration_Service::get_instance()->get_dataset_uri() );
19
+		return trailingslashit(Wordlift_Configuration_Service::get_instance()->get_dataset_uri());
20 20
 	}
21 21
 
22
-	protected function is_absolute( $uri ) {
23
-		return 1 === preg_match( '@^https?://@', $uri );
22
+	protected function is_absolute($uri) {
23
+		return 1 === preg_match('@^https?://@', $uri);
24 24
 	}
25 25
 
26
-	protected function is_internal( $uri ) {
26
+	protected function is_internal($uri) {
27 27
 		$dataset_uri = $this->get_dataset_uri();
28 28
 
29
-		return ! empty( $dataset_uri ) && 0 === strpos( $uri, $dataset_uri );
29
+		return ! empty($dataset_uri) && 0 === strpos($uri, $dataset_uri);
30 30
 	}
31 31
 
32
-	protected function make_absolute( $uri ) {
33
-		Assertions::not_empty( $this->get_dataset_uri(), '`dataset_uri` cannot be empty.' );
32
+	protected function make_absolute($uri) {
33
+		Assertions::not_empty($this->get_dataset_uri(), '`dataset_uri` cannot be empty.');
34 34
 
35
-		if ( 1 !== preg_match( '@^https?://@', $uri ) ) {
36
-			return $this->get_dataset_uri() . $uri;
35
+		if (1 !== preg_match('@^https?://@', $uri)) {
36
+			return $this->get_dataset_uri().$uri;
37 37
 		}
38 38
 
39 39
 		return $uri;
40 40
 	}
41 41
 
42
-	protected function make_relative( $uri ) {
42
+	protected function make_relative($uri) {
43 43
 		$dataset_uri = $this->get_dataset_uri();
44
-		if ( 0 === strpos( $uri, $dataset_uri ) ) {
45
-			return substr( $uri, strlen( $dataset_uri ) );
44
+		if (0 === strpos($uri, $dataset_uri)) {
45
+			return substr($uri, strlen($dataset_uri));
46 46
 		}
47 47
 
48 48
 		return $uri;
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @return string|null
55 55
 	 */
56
-	public function get_about_jsonld( $content_id ) {
56
+	public function get_about_jsonld($content_id) {
57 57
 		global $wpdb;
58 58
 
59 59
 		return $wpdb->get_var(
@@ -74,18 +74,18 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @throws Exception If the 'match_name' column does not exist in the database table.
76 76
 	 */
77
-	public function set_about_jsonld( $content_id, $value ) {
77
+	public function set_about_jsonld($content_id, $value) {
78 78
 		global $wpdb;
79 79
 
80 80
 		// Cleanup value.
81
-		$value      = ( is_string( $value ) && strlen( $value ) > 2 ) ? $value : null;
81
+		$value      = (is_string($value) && strlen($value) > 2) ? $value : null;
82 82
 		$match_name = "NULL";
83 83
 
84
-		if ( $value ) {
84
+		if ($value) {
85 85
 			// Check if the 'match_name' column exists in the database table
86
-			$columns = $wpdb->get_col_info( 'name', 0 );
87
-			if ( in_array( 'match_name', $columns ) ) {
88
-				$match_name = $this->get_match_name( $value );
86
+			$columns = $wpdb->get_col_info('name', 0);
87
+			if (in_array('match_name', $columns)) {
88
+				$match_name = $this->get_match_name($value);
89 89
 			}
90 90
 		}
91 91
 
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
 		// should revise how this works really.
94 94
 		//
95 95
 		// This is currently needed because rel_uri is required in the table.
96
-		switch ( $content_id->get_type() ) {
96
+		switch ($content_id->get_type()) {
97 97
 			case Object_Type_Enum::POST:
98
-				Wordpress_Dataset_Content_Service_Hooks::insert_post( $content_id->get_id() );
98
+				Wordpress_Dataset_Content_Service_Hooks::insert_post($content_id->get_id());
99 99
 				break;
100 100
 			case Object_Type_Enum::TERM:
101
-				Wordpress_Dataset_Content_Service_Hooks::created_term( $content_id->get_id() );
101
+				Wordpress_Dataset_Content_Service_Hooks::created_term($content_id->get_id());
102 102
 				break;
103 103
 			case Object_Type_Enum::USER:
104
-				Wordpress_Dataset_Content_Service_Hooks::user_register( $content_id->get_id() );
104
+				Wordpress_Dataset_Content_Service_Hooks::user_register($content_id->get_id());
105 105
 				break;
106 106
 		}
107 107
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 		 * as `null` if we directly pass it to the prepare function(). So its necessary
112 112
 		 * to make the query conditional based on the $value
113 113
 		 */
114
-		if ( null === $value ) {
114
+		if (null === $value) {
115 115
 			return $wpdb->query(
116 116
 				$wpdb->prepare(
117 117
 					"UPDATE {$wpdb->prefix}wl_entities
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 	 *
143 143
 	 * @return mixed|null
144 144
 	 */
145
-	public function get_match_name( $jsonld ) {
146
-		$data = json_decode( $jsonld, true );
147
-		if ( ! $data || ! array_key_exists( 'name', $data ) ) {
145
+	public function get_match_name($jsonld) {
146
+		$data = json_decode($jsonld, true);
147
+		if ( ! $data || ! array_key_exists('name', $data)) {
148 148
 			return "NULL";
149 149
 		}
150 150
 
Please login to merge, or discard this patch.
src/install/class-wordlift-install-3-49-1.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	 *
20 20
 	 * @return mixed
21 21
 	 */
22
-	public static function is_column_exists( $column_name ) {
22
+	public static function is_column_exists($column_name) {
23 23
 		global $wpdb;
24 24
 
25 25
 		return $wpdb->get_results(
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 		global $wpdb;
40 40
 
41 41
 		// Check if 'match_name' column exists
42
-		if ( self::is_column_exists( 'match_name' ) ) {
42
+		if (self::is_column_exists('match_name')) {
43 43
 			return;
44 44
 		}
45 45
 
@@ -56,17 +56,17 @@  discard block
 block discarded – undo
56 56
 		);
57 57
 
58 58
 		// Update 'match_name' for each row
59
-		foreach ( $results as $row ) {
60
-			$match_name = $this->get_match_name( $row['about_jsonld'] );
59
+		foreach ($results as $row) {
60
+			$match_name = $this->get_match_name($row['about_jsonld']);
61 61
 
62
-			if ( is_null( $match_name ) ) {
62
+			if (is_null($match_name)) {
63 63
 				continue;
64 64
 			}
65 65
 
66 66
 			$wpdb->update(
67 67
 				"{$wpdb->prefix}wl_relation_instances",
68
-				array( 'match_name' => $match_name ),
69
-				array( 'id' => $row['id'] )
68
+				array('match_name' => $match_name),
69
+				array('id' => $row['id'])
70 70
 			);
71 71
 		}
72 72
 
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return mixed|null
82 82
 	 */
83
-	public function get_match_name( $jsonld ) {
84
-		$data = json_decode( $jsonld, true );
85
-		if ( ! $data || ! array_key_exists( 'name', $data ) ) {
83
+	public function get_match_name($jsonld) {
84
+		$data = json_decode($jsonld, true);
85
+		if ( ! $data || ! array_key_exists('name', $data)) {
86 86
 			return null;
87 87
 		}
88 88
 
Please login to merge, or discard this patch.