Completed
Push — develop ( 12a3ed...636ab8 )
by David
03:47
created
src/admin/class-wordlift-admin-entity-taxonomy-list-page.php 2 patches
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 if ( ! defined( 'ABSPATH' ) ) {
16
-	exit;
16
+    exit;
17 17
 }
18 18
 
19 19
 /**
@@ -28,113 +28,113 @@  discard block
 block discarded – undo
28 28
  */
29 29
 class Wordlift_Admin_Entity_Taxonomy_List_Page {
30 30
 
31
-	/**
32
-	 * Hook to `wl_entity_type_row_actions` to add an "action" link to Thread
33
-	 * SEO related settings for the term.
34
-	 *
35
-	 * @see   https://developer.wordpress.org/reference/hooks/taxonomy_row_actions/
36
-	 *
37
-	 * @since 3.11.0
38
-	 *
39
-	 * @param array  $actions An array of action links to be displayed. Default
40
-	 *                        'Edit', 'Quick Edit', 'Delete', and 'View'.
41
-	 * @param object $term    Term object.
42
-	 *
43
-	 * @return array  $actions An array of action links to be displayed. Default
44
-	 *                        'Edit', 'Quick Edit', 'Delete', and 'View'.
45
-	 */
46
-	function wl_entity_type_row_actions( $actions, $term ) {
47
-
48
-		$url               = admin_url( "admin.php?page=wl_entity_type_settings&tag_ID=$term->term_id" );
49
-		$actions['wl-seo'] = '<a href="' . esc_url( $url ) . '">' . __( 'SEO Settings', 'wordlift' ) . '</a>';
50
-
51
-		// Hacks for pre 4.7 compatibility:
52
-		// * remove the quick edit.
53
-		unset( $actions['inline hide-if-no-js'] );
54
-		// * remove the edit link.
55
-		unset( $actions['edit'] );
56
-
57
-		return $actions;
58
-	}
59
-
60
-	/**
61
-	 * Override the capabilities related to managing the entity type terms
62
-	 * for multisite super admin to prevent it from manipulating it in any
63
-	 * way.
64
-	 *
65
-	 * @since 3.12.0
66
-	 *
67
-	 * @param array  $caps    The user's current capabilities.
68
-	 * @param string $cap     Capability name.
69
-	 * @param int    $user_id The user ID.
70
-	 * @param array  $args    Adds the context to the cap. Typically the object ID.
71
-	 *
72
-	 * @return array    Array containing the do_not_allow capability for super admin
73
-	 *                  when editing and deleting entity type terms capabilities
74
-	 *                    are being "approved"
75
-	 */
76
-	function restrict_super_admin( $caps, $cap, $user_id, $args ) {
77
-
78
-		switch ( $cap ) {
79
-			case 'wl_entity_type_edit_term':
80
-			case 'wl_entity_type_delete_term':
81
-				$caps[] = 'do_not_allow';
82
-		}
83
-
84
-		return $caps;
85
-	}
86
-
87
-	/**
88
-	 * Override the capabilities related to managing the entity type terms
89
-	 * required for WordPress < 4.7 to get access to the admin page.
90
-	 *
91
-	 * Before 4.7, WordPress checks whether the user has permission to access
92
-	 * the `edit-tags.php` page. So we need to provide temporary the permission
93
-	 * otherwise the user will get an `access not allowed` when trying to access
94
-	 * the page.
95
-	 *
96
-	 * @see   https://github.com/insideout10/wordlift-plugin/issues/512
97
-	 *
98
-	 * @since 3.12.0
99
-	 *
100
-	 * @param array  $caps    The user's current capabilities.
101
-	 * @param string $cap     Capability name.
102
-	 * @param int    $user_id The user ID.
103
-	 * @param array  $args    Adds the context to the cap. Typically the object ID.
104
-	 *
105
-	 * @return array    Array containing the manage_options capability
106
-	 */
107
-	function enable_admin_access_pre_47( $caps, $cap, $user_id, $args ) {
108
-
109
-		// Bail out if we're not dealing with the `wl_entity_type_edit_term`
110
-		// capability.
111
-		if ( 'wl_entity_type_edit_term' !== $cap ) {
112
-			return $caps;
113
-		}
114
-
115
-		$path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
116
-
117
-		// Bail out if the `path` cannot be determined.
118
-		if ( null === $path ) {
119
-			return $caps;
120
-		}
121
-
122
-		// Bail out if a specific term is being handled.
123
-		if ( isset( $_REQUEST['action'] ) ) {
124
-			return $caps;
125
-		}
126
-
127
-		// Split the path and check if the page is the `edit-tags.php`. We can't
128
-		// use WP's own function because this is called very early.
129
-		$components = explode( '/', $path );
130
-		if ( 'edit-tags.php' !== $components[ count( $components ) - 1 ] ) {
131
-			return $caps;
132
-		}
133
-
134
-		// Give permission to the user.
135
-		$mapped[] = 'manage_options';
136
-
137
-		return $mapped;
138
-	}
31
+    /**
32
+     * Hook to `wl_entity_type_row_actions` to add an "action" link to Thread
33
+     * SEO related settings for the term.
34
+     *
35
+     * @see   https://developer.wordpress.org/reference/hooks/taxonomy_row_actions/
36
+     *
37
+     * @since 3.11.0
38
+     *
39
+     * @param array  $actions An array of action links to be displayed. Default
40
+     *                        'Edit', 'Quick Edit', 'Delete', and 'View'.
41
+     * @param object $term    Term object.
42
+     *
43
+     * @return array  $actions An array of action links to be displayed. Default
44
+     *                        'Edit', 'Quick Edit', 'Delete', and 'View'.
45
+     */
46
+    function wl_entity_type_row_actions( $actions, $term ) {
47
+
48
+        $url               = admin_url( "admin.php?page=wl_entity_type_settings&tag_ID=$term->term_id" );
49
+        $actions['wl-seo'] = '<a href="' . esc_url( $url ) . '">' . __( 'SEO Settings', 'wordlift' ) . '</a>';
50
+
51
+        // Hacks for pre 4.7 compatibility:
52
+        // * remove the quick edit.
53
+        unset( $actions['inline hide-if-no-js'] );
54
+        // * remove the edit link.
55
+        unset( $actions['edit'] );
56
+
57
+        return $actions;
58
+    }
59
+
60
+    /**
61
+     * Override the capabilities related to managing the entity type terms
62
+     * for multisite super admin to prevent it from manipulating it in any
63
+     * way.
64
+     *
65
+     * @since 3.12.0
66
+     *
67
+     * @param array  $caps    The user's current capabilities.
68
+     * @param string $cap     Capability name.
69
+     * @param int    $user_id The user ID.
70
+     * @param array  $args    Adds the context to the cap. Typically the object ID.
71
+     *
72
+     * @return array    Array containing the do_not_allow capability for super admin
73
+     *                  when editing and deleting entity type terms capabilities
74
+     *                    are being "approved"
75
+     */
76
+    function restrict_super_admin( $caps, $cap, $user_id, $args ) {
77
+
78
+        switch ( $cap ) {
79
+            case 'wl_entity_type_edit_term':
80
+            case 'wl_entity_type_delete_term':
81
+                $caps[] = 'do_not_allow';
82
+        }
83
+
84
+        return $caps;
85
+    }
86
+
87
+    /**
88
+     * Override the capabilities related to managing the entity type terms
89
+     * required for WordPress < 4.7 to get access to the admin page.
90
+     *
91
+     * Before 4.7, WordPress checks whether the user has permission to access
92
+     * the `edit-tags.php` page. So we need to provide temporary the permission
93
+     * otherwise the user will get an `access not allowed` when trying to access
94
+     * the page.
95
+     *
96
+     * @see   https://github.com/insideout10/wordlift-plugin/issues/512
97
+     *
98
+     * @since 3.12.0
99
+     *
100
+     * @param array  $caps    The user's current capabilities.
101
+     * @param string $cap     Capability name.
102
+     * @param int    $user_id The user ID.
103
+     * @param array  $args    Adds the context to the cap. Typically the object ID.
104
+     *
105
+     * @return array    Array containing the manage_options capability
106
+     */
107
+    function enable_admin_access_pre_47( $caps, $cap, $user_id, $args ) {
108
+
109
+        // Bail out if we're not dealing with the `wl_entity_type_edit_term`
110
+        // capability.
111
+        if ( 'wl_entity_type_edit_term' !== $cap ) {
112
+            return $caps;
113
+        }
114
+
115
+        $path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
116
+
117
+        // Bail out if the `path` cannot be determined.
118
+        if ( null === $path ) {
119
+            return $caps;
120
+        }
121
+
122
+        // Bail out if a specific term is being handled.
123
+        if ( isset( $_REQUEST['action'] ) ) {
124
+            return $caps;
125
+        }
126
+
127
+        // Split the path and check if the page is the `edit-tags.php`. We can't
128
+        // use WP's own function because this is called very early.
129
+        $components = explode( '/', $path );
130
+        if ( 'edit-tags.php' !== $components[ count( $components ) - 1 ] ) {
131
+            return $caps;
132
+        }
133
+
134
+        // Give permission to the user.
135
+        $mapped[] = 'manage_options';
136
+
137
+        return $mapped;
138
+    }
139 139
 
140 140
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  * @since      3.11.0
13 13
  */
14 14
 
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 	 * @return array  $actions An array of action links to be displayed. Default
44 44
 	 *                        'Edit', 'Quick Edit', 'Delete', and 'View'.
45 45
 	 */
46
-	function wl_entity_type_row_actions( $actions, $term ) {
46
+	function wl_entity_type_row_actions($actions, $term) {
47 47
 
48
-		$url               = admin_url( "admin.php?page=wl_entity_type_settings&tag_ID=$term->term_id" );
49
-		$actions['wl-seo'] = '<a href="' . esc_url( $url ) . '">' . __( 'SEO Settings', 'wordlift' ) . '</a>';
48
+		$url               = admin_url("admin.php?page=wl_entity_type_settings&tag_ID=$term->term_id");
49
+		$actions['wl-seo'] = '<a href="'.esc_url($url).'">'.__('SEO Settings', 'wordlift').'</a>';
50 50
 
51 51
 		// Hacks for pre 4.7 compatibility:
52 52
 		// * remove the quick edit.
53
-		unset( $actions['inline hide-if-no-js'] );
53
+		unset($actions['inline hide-if-no-js']);
54 54
 		// * remove the edit link.
55
-		unset( $actions['edit'] );
55
+		unset($actions['edit']);
56 56
 
57 57
 		return $actions;
58 58
 	}
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
 	 *                  when editing and deleting entity type terms capabilities
74 74
 	 *                    are being "approved"
75 75
 	 */
76
-	function restrict_super_admin( $caps, $cap, $user_id, $args ) {
76
+	function restrict_super_admin($caps, $cap, $user_id, $args) {
77 77
 
78
-		switch ( $cap ) {
78
+		switch ($cap) {
79 79
 			case 'wl_entity_type_edit_term':
80 80
 			case 'wl_entity_type_delete_term':
81 81
 				$caps[] = 'do_not_allow';
@@ -104,30 +104,30 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @return array    Array containing the manage_options capability
106 106
 	 */
107
-	function enable_admin_access_pre_47( $caps, $cap, $user_id, $args ) {
107
+	function enable_admin_access_pre_47($caps, $cap, $user_id, $args) {
108 108
 
109 109
 		// Bail out if we're not dealing with the `wl_entity_type_edit_term`
110 110
 		// capability.
111
-		if ( 'wl_entity_type_edit_term' !== $cap ) {
111
+		if ('wl_entity_type_edit_term' !== $cap) {
112 112
 			return $caps;
113 113
 		}
114 114
 
115
-		$path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
115
+		$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
116 116
 
117 117
 		// Bail out if the `path` cannot be determined.
118
-		if ( null === $path ) {
118
+		if (null === $path) {
119 119
 			return $caps;
120 120
 		}
121 121
 
122 122
 		// Bail out if a specific term is being handled.
123
-		if ( isset( $_REQUEST['action'] ) ) {
123
+		if (isset($_REQUEST['action'])) {
124 124
 			return $caps;
125 125
 		}
126 126
 
127 127
 		// Split the path and check if the page is the `edit-tags.php`. We can't
128 128
 		// use WP's own function because this is called very early.
129
-		$components = explode( '/', $path );
130
-		if ( 'edit-tags.php' !== $components[ count( $components ) - 1 ] ) {
129
+		$components = explode('/', $path);
130
+		if ('edit-tags.php' !== $components[count($components) - 1]) {
131 131
 			return $caps;
132 132
 		}
133 133
 
Please login to merge, or discard this patch.
src/modules/prefixes/wordlift_prefixes.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -15,34 +15,34 @@
 block discarded – undo
15 15
  */
16 16
 function wl_prefixes_list() {
17 17
 
18
-	// If the parameter is false, default prefixes have never been installed.
19
-	if ( false === ( $prefixes = get_option( 'wl_option_prefixes' ) ) ) {
18
+    // If the parameter is false, default prefixes have never been installed.
19
+    if ( false === ( $prefixes = get_option( 'wl_option_prefixes' ) ) ) {
20 20
 
21
-		$prefixes = array(
22
-			array(
23
-				'prefix'    => 'geo',
24
-				'namespace' => 'http://www.w3.org/2003/01/geo/wgs84_pos#',
25
-			),
26
-			array(
27
-				'prefix'    => 'dct',
28
-				'namespace' => 'http://purl.org/dc/terms/',
29
-			),
30
-			array(
31
-				'prefix'    => 'rdfs',
32
-				'namespace' => 'http://www.w3.org/2000/01/rdf-schema#',
33
-			),
34
-			array(
35
-				'prefix'    => 'owl',
36
-				'namespace' => 'http://www.w3.org/2002/07/owl#',
37
-			),
38
-			array( 'prefix' => 'schema', 'namespace' => 'http://schema.org/' ),
39
-			array(
40
-				'prefix'    => 'xsd',
41
-				'namespace' => 'http://www.w3.org/2001/XMLSchema#',
42
-			),
43
-		);
44
-		add_option( 'wl_option_prefixes', $prefixes );
45
-	}
21
+        $prefixes = array(
22
+            array(
23
+                'prefix'    => 'geo',
24
+                'namespace' => 'http://www.w3.org/2003/01/geo/wgs84_pos#',
25
+            ),
26
+            array(
27
+                'prefix'    => 'dct',
28
+                'namespace' => 'http://purl.org/dc/terms/',
29
+            ),
30
+            array(
31
+                'prefix'    => 'rdfs',
32
+                'namespace' => 'http://www.w3.org/2000/01/rdf-schema#',
33
+            ),
34
+            array(
35
+                'prefix'    => 'owl',
36
+                'namespace' => 'http://www.w3.org/2002/07/owl#',
37
+            ),
38
+            array( 'prefix' => 'schema', 'namespace' => 'http://schema.org/' ),
39
+            array(
40
+                'prefix'    => 'xsd',
41
+                'namespace' => 'http://www.w3.org/2001/XMLSchema#',
42
+            ),
43
+        );
44
+        add_option( 'wl_option_prefixes', $prefixes );
45
+    }
46 46
 
47
-	return $prefixes;
47
+    return $prefixes;
48 48
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 function wl_prefixes_list() {
17 17
 
18 18
 	// If the parameter is false, default prefixes have never been installed.
19
-	if ( false === ( $prefixes = get_option( 'wl_option_prefixes' ) ) ) {
19
+	if (false === ($prefixes = get_option('wl_option_prefixes'))) {
20 20
 
21 21
 		$prefixes = array(
22 22
 			array(
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
 				'prefix'    => 'owl',
36 36
 				'namespace' => 'http://www.w3.org/2002/07/owl#',
37 37
 			),
38
-			array( 'prefix' => 'schema', 'namespace' => 'http://schema.org/' ),
38
+			array('prefix' => 'schema', 'namespace' => 'http://schema.org/'),
39 39
 			array(
40 40
 				'prefix'    => 'xsd',
41 41
 				'namespace' => 'http://www.w3.org/2001/XMLSchema#',
42 42
 			),
43 43
 		);
44
-		add_option( 'wl_option_prefixes', $prefixes );
44
+		add_option('wl_option_prefixes', $prefixes);
45 45
 	}
46 46
 
47 47
 	return $prefixes;
Please login to merge, or discard this patch.