Completed
Pull Request — develop (#900)
by William
04:03
created
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/geo_widget/wordlift_geo_widget.php 2 patches
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -9,32 +9,32 @@  discard block
 block discarded – undo
9 9
 
10 10
 function wordlift_geo_widget_shortcode( $atts, $content = null ) {
11 11
 
12
-	// Extract attributes and set default values.
13
-	$params = shortcode_atts( array(
14
-		'width'     => '100%',
15
-		'height'    => '300px',
16
-		'latitude'  => 0.0,
17
-		'longitude' => 0.0,
18
-		'zoom'      => 5,
19
-
20
-	), $atts );
21
-
22
-	// Add leaflet css and library.
23
-	wp_enqueue_style( 'leaflet_css', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/bower_components/leaflet/dist/leaflet.css' );
24
-	wp_enqueue_script( 'leaflet_js', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/bower_components/leaflet/dist/leaflet.js' );
25
-
26
-	ob_start(); // Collect the buffer.
27
-	wordlift_geo_widget_html(
28
-		$params['width'],
29
-		$params['height'],
30
-		$params['latitude'],
31
-		$params['longitude'],
32
-		$params['zoom'],
33
-		$content
34
-	);
35
-
36
-	// Return the accumulated buffer.
37
-	return ob_get_clean();
12
+    // Extract attributes and set default values.
13
+    $params = shortcode_atts( array(
14
+        'width'     => '100%',
15
+        'height'    => '300px',
16
+        'latitude'  => 0.0,
17
+        'longitude' => 0.0,
18
+        'zoom'      => 5,
19
+
20
+    ), $atts );
21
+
22
+    // Add leaflet css and library.
23
+    wp_enqueue_style( 'leaflet_css', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/bower_components/leaflet/dist/leaflet.css' );
24
+    wp_enqueue_script( 'leaflet_js', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/bower_components/leaflet/dist/leaflet.js' );
25
+
26
+    ob_start(); // Collect the buffer.
27
+    wordlift_geo_widget_html(
28
+        $params['width'],
29
+        $params['height'],
30
+        $params['latitude'],
31
+        $params['longitude'],
32
+        $params['zoom'],
33
+        $content
34
+    );
35
+
36
+    // Return the accumulated buffer.
37
+    return ob_get_clean();
38 38
 
39 39
 }
40 40
 
@@ -42,24 +42,24 @@  discard block
 block discarded – undo
42 42
 
43 43
 function wl_geo_widget_layer_shortcode( $atts ) {
44 44
 
45
-	// Extract attributes and set default values.
46
-	$params = shortcode_atts( array(
47
-		'name'  => '',
48
-		'label' => '',
49
-	), $atts );
45
+    // Extract attributes and set default values.
46
+    $params = shortcode_atts( array(
47
+        'name'  => '',
48
+        'label' => '',
49
+    ), $atts );
50 50
 
51
-	// Return if a SPARQL Query name hasn't been provided.
52
-	if ( empty( $params['name'] ) ) {
53
-		return;
54
-	}
51
+    // Return if a SPARQL Query name hasn't been provided.
52
+    if ( empty( $params['name'] ) ) {
53
+        return;
54
+    }
55 55
 
56
-	// Set the layer label.
57
-	$label_j = json_encode( empty( $params['label'] ) ? $params['name'] : $params['label'] );
56
+    // Set the layer label.
57
+    $label_j = json_encode( empty( $params['label'] ) ? $params['name'] : $params['label'] );
58 58
 
59
-	// Define the AJAX Url.
60
-	$ajax_url = admin_url( 'admin-ajax.php?action=wl_sparql&format=geojson&slug=' . urlencode( $params['name'] ) );
59
+    // Define the AJAX Url.
60
+    $ajax_url = admin_url( 'admin-ajax.php?action=wl_sparql&format=geojson&slug=' . urlencode( $params['name'] ) );
61 61
 
62
-	echo <<<EOF
62
+    echo <<<EOF
63 63
 
64 64
         $.ajax( '$ajax_url', {
65 65
             success: function( data ) {
@@ -90,21 +90,21 @@  discard block
 block discarded – undo
90 90
 
91 91
 function wl_geo_widget_marker_shortcode( $atts ) {
92 92
 
93
-	// Extract attributes and set default values.
94
-	$params = shortcode_atts( array(
95
-		'latitude'  => null,
96
-		'longitude' => null,
97
-	), $atts );
93
+    // Extract attributes and set default values.
94
+    $params = shortcode_atts( array(
95
+        'latitude'  => null,
96
+        'longitude' => null,
97
+    ), $atts );
98 98
 
99
-	// Return if either latitude or longitude haven't been provided.
100
-	if ( empty( $params['latitude'] ) || empty( $params['longitude'] ) ) {
101
-		return;
102
-	}
99
+    // Return if either latitude or longitude haven't been provided.
100
+    if ( empty( $params['latitude'] ) || empty( $params['longitude'] ) ) {
101
+        return;
102
+    }
103 103
 
104
-	$latitude_j  = json_encode( $params['latitude'] );
105
-	$longitude_j = json_encode( $params['longitude'] );
104
+    $latitude_j  = json_encode( $params['latitude'] );
105
+    $longitude_j = json_encode( $params['longitude'] );
106 106
 
107
-	echo <<<EOF
107
+    echo <<<EOF
108 108
 
109 109
 		L.marker([$latitude_j, $longitude_j]).addTo(map);
110 110
 EOF;
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
 
117 117
 function wordlift_geo_widget_html( $width, $height, $latitude, $longitude, $zoom, $content ) {
118 118
 
119
-	// Create a unique Id for this widget.
120
-	$div_id = uniqid( 'wl-geo-' );
119
+    // Create a unique Id for this widget.
120
+    $div_id = uniqid( 'wl-geo-' );
121 121
 
122
-	echo <<<EOF
122
+    echo <<<EOF
123 123
 <div id="$div_id" style="width: $width; height: $height;"></div>
124 124
 
125 125
 <script type="text/javascript">
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
 
145 145
 EOF;
146 146
 
147
-	// Run inner shortcodes.
148
-	do_shortcode( $content );
147
+    // Run inner shortcodes.
148
+    do_shortcode( $content );
149 149
 
150
-	echo <<<EOF
150
+    echo <<<EOF
151 151
 
152 152
     } );
153 153
 </script>
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -7,21 +7,21 @@  discard block
 block discarded – undo
7 7
  * @subpackage Wordlift/modules/geo_widget
8 8
  */
9 9
 
10
-function wordlift_geo_widget_shortcode( $atts, $content = null ) {
10
+function wordlift_geo_widget_shortcode($atts, $content = null) {
11 11
 
12 12
 	// Extract attributes and set default values.
13
-	$params = shortcode_atts( array(
13
+	$params = shortcode_atts(array(
14 14
 		'width'     => '100%',
15 15
 		'height'    => '300px',
16 16
 		'latitude'  => 0.0,
17 17
 		'longitude' => 0.0,
18 18
 		'zoom'      => 5,
19 19
 
20
-	), $atts );
20
+	), $atts);
21 21
 
22 22
 	// Add leaflet css and library.
23
-	wp_enqueue_style( 'leaflet_css', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/bower_components/leaflet/dist/leaflet.css' );
24
-	wp_enqueue_script( 'leaflet_js', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/bower_components/leaflet/dist/leaflet.js' );
23
+	wp_enqueue_style('leaflet_css', dirname(dirname(plugin_dir_url(__FILE__))).'/bower_components/leaflet/dist/leaflet.css');
24
+	wp_enqueue_script('leaflet_js', dirname(dirname(plugin_dir_url(__FILE__))).'/bower_components/leaflet/dist/leaflet.js');
25 25
 
26 26
 	ob_start(); // Collect the buffer.
27 27
 	wordlift_geo_widget_html(
@@ -38,26 +38,26 @@  discard block
 block discarded – undo
38 38
 
39 39
 }
40 40
 
41
-add_shortcode( 'wl_geo', 'wordlift_geo_widget_shortcode' );
41
+add_shortcode('wl_geo', 'wordlift_geo_widget_shortcode');
42 42
 
43
-function wl_geo_widget_layer_shortcode( $atts ) {
43
+function wl_geo_widget_layer_shortcode($atts) {
44 44
 
45 45
 	// Extract attributes and set default values.
46
-	$params = shortcode_atts( array(
46
+	$params = shortcode_atts(array(
47 47
 		'name'  => '',
48 48
 		'label' => '',
49
-	), $atts );
49
+	), $atts);
50 50
 
51 51
 	// Return if a SPARQL Query name hasn't been provided.
52
-	if ( empty( $params['name'] ) ) {
52
+	if (empty($params['name'])) {
53 53
 		return;
54 54
 	}
55 55
 
56 56
 	// Set the layer label.
57
-	$label_j = json_encode( empty( $params['label'] ) ? $params['name'] : $params['label'] );
57
+	$label_j = json_encode(empty($params['label']) ? $params['name'] : $params['label']);
58 58
 
59 59
 	// Define the AJAX Url.
60
-	$ajax_url = admin_url( 'admin-ajax.php?action=wl_sparql&format=geojson&slug=' . urlencode( $params['name'] ) );
60
+	$ajax_url = admin_url('admin-ajax.php?action=wl_sparql&format=geojson&slug='.urlencode($params['name']));
61 61
 
62 62
 	echo <<<EOF
63 63
 
@@ -85,24 +85,24 @@  discard block
 block discarded – undo
85 85
 
86 86
 }
87 87
 
88
-add_shortcode( 'wl_geo_layer', 'wl_geo_widget_layer_shortcode' );
88
+add_shortcode('wl_geo_layer', 'wl_geo_widget_layer_shortcode');
89 89
 
90 90
 
91
-function wl_geo_widget_marker_shortcode( $atts ) {
91
+function wl_geo_widget_marker_shortcode($atts) {
92 92
 
93 93
 	// Extract attributes and set default values.
94
-	$params = shortcode_atts( array(
94
+	$params = shortcode_atts(array(
95 95
 		'latitude'  => null,
96 96
 		'longitude' => null,
97
-	), $atts );
97
+	), $atts);
98 98
 
99 99
 	// Return if either latitude or longitude haven't been provided.
100
-	if ( empty( $params['latitude'] ) || empty( $params['longitude'] ) ) {
100
+	if (empty($params['latitude']) || empty($params['longitude'])) {
101 101
 		return;
102 102
 	}
103 103
 
104
-	$latitude_j  = json_encode( $params['latitude'] );
105
-	$longitude_j = json_encode( $params['longitude'] );
104
+	$latitude_j  = json_encode($params['latitude']);
105
+	$longitude_j = json_encode($params['longitude']);
106 106
 
107 107
 	echo <<<EOF
108 108
 
@@ -111,13 +111,13 @@  discard block
 block discarded – undo
111 111
 
112 112
 }
113 113
 
114
-add_shortcode( 'wl_geo_marker', 'wl_geo_widget_marker_shortcode' );
114
+add_shortcode('wl_geo_marker', 'wl_geo_widget_marker_shortcode');
115 115
 
116 116
 
117
-function wordlift_geo_widget_html( $width, $height, $latitude, $longitude, $zoom, $content ) {
117
+function wordlift_geo_widget_html($width, $height, $latitude, $longitude, $zoom, $content) {
118 118
 
119 119
 	// Create a unique Id for this widget.
120
-	$div_id = uniqid( 'wl-geo-' );
120
+	$div_id = uniqid('wl-geo-');
121 121
 
122 122
 	echo <<<EOF
123 123
 <div id="$div_id" style="width: $width; height: $height;"></div>
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 EOF;
146 146
 
147 147
 	// Run inner shortcodes.
148
-	do_shortcode( $content );
148
+	do_shortcode($content);
149 149
 
150 150
 	echo <<<EOF
151 151
 
Please login to merge, or discard this patch.
src/includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -18,50 +18,50 @@
 block discarded – undo
18 18
  */
19 19
 class Wordlift_Post_Meta_Uri_Storage extends Wordlift_Post_Meta_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
-	 * Create a {@link Wordlift_Post_Meta_Uri_Storage} instance.
32
-	 *
33
-	 * @since 3.15.0
34
-	 *
35
-	 * @param string                   $meta_key       The meta key to read data from.
36
-	 * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance.
37
-	 */
38
-	public function __construct( $meta_key, $entity_service ) {
39
-		parent::__construct( $meta_key );
30
+    /**
31
+     * Create a {@link Wordlift_Post_Meta_Uri_Storage} instance.
32
+     *
33
+     * @since 3.15.0
34
+     *
35
+     * @param string                   $meta_key       The meta key to read data from.
36
+     * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance.
37
+     */
38
+    public function __construct( $meta_key, $entity_service ) {
39
+        parent::__construct( $meta_key );
40 40
 
41
-		$this->entity_service = $entity_service;
41
+        $this->entity_service = $entity_service;
42 42
 
43
-	}
43
+    }
44 44
 
45
-	/**
46
-	 * Get the value for the specified meta key.
47
-	 *
48
-	 * The value is expected to be an entity post, for which the URI is loaded
49
-	 * and returned.
50
-	 *
51
-	 * @since 3.15.0
52
-	 *
53
-	 * @param int $post_id The {@link WP_Post}'s id.
54
-	 *
55
-	 * @return array An array of URIs (or an empty array if nothing is set).
56
-	 */
57
-	public function get( $post_id ) {
58
-		$values = parent::get( $post_id );
45
+    /**
46
+     * Get the value for the specified meta key.
47
+     *
48
+     * The value is expected to be an entity post, for which the URI is loaded
49
+     * and returned.
50
+     *
51
+     * @since 3.15.0
52
+     *
53
+     * @param int $post_id The {@link WP_Post}'s id.
54
+     *
55
+     * @return array An array of URIs (or an empty array if nothing is set).
56
+     */
57
+    public function get( $post_id ) {
58
+        $values = parent::get( $post_id );
59 59
 
60
-		$entity_service = $this->entity_service;
60
+        $entity_service = $this->entity_service;
61 61
 
62
-		return array_map( function ( $item ) use ( $entity_service ) {
63
-			return $this->entity_service->get_uri( $item );
64
-		}, $values );
65
-	}
62
+        return array_map( function ( $item ) use ( $entity_service ) {
63
+            return $this->entity_service->get_uri( $item );
64
+        }, $values );
65
+    }
66 66
 
67 67
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
 	 * @param string                   $meta_key       The meta key to read data from.
36 36
 	 * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance.
37 37
 	 */
38
-	public function __construct( $meta_key, $entity_service ) {
39
-		parent::__construct( $meta_key );
38
+	public function __construct($meta_key, $entity_service) {
39
+		parent::__construct($meta_key);
40 40
 
41 41
 		$this->entity_service = $entity_service;
42 42
 
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @return array An array of URIs (or an empty array if nothing is set).
56 56
 	 */
57
-	public function get( $post_id ) {
58
-		$values = parent::get( $post_id );
57
+	public function get($post_id) {
58
+		$values = parent::get($post_id);
59 59
 
60 60
 		$entity_service = $this->entity_service;
61 61
 
62
-		return array_map( function ( $item ) use ( $entity_service ) {
63
-			return $this->entity_service->get_uri( $item );
64
-		}, $values );
62
+		return array_map(function($item) use ($entity_service) {
63
+			return $this->entity_service->get_uri($item);
64
+		}, $values);
65 65
 	}
66 66
 
67 67
 }
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.
src/includes/linked-data/storage/class-wordlift-post-image-storage.php 2 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -18,45 +18,45 @@
 block discarded – undo
18 18
  */
19 19
 class Wordlift_Post_Image_Storage extends Wordlift_Storage {
20 20
 
21
-	/**
22
-	 * Get the property value.
23
-	 *
24
-	 * @since 3.15.0
25
-	 *
26
-	 * @param int $post_id The {@link WP_Post}'s id.
27
-	 *
28
-	 * @return array|string|null A single string, or an array of values or null
29
-	 *                           if the property isn't recognized.
30
-	 */
31
-	public function get( $post_id ) {
32
-
33
-		// Prepare the return array.
34
-		$image_urls = array();
35
-
36
-		// If there is a featured image it has the priority.
37
-		$featured_image_id = get_post_thumbnail_id( $post_id );
38
-		if ( is_numeric( $featured_image_id ) ) {
39
-			$image_url = wp_get_attachment_url( $featured_image_id );
40
-
41
-			$image_urls[] = $image_url;
42
-		}
43
-
44
-		$images = get_children( array(
45
-			'post_parent'    => $post_id,
46
-			'post_type'      => 'attachment',
47
-			'post_mime_type' => 'image',
48
-		) );
49
-
50
-		// Collect the URLs.
51
-		foreach ( $images as $attachment_id => $attachment ) {
52
-			$image_url = wp_get_attachment_url( $attachment_id );
53
-			// Ensure the URL isn't collected already.
54
-			if ( ! in_array( $image_url, $image_urls ) ) {
55
-				array_push( $image_urls, $image_url );
56
-			}
57
-		}
58
-
59
-		return $image_urls;
60
-	}
21
+    /**
22
+     * Get the property value.
23
+     *
24
+     * @since 3.15.0
25
+     *
26
+     * @param int $post_id The {@link WP_Post}'s id.
27
+     *
28
+     * @return array|string|null A single string, or an array of values or null
29
+     *                           if the property isn't recognized.
30
+     */
31
+    public function get( $post_id ) {
32
+
33
+        // Prepare the return array.
34
+        $image_urls = array();
35
+
36
+        // If there is a featured image it has the priority.
37
+        $featured_image_id = get_post_thumbnail_id( $post_id );
38
+        if ( is_numeric( $featured_image_id ) ) {
39
+            $image_url = wp_get_attachment_url( $featured_image_id );
40
+
41
+            $image_urls[] = $image_url;
42
+        }
43
+
44
+        $images = get_children( array(
45
+            'post_parent'    => $post_id,
46
+            'post_type'      => 'attachment',
47
+            'post_mime_type' => 'image',
48
+        ) );
49
+
50
+        // Collect the URLs.
51
+        foreach ( $images as $attachment_id => $attachment ) {
52
+            $image_url = wp_get_attachment_url( $attachment_id );
53
+            // Ensure the URL isn't collected already.
54
+            if ( ! in_array( $image_url, $image_urls ) ) {
55
+                array_push( $image_urls, $image_url );
56
+            }
57
+        }
58
+
59
+        return $image_urls;
60
+    }
61 61
 
62 62
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -28,31 +28,31 @@
 block discarded – undo
28 28
 	 * @return array|string|null A single string, or an array of values or null
29 29
 	 *                           if the property isn't recognized.
30 30
 	 */
31
-	public function get( $post_id ) {
31
+	public function get($post_id) {
32 32
 
33 33
 		// Prepare the return array.
34 34
 		$image_urls = array();
35 35
 
36 36
 		// If there is a featured image it has the priority.
37
-		$featured_image_id = get_post_thumbnail_id( $post_id );
38
-		if ( is_numeric( $featured_image_id ) ) {
39
-			$image_url = wp_get_attachment_url( $featured_image_id );
37
+		$featured_image_id = get_post_thumbnail_id($post_id);
38
+		if (is_numeric($featured_image_id)) {
39
+			$image_url = wp_get_attachment_url($featured_image_id);
40 40
 
41 41
 			$image_urls[] = $image_url;
42 42
 		}
43 43
 
44
-		$images = get_children( array(
44
+		$images = get_children(array(
45 45
 			'post_parent'    => $post_id,
46 46
 			'post_type'      => 'attachment',
47 47
 			'post_mime_type' => 'image',
48
-		) );
48
+		));
49 49
 
50 50
 		// Collect the URLs.
51
-		foreach ( $images as $attachment_id => $attachment ) {
52
-			$image_url = wp_get_attachment_url( $attachment_id );
51
+		foreach ($images as $attachment_id => $attachment) {
52
+			$image_url = wp_get_attachment_url($attachment_id);
53 53
 			// Ensure the URL isn't collected already.
54
-			if ( ! in_array( $image_url, $image_urls ) ) {
55
-				array_push( $image_urls, $image_url );
54
+			if ( ! in_array($image_url, $image_urls)) {
55
+				array_push($image_urls, $image_url);
56 56
 			}
57 57
 		}
58 58
 
Please login to merge, or discard this patch.
src/includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -18,48 +18,48 @@
 block discarded – undo
18 18
  */
19 19
 class Wordlift_Post_Taxonomy_Storage extends Wordlift_Storage {
20 20
 
21
-	/**
22
-	 * The taxonomy name.
23
-	 *
24
-	 * @since  3.15.0
25
-	 * @access private
26
-	 * @var string $taxonomy The taxonomy name.
27
-	 */
28
-	private $taxonomy;
21
+    /**
22
+     * The taxonomy name.
23
+     *
24
+     * @since  3.15.0
25
+     * @access private
26
+     * @var string $taxonomy The taxonomy name.
27
+     */
28
+    private $taxonomy;
29 29
 
30
-	/**
31
-	 * Create a {@link Wordlift_Post_Taxonomy_Storage} with the specified
32
-	 * taxonomy name.
33
-	 *
34
-	 * @since 3.15.0
35
-	 *
36
-	 * @param string $taxonomy The taxonomy name.
37
-	 */
38
-	public function __construct( $taxonomy ) {
30
+    /**
31
+     * Create a {@link Wordlift_Post_Taxonomy_Storage} with the specified
32
+     * taxonomy name.
33
+     *
34
+     * @since 3.15.0
35
+     *
36
+     * @param string $taxonomy The taxonomy name.
37
+     */
38
+    public function __construct( $taxonomy ) {
39 39
 
40
-		$this->taxonomy = $taxonomy;
41
-	}
40
+        $this->taxonomy = $taxonomy;
41
+    }
42 42
 
43
-	/**
44
-	 * Get the taxonomy's terms associated with the specified {@link WP_Post}.
45
-	 *
46
-	 * @since 3.15.0
47
-	 *
48
-	 * @param int $post_id The {@link WP_Post}'s id.
49
-	 *
50
-	 * @return array|WP_Error An array of terms or {@link WP_Error} in case of error.
51
-	 */
52
-	public function get( $post_id ) {
43
+    /**
44
+     * Get the taxonomy's terms associated with the specified {@link WP_Post}.
45
+     *
46
+     * @since 3.15.0
47
+     *
48
+     * @param int $post_id The {@link WP_Post}'s id.
49
+     *
50
+     * @return array|WP_Error An array of terms or {@link WP_Error} in case of error.
51
+     */
52
+    public function get( $post_id ) {
53 53
 
54
-		return wp_get_post_terms( $post_id, $this->taxonomy, array(
55
-			'hide_empty' => false,
56
-			// Because of #334 (and the AAM plugin) we changed fields from 'id=>slug' to 'all'.
57
-			// An issue has been opened with the AAM plugin author as well.
58
-			//
59
-			// see https://github.com/insideout10/wordlift-plugin/issues/334
60
-			// see https://wordpress.org/support/topic/idslug-not-working-anymore?replies=1#post-8806863
61
-			'fields'     => 'all',
62
-		) );
63
-	}
54
+        return wp_get_post_terms( $post_id, $this->taxonomy, array(
55
+            'hide_empty' => false,
56
+            // Because of #334 (and the AAM plugin) we changed fields from 'id=>slug' to 'all'.
57
+            // An issue has been opened with the AAM plugin author as well.
58
+            //
59
+            // see https://github.com/insideout10/wordlift-plugin/issues/334
60
+            // see https://wordpress.org/support/topic/idslug-not-working-anymore?replies=1#post-8806863
61
+            'fields'     => 'all',
62
+        ) );
63
+    }
64 64
 
65 65
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @param string $taxonomy The taxonomy name.
37 37
 	 */
38
-	public function __construct( $taxonomy ) {
38
+	public function __construct($taxonomy) {
39 39
 
40 40
 		$this->taxonomy = $taxonomy;
41 41
 	}
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 	 *
50 50
 	 * @return array|WP_Error An array of terms or {@link WP_Error} in case of error.
51 51
 	 */
52
-	public function get( $post_id ) {
52
+	public function get($post_id) {
53 53
 
54
-		return wp_get_post_terms( $post_id, $this->taxonomy, array(
54
+		return wp_get_post_terms($post_id, $this->taxonomy, array(
55 55
 			'hide_empty' => false,
56 56
 			// Because of #334 (and the AAM plugin) we changed fields from 'id=>slug' to 'all'.
57 57
 			// An issue has been opened with the AAM plugin author as well.
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 			// see https://github.com/insideout10/wordlift-plugin/issues/334
60 60
 			// see https://wordpress.org/support/topic/idslug-not-working-anymore?replies=1#post-8806863
61 61
 			'fields'     => 'all',
62
-		) );
62
+		));
63 63
 	}
64 64
 
65 65
 }
Please login to merge, or discard this patch.
src/includes/linked-data/storage/class-wordlift-url-property-storage.php 2 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -16,42 +16,42 @@
 block discarded – undo
16 16
  */
17 17
 class Wordlift_Url_Property_Storage extends Wordlift_Storage {
18 18
 
19
-	/**
20
-	 * The {@link Wordlift_Property_Getter} instance.
21
-	 *
22
-	 * @since  3.15.0
23
-	 * @access private
24
-	 * @var \Wordlift_Property_Getter The {@link Wordlift_Property_Getter}
25
-	 *                                     instance.
26
-	 */
27
-	private $property_getter;
28
-
29
-	/**
30
-	 * Create a {@link Wordlift_Property_Storage} instance.
31
-	 *
32
-	 * @since 3.15.0
33
-	 *
34
-	 * @param \Wordlift_Property_Getter $property_getter The {@link Wordlift_Property_Getter}
35
-	 *                                                   instance.
36
-	 */
37
-	public function __construct( $property_getter ) {
38
-
39
-		$this->property_getter = $property_getter;
40
-
41
-	}
42
-
43
-	/**
44
-	 * Get the values for the property of the {@link WP_Post}.
45
-	 *
46
-	 * @since 3.15.0
47
-	 *
48
-	 * @param int $post_id The {@link WP_Post}'s id.
49
-	 *
50
-	 * @return array
51
-	 */
52
-	public function get( $post_id ) {
53
-
54
-		return $this->property_getter->get( $post_id, Wordlift_Schema_Url_Property_Service::META_KEY );
55
-	}
19
+    /**
20
+     * The {@link Wordlift_Property_Getter} instance.
21
+     *
22
+     * @since  3.15.0
23
+     * @access private
24
+     * @var \Wordlift_Property_Getter The {@link Wordlift_Property_Getter}
25
+     *                                     instance.
26
+     */
27
+    private $property_getter;
28
+
29
+    /**
30
+     * Create a {@link Wordlift_Property_Storage} instance.
31
+     *
32
+     * @since 3.15.0
33
+     *
34
+     * @param \Wordlift_Property_Getter $property_getter The {@link Wordlift_Property_Getter}
35
+     *                                                   instance.
36
+     */
37
+    public function __construct( $property_getter ) {
38
+
39
+        $this->property_getter = $property_getter;
40
+
41
+    }
42
+
43
+    /**
44
+     * Get the values for the property of the {@link WP_Post}.
45
+     *
46
+     * @since 3.15.0
47
+     *
48
+     * @param int $post_id The {@link WP_Post}'s id.
49
+     *
50
+     * @return array
51
+     */
52
+    public function get( $post_id ) {
53
+
54
+        return $this->property_getter->get( $post_id, Wordlift_Schema_Url_Property_Service::META_KEY );
55
+    }
56 56
 
57 57
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @param \Wordlift_Property_Getter $property_getter The {@link Wordlift_Property_Getter}
35 35
 	 *                                                   instance.
36 36
 	 */
37
-	public function __construct( $property_getter ) {
37
+	public function __construct($property_getter) {
38 38
 
39 39
 		$this->property_getter = $property_getter;
40 40
 
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 	 *
50 50
 	 * @return array
51 51
 	 */
52
-	public function get( $post_id ) {
52
+	public function get($post_id) {
53 53
 
54
-		return $this->property_getter->get( $post_id, Wordlift_Schema_Url_Property_Service::META_KEY );
54
+		return $this->property_getter->get($post_id, Wordlift_Schema_Url_Property_Service::META_KEY);
55 55
 	}
56 56
 
57 57
 }
Please login to merge, or discard this patch.
src/includes/linked-data/storage/class-wordlift-post-meta-storage.php 2 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -18,41 +18,41 @@
 block discarded – undo
18 18
  */
19 19
 class Wordlift_Post_Meta_Storage extends Wordlift_Storage {
20 20
 
21
-	/**
22
-	 * The meta key to load data from.
23
-	 *
24
-	 * @since  3.15.0
25
-	 * @access private
26
-	 * @var string $meta_key The meta key to load data from.
27
-	 */
28
-	private $meta_key;
29
-
30
-	/**
31
-	 * Create a {@link Wordlift_Post_Meta_Storage} instance, by providing the
32
-	 * meta key the storage should read from.
33
-	 *
34
-	 * @since 3.15.0
35
-	 *
36
-	 * @param string $meta_key The post meta key.
37
-	 */
38
-	public function __construct( $meta_key ) {
39
-
40
-		$this->meta_key = $meta_key;
41
-
42
-	}
43
-
44
-	/**
45
-	 * Get the value for the specified meta key.
46
-	 *
47
-	 * @since 3.15.0
48
-	 *
49
-	 * @param int $post_id The {@link WP_Post}'s id.
50
-	 *
51
-	 * @return array An array of values (or an empty array if nothing is set).
52
-	 */
53
-	public function get( $post_id ) {
54
-
55
-		return get_post_meta( $post_id, $this->meta_key );
56
-	}
21
+    /**
22
+     * The meta key to load data from.
23
+     *
24
+     * @since  3.15.0
25
+     * @access private
26
+     * @var string $meta_key The meta key to load data from.
27
+     */
28
+    private $meta_key;
29
+
30
+    /**
31
+     * Create a {@link Wordlift_Post_Meta_Storage} instance, by providing the
32
+     * meta key the storage should read from.
33
+     *
34
+     * @since 3.15.0
35
+     *
36
+     * @param string $meta_key The post meta key.
37
+     */
38
+    public function __construct( $meta_key ) {
39
+
40
+        $this->meta_key = $meta_key;
41
+
42
+    }
43
+
44
+    /**
45
+     * Get the value for the specified meta key.
46
+     *
47
+     * @since 3.15.0
48
+     *
49
+     * @param int $post_id The {@link WP_Post}'s id.
50
+     *
51
+     * @return array An array of values (or an empty array if nothing is set).
52
+     */
53
+    public function get( $post_id ) {
54
+
55
+        return get_post_meta( $post_id, $this->meta_key );
56
+    }
57 57
 
58 58
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @param string $meta_key The post meta key.
37 37
 	 */
38
-	public function __construct( $meta_key ) {
38
+	public function __construct($meta_key) {
39 39
 
40 40
 		$this->meta_key = $meta_key;
41 41
 
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @return array An array of values (or an empty array if nothing is set).
52 52
 	 */
53
-	public function get( $post_id ) {
53
+	public function get($post_id) {
54 54
 
55
-		return get_post_meta( $post_id, $this->meta_key );
55
+		return get_post_meta($post_id, $this->meta_key);
56 56
 	}
57 57
 
58 58
 }
Please login to merge, or discard this patch.
src/includes/linked-data/storage/class-wordlift-post-related-storage.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 *
35 35
 	 * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance.
36 36
 	 */
37
-	public function __construct( $entity_service ) {
37
+	public function __construct($entity_service) {
38 38
 
39 39
 		$this->entity_service = $entity_service;
40 40
 
@@ -50,18 +50,18 @@  discard block
 block discarded – undo
50 50
 	 * @return array|string|null A single string, or an array of values or null
51 51
 	 *                           if the property isn't recognized.
52 52
 	 */
53
-	public function get( $post_id ) {
53
+	public function get($post_id) {
54 54
 
55 55
 		// get related entities.
56
-		$related = wl_core_get_related_entity_ids( $post_id );
56
+		$related = wl_core_get_related_entity_ids($post_id);
57 57
 
58 58
 		// A reference to the entity service.
59 59
 		$entity_service = $this->entity_service;
60 60
 
61 61
 		// Map the related posts' ids to URIs.
62
-		return array_map( function ( $item ) use ( $entity_service ) {
63
-			return $entity_service->get_uri( $item );
64
-		}, $related );
62
+		return array_map(function($item) use ($entity_service) {
63
+			return $entity_service->get_uri($item);
64
+		}, $related);
65 65
 	}
66 66
 
67 67
 }
Please login to merge, or discard this patch.
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -21,53 +21,53 @@
 block discarded – undo
21 21
  */
22 22
 class Wordlift_Post_Related_Storage extends Wordlift_Storage {
23 23
 
24
-	/**
25
-	 * The {@link Wordlift_Entity_Service} instance.
26
-	 *
27
-	 * @since  3.15.0
28
-	 * @access private
29
-	 * @var \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance.
30
-	 */
31
-	private $entity_service;
24
+    /**
25
+     * The {@link Wordlift_Entity_Service} instance.
26
+     *
27
+     * @since  3.15.0
28
+     * @access private
29
+     * @var \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance.
30
+     */
31
+    private $entity_service;
32 32
 
33
-	/**
34
-	 * Create a {@link Wordlift_Post_Related_Storage} instance.
35
-	 *
36
-	 * @since 3.15.0
37
-	 *
38
-	 * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance.
39
-	 */
40
-	public function __construct( $entity_service ) {
33
+    /**
34
+     * Create a {@link Wordlift_Post_Related_Storage} instance.
35
+     *
36
+     * @since 3.15.0
37
+     *
38
+     * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance.
39
+     */
40
+    public function __construct( $entity_service ) {
41 41
 
42
-		$this->entity_service = $entity_service;
42
+        $this->entity_service = $entity_service;
43 43
 
44
-	}
44
+    }
45 45
 
46
-	/**
47
-	 * Get the property value.
48
-	 *
49
-	 * There is no filter for entities or posts, the returned data here can
50
-	 * be used for `relations` and `references` according to the client.
51
-	 *
52
-	 * @since 3.15.0
53
-	 *
54
-	 * @param int $post_id The {@link WP_Post}'s id.
55
-	 *
56
-	 * @return array|string|null A single string, or an array of values or null
57
-	 *                           if the property isn't recognized.
58
-	 */
59
-	public function get( $post_id ) {
46
+    /**
47
+     * Get the property value.
48
+     *
49
+     * There is no filter for entities or posts, the returned data here can
50
+     * be used for `relations` and `references` according to the client.
51
+     *
52
+     * @since 3.15.0
53
+     *
54
+     * @param int $post_id The {@link WP_Post}'s id.
55
+     *
56
+     * @return array|string|null A single string, or an array of values or null
57
+     *                           if the property isn't recognized.
58
+     */
59
+    public function get( $post_id ) {
60 60
 
61
-		// get related entities.
62
-		$related = wl_core_get_related_entity_ids( $post_id );
61
+        // get related entities.
62
+        $related = wl_core_get_related_entity_ids( $post_id );
63 63
 
64
-		// A reference to the entity service.
65
-		$entity_service = $this->entity_service;
64
+        // A reference to the entity service.
65
+        $entity_service = $this->entity_service;
66 66
 
67
-		// Map the related posts' ids to URIs.
68
-		return array_map( function ( $item ) use ( $entity_service ) {
69
-			return $entity_service->get_uri( $item );
70
-		}, $related );
71
-	}
67
+        // Map the related posts' ids to URIs.
68
+        return array_map( function ( $item ) use ( $entity_service ) {
69
+            return $entity_service->get_uri( $item );
70
+        }, $related );
71
+    }
72 72
 
73 73
 }
Please login to merge, or discard this patch.