Completed
Push — develop ( 8e3bd3...934407 )
by Naveen
02:05 queued 57s
created
src/admin/class-wordlift-entity-type-admin-service.php 2 patches
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -20,82 +20,82 @@
 block discarded – undo
20 20
  */
21 21
 class Wordlift_Entity_Type_Admin_Service {
22 22
 
23
-	/**
24
-	 * Create a {@link Wordlift_Entity_List_Service} instance.
25
-	 *
26
-	 * Set up the relevant filters and actions.
27
-	 *
28
-	 * @since 3.15.0
29
-	 */
30
-	public function __construct() {
23
+    /**
24
+     * Create a {@link Wordlift_Entity_List_Service} instance.
25
+     *
26
+     * Set up the relevant filters and actions.
27
+     *
28
+     * @since 3.15.0
29
+     */
30
+    public function __construct() {
31 31
 
32
-		add_action( 'admin_init', array( $this, 'hide_entity_type_metabox' ) );
33
-		add_action(
34
-			'admin_init',
35
-			array(
36
-				$this,
37
-				'set_filters_to_hide_entity_type_from_lists',
38
-			)
39
-		);
40
-	}
32
+        add_action( 'admin_init', array( $this, 'hide_entity_type_metabox' ) );
33
+        add_action(
34
+            'admin_init',
35
+            array(
36
+                $this,
37
+                'set_filters_to_hide_entity_type_from_lists',
38
+            )
39
+        );
40
+    }
41 41
 
42
-	/**
43
-	 * Hide the entity type metabox from non entity edit screens if user is not
44
-	 * allowed to configure entity types.
45
-	 *
46
-	 * @since 3.15.0
47
-	 */
48
-	public function hide_entity_type_metabox() {
42
+    /**
43
+     * Hide the entity type metabox from non entity edit screens if user is not
44
+     * allowed to configure entity types.
45
+     *
46
+     * @since 3.15.0
47
+     */
48
+    public function hide_entity_type_metabox() {
49 49
 
50
-		// Bail out if the user can edit entities.
51
-		if ( current_user_can( 'edit_wordlift_entity' ) ) {
52
-			return;
53
-		}
50
+        // Bail out if the user can edit entities.
51
+        if ( current_user_can( 'edit_wordlift_entity' ) ) {
52
+            return;
53
+        }
54 54
 
55
-		// Loop over all the non entity post types which support entities and turn off the metabox.
56
-		foreach ( $this->get_types_no_entity() as $type ) {
57
-			remove_meta_box( Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME . 'div', $type, 'side' );
58
-		}
55
+        // Loop over all the non entity post types which support entities and turn off the metabox.
56
+        foreach ( $this->get_types_no_entity() as $type ) {
57
+            remove_meta_box( Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME . 'div', $type, 'side' );
58
+        }
59 59
 
60
-	}
60
+    }
61 61
 
62
-	/**
63
-	 * Hide the entity type metabox from non entity list screens if user is not
64
-	 * allowed to configure entity types.
65
-	 *
66
-	 * @since 3.15.0
67
-	 */
68
-	public function set_filters_to_hide_entity_type_from_lists() {
62
+    /**
63
+     * Hide the entity type metabox from non entity list screens if user is not
64
+     * allowed to configure entity types.
65
+     *
66
+     * @since 3.15.0
67
+     */
68
+    public function set_filters_to_hide_entity_type_from_lists() {
69 69
 
70
-		// Bail out if the user can edit entities.
71
-		if ( current_user_can( 'edit_wordlift_entity' ) ) {
72
-			return;
73
-		}
70
+        // Bail out if the user can edit entities.
71
+        if ( current_user_can( 'edit_wordlift_entity' ) ) {
72
+            return;
73
+        }
74 74
 
75
-		// Loop over all the non entity post types which support entities and turn off the taxonomy column.
76
-		foreach ( $this->get_types_no_entity() as $type ) {
77
-			add_filter(
78
-				'manage_taxonomies_for_' . $type . '_columns',
79
-				function ( $taxonomies ) {
80
-					unset( $taxonomies[ Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ] );
75
+        // Loop over all the non entity post types which support entities and turn off the taxonomy column.
76
+        foreach ( $this->get_types_no_entity() as $type ) {
77
+            add_filter(
78
+                'manage_taxonomies_for_' . $type . '_columns',
79
+                function ( $taxonomies ) {
80
+                    unset( $taxonomies[ Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ] );
81 81
 
82
-					return $taxonomies;
83
-				}
84
-			);
85
-		}
82
+                    return $taxonomies;
83
+                }
84
+            );
85
+        }
86 86
 
87
-	}
87
+    }
88 88
 
89
-	/**
90
-	 * Get the types which are not the entity post type.
91
-	 *
92
-	 * @since 3.15.0
93
-	 *
94
-	 * @return array An array of types' names.
95
-	 */
96
-	private function get_types_no_entity() {
89
+    /**
90
+     * Get the types which are not the entity post type.
91
+     *
92
+     * @since 3.15.0
93
+     *
94
+     * @return array An array of types' names.
95
+     */
96
+    private function get_types_no_entity() {
97 97
 
98
-		return array_diff( Wordlift_Entity_Service::valid_entity_post_types(), (array) Wordlift_Entity_Service::TYPE_NAME );
99
-	}
98
+        return array_diff( Wordlift_Entity_Service::valid_entity_post_types(), (array) Wordlift_Entity_Service::TYPE_NAME );
99
+    }
100 100
 
101 101
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public function __construct() {
31 31
 
32
-		add_action( 'admin_init', array( $this, 'hide_entity_type_metabox' ) );
32
+		add_action('admin_init', array($this, 'hide_entity_type_metabox'));
33 33
 		add_action(
34 34
 			'admin_init',
35 35
 			array(
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 	public function hide_entity_type_metabox() {
49 49
 
50 50
 		// Bail out if the user can edit entities.
51
-		if ( current_user_can( 'edit_wordlift_entity' ) ) {
51
+		if (current_user_can('edit_wordlift_entity')) {
52 52
 			return;
53 53
 		}
54 54
 
55 55
 		// Loop over all the non entity post types which support entities and turn off the metabox.
56
-		foreach ( $this->get_types_no_entity() as $type ) {
57
-			remove_meta_box( Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME . 'div', $type, 'side' );
56
+		foreach ($this->get_types_no_entity() as $type) {
57
+			remove_meta_box(Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME.'div', $type, 'side');
58 58
 		}
59 59
 
60 60
 	}
@@ -68,16 +68,16 @@  discard block
 block discarded – undo
68 68
 	public function set_filters_to_hide_entity_type_from_lists() {
69 69
 
70 70
 		// Bail out if the user can edit entities.
71
-		if ( current_user_can( 'edit_wordlift_entity' ) ) {
71
+		if (current_user_can('edit_wordlift_entity')) {
72 72
 			return;
73 73
 		}
74 74
 
75 75
 		// Loop over all the non entity post types which support entities and turn off the taxonomy column.
76
-		foreach ( $this->get_types_no_entity() as $type ) {
76
+		foreach ($this->get_types_no_entity() as $type) {
77 77
 			add_filter(
78
-				'manage_taxonomies_for_' . $type . '_columns',
79
-				function ( $taxonomies ) {
80
-					unset( $taxonomies[ Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ] );
78
+				'manage_taxonomies_for_'.$type.'_columns',
79
+				function($taxonomies) {
80
+					unset($taxonomies[Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME]);
81 81
 
82 82
 					return $taxonomies;
83 83
 				}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	private function get_types_no_entity() {
97 97
 
98
-		return array_diff( Wordlift_Entity_Service::valid_entity_post_types(), (array) Wordlift_Entity_Service::TYPE_NAME );
98
+		return array_diff(Wordlift_Entity_Service::valid_entity_post_types(), (array) Wordlift_Entity_Service::TYPE_NAME);
99 99
 	}
100 100
 
101 101
 }
Please login to merge, or discard this patch.
src/admin/wordlift-admin-edit-post.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -16,37 +16,37 @@
 block discarded – undo
16 16
  */
17 17
 function wl_admin_permalink_html( $html, $post_id ) {
18 18
 
19
-	// Get the entity service instance.
20
-	$entity_service = Wordlift_Entity_Service::get_instance();
19
+    // Get the entity service instance.
20
+    $entity_service = Wordlift_Entity_Service::get_instance();
21 21
 
22
-	// Show the View Linked Data button only for entities.
23
-	//
24
-	// See https://github.com/insideout10/wordlift-plugin/issues/668.
25
-	$uri = $entity_service->get_uri( $post_id );
26
-	if ( 'publish' === get_post_status( $post_id ) && $uri ) {
22
+    // Show the View Linked Data button only for entities.
23
+    //
24
+    // See https://github.com/insideout10/wordlift-plugin/issues/668.
25
+    $uri = $entity_service->get_uri( $post_id );
26
+    if ( 'publish' === get_post_status( $post_id ) && $uri ) {
27 27
 
28
-		$lod_view_href = esc_attr( $uri );
29
-		/*
28
+        $lod_view_href = esc_attr( $uri );
29
+        /*
30 30
 		 * Add the `.html` extension to the link to have Chrome open the html version instead of RDF one.
31 31
 		 *
32 32
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/931
33 33
 		 * @since 3.21.1
34 34
 		 */
35
-		// phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
36
-		$html .= apply_filters( 'wl_feature__enable__view-linked-data', true ) ? "<span id='view-post-btn'><a href='$lod_view_href.html' class='button button-small wl-button' target='_blank'>" .
37
-						  esc_html__( 'View Linked Data', 'wordlift' ) .
38
-						  "</a></span>\n" : '';
35
+        // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
36
+        $html .= apply_filters( 'wl_feature__enable__view-linked-data', true ) ? "<span id='view-post-btn'><a href='$lod_view_href.html' class='button button-small wl-button' target='_blank'>" .
37
+                            esc_html__( 'View Linked Data', 'wordlift' ) .
38
+                            "</a></span>\n" : '';
39 39
 
40
-	}
40
+    }
41 41
 
42
-	// phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
43
-	$html .= apply_filters( 'wl_feature__enable__test-sd', true ) ? "<span id='view-post-btn'><a href='" . WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL .
44
-			rawurlencode( get_permalink( $post_id ) ) .
45
-			 "' class='button button-small wl-button' target='_blank'>" .
46
-			 esc_html__( 'Test Google Rich Snippets', 'wordlift' ) .
47
-			 "</a></span>\n" : '';
42
+    // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
43
+    $html .= apply_filters( 'wl_feature__enable__test-sd', true ) ? "<span id='view-post-btn'><a href='" . WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL .
44
+            rawurlencode( get_permalink( $post_id ) ) .
45
+                "' class='button button-small wl-button' target='_blank'>" .
46
+                esc_html__( 'Test Google Rich Snippets', 'wordlift' ) .
47
+                "</a></span>\n" : '';
48 48
 
49
-	return $html;
49
+    return $html;
50 50
 }
51 51
 
52 52
 add_filter( 'get_sample_permalink_html', 'wl_admin_permalink_html', PHP_INT_MAX, 2 );
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  *
15 15
  * @return string The enhanced html.
16 16
  */
17
-function wl_admin_permalink_html( $html, $post_id ) {
17
+function wl_admin_permalink_html($html, $post_id) {
18 18
 
19 19
 	// Get the entity service instance.
20 20
 	$entity_service = Wordlift_Entity_Service::get_instance();
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
 	// Show the View Linked Data button only for entities.
23 23
 	//
24 24
 	// See https://github.com/insideout10/wordlift-plugin/issues/668.
25
-	$uri = $entity_service->get_uri( $post_id );
26
-	if ( 'publish' === get_post_status( $post_id ) && $uri ) {
25
+	$uri = $entity_service->get_uri($post_id);
26
+	if ('publish' === get_post_status($post_id) && $uri) {
27 27
 
28
-		$lod_view_href = esc_attr( $uri );
28
+		$lod_view_href = esc_attr($uri);
29 29
 		/*
30 30
 		 * Add the `.html` extension to the link to have Chrome open the html version instead of RDF one.
31 31
 		 *
@@ -33,20 +33,20 @@  discard block
 block discarded – undo
33 33
 		 * @since 3.21.1
34 34
 		 */
35 35
 		// phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
36
-		$html .= apply_filters( 'wl_feature__enable__view-linked-data', true ) ? "<span id='view-post-btn'><a href='$lod_view_href.html' class='button button-small wl-button' target='_blank'>" .
37
-						  esc_html__( 'View Linked Data', 'wordlift' ) .
36
+		$html .= apply_filters('wl_feature__enable__view-linked-data', true) ? "<span id='view-post-btn'><a href='$lod_view_href.html' class='button button-small wl-button' target='_blank'>".
37
+						  esc_html__('View Linked Data', 'wordlift').
38 38
 						  "</a></span>\n" : '';
39 39
 
40 40
 	}
41 41
 
42 42
 	// phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
43
-	$html .= apply_filters( 'wl_feature__enable__test-sd', true ) ? "<span id='view-post-btn'><a href='" . WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL .
44
-			rawurlencode( get_permalink( $post_id ) ) .
45
-			 "' class='button button-small wl-button' target='_blank'>" .
46
-			 esc_html__( 'Test Google Rich Snippets', 'wordlift' ) .
43
+	$html .= apply_filters('wl_feature__enable__test-sd', true) ? "<span id='view-post-btn'><a href='".WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL.
44
+			rawurlencode(get_permalink($post_id)).
45
+			 "' class='button button-small wl-button' target='_blank'>".
46
+			 esc_html__('Test Google Rich Snippets', 'wordlift').
47 47
 			 "</a></span>\n" : '';
48 48
 
49 49
 	return $html;
50 50
 }
51 51
 
52
-add_filter( 'get_sample_permalink_html', 'wl_admin_permalink_html', PHP_INT_MAX, 2 );
52
+add_filter('get_sample_permalink_html', 'wl_admin_permalink_html', PHP_INT_MAX, 2);
Please login to merge, or discard this patch.
src/admin/class-wordlift-admin-download-your-data-page.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 		// Add a callback to our 'page' function.
56 56
 		add_submenu_page(
57 57
 			'wl_admin_menu',
58
-			_x( 'Download Your Data', 'Page title', 'wordlift' ),
59
-			_x( 'Download Your Data', 'Menu title', 'wordlift' ),
58
+			_x('Download Your Data', 'Page title', 'wordlift'),
59
+			_x('Download Your Data', 'Menu title', 'wordlift'),
60 60
 			'manage_options',
61 61
 			'wl_download_your_data',
62
-			array( $this, 'page' )
62
+			array($this, 'page')
63 63
 		);
64 64
 
65 65
 	}
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	public function page() {
73 73
 
74 74
 		// Include the partial.
75
-		include plugin_dir_path( __FILE__ ) . 'partials/wordlift-admin-download-your-data.php';
75
+		include plugin_dir_path(__FILE__).'partials/wordlift-admin-download-your-data.php';
76 76
 
77 77
 	}
78 78
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		$default_api_service = Default_Api_Service::get_instance();
87 87
 
88 88
 		// Avoid PHP notices when buffer is empty.
89
-		if ( ob_get_contents() ) {
89
+		if (ob_get_contents()) {
90 90
 			ob_end_clean();
91 91
 		}
92 92
 
@@ -94,44 +94,44 @@  discard block
 block discarded – undo
94 94
 		$suffix = 'json';
95 95
 
96 96
 		// Check if there is suffix.
97
-		if ( isset( $_GET['out'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
98
-			$suffix = sanitize_text_field( wp_unslash( $_GET['out'] ) ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended
97
+		if (isset($_GET['out'])) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
98
+			$suffix = sanitize_text_field(wp_unslash($_GET['out'])); //phpcs:ignore WordPress.Security.NonceVerification.Recommended
99 99
 		}
100 100
 
101 101
 		// Create filename.
102
-		$filename = 'dataset.' . $suffix;
102
+		$filename = 'dataset.'.$suffix;
103 103
 
104
-		if ( ! in_array( $suffix, $this->allowed_formats, true ) ) {
104
+		if ( ! in_array($suffix, $this->allowed_formats, true)) {
105 105
 			// The file type is not from allowed types.
106
-			wp_die( esc_html__( 'The format is not supported.', 'wordlift' ) );
106
+			wp_die(esc_html__('The format is not supported.', 'wordlift'));
107 107
 		}
108 108
 
109
-		$accept_header_format = $this->allowed_headers[ $suffix ];
109
+		$accept_header_format = $this->allowed_headers[$suffix];
110 110
 
111 111
 		$headers = array(
112 112
 			'Accept' => $accept_header_format,
113 113
 		);
114 114
 
115
-		$response = $default_api_service->get( '/dataset/export', $headers );
115
+		$response = $default_api_service->get('/dataset/export', $headers);
116 116
 
117 117
 		$response = $response->get_response();
118 118
 
119 119
 		if (
120
-			is_wp_error( $response ) ||
120
+			is_wp_error($response) ||
121 121
 			200 !== (int) $response['response']['code']
122 122
 		) {
123 123
 			// Something is not working properly, so display error message.
124
-			wp_die( esc_html__( 'There was an error trying to connect to the server. Please try again later.', 'wordlift' ) );
124
+			wp_die(esc_html__('There was an error trying to connect to the server. Please try again later.', 'wordlift'));
125 125
 		}
126 126
 
127 127
 		// Get response body.
128
-		$body     = wp_remote_retrieve_body( $response );
129
-		$type     = wp_remote_retrieve_header( $response, 'content-type' );
130
-		$filename = 'dataset-' . gmdate( 'Y-m-d-H-i-s' ) . '.' . $suffix;
128
+		$body     = wp_remote_retrieve_body($response);
129
+		$type     = wp_remote_retrieve_header($response, 'content-type');
130
+		$filename = 'dataset-'.gmdate('Y-m-d-H-i-s').'.'.$suffix;
131 131
 
132 132
 		// Add proper file headers.
133
-		header( "Content-Disposition: attachment; filename=$filename" );
134
-		header( "Content-Type: $type" );
133
+		header("Content-Disposition: attachment; filename=$filename");
134
+		header("Content-Type: $type");
135 135
 
136 136
 		/*
137 137
 		 * Echo the response body. As this is not HTML we can not escape it
Please login to merge, or discard this patch.
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -18,128 +18,128 @@
 block discarded – undo
18 18
  * @since 3.6.0
19 19
  */
20 20
 class Wordlift_Admin_Download_Your_Data_Page {
21
-	/**
22
-	 * Used to check if the requested file is supported.
23
-	 *
24
-	 * @since  3.16.0
25
-	 * @access private
26
-	 * @var $allowed_formats array Allowed formats.
27
-	 */
28
-	private $allowed_formats = array(
29
-		'json',
30
-		'rdf',
31
-		'ttl',
32
-		'n3',
33
-	);
34
-
35
-	/**
36
-	 * The list of headers allowed by the endpoint.
37
-	 *
38
-	 * @since 3.28.2
39
-	 * @var string[]
40
-	 */
41
-	private $allowed_headers = array(
42
-		'json' => 'application/ld+json',
43
-		'rdf'  => 'application/rdf+xml',
44
-		'n3'   => 'text/n3',
45
-		'ttl'  => 'text/turtle',
46
-	);
47
-
48
-	/**
49
-	 * Hook to 'admin_menu' to add the 'Download Your Data' page.
50
-	 *
51
-	 * @since 3.6.0
52
-	 */
53
-	public function admin_menu() {
54
-
55
-		// Add a callback to our 'page' function.
56
-		add_submenu_page(
57
-			'wl_admin_menu',
58
-			_x( 'Download Your Data', 'Page title', 'wordlift' ),
59
-			_x( 'Download Your Data', 'Menu title', 'wordlift' ),
60
-			'manage_options',
61
-			'wl_download_your_data',
62
-			array( $this, 'page' )
63
-		);
64
-
65
-	}
66
-
67
-	/**
68
-	 * The admin menu callback to render the page.
69
-	 *
70
-	 * @since 3.6.0
71
-	 */
72
-	public function page() {
73
-
74
-		// Include the partial.
75
-		include plugin_dir_path( __FILE__ ) . 'partials/wordlift-admin-download-your-data.php';
76
-
77
-	}
78
-
79
-	/**
80
-	 * Ajax call to redirect to a download URL.
81
-	 *
82
-	 * @since 3.6.0
83
-	 */
84
-	public function download_your_data() {
85
-
86
-		$default_api_service = Default_Api_Service::get_instance();
87
-
88
-		// Avoid PHP notices when buffer is empty.
89
-		if ( ob_get_contents() ) {
90
-			ob_end_clean();
91
-		}
92
-
93
-		// Use json suffix by default.
94
-		$suffix = 'json';
95
-
96
-		// Check if there is suffix.
97
-		if ( isset( $_GET['out'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
98
-			$suffix = sanitize_text_field( wp_unslash( $_GET['out'] ) ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended
99
-		}
100
-
101
-		// Create filename.
102
-		$filename = 'dataset.' . $suffix;
103
-
104
-		if ( ! in_array( $suffix, $this->allowed_formats, true ) ) {
105
-			// The file type is not from allowed types.
106
-			wp_die( esc_html__( 'The format is not supported.', 'wordlift' ) );
107
-		}
108
-
109
-		$accept_header_format = $this->allowed_headers[ $suffix ];
110
-
111
-		$headers = array(
112
-			'Accept' => $accept_header_format,
113
-		);
114
-
115
-		$response = $default_api_service->get( '/dataset/export', $headers );
116
-
117
-		$response = $response->get_response();
118
-
119
-		if (
120
-			is_wp_error( $response ) ||
121
-			200 !== (int) $response['response']['code']
122
-		) {
123
-			// Something is not working properly, so display error message.
124
-			wp_die( esc_html__( 'There was an error trying to connect to the server. Please try again later.', 'wordlift' ) );
125
-		}
126
-
127
-		// Get response body.
128
-		$body     = wp_remote_retrieve_body( $response );
129
-		$type     = wp_remote_retrieve_header( $response, 'content-type' );
130
-		$filename = 'dataset-' . gmdate( 'Y-m-d-H-i-s' ) . '.' . $suffix;
131
-
132
-		// Add proper file headers.
133
-		header( "Content-Disposition: attachment; filename=$filename" );
134
-		header( "Content-Type: $type" );
135
-
136
-		/*
21
+    /**
22
+     * Used to check if the requested file is supported.
23
+     *
24
+     * @since  3.16.0
25
+     * @access private
26
+     * @var $allowed_formats array Allowed formats.
27
+     */
28
+    private $allowed_formats = array(
29
+        'json',
30
+        'rdf',
31
+        'ttl',
32
+        'n3',
33
+    );
34
+
35
+    /**
36
+     * The list of headers allowed by the endpoint.
37
+     *
38
+     * @since 3.28.2
39
+     * @var string[]
40
+     */
41
+    private $allowed_headers = array(
42
+        'json' => 'application/ld+json',
43
+        'rdf'  => 'application/rdf+xml',
44
+        'n3'   => 'text/n3',
45
+        'ttl'  => 'text/turtle',
46
+    );
47
+
48
+    /**
49
+     * Hook to 'admin_menu' to add the 'Download Your Data' page.
50
+     *
51
+     * @since 3.6.0
52
+     */
53
+    public function admin_menu() {
54
+
55
+        // Add a callback to our 'page' function.
56
+        add_submenu_page(
57
+            'wl_admin_menu',
58
+            _x( 'Download Your Data', 'Page title', 'wordlift' ),
59
+            _x( 'Download Your Data', 'Menu title', 'wordlift' ),
60
+            'manage_options',
61
+            'wl_download_your_data',
62
+            array( $this, 'page' )
63
+        );
64
+
65
+    }
66
+
67
+    /**
68
+     * The admin menu callback to render the page.
69
+     *
70
+     * @since 3.6.0
71
+     */
72
+    public function page() {
73
+
74
+        // Include the partial.
75
+        include plugin_dir_path( __FILE__ ) . 'partials/wordlift-admin-download-your-data.php';
76
+
77
+    }
78
+
79
+    /**
80
+     * Ajax call to redirect to a download URL.
81
+     *
82
+     * @since 3.6.0
83
+     */
84
+    public function download_your_data() {
85
+
86
+        $default_api_service = Default_Api_Service::get_instance();
87
+
88
+        // Avoid PHP notices when buffer is empty.
89
+        if ( ob_get_contents() ) {
90
+            ob_end_clean();
91
+        }
92
+
93
+        // Use json suffix by default.
94
+        $suffix = 'json';
95
+
96
+        // Check if there is suffix.
97
+        if ( isset( $_GET['out'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
98
+            $suffix = sanitize_text_field( wp_unslash( $_GET['out'] ) ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended
99
+        }
100
+
101
+        // Create filename.
102
+        $filename = 'dataset.' . $suffix;
103
+
104
+        if ( ! in_array( $suffix, $this->allowed_formats, true ) ) {
105
+            // The file type is not from allowed types.
106
+            wp_die( esc_html__( 'The format is not supported.', 'wordlift' ) );
107
+        }
108
+
109
+        $accept_header_format = $this->allowed_headers[ $suffix ];
110
+
111
+        $headers = array(
112
+            'Accept' => $accept_header_format,
113
+        );
114
+
115
+        $response = $default_api_service->get( '/dataset/export', $headers );
116
+
117
+        $response = $response->get_response();
118
+
119
+        if (
120
+            is_wp_error( $response ) ||
121
+            200 !== (int) $response['response']['code']
122
+        ) {
123
+            // Something is not working properly, so display error message.
124
+            wp_die( esc_html__( 'There was an error trying to connect to the server. Please try again later.', 'wordlift' ) );
125
+        }
126
+
127
+        // Get response body.
128
+        $body     = wp_remote_retrieve_body( $response );
129
+        $type     = wp_remote_retrieve_header( $response, 'content-type' );
130
+        $filename = 'dataset-' . gmdate( 'Y-m-d-H-i-s' ) . '.' . $suffix;
131
+
132
+        // Add proper file headers.
133
+        header( "Content-Disposition: attachment; filename=$filename" );
134
+        header( "Content-Type: $type" );
135
+
136
+        /*
137 137
 		 * Echo the response body. As this is not HTML we can not escape it
138 138
 		 * and neither sanitize it, therefor turning off the linter notice.
139 139
 		 */
140
-		echo $body; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- This is an RDF file which is downloaded to the client (see the `Content-Disposition: attachment` header above).
140
+        echo $body; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- This is an RDF file which is downloaded to the client (see the `Content-Disposition: attachment` header above).
141 141
 
142
-		// Exit in both cases.
143
-		exit;
144
-	}
142
+        // Exit in both cases.
143
+        exit;
144
+    }
145 145
 }
Please login to merge, or discard this patch.
src/admin/partials/admin-setup/step-3.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -6,24 +6,24 @@
 block discarded – undo
6 6
 
7 7
 	<p class="page-txt">
8 8
 		<?php
9
-		$grab_a_key_link_html = sprintf(
10
-			'<a target="_blank" href="%s">%s</a>',
11
-			esc_attr__( 'https://wordlift.io/pricing/?utm_campaign=wl_activation_grab_the_key', 'wordlift' ),
12
-			esc_html__( 'grab a key', 'wordlift' )
13
-		);
9
+        $grab_a_key_link_html = sprintf(
10
+            '<a target="_blank" href="%s">%s</a>',
11
+            esc_attr__( 'https://wordlift.io/pricing/?utm_campaign=wl_activation_grab_the_key', 'wordlift' ),
12
+            esc_html__( 'grab a key', 'wordlift' )
13
+        );
14 14
 
15
-		echo wp_kses(
16
-			sprintf(
17
-					/* translators: %s: Link to Grab a Key. */
18
-				esc_html__(
19
-					'If you already purchased a plan, check your email, get the activation key from your inbox and insert it in the field below. Otherwise %s!',
20
-					'wordlift'
21
-				),
22
-				$grab_a_key_link_html
23
-			),
24
-			array( 'a' => array( 'href' => array() ) )
25
-		);
26
-		?>
15
+        echo wp_kses(
16
+            sprintf(
17
+                    /* translators: %s: Link to Grab a Key. */
18
+                esc_html__(
19
+                    'If you already purchased a plan, check your email, get the activation key from your inbox and insert it in the field below. Otherwise %s!',
20
+                    'wordlift'
21
+                ),
22
+                $grab_a_key_link_html
23
+            ),
24
+            array( 'a' => array( 'href' => array() ) )
25
+        );
26
+        ?>
27 27
 	</p>
28 28
 	<input
29 29
 		type="text"
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@  discard block
 block discarded – undo
1 1
 <!-- Pane 3 content -->
2 2
 <script type="text/html" id="page-2">
3 3
 	<h2 class="page-title">
4
-		<?php esc_html_e( 'License Key', 'wordlift' ); ?>
4
+		<?php esc_html_e('License Key', 'wordlift'); ?>
5 5
 	</h2>
6 6
 
7 7
 	<p class="page-txt">
8 8
 		<?php
9 9
 		$grab_a_key_link_html = sprintf(
10 10
 			'<a target="_blank" href="%s">%s</a>',
11
-			esc_attr__( 'https://wordlift.io/pricing/?utm_campaign=wl_activation_grab_the_key', 'wordlift' ),
12
-			esc_html__( 'grab a key', 'wordlift' )
11
+			esc_attr__('https://wordlift.io/pricing/?utm_campaign=wl_activation_grab_the_key', 'wordlift'),
12
+			esc_html__('grab a key', 'wordlift')
13 13
 		);
14 14
 
15 15
 		echo wp_kses(
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 				),
22 22
 				$grab_a_key_link_html
23 23
 			),
24
-			array( 'a' => array( 'href' => array() ) )
24
+			array('a' => array('href' => array()))
25 25
 		);
26 26
 		?>
27 27
 	</p>
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		name="key"
34 34
 		value=""
35 35
 		autocomplete="off"
36
-		placeholder="<?php echo esc_attr_x( 'License Key', 'Input text placeholder', 'wordlift' ); ?>"
36
+		placeholder="<?php echo esc_attr_x('License Key', 'Input text placeholder', 'wordlift'); ?>"
37 37
 	>
38 38
 	<div>
39 39
 		<p class="wl-val-key-error">
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 			target="_tab"
47 47
 			class="button wl-default-action"
48 48
 		>
49
-			<?php esc_html_e( 'Grab a Key!', 'wordlift' ); ?>
49
+			<?php esc_html_e('Grab a Key!', 'wordlift'); ?>
50 50
 		</a>
51 51
 
52 52
 		<input
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 			type="button"
55 55
 			data-wl-next="wl-next"
56 56
 			class="button"
57
-			value="<?php esc_attr_e( 'Next', 'wordlift' ); ?>"
57
+			value="<?php esc_attr_e('Next', 'wordlift'); ?>"
58 58
 		>
59 59
 	</div>
60 60
 </script>
Please login to merge, or discard this patch.
src/admin/partials/admin-setup/step-1.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,42 +1,42 @@  discard block
 block discarded – undo
1 1
 <!-- Pane 1 content -->
2 2
 <script type="text/html" id="page-0">
3 3
 	<h2 class="page-title">
4
-		<?php esc_html_e( 'Welcome', 'wordlift' ); ?>
4
+		<?php esc_html_e('Welcome', 'wordlift'); ?>
5 5
 	</h2>
6 6
 
7 7
 	<p class="page-txt">
8
-		<?php esc_html_e( 'Thank you for downloading WordLift. Now you can boost your website with a double-digit growth. WordLift helps you with:', 'wordlift' ); ?>
8
+		<?php esc_html_e('Thank you for downloading WordLift. Now you can boost your website with a double-digit growth. WordLift helps you with:', 'wordlift'); ?>
9 9
 	</p>
10 10
 
11 11
 	<ul class="page-list">
12 12
 		<li>
13 13
 			<span class="fa fa-university"></span>
14
-			<?php esc_html_e( 'Trustworthiness', 'wordlift' ); ?>
14
+			<?php esc_html_e('Trustworthiness', 'wordlift'); ?>
15 15
 		</li>
16 16
 
17 17
 		<li>
18 18
 			<span class="fa fa-map-marker"></span>
19
-			<?php esc_html_e( 'Enrichment', 'wordlift' ); ?>
19
+			<?php esc_html_e('Enrichment', 'wordlift'); ?>
20 20
 		</li>
21 21
 
22 22
 		<li>
23 23
 			<span class="fa fa-heart"></span>
24
-			<?php esc_html_e( 'Engagement', 'wordlift' ); ?>
24
+			<?php esc_html_e('Engagement', 'wordlift'); ?>
25 25
 		</li>
26 26
 
27 27
 		<li>
28 28
 			<span class="fa fa-hand-o-right"></span>
29
-			<?php esc_html_e( 'Smart Navigation', 'wordlift' ); ?>
29
+			<?php esc_html_e('Smart Navigation', 'wordlift'); ?>
30 30
 		</li>
31 31
 
32 32
 		<li>
33 33
 			<span class="fa fa-google"></span>
34
-			<?php esc_html_e( 'SEO Optimization', 'wordlift' ); ?>
34
+			<?php esc_html_e('SEO Optimization', 'wordlift'); ?>
35 35
 		</li>
36 36
 
37 37
 		<li>
38 38
 			<span class="fa fa-group"></span>
39
-			<?php esc_html_e( 'Content Marketing', 'wordlift' ); ?>
39
+			<?php esc_html_e('Content Marketing', 'wordlift'); ?>
40 40
 		</li>
41 41
 	</ul>
42 42
 
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
 				target="_tab"
47 47
 				class="button"
48 48
 		>
49
-			<?php esc_html_e( 'Learn More', 'wordlift' ); ?>
49
+			<?php esc_html_e('Learn More', 'wordlift'); ?>
50 50
 		</a>
51 51
 		<input
52 52
 				type="button"
53 53
 				data-wl-next="wl-next"
54 54
 				class="wl-default-action"
55
-				value="<?php esc_attr_e( 'Next', 'wordlift' ); ?>"
55
+				value="<?php esc_attr_e('Next', 'wordlift'); ?>"
56 56
 		>
57 57
 	</div>
58 58
 </script>
Please login to merge, or discard this patch.
src/admin/partials/admin-setup/step-5.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -10,27 +10,27 @@
 block discarded – undo
10 10
 
11 11
 	<?php
12 12
 
13
-	// Get the language locale part.
14
-	$parts    = explode( '_', get_locale() );
15
-	$language = isset( $parts[0] ) ? $parts[0] : '';
16
-	$country  = isset( $parts[1] ) ? strtolower( $parts[1] ) : '';
17
-	?>
13
+    // Get the language locale part.
14
+    $parts    = explode( '_', get_locale() );
15
+    $language = isset( $parts[0] ) ? $parts[0] : '';
16
+    $country  = isset( $parts[1] ) ? strtolower( $parts[1] ) : '';
17
+    ?>
18 18
 
19 19
 	<br>
20 20
 
21 21
 	<?php
22
-	// Render country select element.
22
+    // Render country select element.
23 23
     // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
24
-	$country_select->render(
25
-		array(
26
-			'id'     => 'wl-country-code',
27
-			'name'   => 'wl-country-code',
28
-			'lang'   => $language,
29
-			'value'  => $country,
30
-			'notice' => __( 'The selected language is not supported in this country.</br>Please choose another country or language.', 'wordlift' ),
31
-		)
32
-	);
33
-	?>
24
+    $country_select->render(
25
+        array(
26
+            'id'     => 'wl-country-code',
27
+            'name'   => 'wl-country-code',
28
+            'lang'   => $language,
29
+            'value'  => $country,
30
+            'notice' => __( 'The selected language is not supported in this country.</br>Please choose another country or language.', 'wordlift' ),
31
+        )
32
+    );
33
+    ?>
34 34
 
35 35
 	<div class="btn-wrapper">
36 36
 		<input
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@  discard block
 block discarded – undo
1 1
 <!-- Pane 5 content -->
2 2
 <script type="text/html" id="page-4">
3 3
 	<h2 class="page-title">
4
-		<?php esc_html_e( 'Country', 'wordlift' ); ?>
4
+		<?php esc_html_e('Country', 'wordlift'); ?>
5 5
 	</h2>
6 6
 
7 7
 	<p class="page-txt">
8
-		<?php esc_html_e( 'Each WordLift key can be used only in one language.', 'wordlift' ); ?>
8
+		<?php esc_html_e('Each WordLift key can be used only in one language.', 'wordlift'); ?>
9 9
 	</p>
10 10
 
11 11
 	<?php
12 12
 
13 13
 	// Get the language locale part.
14
-	$parts    = explode( '_', get_locale() );
15
-	$language = isset( $parts[0] ) ? $parts[0] : '';
16
-	$country  = isset( $parts[1] ) ? strtolower( $parts[1] ) : '';
14
+	$parts    = explode('_', get_locale());
15
+	$language = isset($parts[0]) ? $parts[0] : '';
16
+	$country  = isset($parts[1]) ? strtolower($parts[1]) : '';
17 17
 	?>
18 18
 
19 19
 	<br>
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 			'name'   => 'wl-country-code',
28 28
 			'lang'   => $language,
29 29
 			'value'  => $country,
30
-			'notice' => __( 'The selected language is not supported in this country.</br>Please choose another country or language.', 'wordlift' ),
30
+			'notice' => __('The selected language is not supported in this country.</br>Please choose another country or language.', 'wordlift'),
31 31
 		)
32 32
 	);
33 33
 	?>
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 				type="button"
38 38
 				data-wl-next="wl-next"
39 39
 				class="wl-default-action"
40
-				value="<?php esc_attr_e( 'Next', 'wordlift' ); ?>"
40
+				value="<?php esc_attr_e('Next', 'wordlift'); ?>"
41 41
 		>
42 42
 	</div>
43 43
 </script>
Please login to merge, or discard this patch.
src/admin/partials/admin-setup/step-4.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <!-- Pane 4 content -->
2 2
 <script type="text/html" id="page-3">
3 3
 	<h2 class="page-title">
4
-		<?php esc_html_e( 'Vocabulary', 'wordlift' ); ?>
4
+		<?php esc_html_e('Vocabulary', 'wordlift'); ?>
5 5
 	</h2>
6 6
 
7 7
 	<p class="page-txt">
8
-		<?php esc_html_e( 'All new pages created with WordLift, will be stored inside your internal vocabulary. You can customize the url pattern of these pages in the field below. Check our FAQs if you need more info.', 'wordlift' ); ?>
8
+		<?php esc_html_e('All new pages created with WordLift, will be stored inside your internal vocabulary. You can customize the url pattern of these pages in the field below. Check our FAQs if you need more info.', 'wordlift'); ?>
9 9
 	</p>
10 10
 
11 11
 	<input
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 	>
20 20
 
21 21
 	<p class="page-det">
22
-		<?php esc_html_e( 'Leave it empty to place your entities in the root folder of your website', 'wordlift' ); ?>
23
-		<?php esc_html_e( ' (requires the permalink settings to be set to Post name)', 'wordlift' ); ?>
22
+		<?php esc_html_e('Leave it empty to place your entities in the root folder of your website', 'wordlift'); ?>
23
+		<?php esc_html_e(' (requires the permalink settings to be set to Post name)', 'wordlift'); ?>
24 24
 	</p>
25 25
 
26 26
 	<div class="btn-wrapper">
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 				type="button"
29 29
 				data-wl-next="wl-next"
30 30
 				class="wl-default-action"
31
-				value="<?php esc_attr_e( 'Next', 'wordlift' ); ?>"
31
+				value="<?php esc_attr_e('Next', 'wordlift'); ?>"
32 32
 		>
33 33
 	</div>
34 34
 </script>
Please login to merge, or discard this patch.
src/admin/partials/admin-setup/step-2.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
 	<br>
7 7
 	<p class="page-txt">
8 8
 		<?php
9
-			esc_html_e( 'Help us improve our product by automatically sending diagnostic and usage data.', 'wordlift' );
10
-		?>
9
+            esc_html_e( 'Help us improve our product by automatically sending diagnostic and usage data.', 'wordlift' );
10
+        ?>
11 11
 	</p>
12 12
 	<input
13 13
 		type="checkbox"
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <!-- Pane 2 content -->
2 2
 <script type="text/html" id="page-1">
3 3
 	<h2 class="page-title">
4
-		<?php esc_html_e( 'Diagnostic', 'wordlift' ); ?>
4
+		<?php esc_html_e('Diagnostic', 'wordlift'); ?>
5 5
 	</h2>
6 6
 	<br>
7 7
 	<p class="page-txt">
8 8
 		<?php
9
-			esc_html_e( 'Help us improve our product by automatically sending diagnostic and usage data.', 'wordlift' );
9
+			esc_html_e('Help us improve our product by automatically sending diagnostic and usage data.', 'wordlift');
10 10
 		?>
11 11
 	</p>
12 12
 	<input
@@ -17,12 +17,12 @@  discard block
 block discarded – undo
17 17
 		checked
18 18
 	>
19 19
 	<label for="share-diagnostic">
20
-		<?php esc_html_e( 'Share diagnostic data', 'wordlift' ); ?>
20
+		<?php esc_html_e('Share diagnostic data', 'wordlift'); ?>
21 21
 	</label>
22 22
 	
23 23
 	<p class="privacy-policy-details">
24 24
 		<a href="https://wordlift.io/privacy-policy/" target="_blank">
25
-			<?php esc_html_e( 'About our privacy policy...', 'wordlift' ); ?>	
25
+			<?php esc_html_e('About our privacy policy...', 'wordlift'); ?>	
26 26
 		</a>
27 27
 	</p>
28 28
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 			type="button"
32 32
 			data-wl-next="wl-next"
33 33
 			class="wl-default-action"
34
-			value="<?php esc_attr_e( 'Next', 'wordlift' ); ?>"
34
+			value="<?php esc_attr_e('Next', 'wordlift'); ?>"
35 35
 		>
36 36
 	</div>
37 37
 </script>
Please login to merge, or discard this patch.
src/admin/partials/wordlift-admin-download-your-data.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -39,16 +39,16 @@
 block discarded – undo
39 39
 
40 40
 	<!-- Show the 'JSON-LD' button only if the constant is defined and set to true. -->
41 41
 	<?php
42
-	if (
43
-		defined( 'WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA' ) &&
44
-		WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA
45
-	) :
46
-		$class_name = 'button wl-add-input wl-button';
47
-
48
-		if ( ! Wordlift_Google_Analytics_Export_Service::is_postname_permalink_structure() ) {
49
-			$class_name .= ' wl-button-disabled';
50
-		}
51
-		?>
42
+    if (
43
+        defined( 'WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA' ) &&
44
+        WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA
45
+    ) :
46
+        $class_name = 'button wl-add-input wl-button';
47
+
48
+        if ( ! Wordlift_Google_Analytics_Export_Service::is_postname_permalink_structure() ) {
49
+            $class_name .= ' wl-button-disabled';
50
+        }
51
+        ?>
52 52
 		<a href="<?php echo esc_url( admin_url( 'admin-ajax.php?action=wl_google_analytics_export' ) ); ?>"
53 53
 		   class="<?php echo esc_attr( $class_name ); ?>">
54 54
 				<?php esc_html_e( 'Google Analytics', 'wordlift' ); ?>
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -14,46 +14,46 @@
 block discarded – undo
14 14
 <!-- This file should primarily consist of HTML with a little bit of PHP. -->
15 15
 
16 16
 <div class="wrap">
17
-	<h2><?php echo esc_html_x( 'Download Your Data', 'Page title', 'wordlift' ); ?></h2>
18
-	<p><?php esc_html_e( 'Choose the format to download your data:', 'wordlift' ); ?></p>
17
+	<h2><?php echo esc_html_x('Download Your Data', 'Page title', 'wordlift'); ?></h2>
18
+	<p><?php esc_html_e('Choose the format to download your data:', 'wordlift'); ?></p>
19 19
 
20
-	<a href="<?php echo esc_url( admin_url( 'admin-ajax.php?action=wl_download_your_data&out=json' ) ); ?>"
20
+	<a href="<?php echo esc_url(admin_url('admin-ajax.php?action=wl_download_your_data&out=json')); ?>"
21 21
 	   class="button wl-add-input wl-button">
22
-			<?php esc_html_e( 'JSON-LD', 'wordlift' ); ?>
22
+			<?php esc_html_e('JSON-LD', 'wordlift'); ?>
23 23
 	</a>
24 24
 
25
-	<a href="<?php echo esc_url( admin_url( 'admin-ajax.php?action=wl_download_your_data&out=rdf' ) ); ?>"
25
+	<a href="<?php echo esc_url(admin_url('admin-ajax.php?action=wl_download_your_data&out=rdf')); ?>"
26 26
 	   class="button wl-add-input wl-button">
27
-			<?php esc_html_e( 'RDF/XML', 'wordlift' ); ?>
27
+			<?php esc_html_e('RDF/XML', 'wordlift'); ?>
28 28
 	</a>
29 29
 
30
-	<a href="<?php echo esc_url( admin_url( 'admin-ajax.php?action=wl_download_your_data&out=ttl' ) ); ?>"
30
+	<a href="<?php echo esc_url(admin_url('admin-ajax.php?action=wl_download_your_data&out=ttl')); ?>"
31 31
 	   class="button wl-add-input wl-button">
32
-			<?php echo esc_html_x( 'Turtle', 'File format, not the animal', 'wordlift' ); ?>
32
+			<?php echo esc_html_x('Turtle', 'File format, not the animal', 'wordlift'); ?>
33 33
 	</a>
34 34
 
35
-	<a href="<?php echo esc_url( admin_url( 'admin-ajax.php?action=wl_download_your_data&out=n3' ) ); ?>"
35
+	<a href="<?php echo esc_url(admin_url('admin-ajax.php?action=wl_download_your_data&out=n3')); ?>"
36 36
 	   class="button wl-add-input wl-button">
37
-			<?php esc_html_e( 'N3', 'wordlift' ); ?>
37
+			<?php esc_html_e('N3', 'wordlift'); ?>
38 38
 	</a>
39 39
 
40 40
 	<!-- Show the 'JSON-LD' button only if the constant is defined and set to true. -->
41 41
 	<?php
42 42
 	if (
43
-		defined( 'WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA' ) &&
43
+		defined('WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA') &&
44 44
 		WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA
45 45
 	) :
46 46
 		$class_name = 'button wl-add-input wl-button';
47 47
 
48
-		if ( ! Wordlift_Google_Analytics_Export_Service::is_postname_permalink_structure() ) {
48
+		if ( ! Wordlift_Google_Analytics_Export_Service::is_postname_permalink_structure()) {
49 49
 			$class_name .= ' wl-button-disabled';
50 50
 		}
51 51
 		?>
52
-		<a href="<?php echo esc_url( admin_url( 'admin-ajax.php?action=wl_google_analytics_export' ) ); ?>"
53
-		   class="<?php echo esc_attr( $class_name ); ?>">
54
-				<?php esc_html_e( 'Google Analytics', 'wordlift' ); ?>
52
+		<a href="<?php echo esc_url(admin_url('admin-ajax.php?action=wl_google_analytics_export')); ?>"
53
+		   class="<?php echo esc_attr($class_name); ?>">
54
+				<?php esc_html_e('Google Analytics', 'wordlift'); ?>
55 55
 
56
-				<?php if ( ! Wordlift_Google_Analytics_Export_Service::is_postname_permalink_structure() ) : ?>
56
+				<?php if ( ! Wordlift_Google_Analytics_Export_Service::is_postname_permalink_structure()) : ?>
57 57
 					<span class="wl-tooltip">To download your data, please change <br /> the site permalink structure to "Post name"</span>
58 58
 				<?php endif ?>
59 59
 		</a>
Please login to merge, or discard this patch.