Completed
Pull Request — develop (#1554)
by Naveen
48s
created
src/admin/partials/wordlift-admin-settings-match-terms-page.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,13 +3,13 @@
 block discarded – undo
3 3
 use Wordlift\Scripts\Scripts_Helper;
4 4
 
5 5
 Scripts_Helper::enqueue_based_on_wordpress_version(
6
-	'wl-vocabulary-match-terms-settings',
7
-	plugin_dir_url( dirname( __DIR__ )  ) . 'js/dist/vocabulary-settings-page',
8
-	array( 'react', 'react-dom', 'wp-polyfill' )
6
+    'wl-vocabulary-match-terms-settings',
7
+    plugin_dir_url( dirname( __DIR__ )  ) . 'js/dist/vocabulary-settings-page',
8
+    array( 'react', 'react-dom', 'wp-polyfill' )
9 9
 );
10 10
 
11 11
 
12 12
 wp_enqueue_style( 'wl-vocabulary-match-terms-settings',
13
-	plugin_dir_url( dirname( __DIR__ )  ) . 'js/dist/vocabulary-settings-page.full.css'
13
+    plugin_dir_url( dirname( __DIR__ )  ) . 'js/dist/vocabulary-settings-page.full.css'
14 14
 );
15 15
 echo "<br/><div id='wl_vocabulary_analysis_progress_bar'></div>";
16 16
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,12 +4,12 @@
 block discarded – undo
4 4
 
5 5
 Scripts_Helper::enqueue_based_on_wordpress_version(
6 6
 	'wl-vocabulary-match-terms-settings',
7
-	plugin_dir_url( dirname( __DIR__ )  ) . 'js/dist/vocabulary-settings-page',
8
-	array( 'react', 'react-dom', 'wp-polyfill' )
7
+	plugin_dir_url(dirname(__DIR__)).'js/dist/vocabulary-settings-page',
8
+	array('react', 'react-dom', 'wp-polyfill')
9 9
 );
10 10
 
11 11
 
12
-wp_enqueue_style( 'wl-vocabulary-match-terms-settings',
13
-	plugin_dir_url( dirname( __DIR__ )  ) . 'js/dist/vocabulary-settings-page.full.css'
12
+wp_enqueue_style('wl-vocabulary-match-terms-settings',
13
+	plugin_dir_url(dirname(__DIR__)).'js/dist/vocabulary-settings-page.full.css'
14 14
 );
15 15
 echo "<br/><div id='wl_vocabulary_analysis_progress_bar'></div>";
16 16
\ No newline at end of file
Please login to merge, or discard this patch.
src/wordlift/vocabulary/cache/class-options-cache.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -4,40 +4,40 @@
 block discarded – undo
4 4
 
5 5
 class Options_Cache implements Cache {
6 6
 
7
-	private $namespace;
7
+    private $namespace;
8 8
 
9
-	/**
10
-	 * Options_Cache constructor.
11
-	 *
12
-	 * @param $namespace
13
-	 */
14
-	public function __construct( $namespace ) {
15
-		$this->namespace = $namespace;
16
-	}
9
+    /**
10
+     * Options_Cache constructor.
11
+     *
12
+     * @param $namespace
13
+     */
14
+    public function __construct( $namespace ) {
15
+        $this->namespace = $namespace;
16
+    }
17 17
 
18 18
 
19
-	public function get( $cache_key ) {
19
+    public function get( $cache_key ) {
20 20
 
21
-		return get_option( $this->namespace . '__' . $cache_key, false );
21
+        return get_option( $this->namespace . '__' . $cache_key, false );
22 22
 
23
-	}
23
+    }
24 24
 
25 25
 
26
-	public function put( $cache_key, $value ) {
26
+    public function put( $cache_key, $value ) {
27 27
 
28
-		return update_option( $this->namespace . '__' . $cache_key, $value );
28
+        return update_option( $this->namespace . '__' . $cache_key, $value );
29 29
 
30
-	}
30
+    }
31 31
 
32
-	public function flush_all() {
33
-		if ( $this->namespace !== '' ) {
34
-			global $wpdb;
35
-			$options_table_name = $wpdb->options;
36
-			$namespace_esc = $wpdb->esc_like( $this->namespace ) . '__%';
37
-			$sql         = $wpdb->prepare( "DELETE FROM $options_table_name WHERE option_name LIKE %s", $namespace_esc );
38
-			$wpdb->query( $sql );
39
-		}
40
-	}
32
+    public function flush_all() {
33
+        if ( $this->namespace !== '' ) {
34
+            global $wpdb;
35
+            $options_table_name = $wpdb->options;
36
+            $namespace_esc = $wpdb->esc_like( $this->namespace ) . '__%';
37
+            $sql         = $wpdb->prepare( "DELETE FROM $options_table_name WHERE option_name LIKE %s", $namespace_esc );
38
+            $wpdb->query( $sql );
39
+        }
40
+    }
41 41
 
42 42
 
43 43
 }
44 44
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,31 +11,31 @@
 block discarded – undo
11 11
 	 *
12 12
 	 * @param $namespace
13 13
 	 */
14
-	public function __construct( $namespace ) {
14
+	public function __construct($namespace) {
15 15
 		$this->namespace = $namespace;
16 16
 	}
17 17
 
18 18
 
19
-	public function get( $cache_key ) {
19
+	public function get($cache_key) {
20 20
 
21
-		return get_option( $this->namespace . '__' . $cache_key, false );
21
+		return get_option($this->namespace.'__'.$cache_key, false);
22 22
 
23 23
 	}
24 24
 
25 25
 
26
-	public function put( $cache_key, $value ) {
26
+	public function put($cache_key, $value) {
27 27
 
28
-		return update_option( $this->namespace . '__' . $cache_key, $value );
28
+		return update_option($this->namespace.'__'.$cache_key, $value);
29 29
 
30 30
 	}
31 31
 
32 32
 	public function flush_all() {
33
-		if ( $this->namespace !== '' ) {
33
+		if ($this->namespace !== '') {
34 34
 			global $wpdb;
35 35
 			$options_table_name = $wpdb->options;
36
-			$namespace_esc = $wpdb->esc_like( $this->namespace ) . '__%';
37
-			$sql         = $wpdb->prepare( "DELETE FROM $options_table_name WHERE option_name LIKE %s", $namespace_esc );
38
-			$wpdb->query( $sql );
36
+			$namespace_esc = $wpdb->esc_like($this->namespace).'__%';
37
+			$sql = $wpdb->prepare("DELETE FROM $options_table_name WHERE option_name LIKE %s", $namespace_esc);
38
+			$wpdb->query($sql);
39 39
 		}
40 40
 	}
41 41
 
Please login to merge, or discard this patch.
src/wordlift/vocabulary/cache/class-cache.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,10 +4,10 @@
 block discarded – undo
4 4
 
5 5
 interface Cache {
6 6
 
7
-	public function get( $cache_key );
7
+    public function get( $cache_key );
8 8
 
9
-	public function put( $cache_key, $value );
9
+    public function put( $cache_key, $value );
10 10
 
11
-	public function flush_all();
11
+    public function flush_all();
12 12
 
13 13
 }
14 14
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@
 block discarded – undo
4 4
 
5 5
 interface Cache {
6 6
 
7
-	public function get( $cache_key );
7
+	public function get($cache_key);
8 8
 
9
-	public function put( $cache_key, $value );
9
+	public function put($cache_key, $value);
10 10
 
11 11
 	public function flush_all();
12 12
 
Please login to merge, or discard this patch.
src/wordlift/vocabulary/cache/class-cache-service-factory.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 
5 5
 class Cache_Service_Factory {
6 6
 
7
-	public static function get_cache_service() {
8
-		return new Options_Cache( "wordlift-cmkg" );
9
-	}
7
+    public static function get_cache_service() {
8
+        return new Options_Cache( "wordlift-cmkg" );
9
+    }
10 10
 
11 11
 }
12 12
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 class Cache_Service_Factory {
6 6
 
7 7
 	public static function get_cache_service() {
8
-		return new Options_Cache( "wordlift-cmkg" );
8
+		return new Options_Cache("wordlift-cmkg");
9 9
 	}
10 10
 
11 11
 }
12 12
\ No newline at end of file
Please login to merge, or discard this patch.
src/wordlift/vocabulary/data/entity-list/class-entity-list-utils.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @return array<array> An Array of entities with isActive filter.
20 20
 	 */
21
-	public static function mark_is_active_for_entities( $term_id, $entities ) {
21
+	public static function mark_is_active_for_entities($term_id, $entities) {
22 22
 
23
-		$active_entities = self::get_active_entities( $term_id );
23
+		$active_entities = self::get_active_entities($term_id);
24 24
 
25
-		if ( ! is_array( $entities ) ) {
25
+		if ( ! is_array($entities)) {
26 26
 			return $entities;
27 27
 		}
28 28
 
29
-		foreach ( $entities as &$entity ) {
29
+		foreach ($entities as &$entity) {
30 30
 			$entity_id          = $entity['entityId'];
31
-			$entity['isActive'] = in_array( $entity_id, $active_entities );
31
+			$entity['isActive'] = in_array($entity_id, $active_entities);
32 32
 		}
33 33
 
34 34
 		return $entities;
@@ -40,21 +40,21 @@  discard block
 block discarded – undo
40 40
 	 *
41 41
 	 * @return array<string> An array of Entity URIs
42 42
 	 */
43
-	public static function get_active_entities( $term_id ) {
43
+	public static function get_active_entities($term_id) {
44 44
 
45 45
 		// retrieve jsonld data.
46
-		$entity = Entity_List_Factory::get_instance( $term_id );
46
+		$entity = Entity_List_Factory::get_instance($term_id);
47 47
 
48 48
 		$entity_data_list = $entity->get_jsonld_data();
49 49
 
50 50
 		$active_entity_ids = array();
51 51
 
52
-		foreach ( $entity_data_list as $item ) {
52
+		foreach ($entity_data_list as $item) {
53 53
 			$sameas = $item['sameAs'];
54
-			if ( is_array( $sameas ) && count( $sameas ) > 0 ) {
54
+			if (is_array($sameas) && count($sameas) > 0) {
55 55
 				// The entity id is stored on last position, so
56 56
 				// we get the entity id from there.
57
-				$active_entity_ids[] = array_pop( $sameas );
57
+				$active_entity_ids[] = array_pop($sameas);
58 58
 			}
59 59
 		}
60 60
 
Please login to merge, or discard this patch.
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -12,54 +12,54 @@
 block discarded – undo
12 12
 class Entity_List_Utils {
13 13
 
14 14
 
15
-	/**
16
-	 * @param $term_id int Term id.
17
-	 * @param $entities array An array of entities
18
-	 *
19
-	 * @return array<array> An Array of entities with isActive filter.
20
-	 */
21
-	public static function mark_is_active_for_entities( $term_id, $entities ) {
15
+    /**
16
+     * @param $term_id int Term id.
17
+     * @param $entities array An array of entities
18
+     *
19
+     * @return array<array> An Array of entities with isActive filter.
20
+     */
21
+    public static function mark_is_active_for_entities( $term_id, $entities ) {
22 22
 
23
-		$active_entities = self::get_active_entities( $term_id );
23
+        $active_entities = self::get_active_entities( $term_id );
24 24
 
25
-		if ( ! is_array( $entities ) ) {
26
-			return $entities;
27
-		}
25
+        if ( ! is_array( $entities ) ) {
26
+            return $entities;
27
+        }
28 28
 
29
-		foreach ( $entities as &$entity ) {
30
-			$entity_id          = $entity['entityId'];
31
-			$entity['isActive'] = in_array( $entity_id, $active_entities );
32
-		}
29
+        foreach ( $entities as &$entity ) {
30
+            $entity_id          = $entity['entityId'];
31
+            $entity['isActive'] = in_array( $entity_id, $active_entities );
32
+        }
33 33
 
34
-		return $entities;
35
-	}
34
+        return $entities;
35
+    }
36 36
 
37 37
 
38
-	/**
39
-	 * @param $term_id
40
-	 *
41
-	 * @return array<string> An array of Entity URIs
42
-	 */
43
-	public static function get_active_entities( $term_id ) {
38
+    /**
39
+     * @param $term_id
40
+     *
41
+     * @return array<string> An array of Entity URIs
42
+     */
43
+    public static function get_active_entities( $term_id ) {
44 44
 
45
-		// retrieve jsonld data.
46
-		$entity = Entity_List_Factory::get_instance( $term_id );
45
+        // retrieve jsonld data.
46
+        $entity = Entity_List_Factory::get_instance( $term_id );
47 47
 
48
-		$entity_data_list = $entity->get_jsonld_data();
48
+        $entity_data_list = $entity->get_jsonld_data();
49 49
 
50
-		$active_entity_ids = array();
50
+        $active_entity_ids = array();
51 51
 
52
-		foreach ( $entity_data_list as $item ) {
53
-			$sameas = $item['sameAs'];
54
-			if ( is_array( $sameas ) && count( $sameas ) > 0 ) {
55
-				// The entity id is stored on last position, so
56
-				// we get the entity id from there.
57
-				$active_entity_ids[] = array_pop( $sameas );
58
-			}
59
-		}
52
+        foreach ( $entity_data_list as $item ) {
53
+            $sameas = $item['sameAs'];
54
+            if ( is_array( $sameas ) && count( $sameas ) > 0 ) {
55
+                // The entity id is stored on last position, so
56
+                // we get the entity id from there.
57
+                $active_entity_ids[] = array_pop( $sameas );
58
+            }
59
+        }
60 60
 
61 61
 
62
-		return $active_entity_ids;
63
-	}
62
+        return $active_entity_ids;
63
+    }
64 64
 
65 65
 }
Please login to merge, or discard this patch.
src/wordlift/vocabulary/data/entity-list/class-entity-list-factory.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
  */
7 7
 class Entity_List_Factory {
8 8
 
9
-	public static function get_instance( $term_id ) {
10
-		return new Default_Entity_List( $term_id, new Legacy_Entity_List( $term_id ) );
11
-	}
9
+    public static function get_instance( $term_id ) {
10
+        return new Default_Entity_List( $term_id, new Legacy_Entity_List( $term_id ) );
11
+    }
12 12
 
13 13
 }
14 14
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
  */
7 7
 class Entity_List_Factory {
8 8
 
9
-	public static function get_instance( $term_id ) {
10
-		return new Default_Entity_List( $term_id, new Legacy_Entity_List( $term_id ) );
9
+	public static function get_instance($term_id) {
10
+		return new Default_Entity_List($term_id, new Legacy_Entity_List($term_id));
11 11
 	}
12 12
 
13 13
 }
14 14
\ No newline at end of file
Please login to merge, or discard this patch.
src/wordlift/vocabulary/data/entity-list/class-entity-list.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -6,38 +6,38 @@
 block discarded – undo
6 6
  */
7 7
 
8 8
 abstract class Entity_List {
9
-	/**
10
-	 * @var int
11
-	 */
12
-	protected $term_id;
9
+    /**
10
+     * @var int
11
+     */
12
+    protected $term_id;
13 13
 
14
-	/**
15
-	 * Entity constructor.
16
-	 *
17
-	 * @param $term_id int
18
-	 */
19
-	public function __construct( $term_id ) {
20
-		$this->term_id = $term_id;
21
-	}
14
+    /**
15
+     * Entity constructor.
16
+     *
17
+     * @param $term_id int
18
+     */
19
+    public function __construct( $term_id ) {
20
+        $this->term_id = $term_id;
21
+    }
22 22
 
23
-	/**
24
-	 * Return a structure of jsonld data.
25
-	 * @return array
26
-	 */
27
-	abstract  public function get_jsonld_data();
23
+    /**
24
+     * Return a structure of jsonld data.
25
+     * @return array
26
+     */
27
+    abstract  public function get_jsonld_data();
28 28
 
29
-	/**
30
-	 * @param $entity_data array
31
-	 *
32
-	 * @return bool
33
-	 */
34
-	abstract  public function save_jsonld_data( $entity_data );
29
+    /**
30
+     * @param $entity_data array
31
+     *
32
+     * @return bool
33
+     */
34
+    abstract  public function save_jsonld_data( $entity_data );
35 35
 
36
-	/**
37
-	 * Clear the data on the meta.
38
-	 * @return bool
39
-	 */
40
-	abstract public function clear_data();
36
+    /**
37
+     * Clear the data on the meta.
38
+     * @return bool
39
+     */
40
+    abstract public function clear_data();
41 41
 
42
-	abstract public function remove_entity_by_id( $entity_id );
42
+    abstract public function remove_entity_by_id( $entity_id );
43 43
 }
44 44
\ No newline at end of file
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
 	 *
17 17
 	 * @param $term_id int
18 18
 	 */
19
-	public function __construct( $term_id ) {
19
+	public function __construct($term_id) {
20 20
 		$this->term_id = $term_id;
21 21
 	}
22 22
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 *
32 32
 	 * @return bool
33 33
 	 */
34
-	abstract  public function save_jsonld_data( $entity_data );
34
+	abstract  public function save_jsonld_data($entity_data);
35 35
 
36 36
 	/**
37 37
 	 * Clear the data on the meta.
@@ -39,5 +39,5 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	abstract public function clear_data();
41 41
 
42
-	abstract public function remove_entity_by_id( $entity_id );
42
+	abstract public function remove_entity_by_id($entity_id);
43 43
 }
44 44
\ No newline at end of file
Please login to merge, or discard this patch.
src/admin/class-wordlift-admin-user-profile-page.php 2 patches
Indentation   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -18,77 +18,77 @@  discard block
 block discarded – undo
18 18
  */
19 19
 class Wordlift_Admin_User_Profile_Page {
20 20
 
21
-	/**
22
-	 * The {@link Wordlift_Admin_Person_Element} instance.
23
-	 *
24
-	 * @since  3.14.0
25
-	 * @access private
26
-	 * @var \Wordlift_Admin_Author_Element $plugin The person entity
27
-	 *                selection element rendering the possible persons.
28
-	 */
29
-	private $author_element;
30
-
31
-	/**
32
-	 * The {@link Wordlift_User_Service} instance.
33
-	 *
34
-	 * @since  3.14.0
35
-	 * @access private
36
-	 * @var \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance.
37
-	 */
38
-	private $user_service;
39
-
40
-	/**
41
-	 * Create the {@link Wordlift_Admin_User_Profile_Page} instance.
42
-	 *
43
-	 * @param \Wordlift_Admin_Author_Element $author_element The person entity selection
44
-	 *                                                       element rendering the possible persons.
45
-	 * @param \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance.
46
-	 *
47
-	 * @since 3.14.0
48
-	 *
49
-	 */
50
-	function __construct( $author_element, $user_service ) {
51
-
52
-		$this->author_element = $author_element;
53
-		$this->user_service   = $user_service;
54
-
55
-		/*
21
+    /**
22
+     * The {@link Wordlift_Admin_Person_Element} instance.
23
+     *
24
+     * @since  3.14.0
25
+     * @access private
26
+     * @var \Wordlift_Admin_Author_Element $plugin The person entity
27
+     *                selection element rendering the possible persons.
28
+     */
29
+    private $author_element;
30
+
31
+    /**
32
+     * The {@link Wordlift_User_Service} instance.
33
+     *
34
+     * @since  3.14.0
35
+     * @access private
36
+     * @var \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance.
37
+     */
38
+    private $user_service;
39
+
40
+    /**
41
+     * Create the {@link Wordlift_Admin_User_Profile_Page} instance.
42
+     *
43
+     * @param \Wordlift_Admin_Author_Element $author_element The person entity selection
44
+     *                                                       element rendering the possible persons.
45
+     * @param \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance.
46
+     *
47
+     * @since 3.14.0
48
+     *
49
+     */
50
+    function __construct( $author_element, $user_service ) {
51
+
52
+        $this->author_element = $author_element;
53
+        $this->user_service   = $user_service;
54
+
55
+        /*
56 56
 		 * When an admin (or similar permissions) edits his own profile a
57 57
 		 * different action than the usual is being triggered.
58 58
 		 * It is too early in the wordpress boot to do user capabilities filtering
59 59
 		 * here and it is deferred to the handler.
60 60
 		 */
61
-		add_action( 'show_user_profile', array( $this, 'edit_user_profile' ) );
62
-		add_action( 'edit_user_profile', array( $this, 'edit_user_profile' ) );
63
-		add_action( 'edit_user_profile_update', array(
64
-			$this,
65
-			'edit_user_profile_update',
66
-		) );
67
-		add_action( 'personal_options_update', array(
68
-			$this,
69
-			'edit_user_profile_update',
70
-		) );
71
-
72
-	}
73
-
74
-	/**
75
-	 * Add a WordLift section in the user profile which lets
76
-	 * the admin to associate a wordpress user with a person entity.
77
-	 *
78
-	 * @param WP_User $user The current WP_User object of the user being edited.
79
-	 *
80
-	 * @since 3.14.0
81
-	 *
82
-	 */
83
-	public function edit_user_profile( $user ) {
84
-
85
-		// In case it is a user editing his own profile, make sure he has admin
86
-		// like capabilities.
87
-		if ( ! current_user_can( 'edit_users' ) ) {
88
-			return;
89
-		}
90
-
91
-		?>
61
+        add_action( 'show_user_profile', array( $this, 'edit_user_profile' ) );
62
+        add_action( 'edit_user_profile', array( $this, 'edit_user_profile' ) );
63
+        add_action( 'edit_user_profile_update', array(
64
+            $this,
65
+            'edit_user_profile_update',
66
+        ) );
67
+        add_action( 'personal_options_update', array(
68
+            $this,
69
+            'edit_user_profile_update',
70
+        ) );
71
+
72
+    }
73
+
74
+    /**
75
+     * Add a WordLift section in the user profile which lets
76
+     * the admin to associate a wordpress user with a person entity.
77
+     *
78
+     * @param WP_User $user The current WP_User object of the user being edited.
79
+     *
80
+     * @since 3.14.0
81
+     *
82
+     */
83
+    public function edit_user_profile( $user ) {
84
+
85
+        // In case it is a user editing his own profile, make sure he has admin
86
+        // like capabilities.
87
+        if ( ! current_user_can( 'edit_users' ) ) {
88
+            return;
89
+        }
90
+
91
+        ?>
92 92
         <h2><?php esc_html_e( 'WordLift', 'wordlift' ); ?></h2>
93 93
 
94 94
         <table class="form-table">
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
                 </th>
99 99
                 <td>
100 100
 					<?php
101
-					$this->author_element->render( array(
102
-						'id'             => 'wl_person',
103
-						'name'           => 'wl_person',
104
-						'current_entity' => $this->user_service->get_entity( $user->ID ),
105
-					) );
106
-					?>
101
+                    $this->author_element->render( array(
102
+                        'id'             => 'wl_person',
103
+                        'name'           => 'wl_person',
104
+                        'current_entity' => $this->user_service->get_entity( $user->ID ),
105
+                    ) );
106
+                    ?>
107 107
                     <p class="description"><?php _e( 'The entity, person or organization, from the vocabulary to associate with this author.', 'wordlift' ); ?></p>
108 108
                 </td>
109 109
             </tr>
@@ -120,66 +120,66 @@  discard block
 block discarded – undo
120 120
                 </td>
121 121
 				<?php } ?>
122 122
 				<?php
123
-				/**
124
-				 * Action name: wordlift_user_settings_page
125
-				 * An action to render the wordlift user settings.
126
-				 * @since 3.30.0
127
-				 *
128
-				 */
129
-				do_action( 'wordlift_user_settings_page' );
130
-				?>
123
+                /**
124
+                 * Action name: wordlift_user_settings_page
125
+                 * An action to render the wordlift user settings.
126
+                 * @since 3.30.0
127
+                 *
128
+                 */
129
+                do_action( 'wordlift_user_settings_page' );
130
+                ?>
131 131
         </table>
132 132
 		<?php
133
-	}
134
-
135
-	/**
136
-	 * Handle storing the person entity associated with the user.
137
-	 *
138
-	 * @param int $user_id The user id of the user being saved.
139
-	 *
140
-	 * @since 3.14.0
141
-	 *
142
-	 */
143
-	public function edit_user_profile_update( $user_id ) {
144
-
145
-		// In case it is a user editing his own profile, make sure he has admin
146
-		// like capabilities.
147
-		if ( ! current_user_can( 'edit_users' ) ) {
148
-			return;
149
-		}
150
-
151
-		// Link an entity to the user.
152
-		$this->link_entity( $user_id, $_POST );
153
-
154
-		// Deny and enable the edit entity capability
155
-		if ( isset( $_POST['wl_can_create_entities'] ) ) {
156
-			// User has capability so remove the deny indication if present.
157
-			$this->user_service->allow_editor_entity_create( $user_id );
158
-		} else {
159
-			$this->user_service->deny_editor_entity_create( $user_id );
160
-		}
161
-
162
-	}
163
-
164
-	/**
165
-	 * Link an entity (specified in the `$_POST` array) to the {@link WP_User}
166
-	 * with the specified `id`.
167
-	 *
168
-	 * @param int $user_id The {@link WP_User} `id`.
169
-	 * @param array $post The `$_POST` array.
170
-	 *
171
-	 * @since 3.14.0
172
-	 *
173
-	 */
174
-	private function link_entity( $user_id, $post ) {
175
-
176
-		// Bail out if the `wl_person` parameter isn't set.
177
-		if ( ! isset( $post['wl_person'] ) || ! is_numeric( $post['wl_person'] ) ) {
178
-			return;
179
-		}
180
-
181
-		$this->user_service->set_entity( $user_id, intval( $post['wl_person'] ) );
182
-
183
-	}
133
+    }
134
+
135
+    /**
136
+     * Handle storing the person entity associated with the user.
137
+     *
138
+     * @param int $user_id The user id of the user being saved.
139
+     *
140
+     * @since 3.14.0
141
+     *
142
+     */
143
+    public function edit_user_profile_update( $user_id ) {
144
+
145
+        // In case it is a user editing his own profile, make sure he has admin
146
+        // like capabilities.
147
+        if ( ! current_user_can( 'edit_users' ) ) {
148
+            return;
149
+        }
150
+
151
+        // Link an entity to the user.
152
+        $this->link_entity( $user_id, $_POST );
153
+
154
+        // Deny and enable the edit entity capability
155
+        if ( isset( $_POST['wl_can_create_entities'] ) ) {
156
+            // User has capability so remove the deny indication if present.
157
+            $this->user_service->allow_editor_entity_create( $user_id );
158
+        } else {
159
+            $this->user_service->deny_editor_entity_create( $user_id );
160
+        }
161
+
162
+    }
163
+
164
+    /**
165
+     * Link an entity (specified in the `$_POST` array) to the {@link WP_User}
166
+     * with the specified `id`.
167
+     *
168
+     * @param int $user_id The {@link WP_User} `id`.
169
+     * @param array $post The `$_POST` array.
170
+     *
171
+     * @since 3.14.0
172
+     *
173
+     */
174
+    private function link_entity( $user_id, $post ) {
175
+
176
+        // Bail out if the `wl_person` parameter isn't set.
177
+        if ( ! isset( $post['wl_person'] ) || ! is_numeric( $post['wl_person'] ) ) {
178
+            return;
179
+        }
180
+
181
+        $this->user_service->set_entity( $user_id, intval( $post['wl_person'] ) );
182
+
183
+    }
184 184
 
185 185
 }
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * @since 3.14.0
48 48
 	 *
49 49
 	 */
50
-	function __construct( $author_element, $user_service ) {
50
+	function __construct($author_element, $user_service) {
51 51
 
52 52
 		$this->author_element = $author_element;
53 53
 		$this->user_service   = $user_service;
@@ -58,16 +58,16 @@  discard block
 block discarded – undo
58 58
 		 * It is too early in the wordpress boot to do user capabilities filtering
59 59
 		 * here and it is deferred to the handler.
60 60
 		 */
61
-		add_action( 'show_user_profile', array( $this, 'edit_user_profile' ) );
62
-		add_action( 'edit_user_profile', array( $this, 'edit_user_profile' ) );
63
-		add_action( 'edit_user_profile_update', array(
61
+		add_action('show_user_profile', array($this, 'edit_user_profile'));
62
+		add_action('edit_user_profile', array($this, 'edit_user_profile'));
63
+		add_action('edit_user_profile_update', array(
64 64
 			$this,
65 65
 			'edit_user_profile_update',
66
-		) );
67
-		add_action( 'personal_options_update', array(
66
+		));
67
+		add_action('personal_options_update', array(
68 68
 			$this,
69 69
 			'edit_user_profile_update',
70
-		) );
70
+		));
71 71
 
72 72
 	}
73 73
 
@@ -80,45 +80,45 @@  discard block
 block discarded – undo
80 80
 	 * @since 3.14.0
81 81
 	 *
82 82
 	 */
83
-	public function edit_user_profile( $user ) {
83
+	public function edit_user_profile($user) {
84 84
 
85 85
 		// In case it is a user editing his own profile, make sure he has admin
86 86
 		// like capabilities.
87
-		if ( ! current_user_can( 'edit_users' ) ) {
87
+		if ( ! current_user_can('edit_users')) {
88 88
 			return;
89 89
 		}
90 90
 
91 91
 		?>
92
-        <h2><?php esc_html_e( 'WordLift', 'wordlift' ); ?></h2>
92
+        <h2><?php esc_html_e('WordLift', 'wordlift'); ?></h2>
93 93
 
94 94
         <table class="form-table">
95
-		    <?php if ( apply_filters( 'wl_feature__enable__user-author', true ) ) { ?>
95
+		    <?php if (apply_filters('wl_feature__enable__user-author', true)) { ?>
96 96
             <tr class="user-description-wrap">
97 97
                 <th><label
98
-                            for="wl_person"><?php _e( 'Author from the vocabulary', 'wordlift' ); ?></label>
98
+                            for="wl_person"><?php _e('Author from the vocabulary', 'wordlift'); ?></label>
99 99
                 </th>
100 100
                 <td>
101 101
 					<?php
102
-					$this->author_element->render( array(
102
+					$this->author_element->render(array(
103 103
 						'id'             => 'wl_person',
104 104
 						'name'           => 'wl_person',
105
-						'current_entity' => $this->user_service->get_entity( $user->ID ),
106
-					) );
105
+						'current_entity' => $this->user_service->get_entity($user->ID),
106
+					));
107 107
 					?>
108
-                    <p class="description"><?php _e( 'The entity, person or organization, from the vocabulary to associate with this author.', 'wordlift' ); ?></p>
108
+                    <p class="description"><?php _e('The entity, person or organization, from the vocabulary to associate with this author.', 'wordlift'); ?></p>
109 109
                 </td>
110 110
             </tr>
111 111
 		    <?php } ?>
112
-			<?php if ( $this->user_service->is_editor( $user->ID ) ) { ?>
112
+			<?php if ($this->user_service->is_editor($user->ID)) { ?>
113 113
             <tr>
114 114
                 <th>
115 115
                     <label
116
-                            for="wl_can_create_entities"><?php esc_html_e( 'Can create new entities', 'wordlift' ) ?></label>
116
+                            for="wl_can_create_entities"><?php esc_html_e('Can create new entities', 'wordlift') ?></label>
117 117
                 </th>
118 118
                 <td>
119 119
                     <input id="wl_can_create_entities"
120 120
                            name="wl_can_create_entities"
121
-                           type="checkbox" <?php checked( $this->user_service->editor_can_create_entities( $user->ID ) ) ?>
121
+                           type="checkbox" <?php checked($this->user_service->editor_can_create_entities($user->ID)) ?>
122 122
                 </td>
123 123
 				<?php } ?>
124 124
 				<?php
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 				 * @since 3.30.0
129 129
 				 *
130 130
 				 */
131
-				do_action( 'wordlift_user_settings_page' );
131
+				do_action('wordlift_user_settings_page');
132 132
 				?>
133 133
         </table>
134 134
 		<?php
@@ -142,23 +142,23 @@  discard block
 block discarded – undo
142 142
 	 * @since 3.14.0
143 143
 	 *
144 144
 	 */
145
-	public function edit_user_profile_update( $user_id ) {
145
+	public function edit_user_profile_update($user_id) {
146 146
 
147 147
 		// In case it is a user editing his own profile, make sure he has admin
148 148
 		// like capabilities.
149
-		if ( ! current_user_can( 'edit_users' ) ) {
149
+		if ( ! current_user_can('edit_users')) {
150 150
 			return;
151 151
 		}
152 152
 
153 153
 		// Link an entity to the user.
154
-		$this->link_entity( $user_id, $_POST );
154
+		$this->link_entity($user_id, $_POST);
155 155
 
156 156
 		// Deny and enable the edit entity capability
157
-		if ( isset( $_POST['wl_can_create_entities'] ) ) {
157
+		if (isset($_POST['wl_can_create_entities'])) {
158 158
 			// User has capability so remove the deny indication if present.
159
-			$this->user_service->allow_editor_entity_create( $user_id );
159
+			$this->user_service->allow_editor_entity_create($user_id);
160 160
 		} else {
161
-			$this->user_service->deny_editor_entity_create( $user_id );
161
+			$this->user_service->deny_editor_entity_create($user_id);
162 162
 		}
163 163
 
164 164
 	}
@@ -173,14 +173,14 @@  discard block
 block discarded – undo
173 173
 	 * @since 3.14.0
174 174
 	 *
175 175
 	 */
176
-	private function link_entity( $user_id, $post ) {
176
+	private function link_entity($user_id, $post) {
177 177
 
178 178
 		// Bail out if the `wl_person` parameter isn't set.
179
-		if ( ! isset( $post['wl_person'] ) || ! is_numeric( $post['wl_person'] ) ) {
179
+		if ( ! isset($post['wl_person']) || ! is_numeric($post['wl_person'])) {
180 180
 			return;
181 181
 		}
182 182
 
183
-		$this->user_service->set_entity( $user_id, intval( $post['wl_person'] ) );
183
+		$this->user_service->set_entity($user_id, intval($post['wl_person']));
184 184
 
185 185
 	}
186 186
 
Please login to merge, or discard this patch.
src/admin/wordlift_admin_edit_post.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -18,35 +18,35 @@
 block discarded – undo
18 18
  */
19 19
 function wl_admin_permalink_html( $html, $post_id, $new_title, $new_slug ) {
20 20
 
21
-	// Get the entity service instance.
22
-	$entity_service = Wordlift_Entity_Service::get_instance();
21
+    // Get the entity service instance.
22
+    $entity_service = Wordlift_Entity_Service::get_instance();
23 23
 
24
-	// Show the View Linked Data button only for entities.
25
-	//
26
-	// See https://github.com/insideout10/wordlift-plugin/issues/668.
27
-	if ( 'publish' === get_post_status( $post_id )
28
-	     && $uri = $entity_service->get_uri( $post_id ) ) {
24
+    // Show the View Linked Data button only for entities.
25
+    //
26
+    // See https://github.com/insideout10/wordlift-plugin/issues/668.
27
+    if ( 'publish' === get_post_status( $post_id )
28
+         && $uri = $entity_service->get_uri( $post_id ) ) {
29 29
 
30
-		$lod_view_href = esc_attr( $uri );
31
-		/*
30
+        $lod_view_href = esc_attr( $uri );
31
+        /*
32 32
 		 * Add the `.html` extension to the link to have Chrome open the html version instead of RDF one.
33 33
 		 *
34 34
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/931
35 35
 		 * @since 3.21.1
36 36
 		 */
37
-		$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'>" .
38
-		                  esc_html__( 'View Linked Data', 'wordlift' ) .
39
-		                  "</a></span>\n" : '';
37
+        $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'>" .
38
+                            esc_html__( 'View Linked Data', 'wordlift' ) .
39
+                            "</a></span>\n" : '';
40 40
 
41
-	}
41
+    }
42 42
 
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
-	         urlencode( 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" : '';
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
+                urlencode( 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, 4 );
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  *
17 17
  * @return string The enhanced html.
18 18
  */
19
-function wl_admin_permalink_html( $html, $post_id, $new_title, $new_slug ) {
19
+function wl_admin_permalink_html($html, $post_id, $new_title, $new_slug) {
20 20
 
21 21
 	// Get the entity service instance.
22 22
 	$entity_service = Wordlift_Entity_Service::get_instance();
@@ -24,29 +24,29 @@  discard block
 block discarded – undo
24 24
 	// Show the View Linked Data button only for entities.
25 25
 	//
26 26
 	// See https://github.com/insideout10/wordlift-plugin/issues/668.
27
-	if ( 'publish' === get_post_status( $post_id )
28
-	     && $uri = $entity_service->get_uri( $post_id ) ) {
27
+	if ('publish' === get_post_status($post_id)
28
+	     && $uri = $entity_service->get_uri($post_id)) {
29 29
 
30
-		$lod_view_href = esc_attr( $uri );
30
+		$lod_view_href = esc_attr($uri);
31 31
 		/*
32 32
 		 * Add the `.html` extension to the link to have Chrome open the html version instead of RDF one.
33 33
 		 *
34 34
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/931
35 35
 		 * @since 3.21.1
36 36
 		 */
37
-		$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'>" .
38
-		                  esc_html__( 'View Linked Data', 'wordlift' ) .
37
+		$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'>".
38
+		                  esc_html__('View Linked Data', 'wordlift').
39 39
 		                  "</a></span>\n" : '';
40 40
 
41 41
 	}
42 42
 
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
-	         urlencode( 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
+	         urlencode(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, 4 );
52
+add_filter('get_sample_permalink_html', 'wl_admin_permalink_html', PHP_INT_MAX, 4);
Please login to merge, or discard this patch.