Completed
Push — develop ( 3bdb5b...5d3214 )
by David
02:32
created
src/modules/geo_widget/wordlift_geo_widget.php 2 patches
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -2,32 +2,32 @@  discard block
 block discarded – undo
2 2
 
3 3
 function wordlift_geo_widget_shortcode( $atts, $content = null ) {
4 4
 
5
-	// Extract attributes and set default values.
6
-	$params = shortcode_atts( array(
7
-		'width'     => '100%',
8
-		'height'    => '300px',
9
-		'latitude'  => 0.0,
10
-		'longitude' => 0.0,
11
-		'zoom'      => 5
12
-
13
-	), $atts );
14
-
15
-	// Add leaflet css and library.
16
-	wp_enqueue_style( 'leaflet_css', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/bower_components/leaflet/dist/leaflet.css' );
17
-	wp_enqueue_script( 'leaflet_js', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/bower_components/leaflet/dist/leaflet.js' );
18
-
19
-	ob_start(); // Collect the buffer.
20
-	wordlift_geo_widget_html(
21
-		$params['width'],
22
-		$params['height'],
23
-		$params['latitude'],
24
-		$params['longitude'],
25
-		$params['zoom'],
26
-		$content
27
-	);
28
-
29
-	// Return the accumulated buffer.
30
-	return ob_get_clean();
5
+    // Extract attributes and set default values.
6
+    $params = shortcode_atts( array(
7
+        'width'     => '100%',
8
+        'height'    => '300px',
9
+        'latitude'  => 0.0,
10
+        'longitude' => 0.0,
11
+        'zoom'      => 5
12
+
13
+    ), $atts );
14
+
15
+    // Add leaflet css and library.
16
+    wp_enqueue_style( 'leaflet_css', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/bower_components/leaflet/dist/leaflet.css' );
17
+    wp_enqueue_script( 'leaflet_js', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/bower_components/leaflet/dist/leaflet.js' );
18
+
19
+    ob_start(); // Collect the buffer.
20
+    wordlift_geo_widget_html(
21
+        $params['width'],
22
+        $params['height'],
23
+        $params['latitude'],
24
+        $params['longitude'],
25
+        $params['zoom'],
26
+        $content
27
+    );
28
+
29
+    // Return the accumulated buffer.
30
+    return ob_get_clean();
31 31
 
32 32
 }
33 33
 
@@ -35,24 +35,24 @@  discard block
 block discarded – undo
35 35
 
36 36
 function wl_geo_widget_layer_shortcode( $atts ) {
37 37
 
38
-	// Extract attributes and set default values.
39
-	$params = shortcode_atts( array(
40
-		'name'  => '',
41
-		'label' => ''
42
-	), $atts );
38
+    // Extract attributes and set default values.
39
+    $params = shortcode_atts( array(
40
+        'name'  => '',
41
+        'label' => ''
42
+    ), $atts );
43 43
 
44
-	// Return if a SPARQL Query name hasn't been provided.
45
-	if ( empty( $params['name'] ) ) {
46
-		return;
47
-	}
44
+    // Return if a SPARQL Query name hasn't been provided.
45
+    if ( empty( $params['name'] ) ) {
46
+        return;
47
+    }
48 48
 
49
-	// Set the layer label.
50
-	$label_j = json_encode( empty( $params['label'] ) ? $params['name'] : $params['label'] );
49
+    // Set the layer label.
50
+    $label_j = json_encode( empty( $params['label'] ) ? $params['name'] : $params['label'] );
51 51
 
52
-	// Define the AJAX Url.
53
-	$ajax_url = admin_url( 'admin-ajax.php?action=wl_sparql&format=geojson&slug=' . urlencode( $params['name'] ) );
52
+    // Define the AJAX Url.
53
+    $ajax_url = admin_url( 'admin-ajax.php?action=wl_sparql&format=geojson&slug=' . urlencode( $params['name'] ) );
54 54
 
55
-	echo <<<EOF
55
+    echo <<<EOF
56 56
 
57 57
         $.ajax( '$ajax_url', {
58 58
             success: function( data ) {
@@ -83,21 +83,21 @@  discard block
 block discarded – undo
83 83
 
84 84
 function wl_geo_widget_marker_shortcode( $atts ) {
85 85
 
86
-	// Extract attributes and set default values.
87
-	$params = shortcode_atts( array(
88
-		'latitude'  => null,
89
-		'longitude' => null
90
-	), $atts );
86
+    // Extract attributes and set default values.
87
+    $params = shortcode_atts( array(
88
+        'latitude'  => null,
89
+        'longitude' => null
90
+    ), $atts );
91 91
 
92
-	// Return if either latitude or longitude haven't been provided.
93
-	if ( empty( $params['latitude'] ) || empty( $params['longitude'] ) ) {
94
-		return;
95
-	}
92
+    // Return if either latitude or longitude haven't been provided.
93
+    if ( empty( $params['latitude'] ) || empty( $params['longitude'] ) ) {
94
+        return;
95
+    }
96 96
 
97
-	$latitude_j  = json_encode( $params['latitude'] );
98
-	$longitude_j = json_encode( $params['longitude'] );
97
+    $latitude_j  = json_encode( $params['latitude'] );
98
+    $longitude_j = json_encode( $params['longitude'] );
99 99
 
100
-	echo <<<EOF
100
+    echo <<<EOF
101 101
 
102 102
 		L.marker([$latitude_j, $longitude_j]).addTo(map);
103 103
 EOF;
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 
110 110
 function wordlift_geo_widget_html( $width, $height, $latitude, $longitude, $zoom, $content ) {
111 111
 
112
-	// Create a unique Id for this widget.
113
-	$div_id = uniqid( 'wl-geo-' );
112
+    // Create a unique Id for this widget.
113
+    $div_id = uniqid( 'wl-geo-' );
114 114
 
115
-	echo <<<EOF
115
+    echo <<<EOF
116 116
 <div id="$div_id" style="width: $width; height: $height;"></div>
117 117
 
118 118
 <script type="text/javascript">
@@ -137,10 +137,10 @@  discard block
 block discarded – undo
137 137
 
138 138
 EOF;
139 139
 
140
-	// Run inner shortcodes.
141
-	do_shortcode( $content );
140
+    // Run inner shortcodes.
141
+    do_shortcode( $content );
142 142
 
143
-	echo <<<EOF
143
+    echo <<<EOF
144 144
 
145 145
     } );
146 146
 </script>
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-function wordlift_geo_widget_shortcode( $atts, $content = null ) {
3
+function wordlift_geo_widget_shortcode($atts, $content = null) {
4 4
 
5 5
 	// Extract attributes and set default values.
6
-	$params = shortcode_atts( array(
6
+	$params = shortcode_atts(array(
7 7
 		'width'     => '100%',
8 8
 		'height'    => '300px',
9 9
 		'latitude'  => 0.0,
10 10
 		'longitude' => 0.0,
11 11
 		'zoom'      => 5
12 12
 
13
-	), $atts );
13
+	), $atts);
14 14
 
15 15
 	// Add leaflet css and library.
16
-	wp_enqueue_style( 'leaflet_css', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/bower_components/leaflet/dist/leaflet.css' );
17
-	wp_enqueue_script( 'leaflet_js', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/bower_components/leaflet/dist/leaflet.js' );
16
+	wp_enqueue_style('leaflet_css', dirname(dirname(plugin_dir_url(__FILE__))).'/bower_components/leaflet/dist/leaflet.css');
17
+	wp_enqueue_script('leaflet_js', dirname(dirname(plugin_dir_url(__FILE__))).'/bower_components/leaflet/dist/leaflet.js');
18 18
 
19 19
 	ob_start(); // Collect the buffer.
20 20
 	wordlift_geo_widget_html(
@@ -31,26 +31,26 @@  discard block
 block discarded – undo
31 31
 
32 32
 }
33 33
 
34
-add_shortcode( 'wl_geo', 'wordlift_geo_widget_shortcode' );
34
+add_shortcode('wl_geo', 'wordlift_geo_widget_shortcode');
35 35
 
36
-function wl_geo_widget_layer_shortcode( $atts ) {
36
+function wl_geo_widget_layer_shortcode($atts) {
37 37
 
38 38
 	// Extract attributes and set default values.
39
-	$params = shortcode_atts( array(
39
+	$params = shortcode_atts(array(
40 40
 		'name'  => '',
41 41
 		'label' => ''
42
-	), $atts );
42
+	), $atts);
43 43
 
44 44
 	// Return if a SPARQL Query name hasn't been provided.
45
-	if ( empty( $params['name'] ) ) {
45
+	if (empty($params['name'])) {
46 46
 		return;
47 47
 	}
48 48
 
49 49
 	// Set the layer label.
50
-	$label_j = json_encode( empty( $params['label'] ) ? $params['name'] : $params['label'] );
50
+	$label_j = json_encode(empty($params['label']) ? $params['name'] : $params['label']);
51 51
 
52 52
 	// Define the AJAX Url.
53
-	$ajax_url = admin_url( 'admin-ajax.php?action=wl_sparql&format=geojson&slug=' . urlencode( $params['name'] ) );
53
+	$ajax_url = admin_url('admin-ajax.php?action=wl_sparql&format=geojson&slug='.urlencode($params['name']));
54 54
 
55 55
 	echo <<<EOF
56 56
 
@@ -78,24 +78,24 @@  discard block
 block discarded – undo
78 78
 
79 79
 }
80 80
 
81
-add_shortcode( 'wl_geo_layer', 'wl_geo_widget_layer_shortcode' );
81
+add_shortcode('wl_geo_layer', 'wl_geo_widget_layer_shortcode');
82 82
 
83 83
 
84
-function wl_geo_widget_marker_shortcode( $atts ) {
84
+function wl_geo_widget_marker_shortcode($atts) {
85 85
 
86 86
 	// Extract attributes and set default values.
87
-	$params = shortcode_atts( array(
87
+	$params = shortcode_atts(array(
88 88
 		'latitude'  => null,
89 89
 		'longitude' => null
90
-	), $atts );
90
+	), $atts);
91 91
 
92 92
 	// Return if either latitude or longitude haven't been provided.
93
-	if ( empty( $params['latitude'] ) || empty( $params['longitude'] ) ) {
93
+	if (empty($params['latitude']) || empty($params['longitude'])) {
94 94
 		return;
95 95
 	}
96 96
 
97
-	$latitude_j  = json_encode( $params['latitude'] );
98
-	$longitude_j = json_encode( $params['longitude'] );
97
+	$latitude_j  = json_encode($params['latitude']);
98
+	$longitude_j = json_encode($params['longitude']);
99 99
 
100 100
 	echo <<<EOF
101 101
 
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
 
105 105
 }
106 106
 
107
-add_shortcode( 'wl_geo_marker', 'wl_geo_widget_marker_shortcode' );
107
+add_shortcode('wl_geo_marker', 'wl_geo_widget_marker_shortcode');
108 108
 
109 109
 
110
-function wordlift_geo_widget_html( $width, $height, $latitude, $longitude, $zoom, $content ) {
110
+function wordlift_geo_widget_html($width, $height, $latitude, $longitude, $zoom, $content) {
111 111
 
112 112
 	// Create a unique Id for this widget.
113
-	$div_id = uniqid( 'wl-geo-' );
113
+	$div_id = uniqid('wl-geo-');
114 114
 
115 115
 	echo <<<EOF
116 116
 <div id="$div_id" style="width: $width; height: $height;"></div>
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 EOF;
139 139
 
140 140
 	// Run inner shortcodes.
141
-	do_shortcode( $content );
141
+	do_shortcode($content);
142 142
 
143 143
 	echo <<<EOF
144 144
 
Please login to merge, or discard this patch.
src/modules/linked_data/wordlift_linked_data_images.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -9,18 +9,18 @@  discard block
 block discarded – undo
9 9
  * @return array An array with information about the saved image (*path*: the local path to the image, *url*: the local
10 10
  * url, *content_type*: the image content type)
11 11
  */
12
-function wl_save_image( $url ) {
12
+function wl_save_image($url) {
13 13
 
14
-	$parts = parse_url( $url );
14
+	$parts = parse_url($url);
15 15
 	$path  = $parts['path'];
16 16
 
17 17
 	// Get the bare filename (filename w/o the extension).
18 18
 	// Sanitize filename before saving the current image as attachment
19 19
 	// See https://codex.wordpress.org/Function_Reference/sanitize_file_name
20
-	$basename = sanitize_file_name( pathinfo( $path, PATHINFO_FILENAME ) . '-' . uniqid( date( 'YmdH-' ) ) );
20
+	$basename = sanitize_file_name(pathinfo($path, PATHINFO_FILENAME).'-'.uniqid(date('YmdH-')));
21 21
 
22 22
 	// Chunk the bare name to get a subpath.
23
-	$chunks = chunk_split( strtolower( $basename ), 3, DIRECTORY_SEPARATOR );
23
+	$chunks = chunk_split(strtolower($basename), 3, DIRECTORY_SEPARATOR);
24 24
 
25 25
 	// Get the base dir.
26 26
 	$wp_upload_dir = wp_upload_dir();
@@ -28,22 +28,22 @@  discard block
 block discarded – undo
28 28
 	$base_url      = $wp_upload_dir['baseurl'];
29 29
 
30 30
 	// Get the full path to the local filename.
31
-	$image_path      = '/' . $chunks;
32
-	$image_full_path = $base_dir . $image_path;
33
-	$image_full_url  = $base_url . $image_path;
31
+	$image_path      = '/'.$chunks;
32
+	$image_full_path = $base_dir.$image_path;
33
+	$image_full_url  = $base_url.$image_path;
34 34
 
35 35
 	// Create the folders.
36
-	if ( ! ( file_exists( $image_full_path ) && is_dir( $image_full_path ) ) ) {
37
-		if ( false === mkdir( $image_full_path, 0777, true ) ) {
38
-			wl_write_log( "wl_save_image : failed creating dir [ image full path :: $image_full_path ]\n" );
36
+	if ( ! (file_exists($image_full_path) && is_dir($image_full_path))) {
37
+		if (false === mkdir($image_full_path, 0777, true)) {
38
+			wl_write_log("wl_save_image : failed creating dir [ image full path :: $image_full_path ]\n");
39 39
 		}
40 40
 	};
41 41
 
42 42
 	// Request the remote file.
43
-	$response     = wp_remote_get( $url );
44
-	$content_type = wp_remote_retrieve_header( $response, 'content-type' );
43
+	$response     = wp_remote_get($url);
44
+	$content_type = wp_remote_retrieve_header($response, 'content-type');
45 45
 
46
-	switch ( $content_type ) {
46
+	switch ($content_type) {
47 47
 		case 'image/jpeg':
48 48
 		case 'image/jpg':
49 49
 			$extension = ".jpg";
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 	}
63 63
 
64 64
 	// Complete the local filename.
65
-	$image_full_path .= $basename . $extension;
66
-	$image_full_url .= $basename . $extension;
65
+	$image_full_path .= $basename.$extension;
66
+	$image_full_url .= $basename.$extension;
67 67
 
68 68
 	// Store the data locally.
69
-	file_put_contents( $image_full_path, wp_remote_retrieve_body( $response ) );
69
+	file_put_contents($image_full_path, wp_remote_retrieve_body($response));
70 70
 
71 71
 	// wl_write_log( "wl_save_image [ url :: $url ][ content type :: $content_type ][ image full path :: $image_full_path ][ image full url :: $image_full_url ]\n" );
72 72
 
Please login to merge, or discard this patch.
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -10,69 +10,69 @@
 block discarded – undo
10 10
  */
11 11
 function wl_save_image( $url ) {
12 12
 
13
-	$parts = parse_url( $url );
14
-	$path  = $parts['path'];
13
+    $parts = parse_url( $url );
14
+    $path  = $parts['path'];
15 15
 
16
-	// Get the bare filename (filename w/o the extension).
17
-	// Sanitize filename before saving the current image as attachment
18
-	// See https://codex.wordpress.org/Function_Reference/sanitize_file_name
19
-	$basename = sanitize_file_name( pathinfo( $path, PATHINFO_FILENAME ) . '-' . uniqid( date( 'YmdH-' ) ) );
16
+    // Get the bare filename (filename w/o the extension).
17
+    // Sanitize filename before saving the current image as attachment
18
+    // See https://codex.wordpress.org/Function_Reference/sanitize_file_name
19
+    $basename = sanitize_file_name( pathinfo( $path, PATHINFO_FILENAME ) . '-' . uniqid( date( 'YmdH-' ) ) );
20 20
 
21
-	// Chunk the bare name to get a subpath.
22
-	$chunks = chunk_split( strtolower( $basename ), 3, DIRECTORY_SEPARATOR );
21
+    // Chunk the bare name to get a subpath.
22
+    $chunks = chunk_split( strtolower( $basename ), 3, DIRECTORY_SEPARATOR );
23 23
 
24
-	// Get the base dir.
25
-	$wp_upload_dir = wp_upload_dir();
26
-	$base_dir      = $wp_upload_dir['basedir'];
27
-	$base_url      = $wp_upload_dir['baseurl'];
24
+    // Get the base dir.
25
+    $wp_upload_dir = wp_upload_dir();
26
+    $base_dir      = $wp_upload_dir['basedir'];
27
+    $base_url      = $wp_upload_dir['baseurl'];
28 28
 
29
-	// Get the full path to the local filename.
30
-	$image_path      = '/' . $chunks;
31
-	$image_full_path = $base_dir . $image_path;
32
-	$image_full_url  = $base_url . $image_path;
29
+    // Get the full path to the local filename.
30
+    $image_path      = '/' . $chunks;
31
+    $image_full_path = $base_dir . $image_path;
32
+    $image_full_url  = $base_url . $image_path;
33 33
 
34
-	// Create the folders.
35
-	if ( ! ( file_exists( $image_full_path ) && is_dir( $image_full_path ) ) ) {
36
-		if ( false === mkdir( $image_full_path, 0777, true ) ) {
37
-			wl_write_log( "wl_save_image : failed creating dir [ image full path :: $image_full_path ]\n" );
38
-		}
39
-	};
34
+    // Create the folders.
35
+    if ( ! ( file_exists( $image_full_path ) && is_dir( $image_full_path ) ) ) {
36
+        if ( false === mkdir( $image_full_path, 0777, true ) ) {
37
+            wl_write_log( "wl_save_image : failed creating dir [ image full path :: $image_full_path ]\n" );
38
+        }
39
+    };
40 40
 
41
-	// Request the remote file.
42
-	$response     = wp_remote_get( $url );
43
-	$content_type = wp_remote_retrieve_header( $response, 'content-type' );
41
+    // Request the remote file.
42
+    $response     = wp_remote_get( $url );
43
+    $content_type = wp_remote_retrieve_header( $response, 'content-type' );
44 44
 
45
-	switch ( $content_type ) {
46
-		case 'image/jpeg':
47
-		case 'image/jpg':
48
-			$extension = ".jpg";
49
-			break;
50
-		case 'image/svg+xml':
51
-			$extension = ".svg";
52
-			break;
53
-		case 'image/gif':
54
-			$extension = ".gif";
55
-			break;
56
-		case 'image/png':
57
-			$extension = ".png";
58
-			break;
59
-		default:
60
-			$extension = '';
61
-	}
45
+    switch ( $content_type ) {
46
+        case 'image/jpeg':
47
+        case 'image/jpg':
48
+            $extension = ".jpg";
49
+            break;
50
+        case 'image/svg+xml':
51
+            $extension = ".svg";
52
+            break;
53
+        case 'image/gif':
54
+            $extension = ".gif";
55
+            break;
56
+        case 'image/png':
57
+            $extension = ".png";
58
+            break;
59
+        default:
60
+            $extension = '';
61
+    }
62 62
 
63
-	// Complete the local filename.
64
-	$image_full_path .= $basename . $extension;
65
-	$image_full_url .= $basename . $extension;
63
+    // Complete the local filename.
64
+    $image_full_path .= $basename . $extension;
65
+    $image_full_url .= $basename . $extension;
66 66
 
67
-	// Store the data locally.
68
-	file_put_contents( $image_full_path, wp_remote_retrieve_body( $response ) );
67
+    // Store the data locally.
68
+    file_put_contents( $image_full_path, wp_remote_retrieve_body( $response ) );
69 69
 
70
-	// wl_write_log( "wl_save_image [ url :: $url ][ content type :: $content_type ][ image full path :: $image_full_path ][ image full url :: $image_full_url ]\n" );
70
+    // wl_write_log( "wl_save_image [ url :: $url ][ content type :: $content_type ][ image full path :: $image_full_path ][ image full url :: $image_full_url ]\n" );
71 71
 
72
-	// Return the path.
73
-	return array(
74
-		'path'         => $image_full_path,
75
-		'url'          => $image_full_url,
76
-		'content_type' => $content_type,
77
-	);
72
+    // Return the path.
73
+    return array(
74
+        'path'         => $image_full_path,
75
+        'url'          => $image_full_url,
76
+        'content_type' => $content_type,
77
+    );
78 78
 }
Please login to merge, or discard this patch.
src/modules/redirector/wordlift_redirector.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,10 +9,10 @@
 block discarded – undo
9 9
  */
10 10
 function wordlift_ajax_redirect() {
11 11
 
12
-	$url = $_GET['url'];
13
-	$link = get_permalink( get_page_by_path( 'timeline-event' ) );
14
-	header( 'Location: ' . $link . '?url=' . urlencode( $url ) );
15
-	wp_die();
12
+    $url = $_GET['url'];
13
+    $link = get_permalink( get_page_by_path( 'timeline-event' ) );
14
+    header( 'Location: ' . $link . '?url=' . urlencode( $url ) );
15
+    wp_die();
16 16
 
17 17
 }
18 18
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@
 block discarded – undo
10 10
 function wordlift_ajax_redirect() {
11 11
 
12 12
 	$url = $_GET['url'];
13
-	$link = get_permalink( get_page_by_path( 'timeline-event' ) );
14
-	header( 'Location: ' . $link . '?url=' . urlencode( $url ) );
13
+	$link = get_permalink(get_page_by_path('timeline-event'));
14
+	header('Location: '.$link.'?url='.urlencode($url));
15 15
 	wp_die();
16 16
 
17 17
 }
18 18
 
19
-add_action( 'wp_ajax_wl_redirect', 'wordlift_ajax_redirect' );
20
-add_action( 'wp_ajax_nopriv_wl_redirect', 'wordlift_ajax_redirect' );
21 19
\ No newline at end of file
20
+add_action('wp_ajax_wl_redirect', 'wordlift_ajax_redirect');
21
+add_action('wp_ajax_nopriv_wl_redirect', 'wordlift_ajax_redirect');
22 22
\ No newline at end of file
Please login to merge, or discard this patch.
src/shortcodes/wordlift_shortcode_field.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,28 +9,28 @@  discard block
 block discarded – undo
9 9
  * @param array $atts An array of shortcode attributes.
10 10
  * @return string A dom element with requested property value(s).
11 11
  */
12
-function wl_shortcode_field( $atts ) {
12
+function wl_shortcode_field($atts) {
13 13
 	
14 14
     // Extract attributes and set default values.
15
-    $field_atts = shortcode_atts( array(
15
+    $field_atts = shortcode_atts(array(
16 16
         'id'    => null,
17 17
         'name'  => null
18
-    ), $atts );
18
+    ), $atts);
19 19
     
20 20
     // Get id of the post
21 21
     $entity_id = $field_atts['id'];
22
-    if( is_null( $field_atts['id'] ) || !is_numeric( $field_atts['id'] ) ) {
22
+    if (is_null($field_atts['id']) || ! is_numeric($field_atts['id'])) {
23 23
         $entity_id = get_the_ID();
24 24
     }
25 25
 
26 26
     $property_name = $field_atts['name'];
27
-    if( !is_null( $property_name ) ) {
28
-        $values = wl_schema_get_value( $entity_id, $property_name );
27
+    if ( ! is_null($property_name)) {
28
+        $values = wl_schema_get_value($entity_id, $property_name);
29 29
     }
30 30
     
31 31
     // Return
32
-    if( is_array( $values ) ) {
33
-        return implode( ', ', $values );
32
+    if (is_array($values)) {
33
+        return implode(', ', $values);
34 34
     } else {
35 35
         return null;
36 36
     }
@@ -40,5 +40,5 @@  discard block
 block discarded – undo
40 40
     add_shortcode('wl_field', 'wl_shortcode_field');
41 41
 }
42 42
 
43
-add_action( 'init', 'wl_register_shortcode_field');
43
+add_action('init', 'wl_register_shortcode_field');
44 44
 
Please login to merge, or discard this patch.
src/uninstall.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
 // If uninstall not called from WordPress, then exit.
29 29
 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
30
-	exit;
30
+    exit;
31 31
 }
32 32
 
33 33
 // Get a reference to WP and the Wordlift plugin
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
 
41 41
 // Do a db search for posts of type entity
42 42
 $args           = array(
43
-	'posts_per_page' => - 1,
44
-	'post_type'      => Wordlift_Entity_Service::TYPE_NAME,
45
-	'post_status'    => array( 'publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', 'trash' ),
46
-	'fields'         => 'ids'
43
+    'posts_per_page' => - 1,
44
+    'post_type'      => Wordlift_Entity_Service::TYPE_NAME,
45
+    'post_status'    => array( 'publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', 'trash' ),
46
+    'fields'         => 'ids'
47 47
 );
48 48
 $entities_array = get_posts( $args );
49 49
 
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 wl_write_log( 'Deleting entities and their meta... ' );
53 53
 wl_write_log( $entities_array );
54 54
 foreach ( $entities_array as $entity_id ) {
55
-	// Delete the whole entity and its metas.
56
-	wp_delete_post( $entity_id, true );
55
+    // Delete the whole entity and its metas.
56
+    wp_delete_post( $entity_id, true );
57 57
 }
58 58
 wl_write_log( 'Done.' );
59 59
 
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 // We loop over terms in this rude way because in the uninstall script
75 75
 // is not possible to call WP custom taxonomy functions.
76 76
 foreach ( range( 0, 100 ) as $index ) {
77
-	delete_option( Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME . '_' . $index );
78
-	wp_delete_term( $index, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
77
+    delete_option( Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME . '_' . $index );
78
+    wp_delete_term( $index, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
79 79
 }
80 80
 delete_option( Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME . '_children' );  // it's a hierarchical taxonomy
81 81
 wl_write_log( 'Done.' );
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  */
27 27
 
28 28
 // If uninstall not called from WordPress, then exit.
29
-if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
29
+if ( ! defined('WP_UNINSTALL_PLUGIN')) {
30 30
 	exit;
31 31
 }
32 32
 
@@ -39,53 +39,53 @@  discard block
 block discarded – undo
39 39
  */
40 40
 
41 41
 // Do a db search for posts of type entity
42
-$args           = array(
43
-	'posts_per_page' => - 1,
42
+$args = array(
43
+	'posts_per_page' => -1,
44 44
 	'post_type'      => Wordlift_Entity_Service::TYPE_NAME,
45
-	'post_status'    => array( 'publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', 'trash' ),
45
+	'post_status'    => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', 'trash'),
46 46
 	'fields'         => 'ids'
47 47
 );
48
-$entities_array = get_posts( $args );
48
+$entities_array = get_posts($args);
49 49
 
50 50
 // Loop over entities and delete them.
51 51
 // TODO: thumbnails?
52
-wl_write_log( 'Deleting entities and their meta... ' );
53
-wl_write_log( $entities_array );
54
-foreach ( $entities_array as $entity_id ) {
52
+wl_write_log('Deleting entities and their meta... ');
53
+wl_write_log($entities_array);
54
+foreach ($entities_array as $entity_id) {
55 55
 	// Delete the whole entity and its metas.
56
-	wp_delete_post( $entity_id, true );
56
+	wp_delete_post($entity_id, true);
57 57
 }
58
-wl_write_log( 'Done.' );
58
+wl_write_log('Done.');
59 59
 
60 60
 /*
61 61
  * Delete post-entity relationships
62 62
  */
63
-wl_write_log( 'Deleting post-entity relationships... ' );
64
-$sql = 'DROP TABLE IF EXISTS ' . wl_core_get_relation_instances_table_name() . ';';
65
-$wpdb->query( $sql );
66
-delete_option( 'wl_db_version' );
67
-wl_write_log( 'Done.' );
63
+wl_write_log('Deleting post-entity relationships... ');
64
+$sql = 'DROP TABLE IF EXISTS '.wl_core_get_relation_instances_table_name().';';
65
+$wpdb->query($sql);
66
+delete_option('wl_db_version');
67
+wl_write_log('Done.');
68 68
 
69 69
 /*
70 70
  * Delete taxonomy
71 71
  */
72
-wl_write_log( 'Cleaning entities taxonomy... ' );
72
+wl_write_log('Cleaning entities taxonomy... ');
73 73
 // Delte custom taxonomy terms.
74 74
 // We loop over terms in this rude way because in the uninstall script
75 75
 // is not possible to call WP custom taxonomy functions.
76
-foreach ( range( 0, 100 ) as $index ) {
77
-	delete_option( Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME . '_' . $index );
78
-	wp_delete_term( $index, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
76
+foreach (range(0, 100) as $index) {
77
+	delete_option(Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME.'_'.$index);
78
+	wp_delete_term($index, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME);
79 79
 }
80
-delete_option( Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME . '_children' );  // it's a hierarchical taxonomy
81
-wl_write_log( 'Done.' );
80
+delete_option(Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME.'_children'); // it's a hierarchical taxonomy
81
+wl_write_log('Done.');
82 82
 
83 83
 /**
84 84
  * Delete options
85 85
  */
86
-wl_write_log( 'Cleaning WordLift options... ' );
86
+wl_write_log('Cleaning WordLift options... ');
87 87
 // delete_option( WL_OPTIONS_NAME );
88
-delete_option( 'wl_option_prefixes' );
89
-delete_option( 'wl_general_settings' );
90
-delete_option( 'wl_advanced_settings' );
91
-wl_write_log( 'Done. WordLift successfully uninstalled.' );
88
+delete_option('wl_option_prefixes');
89
+delete_option('wl_general_settings');
90
+delete_option('wl_advanced_settings');
91
+wl_write_log('Done. WordLift successfully uninstalled.');
Please login to merge, or discard this patch.
src/widgets/wordlift_widget_geo.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
      * @param array $args
28 28
      * @param array $instance
29 29
      */
30
-    public function widget( $args, $instance )
30
+    public function widget($args, $instance)
31 31
     {
32 32
         // Get the widget's title.
33 33
         $title = apply_filters('widget_title', $instance['title']);
34 34
 
35 35
         // Print the HTML output.
36 36
         echo $args['before_widget'];
37
-        if (!empty($title)) {
38
-            echo $args['before_title'] . $title . $args['after_title'];
37
+        if ( ! empty($title)) {
38
+            echo $args['before_title'].$title.$args['after_title'];
39 39
         }
40 40
 
41 41
         // Print the geomap shortcode
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     {
82 82
 
83 83
         $instance = array();
84
-        $instance['title'] = (!empty($new_instance['title'])) ? strip_tags($new_instance['title']) : '';
84
+        $instance['title'] = ( ! empty($new_instance['title'])) ? strip_tags($new_instance['title']) : '';
85 85
 
86 86
         return $instance;
87 87
     }
Please login to merge, or discard this patch.
src/wordlift_editor.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
  * @return The updated list of styles, including the custom style provided by WordLift.
9 9
  */
10 10
 function wordlift_mce_css( $mce_css ) {
11
-	if ( ! empty( $mce_css ) ) {
12
-		$mce_css .= ',';
13
-	}
11
+    if ( ! empty( $mce_css ) ) {
12
+        $mce_css .= ',';
13
+    }
14 14
 
15
-	$mce_css .= plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css';
15
+    $mce_css .= plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css';
16 16
 
17
-	return $mce_css;
17
+    return $mce_css;
18 18
 }
19 19
 
20 20
 // hook the TinyMCE custom styles function.
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
  */
30 30
 function wordlift_filter_tiny_mce_before_init( $options ) {
31 31
 
32
-	if ( ! isset( $options['extended_valid_elements'] ) ) {
33
-		$options['extended_valid_elements'] = '';
34
-	}
32
+    if ( ! isset( $options['extended_valid_elements'] ) ) {
33
+        $options['extended_valid_elements'] = '';
34
+    }
35 35
 
36
-	$options['extended_valid_elements'] .= ",span[*]";
36
+    $options['extended_valid_elements'] .= ",span[*]";
37 37
 
38
-	return $options;
38
+    return $options;
39 39
 }
40 40
 
41 41
 add_filter( 'tiny_mce_before_init', 'wordlift_filter_tiny_mce_before_init' );
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@  discard block
 block discarded – undo
7 7
  *
8 8
  * @return The updated list of styles, including the custom style provided by WordLift.
9 9
  */
10
-function wordlift_mce_css( $mce_css ) {
11
-	if ( ! empty( $mce_css ) ) {
10
+function wordlift_mce_css($mce_css) {
11
+	if ( ! empty($mce_css)) {
12 12
 		$mce_css .= ',';
13 13
 	}
14 14
 
15
-	$mce_css .= plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css';
15
+	$mce_css .= plugin_dir_url(__FILE__).'css/wordlift-reloaded.min.css';
16 16
 
17 17
 	return $mce_css;
18 18
 }
19 19
 
20 20
 // hook the TinyMCE custom styles function.
21
-add_filter( 'mce_css', 'wordlift_mce_css' );
21
+add_filter('mce_css', 'wordlift_mce_css');
22 22
 
23 23
 /**
24 24
  * Set TinyMCE options, in particular enable microdata tagging.
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
  *
28 28
  * @return mixed
29 29
  */
30
-function wordlift_filter_tiny_mce_before_init( $options ) {
30
+function wordlift_filter_tiny_mce_before_init($options) {
31 31
 
32
-	if ( ! isset( $options['extended_valid_elements'] ) ) {
32
+	if ( ! isset($options['extended_valid_elements'])) {
33 33
 		$options['extended_valid_elements'] = '';
34 34
 	}
35 35
 
@@ -38,4 +38,4 @@  discard block
 block discarded – undo
38 38
 	return $options;
39 39
 }
40 40
 
41
-add_filter( 'tiny_mce_before_init', 'wordlift_filter_tiny_mce_before_init' );
41
+add_filter('tiny_mce_before_init', 'wordlift_filter_tiny_mce_before_init');
Please login to merge, or discard this patch.
src/wordlift_sparql.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,5 +12,5 @@
 block discarded – undo
12 12
 function wl_get_sparql_time($time)
13 13
 {
14 14
 
15
-    return '"' . str_replace('+00:00', '.000Z', $time) . '"^^<http://www.w3.org/2001/XMLSchema#dateTime>';
15
+    return '"'.str_replace('+00:00', '.000Z', $time).'"^^<http://www.w3.org/2001/XMLSchema#dateTime>';
16 16
 }
17 17
\ No newline at end of file
Please login to merge, or discard this patch.
src/includes/class-wordlift-ui-service.php 2 patches
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -7,80 +7,80 @@
 block discarded – undo
7 7
  */
8 8
 class Wordlift_UI_Service {
9 9
 
10
-	/**
11
-	 * The button element HTML code.
12
-	 *
13
-	 * @since 3.2.0
14
-	 */
15
-	const BUTTON_HTML = '<a id="%s" class="button wl-button">%s</a>';
10
+    /**
11
+     * The button element HTML code.
12
+     *
13
+     * @since 3.2.0
14
+     */
15
+    const BUTTON_HTML = '<a id="%s" class="button wl-button">%s</a>';
16 16
 
17
-	/**
18
-	 * The template HTML code.
19
-	 *
20
-	 * @since 3.2.0
21
-	 */
22
-	const TEMPLATE_HTML = '<script id="%s" type="text/template">%s</script>';
17
+    /**
18
+     * The template HTML code.
19
+     *
20
+     * @since 3.2.0
21
+     */
22
+    const TEMPLATE_HTML = '<script id="%s" type="text/template">%s</script>';
23 23
 
24
-	/**
25
-	 * Get the button HTML.
26
-	 *
27
-	 * @since 3.2.0
28
-	 *
29
-	 * @param string $element_id The button element id.
30
-	 * @param string $label The button (translated) label.
31
-	 *
32
-	 * @return string The button HTML code.
33
-	 */
34
-	public function get_button_html( $element_id, $label ) {
24
+    /**
25
+     * Get the button HTML.
26
+     *
27
+     * @since 3.2.0
28
+     *
29
+     * @param string $element_id The button element id.
30
+     * @param string $label The button (translated) label.
31
+     *
32
+     * @return string The button HTML code.
33
+     */
34
+    public function get_button_html( $element_id, $label ) {
35 35
 
36
-		return sprintf( self::BUTTON_HTML, $element_id, esc_html( $label ) );
37
-	}
36
+        return sprintf( self::BUTTON_HTML, $element_id, esc_html( $label ) );
37
+    }
38 38
 
39
-	/**
40
-	 * Echo the button HTML.
41
-	 *
42
-	 * @since 3.2.0
43
-	 *
44
-	 * @param string $element_id The button element id.
45
-	 * @param string $label The button (translated) label.
46
-	 *
47
-	 * @return string The button HTML code.
48
-	 */
49
-	public function print_button( $element_id, $label ) {
39
+    /**
40
+     * Echo the button HTML.
41
+     *
42
+     * @since 3.2.0
43
+     *
44
+     * @param string $element_id The button element id.
45
+     * @param string $label The button (translated) label.
46
+     *
47
+     * @return string The button HTML code.
48
+     */
49
+    public function print_button( $element_id, $label ) {
50 50
 
51
-		echo( $this->get_button_html( $element_id, $label ) );
51
+        echo( $this->get_button_html( $element_id, $label ) );
52 52
 
53
-	}
53
+    }
54 54
 
55
-	/**
56
-	 * Get the HTML code for a template tag.
57
-	 *
58
-	 * @since 3.2.0
59
-	 *
60
-	 * @param string $element_id The element id.
61
-	 * @param string $body The element content.
62
-	 *
63
-	 * @return string The HTML code.
64
-	 */
65
-	public function get_template_html( $element_id, $body ) {
55
+    /**
56
+     * Get the HTML code for a template tag.
57
+     *
58
+     * @since 3.2.0
59
+     *
60
+     * @param string $element_id The element id.
61
+     * @param string $body The element content.
62
+     *
63
+     * @return string The HTML code.
64
+     */
65
+    public function get_template_html( $element_id, $body ) {
66 66
 
67
-		return sprintf( self::TEMPLATE_HTML, $element_id, $body );
68
-	}
67
+        return sprintf( self::TEMPLATE_HTML, $element_id, $body );
68
+    }
69 69
 
70
-	/**
71
-	 * Echo the HTML code for a template tag.
72
-	 *
73
-	 * @since 3.2.0
74
-	 *
75
-	 * @param string $element_id The element id.
76
-	 * @param string $body The element content.
77
-	 *
78
-	 * @return string The HTML code.
79
-	 */
80
-	public function print_template( $element_id, $body ) {
70
+    /**
71
+     * Echo the HTML code for a template tag.
72
+     *
73
+     * @since 3.2.0
74
+     *
75
+     * @param string $element_id The element id.
76
+     * @param string $body The element content.
77
+     *
78
+     * @return string The HTML code.
79
+     */
80
+    public function print_template( $element_id, $body ) {
81 81
 
82
-		echo( $this->get_template_html( $element_id, $body ) );
82
+        echo( $this->get_template_html( $element_id, $body ) );
83 83
 
84
-	}
84
+    }
85 85
 
86 86
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 	 *
32 32
 	 * @return string The button HTML code.
33 33
 	 */
34
-	public function get_button_html( $element_id, $label ) {
34
+	public function get_button_html($element_id, $label) {
35 35
 
36
-		return sprintf( self::BUTTON_HTML, $element_id, esc_html( $label ) );
36
+		return sprintf(self::BUTTON_HTML, $element_id, esc_html($label));
37 37
 	}
38 38
 
39 39
 	/**
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
 	 *
47 47
 	 * @return string The button HTML code.
48 48
 	 */
49
-	public function print_button( $element_id, $label ) {
49
+	public function print_button($element_id, $label) {
50 50
 
51
-		echo( $this->get_button_html( $element_id, $label ) );
51
+		echo($this->get_button_html($element_id, $label));
52 52
 
53 53
 	}
54 54
 
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return string The HTML code.
64 64
 	 */
65
-	public function get_template_html( $element_id, $body ) {
65
+	public function get_template_html($element_id, $body) {
66 66
 
67
-		return sprintf( self::TEMPLATE_HTML, $element_id, $body );
67
+		return sprintf(self::TEMPLATE_HTML, $element_id, $body);
68 68
 	}
69 69
 
70 70
 	/**
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 	 *
78 78
 	 * @return string The HTML code.
79 79
 	 */
80
-	public function print_template( $element_id, $body ) {
80
+	public function print_template($element_id, $body) {
81 81
 
82
-		echo( $this->get_template_html( $element_id, $body ) );
82
+		echo($this->get_template_html($element_id, $body));
83 83
 
84 84
 	}
85 85
 
Please login to merge, or discard this patch.