Completed
Branch feature/397-review-wordlifts-s... (3d685b)
by David
02:44
created
src/modules/core/wordlift_core_functions.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,9 +5,9 @@
 block discarded – undo
5 5
  * Ensure output buffer is cleaned
6 6
  */
7 7
 function wl_core_send_json( $response ) {
8
-	if ( ob_get_contents() ) {
9
-		ob_clean();
10
-	}
8
+    if ( ob_get_contents() ) {
9
+        ob_clean();
10
+    }
11 11
 
12
-	return wp_send_json( $response );
12
+    return wp_send_json( $response );
13 13
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,10 +4,10 @@
 block discarded – undo
4 4
  * @see https://codex.wordpress.org/Function_Reference/wp_send_json
5 5
  * Ensure output buffer is cleaned
6 6
  */
7
-function wl_core_send_json( $response ) {
8
-	if ( ob_get_contents() ) {
7
+function wl_core_send_json($response) {
8
+	if (ob_get_contents()) {
9 9
 		ob_clean();
10 10
 	}
11 11
 
12
-	return wp_send_json( $response );
12
+	return wp_send_json($response);
13 13
 }
Please login to merge, or discard this patch.
src/modules/core/wordlift_core_install.php 2 patches
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -22,66 +22,66 @@  discard block
 block discarded – undo
22 22
 		'creative-work' => array(
23 23
 			'label'       => 'CreativeWork',
24 24
 			'description' => 'A creative work (or a Music Album).',
25
-			'parents'     => array( 'thing' ), // give term slug as parent
25
+			'parents'     => array('thing'), // give term slug as parent
26 26
 		),
27 27
 		'event'         => array(
28 28
 			'label'       => 'Event',
29 29
 			'description' => 'An event.',
30
-			'parents'     => array( 'thing' ),
30
+			'parents'     => array('thing'),
31 31
 		),
32 32
 		'organization'  => array(
33 33
 			'label'       => 'Organization',
34 34
 			'description' => 'An organization, including a government or a newspaper.',
35
-			'parents'     => array( 'thing' ),
35
+			'parents'     => array('thing'),
36 36
 		),
37 37
 		'person'        => array(
38 38
 			'label'       => 'Person',
39 39
 			'description' => 'A person (or a music artist).',
40
-			'parents'     => array( 'thing' ),
40
+			'parents'     => array('thing'),
41 41
 		),
42 42
 		'place'         => array(
43 43
 			'label'       => 'Place',
44 44
 			'description' => 'A place.',
45
-			'parents'     => array( 'thing' ),
45
+			'parents'     => array('thing'),
46 46
 		),
47 47
 		'localbusiness' => array(
48 48
 			'label'       => 'LocalBusiness',
49 49
 			'description' => 'A local business.',
50
-			'parents'     => array( 'place', 'organization' ),
50
+			'parents'     => array('place', 'organization'),
51 51
 		),
52 52
 	);
53 53
 
54
-	foreach ( $terms as $slug => $term ) {
54
+	foreach ($terms as $slug => $term) {
55 55
 
56 56
 		// Create the term if it does not exist, then get its ID
57
-		$term_id = term_exists( $slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
57
+		$term_id = term_exists($slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME);
58 58
 
59
-		if ( $term_id == 0 || is_null( $term_id ) ) {
60
-			$result = wp_insert_term( $slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
59
+		if ($term_id == 0 || is_null($term_id)) {
60
+			$result = wp_insert_term($slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME);
61 61
 		} else {
62 62
 			$term_id = $term_id['term_id'];
63
-			$result  = get_term( $term_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME, ARRAY_A );
63
+			$result  = get_term($term_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME, ARRAY_A);
64 64
 		}
65 65
 
66 66
 		// Check for errors.
67
-		if ( is_wp_error( $result ) ) {
68
-			wl_write_log( 'wl_install_entity_type_data [ ' . $result->get_error_message() . ' ]' );
67
+		if (is_wp_error($result)) {
68
+			wl_write_log('wl_install_entity_type_data [ '.$result->get_error_message().' ]');
69 69
 			continue;
70 70
 		}
71 71
 
72 72
 		// Check if 'parent' corresponds to an actual term and get its ID.
73
-		if ( ! isset( $term['parents'] ) ) {
73
+		if ( ! isset($term['parents'])) {
74 74
 			$term['parents'] = array();
75 75
 		}
76 76
 
77 77
 		$parent_ids = array();
78
-		foreach ( $term['parents'] as $parent_slug ) {
79
-			$parent_id    = get_term_by( 'slug', $parent_slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
80
-			$parent_ids[] = intval( $parent_id->term_id );  // Note: int casting is suggested by Codex: http://codex.wordpress.org/Function_Reference/get_term_by
78
+		foreach ($term['parents'] as $parent_slug) {
79
+			$parent_id    = get_term_by('slug', $parent_slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME);
80
+			$parent_ids[] = intval($parent_id->term_id); // Note: int casting is suggested by Codex: http://codex.wordpress.org/Function_Reference/get_term_by
81 81
 		}
82 82
 
83 83
 		// Define a parent in the WP taxonomy style (not important for WL)
84
-		if ( empty( $parent_ids ) ) {
84
+		if (empty($parent_ids)) {
85 85
 			// No parent
86 86
 			$parent_id = 0;
87 87
 		} else {
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
 		}
91 91
 
92 92
 		// Update term with description, slug and parent
93
-		wp_update_term( $result['term_id'], Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME, array(
93
+		wp_update_term($result['term_id'], Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME, array(
94 94
 			'name'        => $term['label'],
95 95
 			'slug'        => $slug,
96 96
 			'description' => $term['description'],
97 97
 			'parent'      => $parent_id   // We give to WP taxonomy just one parent. TODO: see if can give more than one
98
-		) );
98
+		));
99 99
 
100 100
 	}
101 101
 
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
 
109 109
 	global $wpdb;
110 110
 	// global $wl_db_version;
111
-	$installed_version = get_option( "wl_db_version" );
111
+	$installed_version = get_option("wl_db_version");
112 112
 
113
-	if ( $installed_version != WL_DB_VERSION ) {
114
-		$table_name      = $wpdb->prefix . WL_DB_RELATION_INSTANCES_TABLE_NAME;
113
+	if ($installed_version != WL_DB_VERSION) {
114
+		$table_name      = $wpdb->prefix.WL_DB_RELATION_INSTANCES_TABLE_NAME;
115 115
 		$charset_collate = $wpdb->get_charset_collate();
116 116
 
117 117
 		// Sql statement for the relation instances custom table
@@ -128,12 +128,12 @@  discard block
 block discarded – undo
128 128
 EOF;
129 129
 
130 130
 		// @see: https://codex.wordpress.org/Creating_Tables_with_Plugins
131
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
132
-		$results = dbDelta( $sql );
131
+		require_once(ABSPATH.'wp-admin/includes/upgrade.php');
132
+		$results = dbDelta($sql);
133 133
 
134
-		wl_write_log( $results );
134
+		wl_write_log($results);
135 135
 
136
-		update_option( "wl_db_version", WL_DB_VERSION );
136
+		update_option("wl_db_version", WL_DB_VERSION);
137 137
 	}
138 138
 }
139 139
 
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 
145 145
 	// Create a blank application key if there is none
146 146
 	$key = wl_configuration_get_key();
147
-	if ( empty( $key ) ) {
148
-		wl_configuration_set_key( '' );
147
+	if (empty($key)) {
148
+		wl_configuration_set_key('');
149 149
 	}
150 150
 
151 151
 	wl_core_install_entity_type_data();
@@ -153,13 +153,13 @@  discard block
 block discarded – undo
153 153
 }
154 154
 
155 155
 // Installation Hook
156
-add_action( 'activate_wordlift/wordlift.php', 'wl_core_install' );
156
+add_action('activate_wordlift/wordlift.php', 'wl_core_install');
157 157
 
158 158
 // Check db status on automated plugins updates
159 159
 function wl_core_update_db_check() {
160
-	if ( get_site_option( 'wl_db_version' ) != WL_DB_VERSION ) {
160
+	if (get_site_option('wl_db_version') != WL_DB_VERSION) {
161 161
 		wl_core_install_create_relation_instance_table();
162 162
 	}
163 163
 }
164 164
 
165
-add_action( 'plugins_loaded', 'wl_core_update_db_check' );
165
+add_action('plugins_loaded', 'wl_core_update_db_check');
Please login to merge, or discard this patch.
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -5,103 +5,103 @@  discard block
 block discarded – undo
5 5
  */
6 6
 function wl_core_install_entity_type_data() {
7 7
 
8
-	// global $wl_logger;
9
-	// $wl_logger->trace( 'Installing entity type data...' );
8
+    // global $wl_logger;
9
+    // $wl_logger->trace( 'Installing entity type data...' );
10 10
 
11
-	// Ensure the custom type and the taxonomy are registered.
11
+    // Ensure the custom type and the taxonomy are registered.
12 12
 //	wl_entity_type_register();
13
-	Wordlift_Entity_Post_Type_Service::get_instance()->register();
14
-
15
-	wl_entity_type_taxonomy_register();
16
-	// Ensure the custom taxonomy for dbpedia topics is registered
17
-	Wordlift_Topic_Taxonomy_Service::get_instance()->init();
18
-
19
-	// Set the taxonomy data.
20
-	// Note: parent types must be defined before child types.
21
-	$terms = array(
22
-		'thing'         => array(
23
-			'label'       => 'Thing',
24
-			'description' => 'A generic thing (something that doesn\'t fit in the previous definitions.',
25
-		),
26
-		'creative-work' => array(
27
-			'label'       => 'CreativeWork',
28
-			'description' => 'A creative work (or a Music Album).',
29
-			'parents'     => array( 'thing' ), // give term slug as parent
30
-		),
31
-		'event'         => array(
32
-			'label'       => 'Event',
33
-			'description' => 'An event.',
34
-			'parents'     => array( 'thing' ),
35
-		),
36
-		'organization'  => array(
37
-			'label'       => 'Organization',
38
-			'description' => 'An organization, including a government or a newspaper.',
39
-			'parents'     => array( 'thing' ),
40
-		),
41
-		'person'        => array(
42
-			'label'       => 'Person',
43
-			'description' => 'A person (or a music artist).',
44
-			'parents'     => array( 'thing' ),
45
-		),
46
-		'place'         => array(
47
-			'label'       => 'Place',
48
-			'description' => 'A place.',
49
-			'parents'     => array( 'thing' ),
50
-		),
51
-		'localbusiness' => array(
52
-			'label'       => 'LocalBusiness',
53
-			'description' => 'A local business.',
54
-			'parents'     => array( 'place', 'organization' ),
55
-		),
56
-	);
57
-
58
-	foreach ( $terms as $slug => $term ) {
59
-
60
-		// Create the term if it does not exist, then get its ID
61
-		$term_id = term_exists( $slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
62
-
63
-		if ( $term_id == 0 || is_null( $term_id ) ) {
64
-			$result = wp_insert_term( $slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
65
-		} else {
66
-			$term_id = $term_id['term_id'];
67
-			$result  = get_term( $term_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME, ARRAY_A );
68
-		}
69
-
70
-		// Check for errors.
71
-		if ( is_wp_error( $result ) ) {
72
-			wl_write_log( 'wl_install_entity_type_data [ ' . $result->get_error_message() . ' ]' );
73
-			continue;
74
-		}
75
-
76
-		// Check if 'parent' corresponds to an actual term and get its ID.
77
-		if ( ! isset( $term['parents'] ) ) {
78
-			$term['parents'] = array();
79
-		}
80
-
81
-		$parent_ids = array();
82
-		foreach ( $term['parents'] as $parent_slug ) {
83
-			$parent_id    = get_term_by( 'slug', $parent_slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
84
-			$parent_ids[] = intval( $parent_id->term_id );  // Note: int casting is suggested by Codex: http://codex.wordpress.org/Function_Reference/get_term_by
85
-		}
86
-
87
-		// Define a parent in the WP taxonomy style (not important for WL)
88
-		if ( empty( $parent_ids ) ) {
89
-			// No parent
90
-			$parent_id = 0;
91
-		} else {
92
-			// Get first parent
93
-			$parent_id = $parent_ids[0];
94
-		}
95
-
96
-		// Update term with description, slug and parent
97
-		wp_update_term( $result['term_id'], Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME, array(
98
-			'name'        => $term['label'],
99
-			'slug'        => $slug,
100
-			'description' => $term['description'],
101
-			'parent'      => $parent_id   // We give to WP taxonomy just one parent. TODO: see if can give more than one
102
-		) );
103
-
104
-	}
13
+    Wordlift_Entity_Post_Type_Service::get_instance()->register();
14
+
15
+    wl_entity_type_taxonomy_register();
16
+    // Ensure the custom taxonomy for dbpedia topics is registered
17
+    Wordlift_Topic_Taxonomy_Service::get_instance()->init();
18
+
19
+    // Set the taxonomy data.
20
+    // Note: parent types must be defined before child types.
21
+    $terms = array(
22
+        'thing'         => array(
23
+            'label'       => 'Thing',
24
+            'description' => 'A generic thing (something that doesn\'t fit in the previous definitions.',
25
+        ),
26
+        'creative-work' => array(
27
+            'label'       => 'CreativeWork',
28
+            'description' => 'A creative work (or a Music Album).',
29
+            'parents'     => array( 'thing' ), // give term slug as parent
30
+        ),
31
+        'event'         => array(
32
+            'label'       => 'Event',
33
+            'description' => 'An event.',
34
+            'parents'     => array( 'thing' ),
35
+        ),
36
+        'organization'  => array(
37
+            'label'       => 'Organization',
38
+            'description' => 'An organization, including a government or a newspaper.',
39
+            'parents'     => array( 'thing' ),
40
+        ),
41
+        'person'        => array(
42
+            'label'       => 'Person',
43
+            'description' => 'A person (or a music artist).',
44
+            'parents'     => array( 'thing' ),
45
+        ),
46
+        'place'         => array(
47
+            'label'       => 'Place',
48
+            'description' => 'A place.',
49
+            'parents'     => array( 'thing' ),
50
+        ),
51
+        'localbusiness' => array(
52
+            'label'       => 'LocalBusiness',
53
+            'description' => 'A local business.',
54
+            'parents'     => array( 'place', 'organization' ),
55
+        ),
56
+    );
57
+
58
+    foreach ( $terms as $slug => $term ) {
59
+
60
+        // Create the term if it does not exist, then get its ID
61
+        $term_id = term_exists( $slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
62
+
63
+        if ( $term_id == 0 || is_null( $term_id ) ) {
64
+            $result = wp_insert_term( $slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
65
+        } else {
66
+            $term_id = $term_id['term_id'];
67
+            $result  = get_term( $term_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME, ARRAY_A );
68
+        }
69
+
70
+        // Check for errors.
71
+        if ( is_wp_error( $result ) ) {
72
+            wl_write_log( 'wl_install_entity_type_data [ ' . $result->get_error_message() . ' ]' );
73
+            continue;
74
+        }
75
+
76
+        // Check if 'parent' corresponds to an actual term and get its ID.
77
+        if ( ! isset( $term['parents'] ) ) {
78
+            $term['parents'] = array();
79
+        }
80
+
81
+        $parent_ids = array();
82
+        foreach ( $term['parents'] as $parent_slug ) {
83
+            $parent_id    = get_term_by( 'slug', $parent_slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
84
+            $parent_ids[] = intval( $parent_id->term_id );  // Note: int casting is suggested by Codex: http://codex.wordpress.org/Function_Reference/get_term_by
85
+        }
86
+
87
+        // Define a parent in the WP taxonomy style (not important for WL)
88
+        if ( empty( $parent_ids ) ) {
89
+            // No parent
90
+            $parent_id = 0;
91
+        } else {
92
+            // Get first parent
93
+            $parent_id = $parent_ids[0];
94
+        }
95
+
96
+        // Update term with description, slug and parent
97
+        wp_update_term( $result['term_id'], Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME, array(
98
+            'name'        => $term['label'],
99
+            'slug'        => $slug,
100
+            'description' => $term['description'],
101
+            'parent'      => $parent_id   // We give to WP taxonomy just one parent. TODO: see if can give more than one
102
+        ) );
103
+
104
+    }
105 105
 
106 106
 }
107 107
 
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
  */
111 111
 function wl_core_install_create_relation_instance_table() {
112 112
 
113
-	global $wpdb;
114
-	// global $wl_db_version;
115
-	$installed_version = get_option( "wl_db_version" );
113
+    global $wpdb;
114
+    // global $wl_db_version;
115
+    $installed_version = get_option( "wl_db_version" );
116 116
 
117
-	if ( $installed_version != WL_DB_VERSION ) {
118
-		$table_name      = $wpdb->prefix . WL_DB_RELATION_INSTANCES_TABLE_NAME;
119
-		$charset_collate = $wpdb->get_charset_collate();
117
+    if ( $installed_version != WL_DB_VERSION ) {
118
+        $table_name      = $wpdb->prefix . WL_DB_RELATION_INSTANCES_TABLE_NAME;
119
+        $charset_collate = $wpdb->get_charset_collate();
120 120
 
121
-		// Sql statement for the relation instances custom table
122
-		$sql = <<<EOF
121
+        // Sql statement for the relation instances custom table
122
+        $sql = <<<EOF
123 123
 			CREATE TABLE $table_name (
124 124
   				id int(11) NOT NULL AUTO_INCREMENT,
125 125
   				subject_id int(11) NOT NULL,
@@ -131,14 +131,14 @@  discard block
 block discarded – undo
131 131
 			) $charset_collate;
132 132
 EOF;
133 133
 
134
-		// @see: https://codex.wordpress.org/Creating_Tables_with_Plugins
135
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
136
-		$results = dbDelta( $sql );
134
+        // @see: https://codex.wordpress.org/Creating_Tables_with_Plugins
135
+        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
136
+        $results = dbDelta( $sql );
137 137
 
138
-		wl_write_log( $results );
138
+        wl_write_log( $results );
139 139
 
140
-		update_option( "wl_db_version", WL_DB_VERSION );
141
-	}
140
+        update_option( "wl_db_version", WL_DB_VERSION );
141
+    }
142 142
 }
143 143
 
144 144
 /**
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
  */
147 147
 function wl_core_install() {
148 148
 
149
-	// Create a blank application key if there is none
150
-	$key = wl_configuration_get_key();
151
-	if ( empty( $key ) ) {
152
-		wl_configuration_set_key( '' );
153
-	}
149
+    // Create a blank application key if there is none
150
+    $key = wl_configuration_get_key();
151
+    if ( empty( $key ) ) {
152
+        wl_configuration_set_key( '' );
153
+    }
154 154
 
155
-	wl_core_install_entity_type_data();
156
-	wl_core_install_create_relation_instance_table();
157
-	flush_rewrite_rules();
155
+    wl_core_install_entity_type_data();
156
+    wl_core_install_create_relation_instance_table();
157
+    flush_rewrite_rules();
158 158
 }
159 159
 
160 160
 // Installation Hook
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
 
163 163
 // Check db status on automated plugins updates
164 164
 function wl_core_update_db_check() {
165
-	if ( get_site_option( 'wl_db_version' ) != WL_DB_VERSION ) {
166
-		wl_core_install_create_relation_instance_table();
167
-	}
165
+    if ( get_site_option( 'wl_db_version' ) != WL_DB_VERSION ) {
166
+        wl_core_install_create_relation_instance_table();
167
+    }
168 168
 }
169 169
 
170 170
 add_action( 'plugins_loaded', 'wl_core_update_db_check' );
Please login to merge, or discard this patch.
src/modules/freebase_image_proxy/wordlift_freebase_image_proxy.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -7,30 +7,30 @@
 block discarded – undo
7 7
  */
8 8
 function wl_freebase_image_proxy() {
9 9
 
10
-	// get the url.
11
-	$url = $_GET['url'];
12
-
13
-	$matches = array();
14
-	if ( 1 === preg_match( '/http:\/\/rdf.freebase.com\/ns\/(\w)\.([\w|\d]+)/i', $url, $matches ) ) {
15
-		$prefix    = $matches[1];
16
-		$path      = $matches[2];
17
-		$image_url = "https://usercontent.googleapis.com/freebase/v1/image/$prefix/$path";
18
-		$response  = wp_remote_get( $image_url );
19
-
20
-		if ( is_wp_error( $response ) ) {
21
-			die( 'An error occurred.' );
22
-		}
23
-
24
-		// dump out the image.
25
-		$content_type = $response['headers']['content-type'];
26
-		header( "Content-Type: $content_type" );
27
-		echo( $response['body'] );
28
-
29
-	} else {
30
-		die( 'Invalid URL' );
31
-	}
32
-
33
-	die(); // this is required to return a proper result
10
+    // get the url.
11
+    $url = $_GET['url'];
12
+
13
+    $matches = array();
14
+    if ( 1 === preg_match( '/http:\/\/rdf.freebase.com\/ns\/(\w)\.([\w|\d]+)/i', $url, $matches ) ) {
15
+        $prefix    = $matches[1];
16
+        $path      = $matches[2];
17
+        $image_url = "https://usercontent.googleapis.com/freebase/v1/image/$prefix/$path";
18
+        $response  = wp_remote_get( $image_url );
19
+
20
+        if ( is_wp_error( $response ) ) {
21
+            die( 'An error occurred.' );
22
+        }
23
+
24
+        // dump out the image.
25
+        $content_type = $response['headers']['content-type'];
26
+        header( "Content-Type: $content_type" );
27
+        echo( $response['body'] );
28
+
29
+    } else {
30
+        die( 'Invalid URL' );
31
+    }
32
+
33
+    die(); // this is required to return a proper result
34 34
 }
35 35
 
36 36
 add_action( 'wp_ajax_wordlift_freebase_image', 'wl_freebase_image_proxy' );
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,26 +11,26 @@
 block discarded – undo
11 11
 	$url = $_GET['url'];
12 12
 
13 13
 	$matches = array();
14
-	if ( 1 === preg_match( '/http:\/\/rdf.freebase.com\/ns\/(\w)\.([\w|\d]+)/i', $url, $matches ) ) {
14
+	if (1 === preg_match('/http:\/\/rdf.freebase.com\/ns\/(\w)\.([\w|\d]+)/i', $url, $matches)) {
15 15
 		$prefix    = $matches[1];
16 16
 		$path      = $matches[2];
17 17
 		$image_url = "https://usercontent.googleapis.com/freebase/v1/image/$prefix/$path";
18
-		$response  = wp_remote_get( $image_url );
18
+		$response  = wp_remote_get($image_url);
19 19
 
20
-		if ( is_wp_error( $response ) ) {
21
-			die( 'An error occurred.' );
20
+		if (is_wp_error($response)) {
21
+			die('An error occurred.');
22 22
 		}
23 23
 
24 24
 		// dump out the image.
25 25
 		$content_type = $response['headers']['content-type'];
26
-		header( "Content-Type: $content_type" );
27
-		echo( $response['body'] );
26
+		header("Content-Type: $content_type");
27
+		echo($response['body']);
28 28
 
29 29
 	} else {
30
-		die( 'Invalid URL' );
30
+		die('Invalid URL');
31 31
 	}
32 32
 
33 33
 	die(); // this is required to return a proper result
34 34
 }
35 35
 
36
-add_action( 'wp_ajax_wordlift_freebase_image', 'wl_freebase_image_proxy' );
36
+add_action('wp_ajax_wordlift_freebase_image', 'wl_freebase_image_proxy');
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
@@ -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
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -11,70 +11,70 @@
 block discarded – undo
11 11
  */
12 12
 function wl_save_image( $url ) {
13 13
 
14
-	$parts = parse_url( $url );
15
-	$path  = $parts['path'];
14
+    $parts = parse_url( $url );
15
+    $path  = $parts['path'];
16 16
 
17
-	// Get the bare filename (filename w/o the extension).
18
-	// Sanitize filename before saving the current image as attachment
19
-	// See https://codex.wordpress.org/Function_Reference/sanitize_file_name
20
-	$basename = sanitize_file_name( pathinfo( $path, PATHINFO_FILENAME ) . '-' . uniqid( date( 'YmdH-' ) ) );
17
+    // Get the bare filename (filename w/o the extension).
18
+    // Sanitize filename before saving the current image as attachment
19
+    // See https://codex.wordpress.org/Function_Reference/sanitize_file_name
20
+    $basename = sanitize_file_name( pathinfo( $path, PATHINFO_FILENAME ) . '-' . uniqid( date( 'YmdH-' ) ) );
21 21
 
22
-	// Chunk the bare name to get a subpath.
23
-	$chunks = chunk_split( strtolower( $basename ), 3, DIRECTORY_SEPARATOR );
22
+    // Chunk the bare name to get a subpath.
23
+    $chunks = chunk_split( strtolower( $basename ), 3, DIRECTORY_SEPARATOR );
24 24
 
25
-	// Get the base dir.
26
-	$wp_upload_dir = wp_upload_dir();
27
-	$base_dir      = $wp_upload_dir['basedir'];
28
-	$base_url      = $wp_upload_dir['baseurl'];
25
+    // Get the base dir.
26
+    $wp_upload_dir = wp_upload_dir();
27
+    $base_dir      = $wp_upload_dir['basedir'];
28
+    $base_url      = $wp_upload_dir['baseurl'];
29 29
 
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;
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;
34 34
 
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" );
39
-		}
40
-	};
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" );
39
+        }
40
+    };
41 41
 
42
-	// Request the remote file.
43
-	$response     = wp_remote_get( $url );
44
-	$content_type = wp_remote_retrieve_header( $response, 'content-type' );
42
+    // Request the remote file.
43
+    $response     = wp_remote_get( $url );
44
+    $content_type = wp_remote_retrieve_header( $response, 'content-type' );
45 45
 
46
-	switch ( $content_type ) {
47
-		case 'image/jpeg':
48
-		case 'image/jpg':
49
-			$extension = ".jpg";
50
-			break;
51
-		case 'image/svg+xml':
52
-			$extension = ".svg";
53
-			break;
54
-		case 'image/gif':
55
-			$extension = ".gif";
56
-			break;
57
-		case 'image/png':
58
-			$extension = ".png";
59
-			break;
60
-		default:
61
-			$extension = '';
62
-	}
46
+    switch ( $content_type ) {
47
+        case 'image/jpeg':
48
+        case 'image/jpg':
49
+            $extension = ".jpg";
50
+            break;
51
+        case 'image/svg+xml':
52
+            $extension = ".svg";
53
+            break;
54
+        case 'image/gif':
55
+            $extension = ".gif";
56
+            break;
57
+        case 'image/png':
58
+            $extension = ".png";
59
+            break;
60
+        default:
61
+            $extension = '';
62
+    }
63 63
 
64
-	// Complete the local filename.
65
-	$image_full_path .= $basename . $extension;
66
-	$image_full_url .= $basename . $extension;
64
+    // Complete the local filename.
65
+    $image_full_path .= $basename . $extension;
66
+    $image_full_url .= $basename . $extension;
67 67
 
68
-	// Store the data locally.
69
-	file_put_contents( $image_full_path, wp_remote_retrieve_body( $response ) );
68
+    // Store the data locally.
69
+    file_put_contents( $image_full_path, wp_remote_retrieve_body( $response ) );
70 70
 
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" );
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
 
73
-	// Return the path.
74
-	return array(
75
-		'path'         => $image_full_path,
76
-		'url'          => $image_full_url,
77
-		'content_type' => $content_type
78
-	);
73
+    // Return the path.
74
+    return array(
75
+        'path'         => $image_full_path,
76
+        'url'          => $image_full_url,
77
+        'content_type' => $content_type
78
+    );
79 79
 }
80 80
 
Please login to merge, or discard this patch.
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.
src/modules/prefixes/class-wl-prefixes-list-table.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
  * This file contains the Prefixes List table.
4 4
  */
5 5
 
6
-if( ! class_exists( 'WP_List_Table' ) ) {
7
-    require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
6
+if ( ! class_exists('WP_List_Table')) {
7
+    require_once(ABSPATH.'wp-admin/includes/class-wp-list-table.php');
8 8
 }
9 9
 
10 10
 /**
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
     var $_column_headers;
19 19
 
20
-    function get_columns(){
20
+    function get_columns() {
21 21
         $columns = array(
22 22
 //            'cb'        => '<input type="checkbox" />',
23 23
             'prefix'    => 'Prefix',
@@ -30,31 +30,31 @@  discard block
 block discarded – undo
30 30
         $columns  = $this->get_columns();
31 31
         $hidden   = array();
32 32
         $sortable = $this->get_sortable_columns();
33
-        $this->_column_headers = array( $columns, $hidden, $sortable );
33
+        $this->_column_headers = array($columns, $hidden, $sortable);
34 34
 
35 35
         $prefixes = wl_prefixes_list();
36
-        usort( $prefixes, array( &$this, 'usort_reorder' ) );
36
+        usort($prefixes, array(&$this, 'usort_reorder'));
37 37
         $this->items = $prefixes;
38 38
 
39 39
     }
40 40
 
41
-    function column_default( $item, $column_name ) {
42
-        switch( $column_name ) {
41
+    function column_default($item, $column_name) {
42
+        switch ($column_name) {
43 43
             case 'prefix':
44 44
             case 'namespace':
45
-                return $item[ $column_name ];
45
+                return $item[$column_name];
46 46
             default:
47
-                return print_r( $item, true ) ; //Show the whole array for troubleshooting purposes
47
+                return print_r($item, true); //Show the whole array for troubleshooting purposes
48 48
         }
49 49
     }
50 50
 
51
-    function column_prefix( $item ) {
51
+    function column_prefix($item) {
52 52
         $actions = array(
53 53
 //            'edit'   => sprintf( '<a href="?page=%s&action=%s&prefix=%s">Edit</a>', $_REQUEST['page'], 'edit', $item['prefix'] ),
54
-            'delete' => sprintf( '<a href="?page=%s&action=%s&prefix=%s">Delete</a>', $_REQUEST['page'], 'delete', $item['prefix'] )
54
+            'delete' => sprintf('<a href="?page=%s&action=%s&prefix=%s">Delete</a>', $_REQUEST['page'], 'delete', $item['prefix'])
55 55
         );
56 56
 
57
-        return sprintf( '%1$s %2$s', $item['prefix'], $this->row_actions($actions) );
57
+        return sprintf('%1$s %2$s', $item['prefix'], $this->row_actions($actions));
58 58
     }
59 59
 
60 60
 
@@ -67,21 +67,21 @@  discard block
 block discarded – undo
67 67
 
68 68
     function get_sortable_columns() {
69 69
         $sortable_columns = array(
70
-            'prefix'    => array('prefix',false),
71
-            'namespace' => array('namespace',false)
70
+            'prefix'    => array('prefix', false),
71
+            'namespace' => array('namespace', false)
72 72
         );
73 73
         return $sortable_columns;
74 74
     }
75 75
 
76
-    function usort_reorder( $a, $b ) {
76
+    function usort_reorder($a, $b) {
77 77
         // If no sort, default to title
78
-        $orderby = ( ! empty( $_GET['orderby'] ) ) ? $_GET['orderby'] : 'prefix';
78
+        $orderby = ( ! empty($_GET['orderby'])) ? $_GET['orderby'] : 'prefix';
79 79
         // If no order, default to asc
80
-        $order = ( ! empty($_GET['order'] ) ) ? $_GET['order'] : 'asc';
80
+        $order = ( ! empty($_GET['order'])) ? $_GET['order'] : 'asc';
81 81
         // Determine sort order
82
-        $result = strcmp( $a[$orderby], $b[$orderby] );
82
+        $result = strcmp($a[$orderby], $b[$orderby]);
83 83
         // Send final sort direction to usort
84
-        return ( $order === 'asc' ) ? $result : -$result;
84
+        return ($order === 'asc') ? $result : -$result;
85 85
     }
86 86
 
87 87
     function get_bulk_actions() {
Please login to merge, or discard this patch.
src/modules/prefixes/prefixes.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -7,50 +7,50 @@  discard block
 block discarded – undo
7 7
 
8 8
 if ( class_exists( 'SU_Module' ) ) {
9 9
 
10
-	class SU_Prefixes extends SU_Module {
11
-		static function get_module_title() {
12
-			return __( 'Prefixes', 'wordlift' );
13
-		}
10
+    class SU_Prefixes extends SU_Module {
11
+        static function get_module_title() {
12
+            return __( 'Prefixes', 'wordlift' );
13
+        }
14 14
 
15
-		static function get_menu_title() {
16
-			return __( 'Prefixes', 'wordlift' );
17
-		}
15
+        static function get_menu_title() {
16
+            return __( 'Prefixes', 'wordlift' );
17
+        }
18 18
 
19
-		/**
20
-		 * This method is called to display the admin page inside of SEO Ultimate.
21
-		 *
22
-		 * @since 3.0.0
23
-		 *
24
-		 * @uses wl_prefixes_admin_menu_callback() to display the admin page.
25
-		 */
26
-		function admin_page_contents() {
19
+        /**
20
+         * This method is called to display the admin page inside of SEO Ultimate.
21
+         *
22
+         * @since 3.0.0
23
+         *
24
+         * @uses wl_prefixes_admin_menu_callback() to display the admin page.
25
+         */
26
+        function admin_page_contents() {
27 27
 
28
-			if ($this->should_show_sdf_theme_promo()) {
29
-				echo "\n\n<div class='row'>\n";
30
-				echo "\n\n<div class='col-sm-8 col-md-9'>\n";
31
-			}
28
+            if ($this->should_show_sdf_theme_promo()) {
29
+                echo "\n\n<div class='row'>\n";
30
+                echo "\n\n<div class='col-sm-8 col-md-9'>\n";
31
+            }
32 32
 
33
-			wl_prefixes_admin_menu_callback( false );
33
+            wl_prefixes_admin_menu_callback( false );
34 34
 
35
-			if ($this->should_show_sdf_theme_promo()) {
36
-				echo "\n\n</div>\n";
37
-				echo "\n\n<div class='col-sm-4 col-md-3'>\n";
38
-				$this->promo_sdf_banners();
39
-				echo "\n\n</div>\n";
40
-				echo "\n\n</div>\n";
41
-			}
35
+            if ($this->should_show_sdf_theme_promo()) {
36
+                echo "\n\n</div>\n";
37
+                echo "\n\n<div class='col-sm-4 col-md-3'>\n";
38
+                $this->promo_sdf_banners();
39
+                echo "\n\n</div>\n";
40
+                echo "\n\n</div>\n";
41
+            }
42 42
 
43
-		}
43
+        }
44 44
 
45
-		function add_help_tabs( $screen ) {
45
+        function add_help_tabs( $screen ) {
46 46
 
47
-			// TODO: write some help text here.
48
-			$screen->add_help_tab( array(
49
-				'id'      => 'wl-prefixes-overview'
50
-			,
51
-				'title'   => __( 'Overview', 'seo-ultimate' )
52
-			,
53
-				'content' => __( "
47
+            // TODO: write some help text here.
48
+            $screen->add_help_tab( array(
49
+                'id'      => 'wl-prefixes-overview'
50
+            ,
51
+                'title'   => __( 'Overview', 'seo-ultimate' )
52
+            ,
53
+                'content' => __( "
54 54
 <ul>
55 55
 	<li><strong>What it does:</strong> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</li>
56 56
 	<li><strong>Why it helps:</strong> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</li>
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
 
60 60
 <p>If there are no 404 errors in the log, this is good and means there's no action required on your part.</p>
61 61
 ", 'seo-ultimate' )
62
-			) );
62
+            ) );
63 63
 
64
-		}
65
-	}
64
+        }
65
+    }
66 66
 
67 67
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,15 +5,15 @@  discard block
 block discarded – undo
5 5
  * @since 3.0.0
6 6
  */
7 7
 
8
-if ( class_exists( 'SU_Module' ) ) {
8
+if (class_exists('SU_Module')) {
9 9
 
10 10
 	class SU_Prefixes extends SU_Module {
11 11
 		static function get_module_title() {
12
-			return __( 'Prefixes', 'wordlift' );
12
+			return __('Prefixes', 'wordlift');
13 13
 		}
14 14
 
15 15
 		static function get_menu_title() {
16
-			return __( 'Prefixes', 'wordlift' );
16
+			return __('Prefixes', 'wordlift');
17 17
 		}
18 18
 
19 19
 		/**
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 				echo "\n\n<div class='col-sm-8 col-md-9'>\n";
31 31
 			}
32 32
 
33
-			wl_prefixes_admin_menu_callback( false );
33
+			wl_prefixes_admin_menu_callback(false);
34 34
 
35 35
 			if ($this->should_show_sdf_theme_promo()) {
36 36
 				echo "\n\n</div>\n";
@@ -42,15 +42,15 @@  discard block
 block discarded – undo
42 42
 
43 43
 		}
44 44
 
45
-		function add_help_tabs( $screen ) {
45
+		function add_help_tabs($screen) {
46 46
 
47 47
 			// TODO: write some help text here.
48
-			$screen->add_help_tab( array(
48
+			$screen->add_help_tab(array(
49 49
 				'id'      => 'wl-prefixes-overview'
50 50
 			,
51
-				'title'   => __( 'Overview', 'seo-ultimate' )
51
+				'title'   => __('Overview', 'seo-ultimate')
52 52
 			,
53
-				'content' => __( "
53
+				'content' => __("
54 54
 <ul>
55 55
 	<li><strong>What it does:</strong> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</li>
56 56
 	<li><strong>Why it helps:</strong> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</li>
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 </ul>
59 59
 
60 60
 <p>If there are no 404 errors in the log, this is good and means there's no action required on your part.</p>
61
-", 'seo-ultimate' )
62
-			) );
61
+", 'seo-ultimate')
62
+			));
63 63
 
64 64
 		}
65 65
 	}
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/public/class-wordlift-public.php 2 patches
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -22,82 +22,82 @@
 block discarded – undo
22 22
  */
23 23
 class Wordlift_Public {
24 24
 
25
-	/**
26
-	 * The ID of this plugin.
27
-	 *
28
-	 * @since    1.0.0
29
-	 * @access   private
30
-	 * @var      string    $plugin_name    The ID of this plugin.
31
-	 */
32
-	private $plugin_name;
33
-
34
-	/**
35
-	 * The version of this plugin.
36
-	 *
37
-	 * @since    1.0.0
38
-	 * @access   private
39
-	 * @var      string    $version    The current version of this plugin.
40
-	 */
41
-	private $version;
42
-
43
-	/**
44
-	 * Initialize the class and set its properties.
45
-	 *
46
-	 * @since    1.0.0
47
-	 * @param      string    $plugin_name       The name of the plugin.
48
-	 * @param      string    $version    The version of this plugin.
49
-	 */
50
-	public function __construct( $plugin_name, $version ) {
51
-
52
-		$this->plugin_name = $plugin_name;
53
-		$this->version = $version;
54
-
55
-	}
56
-
57
-	/**
58
-	 * Register the stylesheets for the public-facing side of the site.
59
-	 *
60
-	 * @since    1.0.0
61
-	 */
62
-	public function enqueue_styles() {
63
-
64
-		/**
65
-		 * This function is provided for demonstration purposes only.
66
-		 *
67
-		 * An instance of this class should be passed to the run() function
68
-		 * defined in Wordlift_Loader as all of the hooks are defined
69
-		 * in that particular class.
70
-		 *
71
-		 * The Wordlift_Loader will then create the relationship
72
-		 * between the defined hooks and the functions defined in this
73
-		 * class.
74
-		 */
75
-
76
-		wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-public.css', array(), $this->version, 'all' );
77
-
78
-	}
79
-
80
-	/**
81
-	 * Register the stylesheets for the public-facing side of the site.
82
-	 *
83
-	 * @since    1.0.0
84
-	 */
85
-	public function enqueue_scripts() {
86
-
87
-		/**
88
-		 * This function is provided for demonstration purposes only.
89
-		 *
90
-		 * An instance of this class should be passed to the run() function
91
-		 * defined in Wordlift_Loader as all of the hooks are defined
92
-		 * in that particular class.
93
-		 *
94
-		 * The Wordlift_Loader will then create the relationship
95
-		 * between the defined hooks and the functions defined in this
96
-		 * class.
97
-		 */
98
-
99
-		wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wordlift-public.js', array( 'jquery' ), $this->version, false );
100
-
101
-	}
25
+    /**
26
+     * The ID of this plugin.
27
+     *
28
+     * @since    1.0.0
29
+     * @access   private
30
+     * @var      string    $plugin_name    The ID of this plugin.
31
+     */
32
+    private $plugin_name;
33
+
34
+    /**
35
+     * The version of this plugin.
36
+     *
37
+     * @since    1.0.0
38
+     * @access   private
39
+     * @var      string    $version    The current version of this plugin.
40
+     */
41
+    private $version;
42
+
43
+    /**
44
+     * Initialize the class and set its properties.
45
+     *
46
+     * @since    1.0.0
47
+     * @param      string    $plugin_name       The name of the plugin.
48
+     * @param      string    $version    The version of this plugin.
49
+     */
50
+    public function __construct( $plugin_name, $version ) {
51
+
52
+        $this->plugin_name = $plugin_name;
53
+        $this->version = $version;
54
+
55
+    }
56
+
57
+    /**
58
+     * Register the stylesheets for the public-facing side of the site.
59
+     *
60
+     * @since    1.0.0
61
+     */
62
+    public function enqueue_styles() {
63
+
64
+        /**
65
+         * This function is provided for demonstration purposes only.
66
+         *
67
+         * An instance of this class should be passed to the run() function
68
+         * defined in Wordlift_Loader as all of the hooks are defined
69
+         * in that particular class.
70
+         *
71
+         * The Wordlift_Loader will then create the relationship
72
+         * between the defined hooks and the functions defined in this
73
+         * class.
74
+         */
75
+
76
+        wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-public.css', array(), $this->version, 'all' );
77
+
78
+    }
79
+
80
+    /**
81
+     * Register the stylesheets for the public-facing side of the site.
82
+     *
83
+     * @since    1.0.0
84
+     */
85
+    public function enqueue_scripts() {
86
+
87
+        /**
88
+         * This function is provided for demonstration purposes only.
89
+         *
90
+         * An instance of this class should be passed to the run() function
91
+         * defined in Wordlift_Loader as all of the hooks are defined
92
+         * in that particular class.
93
+         *
94
+         * The Wordlift_Loader will then create the relationship
95
+         * between the defined hooks and the functions defined in this
96
+         * class.
97
+         */
98
+
99
+        wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wordlift-public.js', array( 'jquery' ), $this->version, false );
100
+
101
+    }
102 102
 
103 103
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * @param      string    $plugin_name       The name of the plugin.
48 48
 	 * @param      string    $version    The version of this plugin.
49 49
 	 */
50
-	public function __construct( $plugin_name, $version ) {
50
+	public function __construct($plugin_name, $version) {
51 51
 
52 52
 		$this->plugin_name = $plugin_name;
53 53
 		$this->version = $version;
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 		 * class.
74 74
 		 */
75 75
 
76
-		wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-public.css', array(), $this->version, 'all' );
76
+		wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__).'css/wordlift-public.css', array(), $this->version, 'all');
77 77
 
78 78
 	}
79 79
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		 * class.
97 97
 		 */
98 98
 
99
-		wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wordlift-public.js', array( 'jquery' ), $this->version, false );
99
+		wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__).'js/wordlift-public.js', array('jquery'), $this->version, false);
100 100
 
101 101
 	}
102 102
 
Please login to merge, or discard this patch.