Completed
Push — develop ( 565960...e2f469 )
by David
03:44
created
src/admin/WL_Metabox/WL_Metabox_Field_date.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -3,17 +3,17 @@  discard block
 block discarded – undo
3 3
 
4 4
 class WL_Metabox_Field_date extends WL_Metabox_Field {
5 5
     
6
-    public function html_input( $date ) {
6
+    public function html_input($date) {
7 7
         
8
-        $pickerDate  = '';
9
-        if( !empty( $date ) ){
10
-            $pickerDate = date( 'Y/m/d H:i', strtotime( $date ) );
8
+        $pickerDate = '';
9
+        if ( ! empty($date)) {
10
+            $pickerDate = date('Y/m/d H:i', strtotime($date));
11 11
         }
12
-        $pickerDate = esc_attr( $pickerDate );
12
+        $pickerDate = esc_attr($pickerDate);
13 13
         
14 14
         $html = '<div class="wl-input-wrapper">
15
-            <input type="text" class="' . $this->meta_name . '" value="' . $pickerDate . '" style="width:88%" />
16
-            <input type="hidden" class="' . $this->meta_name . '_hidden" name="wl_metaboxes[' . $this->meta_name . '][]" value="' . $date . '" />      
15
+            <input type="text" class="' . $this->meta_name.'" value="'.$pickerDate.'" style="width:88%" />
16
+            <input type="hidden" class="' . $this->meta_name.'_hidden" name="wl_metaboxes['.$this->meta_name.'][]" value="'.$date.'" />      
17 17
             <button class="button wl-remove-input" type="button" style="width:10%">Remove</button>
18 18
         </div>';
19 19
         
@@ -21,19 +21,19 @@  discard block
 block discarded – undo
21 21
 
22 22
     }
23 23
     
24
-    public function html_wrapper_close(){
24
+    public function html_wrapper_close() {
25 25
           
26 26
         $html = "<script type='text/javascript'>
27 27
         $ = jQuery;
28 28
         $(document).ready(function() {
29 29
 
30
-            $('." . $this->meta_name . "').datetimepicker({
30
+            $('." . $this->meta_name."').datetimepicker({
31 31
                 onChangeDateTime:function(dp, input){
32 32
                     // format must be: 'YYYY-MM-DDTHH:MM:SSZ' from '2014/11/21 04:00'
33 33
                     var currentDate = input.val();
34 34
                     currentDate = currentDate.replace(/(\d{4})\/(\d{2})\/(\d{2}) (\d{2}):(\d{2})/,'$1-$2-$3T$4:$5:00Z')
35 35
                     // store value to save in the hidden input field
36
-                    $('." . $this->meta_name . "_hidden').val( currentDate );
36
+                    $('." . $this->meta_name."_hidden').val( currentDate );
37 37
                 }
38 38
             });
39 39
         });
Please login to merge, or discard this patch.
src/admin/WL_Metabox/WL_Metabox_Field_sameas.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,16 +2,16 @@
 block discarded – undo
2 2
 
3 3
 class WL_Metabox_Field_sameas extends WL_Metabox_Field {
4 4
 
5
-    public function __construct( $args ) {
6
-        parent::__construct( $args['sameas'] );
5
+    public function __construct($args) {
6
+        parent::__construct($args['sameas']);
7 7
     }
8 8
     
9 9
     /**
10 10
      * Only accept URIs
11 11
      */
12
-    public function sanitize_data_filter( $value ) {
12
+    public function sanitize_data_filter($value) {
13 13
 
14
-        if( !is_null( $value ) && $value !== '' && filter_var($value, FILTER_VALIDATE_URL) ){
14
+        if ( ! is_null($value) && $value !== '' && filter_var($value, FILTER_VALIDATE_URL)) {
15 15
             return $value;
16 16
         }
17 17
         return null;
Please login to merge, or discard this patch.
src/admin/WL_Metabox/WL_Metabox_Field_uri.php 2 patches
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -3,110 +3,110 @@
 block discarded – undo
3 3
 
4 4
 class WL_Metabox_Field_uri extends WL_Metabox_Field {
5 5
 
6
-	/**
7
-	 * Only accept URIs or local entity IDs.
8
-	 * Build new entity if the user inputted a name that is not present in DB.
9
-	 */
10
-	public function sanitize_data_filter( $value ) {
11
-
12
-		if ( empty( $value ) ) {
13
-			return null;
14
-		}
15
-
16
-		// Check that the inserted URI, ID or name does not point to a saved entity.
17
-		if ( is_numeric( $value ) ) {
18
-			$absent_from_db = is_null( get_post( $value ) );                           // search by ID
19
-		} else {
20
-			$absent_from_db =
21
-				is_null( wl_get_entity_post_by_uri( $value ) ) &&                      // search by uri
22
-				is_null( get_page_by_title( $value, OBJECT, Wordlift_Entity_Service::TYPE_NAME ) );   // search by name
23
-		}
24
-
25
-		// Is it an URI?
26
-		$name_is_uri = strpos( $value, 'http' ) === 0;
27
-
28
-		// We create a new entity only if the entity is not present in the DB.
29
-		// In the case of an external uri, we just save the uri.
30
-		if ( $absent_from_db && ! $name_is_uri ) {
31
-
32
-			// ...we create a new entity!
33
-			$new_entity_id = wp_insert_post( array(
34
-				'post_status' => 'publish',
35
-				'post_type'   => Wordlift_Entity_Service::TYPE_NAME,
36
-				'post_title'  => $value
37
-			) );
38
-			$new_entity    = get_post( $new_entity_id );
39
-
40
-			$type = 'http://schema.org/' . ( isset( $this->expected_uri_type ) ? $this->expected_uri_type[0] : 'Thing' );
41
-
42
-			wl_set_entity_main_type( $new_entity_id, $type );
43
-
44
-			// Build uri for this entity
45
-			$new_uri = wl_build_entity_uri( $new_entity_id );
46
-			wl_set_entity_uri( $new_entity_id, $new_uri );
47
-
48
-			wl_push_entity_post_to_redlink( $new_entity );
49
-
50
-			// Update the value that will be saved as meta
51
-			$value = $new_entity_id;
52
-		}
53
-
54
-		return $value;
55
-	}
56
-
57
-	public function html_wrapper_open() {
58
-
59
-		// The containing <div> contains info on cardinality and expected types
60
-		$html = '<div class="wl-metabox" data-cardinality="' . $this->cardinality . '"';
61
-
62
-		if ( isset( $this->expected_uri_type ) && ! is_null( $this->expected_uri_type ) ) {
63
-
64
-			if ( is_array( $this->expected_uri_type ) ) {
65
-				$html .= ' data-expected-types="' . implode( ',', $this->expected_uri_type ) . '"';
66
-			} else {
67
-				$html .= ' data-expected-types="' . $this->expected_uri_type . '"';
68
-			}
69
-		}
70
-
71
-		$html .= '>';
72
-
73
-		return $html;
74
-	}
75
-
76
-	public function html_input( $default_entity_identifier ) {
77
-
78
-		// The entity can be referenced as URI or ID.
79
-		if ( is_numeric( $default_entity_identifier ) ) {
80
-			$entity = get_post( $default_entity_identifier );
81
-		} else {
82
-			// It is an URI
83
-			$entity = wl_get_entity_post_by_uri( $default_entity_identifier );
84
-		}
85
-
86
-		if ( ! is_null( $entity ) ) {
87
-			$label = $entity->post_title;
88
-			$value = $entity->ID;
89
-		} else {
90
-			// No ID and no internal uri. Just leave as is.
91
-			$label = $default_entity_identifier;
92
-			$value = $default_entity_identifier;
93
-		}
94
-
95
-		/*
6
+    /**
7
+     * Only accept URIs or local entity IDs.
8
+     * Build new entity if the user inputted a name that is not present in DB.
9
+     */
10
+    public function sanitize_data_filter( $value ) {
11
+
12
+        if ( empty( $value ) ) {
13
+            return null;
14
+        }
15
+
16
+        // Check that the inserted URI, ID or name does not point to a saved entity.
17
+        if ( is_numeric( $value ) ) {
18
+            $absent_from_db = is_null( get_post( $value ) );                           // search by ID
19
+        } else {
20
+            $absent_from_db =
21
+                is_null( wl_get_entity_post_by_uri( $value ) ) &&                      // search by uri
22
+                is_null( get_page_by_title( $value, OBJECT, Wordlift_Entity_Service::TYPE_NAME ) );   // search by name
23
+        }
24
+
25
+        // Is it an URI?
26
+        $name_is_uri = strpos( $value, 'http' ) === 0;
27
+
28
+        // We create a new entity only if the entity is not present in the DB.
29
+        // In the case of an external uri, we just save the uri.
30
+        if ( $absent_from_db && ! $name_is_uri ) {
31
+
32
+            // ...we create a new entity!
33
+            $new_entity_id = wp_insert_post( array(
34
+                'post_status' => 'publish',
35
+                'post_type'   => Wordlift_Entity_Service::TYPE_NAME,
36
+                'post_title'  => $value
37
+            ) );
38
+            $new_entity    = get_post( $new_entity_id );
39
+
40
+            $type = 'http://schema.org/' . ( isset( $this->expected_uri_type ) ? $this->expected_uri_type[0] : 'Thing' );
41
+
42
+            wl_set_entity_main_type( $new_entity_id, $type );
43
+
44
+            // Build uri for this entity
45
+            $new_uri = wl_build_entity_uri( $new_entity_id );
46
+            wl_set_entity_uri( $new_entity_id, $new_uri );
47
+
48
+            wl_push_entity_post_to_redlink( $new_entity );
49
+
50
+            // Update the value that will be saved as meta
51
+            $value = $new_entity_id;
52
+        }
53
+
54
+        return $value;
55
+    }
56
+
57
+    public function html_wrapper_open() {
58
+
59
+        // The containing <div> contains info on cardinality and expected types
60
+        $html = '<div class="wl-metabox" data-cardinality="' . $this->cardinality . '"';
61
+
62
+        if ( isset( $this->expected_uri_type ) && ! is_null( $this->expected_uri_type ) ) {
63
+
64
+            if ( is_array( $this->expected_uri_type ) ) {
65
+                $html .= ' data-expected-types="' . implode( ',', $this->expected_uri_type ) . '"';
66
+            } else {
67
+                $html .= ' data-expected-types="' . $this->expected_uri_type . '"';
68
+            }
69
+        }
70
+
71
+        $html .= '>';
72
+
73
+        return $html;
74
+    }
75
+
76
+    public function html_input( $default_entity_identifier ) {
77
+
78
+        // The entity can be referenced as URI or ID.
79
+        if ( is_numeric( $default_entity_identifier ) ) {
80
+            $entity = get_post( $default_entity_identifier );
81
+        } else {
82
+            // It is an URI
83
+            $entity = wl_get_entity_post_by_uri( $default_entity_identifier );
84
+        }
85
+
86
+        if ( ! is_null( $entity ) ) {
87
+            $label = $entity->post_title;
88
+            $value = $entity->ID;
89
+        } else {
90
+            // No ID and no internal uri. Just leave as is.
91
+            $label = $default_entity_identifier;
92
+            $value = $default_entity_identifier;
93
+        }
94
+
95
+        /*
96 96
 		 * Write saved value in page
97 97
 		 * The <input> tags host the meta value.
98 98
 		 * The visible <input> has the human readable value (i.e. entity name or uri)
99 99
 		 * and is accompained by an hidden <input> tag, passed to the server,
100 100
 		 * that contains the raw value (i.e. the uri or entity id).
101 101
 		 */
102
-		$html = '<div class="wl-input-wrapper wl-autocomplete-wrapper">
102
+        $html = '<div class="wl-input-wrapper wl-autocomplete-wrapper">
103 103
                     <input type="text" class="' . $this->meta_name . ' wl-autocomplete" value="' . $label . '" style="width:88%" />
104 104
                     <input type="hidden" class="' . $this->meta_name . '" name="wl_metaboxes[' . $this->meta_name . '][]" value="' . $value . '" />
105 105
                     <button class="button wl-remove-input" type="button" style="width:10%">Remove</button>
106 106
                     <div class="wl-input-notice"></div>
107 107
                 </div>';
108 108
 
109
-		return $html;
110
-	}
109
+        return $html;
110
+    }
111 111
 }
112 112
 
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -7,45 +7,45 @@  discard block
 block discarded – undo
7 7
 	 * Only accept URIs or local entity IDs.
8 8
 	 * Build new entity if the user inputted a name that is not present in DB.
9 9
 	 */
10
-	public function sanitize_data_filter( $value ) {
10
+	public function sanitize_data_filter($value) {
11 11
 
12
-		if ( empty( $value ) ) {
12
+		if (empty($value)) {
13 13
 			return null;
14 14
 		}
15 15
 
16 16
 		// Check that the inserted URI, ID or name does not point to a saved entity.
17
-		if ( is_numeric( $value ) ) {
18
-			$absent_from_db = is_null( get_post( $value ) );                           // search by ID
17
+		if (is_numeric($value)) {
18
+			$absent_from_db = is_null(get_post($value)); // search by ID
19 19
 		} else {
20 20
 			$absent_from_db =
21
-				is_null( wl_get_entity_post_by_uri( $value ) ) &&                      // search by uri
22
-				is_null( get_page_by_title( $value, OBJECT, Wordlift_Entity_Service::TYPE_NAME ) );   // search by name
21
+				is_null(wl_get_entity_post_by_uri($value)) && // search by uri
22
+				is_null(get_page_by_title($value, OBJECT, Wordlift_Entity_Service::TYPE_NAME)); // search by name
23 23
 		}
24 24
 
25 25
 		// Is it an URI?
26
-		$name_is_uri = strpos( $value, 'http' ) === 0;
26
+		$name_is_uri = strpos($value, 'http') === 0;
27 27
 
28 28
 		// We create a new entity only if the entity is not present in the DB.
29 29
 		// In the case of an external uri, we just save the uri.
30
-		if ( $absent_from_db && ! $name_is_uri ) {
30
+		if ($absent_from_db && ! $name_is_uri) {
31 31
 
32 32
 			// ...we create a new entity!
33
-			$new_entity_id = wp_insert_post( array(
33
+			$new_entity_id = wp_insert_post(array(
34 34
 				'post_status' => 'publish',
35 35
 				'post_type'   => Wordlift_Entity_Service::TYPE_NAME,
36 36
 				'post_title'  => $value
37
-			) );
38
-			$new_entity    = get_post( $new_entity_id );
37
+			));
38
+			$new_entity = get_post($new_entity_id);
39 39
 
40
-			$type = 'http://schema.org/' . ( isset( $this->expected_uri_type ) ? $this->expected_uri_type[0] : 'Thing' );
40
+			$type = 'http://schema.org/'.(isset($this->expected_uri_type) ? $this->expected_uri_type[0] : 'Thing');
41 41
 
42
-			wl_set_entity_main_type( $new_entity_id, $type );
42
+			wl_set_entity_main_type($new_entity_id, $type);
43 43
 
44 44
 			// Build uri for this entity
45
-			$new_uri = wl_build_entity_uri( $new_entity_id );
46
-			wl_set_entity_uri( $new_entity_id, $new_uri );
45
+			$new_uri = wl_build_entity_uri($new_entity_id);
46
+			wl_set_entity_uri($new_entity_id, $new_uri);
47 47
 
48
-			wl_push_entity_post_to_redlink( $new_entity );
48
+			wl_push_entity_post_to_redlink($new_entity);
49 49
 
50 50
 			// Update the value that will be saved as meta
51 51
 			$value = $new_entity_id;
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
 	public function html_wrapper_open() {
58 58
 
59 59
 		// The containing <div> contains info on cardinality and expected types
60
-		$html = '<div class="wl-metabox" data-cardinality="' . $this->cardinality . '"';
60
+		$html = '<div class="wl-metabox" data-cardinality="'.$this->cardinality.'"';
61 61
 
62
-		if ( isset( $this->expected_uri_type ) && ! is_null( $this->expected_uri_type ) ) {
62
+		if (isset($this->expected_uri_type) && ! is_null($this->expected_uri_type)) {
63 63
 
64
-			if ( is_array( $this->expected_uri_type ) ) {
65
-				$html .= ' data-expected-types="' . implode( ',', $this->expected_uri_type ) . '"';
64
+			if (is_array($this->expected_uri_type)) {
65
+				$html .= ' data-expected-types="'.implode(',', $this->expected_uri_type).'"';
66 66
 			} else {
67
-				$html .= ' data-expected-types="' . $this->expected_uri_type . '"';
67
+				$html .= ' data-expected-types="'.$this->expected_uri_type.'"';
68 68
 			}
69 69
 		}
70 70
 
@@ -73,17 +73,17 @@  discard block
 block discarded – undo
73 73
 		return $html;
74 74
 	}
75 75
 
76
-	public function html_input( $default_entity_identifier ) {
76
+	public function html_input($default_entity_identifier) {
77 77
 
78 78
 		// The entity can be referenced as URI or ID.
79
-		if ( is_numeric( $default_entity_identifier ) ) {
80
-			$entity = get_post( $default_entity_identifier );
79
+		if (is_numeric($default_entity_identifier)) {
80
+			$entity = get_post($default_entity_identifier);
81 81
 		} else {
82 82
 			// It is an URI
83
-			$entity = wl_get_entity_post_by_uri( $default_entity_identifier );
83
+			$entity = wl_get_entity_post_by_uri($default_entity_identifier);
84 84
 		}
85 85
 
86
-		if ( ! is_null( $entity ) ) {
86
+		if ( ! is_null($entity)) {
87 87
 			$label = $entity->post_title;
88 88
 			$value = $entity->ID;
89 89
 		} else {
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 		 * that contains the raw value (i.e. the uri or entity id).
101 101
 		 */
102 102
 		$html = '<div class="wl-input-wrapper wl-autocomplete-wrapper">
103
-                    <input type="text" class="' . $this->meta_name . ' wl-autocomplete" value="' . $label . '" style="width:88%" />
104
-                    <input type="hidden" class="' . $this->meta_name . '" name="wl_metaboxes[' . $this->meta_name . '][]" value="' . $value . '" />
103
+                    <input type="text" class="' . $this->meta_name.' wl-autocomplete" value="'.$label.'" style="width:88%" />
104
+                    <input type="hidden" class="' . $this->meta_name.'" name="wl_metaboxes['.$this->meta_name.'][]" value="'.$value.'" />
105 105
                     <button class="button wl-remove-input" type="button" style="width:10%">Remove</button>
106 106
                     <div class="wl-input-notice"></div>
107 107
                 </div>';
Please login to merge, or discard this patch.
src/admin/class-wordlift-admin.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_Admin {
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 this 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 admin area.
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-admin.css', array(), $this->version, 'all' );
77
-
78
-	}
79
-
80
-	/**
81
-	 * Register the JavaScript for the admin area.
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-admin.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 this 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 admin area.
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-admin.css', array(), $this->version, 'all' );
77
+
78
+    }
79
+
80
+    /**
81
+     * Register the JavaScript for the admin area.
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-admin.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 this 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-admin.css', array(), $this->version, 'all' );
76
+		wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__).'css/wordlift-admin.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-admin.js', array( 'jquery' ), $this->version, false );
99
+		wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__).'js/wordlift-admin.js', array('jquery'), $this->version, false);
100 100
 
101 101
 	}
102 102
 
Please login to merge, or discard this patch.
src/admin/class-wordlift-entity-types-taxonomy-walker.php 2 patches
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  * Entity Types taxonomy.
5 5
  */
6 6
 if ( ! class_exists( 'Walker_Category_Checklist' ) ) {
7
-	require_once( ABSPATH . 'wp-admin/includes/template.php' );
7
+    require_once( ABSPATH . 'wp-admin/includes/template.php' );
8 8
 }
9 9
 
10 10
 /**
@@ -14,77 +14,77 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class Wordlift_Entity_Types_Taxonomy_Walker extends Walker_Category_Checklist {
16 16
 
17
-	/**
18
-	 * The Log service.
19
-	 *
20
-	 * @since 3.1.0
21
-	 * @access private
22
-	 * @var \Wordlift_Log_Service $log_service The Log service.
23
-	 */
24
-	private $log_service;
25
-
26
-	/**
27
-	 * Create an instance of Wordlift_Entity_Types_Taxonomy_Walker.
28
-	 *
29
-	 * @since 3.1.0
30
-	 */
31
-	public function __construct() {
32
-
33
-		$this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Types_Taxonomy_Walker' );
34
-
35
-	}
36
-
37
-	/**
38
-	 * Entity taxonomy metabox must show exclusive options, no checkboxes.
39
-	 *
40
-	 * @since 3.1.0
41
-	 *
42
-	 * @param $args
43
-	 *
44
-	 * @return array An array of arguments, with this walker in case the taxonomy is the Entity Type taxonomy.
45
-	 */
46
-	function terms_checklist_args( $args ) {
47
-
48
-		if ( ! isset( $args['taxonomy'] ) || Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME !== $args['taxonomy'] ) {
49
-			return $args;
50
-		}
51
-
52
-		// We override the way WP prints the taxonomy metabox HTML
53
-		$args['walker']        = $this;
54
-		$args['checked_ontop'] = false;
55
-
56
-		return $args;
57
-
58
-	}
59
-
60
-
61
-	/**
62
-	 * Change checkboxes to radios.
63
-	 *
64
-	 * $max_depth = -1 means flatly display every element.
65
-	 * $max_depth = 0 means display all levels.
66
-	 * $max_depth > 0 specifies the number of display levels.
67
-	 *
68
-	 * @since 3.1.0
69
-	 *
70
-	 * @param array $elements An array of elements.
71
-	 * @param int $max_depth The maximum hierarchical depth.
72
-	 *
73
-	 * @param array $args Additional arguments.
74
-	 *
75
-	 * @return string The hierarchical item output.
76
-	 */
77
-	public function walk( $elements, $max_depth, $args = array() ) {
78
-
79
-		$output = parent::walk( $elements, $max_depth, $args );
80
-
81
-		$output = str_replace(
82
-			array( 'type="checkbox"', "type='checkbox'" ),
83
-			array( 'type="radio"', "type='radio'" ),
84
-			$output
85
-		);
86
-
87
-		return $output;
88
-	}
17
+    /**
18
+     * The Log service.
19
+     *
20
+     * @since 3.1.0
21
+     * @access private
22
+     * @var \Wordlift_Log_Service $log_service The Log service.
23
+     */
24
+    private $log_service;
25
+
26
+    /**
27
+     * Create an instance of Wordlift_Entity_Types_Taxonomy_Walker.
28
+     *
29
+     * @since 3.1.0
30
+     */
31
+    public function __construct() {
32
+
33
+        $this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Types_Taxonomy_Walker' );
34
+
35
+    }
36
+
37
+    /**
38
+     * Entity taxonomy metabox must show exclusive options, no checkboxes.
39
+     *
40
+     * @since 3.1.0
41
+     *
42
+     * @param $args
43
+     *
44
+     * @return array An array of arguments, with this walker in case the taxonomy is the Entity Type taxonomy.
45
+     */
46
+    function terms_checklist_args( $args ) {
47
+
48
+        if ( ! isset( $args['taxonomy'] ) || Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME !== $args['taxonomy'] ) {
49
+            return $args;
50
+        }
51
+
52
+        // We override the way WP prints the taxonomy metabox HTML
53
+        $args['walker']        = $this;
54
+        $args['checked_ontop'] = false;
55
+
56
+        return $args;
57
+
58
+    }
59
+
60
+
61
+    /**
62
+     * Change checkboxes to radios.
63
+     *
64
+     * $max_depth = -1 means flatly display every element.
65
+     * $max_depth = 0 means display all levels.
66
+     * $max_depth > 0 specifies the number of display levels.
67
+     *
68
+     * @since 3.1.0
69
+     *
70
+     * @param array $elements An array of elements.
71
+     * @param int $max_depth The maximum hierarchical depth.
72
+     *
73
+     * @param array $args Additional arguments.
74
+     *
75
+     * @return string The hierarchical item output.
76
+     */
77
+    public function walk( $elements, $max_depth, $args = array() ) {
78
+
79
+        $output = parent::walk( $elements, $max_depth, $args );
80
+
81
+        $output = str_replace(
82
+            array( 'type="checkbox"', "type='checkbox'" ),
83
+            array( 'type="radio"', "type='radio'" ),
84
+            $output
85
+        );
86
+
87
+        return $output;
88
+    }
89 89
 
90 90
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
  * This file contains the Entity Types Taxonomy Walker whose main role is to turn checkboxes to radios for the
4 4
  * Entity Types taxonomy.
5 5
  */
6
-if ( ! class_exists( 'Walker_Category_Checklist' ) ) {
7
-	require_once( ABSPATH . 'wp-admin/includes/template.php' );
6
+if ( ! class_exists('Walker_Category_Checklist')) {
7
+	require_once(ABSPATH.'wp-admin/includes/template.php');
8 8
 }
9 9
 
10 10
 /**
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	public function __construct() {
32 32
 
33
-		$this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Types_Taxonomy_Walker' );
33
+		$this->log_service = Wordlift_Log_Service::get_logger('Wordlift_Entity_Types_Taxonomy_Walker');
34 34
 
35 35
 	}
36 36
 
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 	 *
44 44
 	 * @return array An array of arguments, with this walker in case the taxonomy is the Entity Type taxonomy.
45 45
 	 */
46
-	function terms_checklist_args( $args ) {
46
+	function terms_checklist_args($args) {
47 47
 
48
-		if ( ! isset( $args['taxonomy'] ) || Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME !== $args['taxonomy'] ) {
48
+		if ( ! isset($args['taxonomy']) || Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME !== $args['taxonomy']) {
49 49
 			return $args;
50 50
 		}
51 51
 
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @return string The hierarchical item output.
76 76
 	 */
77
-	public function walk( $elements, $max_depth, $args = array() ) {
77
+	public function walk($elements, $max_depth, $args = array()) {
78 78
 
79
-		$output = parent::walk( $elements, $max_depth, $args );
79
+		$output = parent::walk($elements, $max_depth, $args);
80 80
 
81 81
 		$output = str_replace(
82
-			array( 'type="checkbox"', "type='checkbox'" ),
83
-			array( 'type="radio"', "type='radio'" ),
82
+			array('type="checkbox"', "type='checkbox'"),
83
+			array('type="radio"', "type='radio'"),
84 84
 			$output
85 85
 		);
86 86
 
Please login to merge, or discard this patch.
src/admin/wordlift_admin.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -15,21 +15,21 @@  discard block
 block discarded – undo
15 15
  */
16 16
 function wl_serialize_entity( $entity ) {
17 17
 
18
-	$entity = ( is_numeric( $entity ) ) ? get_post( $entity ) : $entity;
18
+    $entity = ( is_numeric( $entity ) ) ? get_post( $entity ) : $entity;
19 19
 	
20
-	$type   = wl_entity_type_taxonomy_get_type( $entity->ID );
21
-	$images = wl_get_image_urls( $entity->ID );
22
-
23
-	return array(
24
-		'id'         	=> wl_get_entity_uri( $entity->ID ),
25
-		'label'      	=> $entity->post_title,
26
-		'description'	=> $entity->post_content,
27
-		'sameAs'     	=> wl_schema_get_value( $entity->ID, 'sameAs' ),
28
-		'mainType'      => str_replace( 'wl-', '', $type['css_class'] ),
29
-		'types'      	=> wl_get_entity_rdf_types( $entity->ID ),
30
-		'images' 		=> $images,
31
-
32
-	);
20
+    $type   = wl_entity_type_taxonomy_get_type( $entity->ID );
21
+    $images = wl_get_image_urls( $entity->ID );
22
+
23
+    return array(
24
+        'id'         	=> wl_get_entity_uri( $entity->ID ),
25
+        'label'      	=> $entity->post_title,
26
+        'description'	=> $entity->post_content,
27
+        'sameAs'     	=> wl_schema_get_value( $entity->ID, 'sameAs' ),
28
+        'mainType'      => str_replace( 'wl-', '', $type['css_class'] ),
29
+        'types'      	=> wl_get_entity_rdf_types( $entity->ID ),
30
+        'images' 		=> $images,
31
+
32
+    );
33 33
 }
34 34
 
35 35
 /**
@@ -43,18 +43,18 @@  discard block
 block discarded – undo
43 43
  */
44 44
 function wl_remove_text_annotations( $data ) {
45 45
 
46
-	//    <span class="textannotation" id="urn:enhancement-777cbed4-b131-00fb-54a4-ed9b26ae57ea">
47
-	//    $pattern = '/<span class=\\\"textannotation\\\" id=\\\"[^\"]+\\\">([^<]+)<\/span>/i';
48
-	$pattern = '/<(\w+)[^>]*\sclass=\\\"textannotation\\\"[^>]*>([^<]+)<\/\1>/im';
46
+    //    <span class="textannotation" id="urn:enhancement-777cbed4-b131-00fb-54a4-ed9b26ae57ea">
47
+    //    $pattern = '/<span class=\\\"textannotation\\\" id=\\\"[^\"]+\\\">([^<]+)<\/span>/i';
48
+    $pattern = '/<(\w+)[^>]*\sclass=\\\"textannotation\\\"[^>]*>([^<]+)<\/\1>/im';
49 49
 
50
-	// wl_write_log( "Removing text annotations [ pattern :: $pattern ]" );
50
+    // wl_write_log( "Removing text annotations [ pattern :: $pattern ]" );
51 51
 
52
-	// Remove the pattern while it is found (match nested annotations).
53
-	while ( 1 === preg_match( $pattern, $data['post_content'] ) ) {
54
-		$data['post_content'] = preg_replace( $pattern, '$2', $data['post_content'], - 1, $count );
55
-	}
52
+    // Remove the pattern while it is found (match nested annotations).
53
+    while ( 1 === preg_match( $pattern, $data['post_content'] ) ) {
54
+        $data['post_content'] = preg_replace( $pattern, '$2', $data['post_content'], - 1, $count );
55
+    }
56 56
 
57
-	return $data;
57
+    return $data;
58 58
 }
59 59
 
60 60
 add_filter( 'wp_insert_post_data', 'wl_remove_text_annotations', '98', 1 );
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  */
5 5
 
6 6
 // Add the Admin menu.
7
-require_once( 'wordlift_admin_menu.php' );
7
+require_once('wordlift_admin_menu.php');
8 8
 
9 9
 /**
10 10
  * Serialize an entity post.
@@ -13,20 +13,20 @@  discard block
 block discarded – undo
13 13
  *
14 14
  * @return array mixed The entity data array.
15 15
  */
16
-function wl_serialize_entity( $entity ) {
16
+function wl_serialize_entity($entity) {
17 17
 
18
-	$entity = ( is_numeric( $entity ) ) ? get_post( $entity ) : $entity;
18
+	$entity = (is_numeric($entity)) ? get_post($entity) : $entity;
19 19
 	
20
-	$type   = wl_entity_type_taxonomy_get_type( $entity->ID );
21
-	$images = wl_get_image_urls( $entity->ID );
20
+	$type   = wl_entity_type_taxonomy_get_type($entity->ID);
21
+	$images = wl_get_image_urls($entity->ID);
22 22
 
23 23
 	return array(
24
-		'id'         	=> wl_get_entity_uri( $entity->ID ),
24
+		'id'         	=> wl_get_entity_uri($entity->ID),
25 25
 		'label'      	=> $entity->post_title,
26 26
 		'description'	=> $entity->post_content,
27
-		'sameAs'     	=> wl_schema_get_value( $entity->ID, 'sameAs' ),
28
-		'mainType'      => str_replace( 'wl-', '', $type['css_class'] ),
29
-		'types'      	=> wl_get_entity_rdf_types( $entity->ID ),
27
+		'sameAs'     	=> wl_schema_get_value($entity->ID, 'sameAs'),
28
+		'mainType'      => str_replace('wl-', '', $type['css_class']),
29
+		'types'      	=> wl_get_entity_rdf_types($entity->ID),
30 30
 		'images' 		=> $images,
31 31
 
32 32
 	);
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
  *
42 42
  * @return array mixed The post data array.
43 43
  */
44
-function wl_remove_text_annotations( $data ) {
44
+function wl_remove_text_annotations($data) {
45 45
 
46 46
 	//    <span class="textannotation" id="urn:enhancement-777cbed4-b131-00fb-54a4-ed9b26ae57ea">
47 47
 	//    $pattern = '/<span class=\\\"textannotation\\\" id=\\\"[^\"]+\\\">([^<]+)<\/span>/i';
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 	// wl_write_log( "Removing text annotations [ pattern :: $pattern ]" );
51 51
 
52 52
 	// Remove the pattern while it is found (match nested annotations).
53
-	while ( 1 === preg_match( $pattern, $data['post_content'] ) ) {
54
-		$data['post_content'] = preg_replace( $pattern, '$2', $data['post_content'], - 1, $count );
53
+	while (1 === preg_match($pattern, $data['post_content'])) {
54
+		$data['post_content'] = preg_replace($pattern, '$2', $data['post_content'], - 1, $count);
55 55
 	}
56 56
 
57 57
 	return $data;
58 58
 }
59 59
 
60
-add_filter( 'wp_insert_post_data', 'wl_remove_text_annotations', '98', 1 );
60
+add_filter('wp_insert_post_data', 'wl_remove_text_annotations', '98', 1);
Please login to merge, or discard this patch.
src/admin/wordlift_admin_ajax_related_posts.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,54 +1,54 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-function wordlift_ajax_related_posts( $http_raw_data = null ) {
3
+function wordlift_ajax_related_posts($http_raw_data = null) {
4 4
     
5 5
     // Extract filtering conditions
6
-    if( !isset( $_GET["post_id"] ) || !is_numeric( $_GET["post_id"] ) ) {
6
+    if ( ! isset($_GET["post_id"]) || ! is_numeric($_GET["post_id"])) {
7 7
         wp_die('Post id missing or invalid!');
8 8
         return;
9 9
     }
10 10
 
11 11
     $post_id = $_GET["post_id"]; 
12 12
     // Get the current post
13
-    $post = get_post( $post_id );
13
+    $post = get_post($post_id);
14 14
 
15
-    wl_write_log( "Going to find posts related to current with post id: $post_id ..." );
15
+    wl_write_log("Going to find posts related to current with post id: $post_id ...");
16 16
     
17 17
     // Extract filtering conditions
18
-    $filtering_entity_uris = ( null == $http_raw_data ) ? file_get_contents("php://input") : $http_raw_data;
19
-    $filtering_entity_uris = json_decode( $filtering_entity_uris );
18
+    $filtering_entity_uris = (null == $http_raw_data) ? file_get_contents("php://input") : $http_raw_data;
19
+    $filtering_entity_uris = json_decode($filtering_entity_uris);
20 20
    
21
-    $filtering_entity_ids = wl_get_entity_post_ids_by_uris( $filtering_entity_uris );
21
+    $filtering_entity_ids = wl_get_entity_post_ids_by_uris($filtering_entity_uris);
22 22
     $related_posts = array();
23 23
     
24 24
     // If the current post is an antity 
25 25
     // related posts to the current entity are returned
26
-    if ( Wordlift_Entity_Service::TYPE_NAME == $post->post_type ) {
27
-        $filtering_entity_ids = array( $post_id );        
26
+    if (Wordlift_Entity_Service::TYPE_NAME == $post->post_type) {
27
+        $filtering_entity_ids = array($post_id);        
28 28
     }
29 29
 
30
-    if ( !empty( $filtering_entity_ids ) ) {
30
+    if ( ! empty($filtering_entity_ids)) {
31 31
     
32
-        $related_posts = wl_core_get_posts( array(
32
+        $related_posts = wl_core_get_posts(array(
33 33
             'get'             =>    'posts',  
34 34
             'related_to__in'  =>    $filtering_entity_ids,
35
-            'post__not_in'    =>    array( $post_id ),
35
+            'post__not_in'    =>    array($post_id),
36 36
             'post_type'       =>    'post',
37 37
             'post_status'     =>    'publish',
38 38
             'as'              =>    'subject',
39
-        ) );
39
+        ));
40 40
         
41
-        foreach ( $related_posts as $post_obj ) {
41
+        foreach ($related_posts as $post_obj) {
42 42
                 
43
-            $thumbnail = wp_get_attachment_url( get_post_thumbnail_id( $post_obj->ID, 'thumbnail' ) );
44
-            $post_obj->thumbnail = ( $thumbnail ) ? $thumbnail : WL_DEFAULT_THUMBNAIL_PATH; 
45
-            $post_obj->link = get_edit_post_link( $post_obj->ID, 'none' );  
46
-            $post_obj->permalink = get_post_permalink( $post_obj->ID );  
43
+            $thumbnail = wp_get_attachment_url(get_post_thumbnail_id($post_obj->ID, 'thumbnail'));
44
+            $post_obj->thumbnail = ($thumbnail) ? $thumbnail : WL_DEFAULT_THUMBNAIL_PATH; 
45
+            $post_obj->link = get_edit_post_link($post_obj->ID, 'none');  
46
+            $post_obj->permalink = get_post_permalink($post_obj->ID);  
47 47
         
48 48
         }
49 49
     }
50 50
 
51
-    wl_core_send_json( $related_posts );
51
+    wl_core_send_json($related_posts);
52 52
 }
53 53
 
54
-add_action( 'wp_ajax_wordlift_related_posts', 'wordlift_ajax_related_posts' );
54
+add_action('wp_ajax_wordlift_related_posts', 'wordlift_ajax_related_posts');
Please login to merge, or discard this patch.
src/admin/wordlift_admin_menu.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -11,24 +11,24 @@  discard block
 block discarded – undo
11 11
  */
12 12
 function wl_admin_menu() {
13 13
 
14
-	$menu_slug  = 'wl_admin_menu';
15
-	$capability = 'manage_options';
16
-
17
-	// see http://codex.wordpress.org/Function_Reference/add_utility_page
18
-	add_utility_page(
19
-		__( 'WordLift', 'wordlift' ), // page title
20
-		__( 'WordLift', 'wordlift' ), // menu title
21
-		$capability,                 // capabilities
22
-		$menu_slug,                  // menu slug
23
-		//'wl_admin_menu_callback',  // TODO: function callback to draw the coming dashboard
24
-		'wl_configuration_admin_menu_callback',
25
-		WP_CONTENT_URL . '/plugins/wordlift/images/pink-logo-20x20.gif' );  // icon URL 20x20 px	
14
+    $menu_slug  = 'wl_admin_menu';
15
+    $capability = 'manage_options';
16
+
17
+    // see http://codex.wordpress.org/Function_Reference/add_utility_page
18
+    add_utility_page(
19
+        __( 'WordLift', 'wordlift' ), // page title
20
+        __( 'WordLift', 'wordlift' ), // menu title
21
+        $capability,                 // capabilities
22
+        $menu_slug,                  // menu slug
23
+        //'wl_admin_menu_callback',  // TODO: function callback to draw the coming dashboard
24
+        'wl_configuration_admin_menu_callback',
25
+        WP_CONTENT_URL . '/plugins/wordlift/images/pink-logo-20x20.gif' );  // icon URL 20x20 px	
26 26
 	
27
-	// Call hooked functions.
28
-	do_action( 'wl_admin_menu', $menu_slug, $capability );
27
+    // Call hooked functions.
28
+    do_action( 'wl_admin_menu', $menu_slug, $capability );
29 29
 	
30
-	// Remove duplicate 'WordLift' subpage created by WordPress. 
31
-	remove_submenu_page( $menu_slug, $menu_slug );
30
+    // Remove duplicate 'WordLift' subpage created by WordPress. 
31
+    remove_submenu_page( $menu_slug, $menu_slug );
32 32
 	
33 33
 }
34 34
 
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
  */
42 42
 function wl_admin_menu_callback() {
43 43
 
44
-	if ( ! current_user_can( 'manage_options' ) ) {
45
-		wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
46
-	}
44
+    if ( ! current_user_can( 'manage_options' ) ) {
45
+        wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
46
+    }
47 47
 
48
-	echo '<div class="wrap">';
49
-	echo '<p>Here is where the form would go if I actually had options.</p>';
50
-	echo '</div>';
48
+    echo '<div class="wrap">';
49
+    echo '<p>Here is where the form would go if I actually had options.</p>';
50
+    echo '</div>';
51 51
 
52 52
 }
53 53
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -16,23 +16,23 @@  discard block
 block discarded – undo
16 16
 
17 17
 	// see http://codex.wordpress.org/Function_Reference/add_utility_page
18 18
 	add_utility_page(
19
-		__( 'WordLift', 'wordlift' ), // page title
20
-		__( 'WordLift', 'wordlift' ), // menu title
21
-		$capability,                 // capabilities
22
-		$menu_slug,                  // menu slug
19
+		__('WordLift', 'wordlift'), // page title
20
+		__('WordLift', 'wordlift'), // menu title
21
+		$capability, // capabilities
22
+		$menu_slug, // menu slug
23 23
 		//'wl_admin_menu_callback',  // TODO: function callback to draw the coming dashboard
24 24
 		'wl_configuration_admin_menu_callback',
25
-		WP_CONTENT_URL . '/plugins/wordlift/images/pink-logo-20x20.gif' );  // icon URL 20x20 px	
25
+		WP_CONTENT_URL.'/plugins/wordlift/images/pink-logo-20x20.gif' ); // icon URL 20x20 px	
26 26
 	
27 27
 	// Call hooked functions.
28
-	do_action( 'wl_admin_menu', $menu_slug, $capability );
28
+	do_action('wl_admin_menu', $menu_slug, $capability);
29 29
 	
30 30
 	// Remove duplicate 'WordLift' subpage created by WordPress. 
31
-	remove_submenu_page( $menu_slug, $menu_slug );
31
+	remove_submenu_page($menu_slug, $menu_slug);
32 32
 	
33 33
 }
34 34
 
35
-add_action( 'admin_menu', 'wl_admin_menu' );
35
+add_action('admin_menu', 'wl_admin_menu');
36 36
 
37 37
 /**
38 38
  * This function is called as a callback by the *wl_admin_menu* to display the actual page.
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
  */
42 42
 function wl_admin_menu_callback() {
43 43
 
44
-	if ( ! current_user_can( 'manage_options' ) ) {
45
-		wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
44
+	if ( ! current_user_can('manage_options')) {
45
+		wp_die(__('You do not have sufficient permissions to access this page.'));
46 46
 	}
47 47
 
48 48
 	echo '<div class="wrap">';
Please login to merge, or discard this patch.
src/admin/wordlift_admin_meta_box_entities.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
  */
29 29
 function wl_admin_add_entities_meta_box( $post_type ) {
30 30
 
31
-	// wl_write_log( "wl_admin_add_entities_meta_box [ post type :: $post_type ]" );
31
+    // wl_write_log( "wl_admin_add_entities_meta_box [ post type :: $post_type ]" );
32 32
 
33
-	// Add main meta box for related entities and 4W
34
-	add_meta_box(
35
-		'wordlift_entities_box', __( 'Wordlift', 'wordlift' ), 'wl_entities_box_content', $post_type, 'side', 'high'
36
-	);
33
+    // Add main meta box for related entities and 4W
34
+    add_meta_box(
35
+        'wordlift_entities_box', __( 'Wordlift', 'wordlift' ), 'wl_entities_box_content', $post_type, 'side', 'high'
36
+    );
37 37
 }
38 38
 add_action( 'add_meta_boxes', 'wl_admin_add_entities_meta_box' );
39 39
 
@@ -44,26 +44,26 @@  discard block
 block discarded – undo
44 44
  */
45 45
 function wl_entities_box_content( $post ) {
46 46
     
47
-	// wl_write_log( "wl_entities_box_content [ post id :: $post->ID ]" );
47
+    // wl_write_log( "wl_entities_box_content [ post id :: $post->ID ]" );
48 48
 	
49 49
         // Angularjs edit-post widget wrapper
50
-	echo '<div id="wordlift-edit-post-outer-wrapper"></div>';
50
+    echo '<div id="wordlift-edit-post-outer-wrapper"></div>';
51 51
 	
52 52
         // Angularjs edit-post widget classification boxes configuration
53
-	$classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES );
53
+    $classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES );
54 54
         
55 55
         // Array to store all related entities ids
56 56
         $all_referenced_entities_ids = array();
57 57
 	
58 58
         // Add selected entities to classification_boxes
59
-	foreach ( $classification_boxes as $i => $box ) {
60
-		// Build the proper relation name
61
-		$relation_name = $box['id'];
59
+    foreach ( $classification_boxes as $i => $box ) {
60
+        // Build the proper relation name
61
+        $relation_name = $box['id'];
62 62
 		
63
-		// wl_write_log( "Going to related of $relation_name" );
63
+        // wl_write_log( "Going to related of $relation_name" );
64 64
     
65
-		// Get entity ids related to the current post for the given relation name (both draft and published entities)
66
-		$draft_entity_ids = wl_core_get_related_entity_ids( $post->ID, array(
65
+        // Get entity ids related to the current post for the given relation name (both draft and published entities)
66
+        $draft_entity_ids = wl_core_get_related_entity_ids( $post->ID, array(
67 67
                     'predicate' => $relation_name,
68 68
                     'status'    => 'draft'
69 69
                 ) );
@@ -76,17 +76,17 @@  discard block
 block discarded – undo
76 76
                 // Store the entity ids for all the 4W
77 77
                 $all_referenced_entities_ids = array_merge( $all_referenced_entities_ids, $entity_ids );
78 78
 	
79
-		// Transform entity ids array in entity uris array
80
-		array_walk($entity_ids, function(&$entity_id) {
79
+        // Transform entity ids array in entity uris array
80
+        array_walk($entity_ids, function(&$entity_id) {
81 81
                     // Retrieve the entity uri for the given entity id
82 82
                     $entity_id = wl_get_entity_uri( $entity_id );
83
-		});
83
+        });
84 84
 		
85
-		// Enhance current box selected entities
86
-		$classification_boxes[ $i ]['selectedEntities'] = $entity_ids;
87
-	}
88
-	// Json encoding for classification boxes structure
89
-	$classification_boxes = json_encode( $classification_boxes );
85
+        // Enhance current box selected entities
86
+        $classification_boxes[ $i ]['selectedEntities'] = $entity_ids;
87
+    }
88
+    // Json encoding for classification boxes structure
89
+    $classification_boxes = json_encode( $classification_boxes );
90 90
         
91 91
         // Ensure there are no repetitions of the referenced entities
92 92
         $all_referenced_entities_ids = array_unique( $all_referenced_entities_ids );
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
     $referenced_entities_obj = empty($referenced_entities_obj) ? 
102 102
         '{}' : json_encode( $referenced_entities_obj );
103 103
 	
104
-	$default_thumbnail_path = WL_DEFAULT_THUMBNAIL_PATH;
105
-	$dataset_uri = wl_configuration_get_redlink_dataset_uri();
104
+    $default_thumbnail_path = WL_DEFAULT_THUMBNAIL_PATH;
105
+    $dataset_uri = wl_configuration_get_redlink_dataset_uri();
106 106
 
107
-	echo <<<EOF
107
+    echo <<<EOF
108 108
     <script type="text/javascript">
109 109
         jQuery( function() {
110 110
 
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
 function wl_register_metaboxes() {
12 12
     
13 13
     // Load metabox classes
14
-    require_once( 'WL_Metabox/WL_Metabox.php' );
14
+    require_once('WL_Metabox/WL_Metabox.php');
15 15
 
16
-    $wl_metabox = new WL_Metabox();     // Everything is done inside here with the correct timing 
16
+    $wl_metabox = new WL_Metabox(); // Everything is done inside here with the correct timing 
17 17
 }
18
-if ( is_admin() ) {
19
-    add_action( 'load-post.php', 'wl_register_metaboxes' );
20
-    add_action( 'load-post-new.php', 'wl_register_metaboxes' );
18
+if (is_admin()) {
19
+    add_action('load-post.php', 'wl_register_metaboxes');
20
+    add_action('load-post-new.php', 'wl_register_metaboxes');
21 21
 }
22 22
 
23 23
 
@@ -26,23 +26,23 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @param string $post_type The type of the current open post.
28 28
  */
29
-function wl_admin_add_entities_meta_box( $post_type ) {
29
+function wl_admin_add_entities_meta_box($post_type) {
30 30
 
31 31
 	// wl_write_log( "wl_admin_add_entities_meta_box [ post type :: $post_type ]" );
32 32
 
33 33
 	// Add main meta box for related entities and 4W
34 34
 	add_meta_box(
35
-		'wordlift_entities_box', __( 'Wordlift', 'wordlift' ), 'wl_entities_box_content', $post_type, 'side', 'high'
35
+		'wordlift_entities_box', __('Wordlift', 'wordlift'), 'wl_entities_box_content', $post_type, 'side', 'high'
36 36
 	);
37 37
 }
38
-add_action( 'add_meta_boxes', 'wl_admin_add_entities_meta_box' );
38
+add_action('add_meta_boxes', 'wl_admin_add_entities_meta_box');
39 39
 
40 40
 /**
41 41
  * Displays the meta box contents (called by *add_meta_box* callback).
42 42
  *
43 43
  * @param WP_Post $post The current post.
44 44
  */
45
-function wl_entities_box_content( $post ) {
45
+function wl_entities_box_content($post) {
46 46
     
47 47
 	// wl_write_log( "wl_entities_box_content [ post id :: $post->ID ]" );
48 48
 	
@@ -50,56 +50,56 @@  discard block
 block discarded – undo
50 50
 	echo '<div id="wordlift-edit-post-outer-wrapper"></div>';
51 51
 	
52 52
         // Angularjs edit-post widget classification boxes configuration
53
-	$classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES );
53
+	$classification_boxes = unserialize(WL_CORE_POST_CLASSIFICATION_BOXES);
54 54
         
55 55
         // Array to store all related entities ids
56 56
         $all_referenced_entities_ids = array();
57 57
 	
58 58
         // Add selected entities to classification_boxes
59
-	foreach ( $classification_boxes as $i => $box ) {
59
+	foreach ($classification_boxes as $i => $box) {
60 60
 		// Build the proper relation name
61 61
 		$relation_name = $box['id'];
62 62
 		
63 63
 		// wl_write_log( "Going to related of $relation_name" );
64 64
     
65 65
 		// Get entity ids related to the current post for the given relation name (both draft and published entities)
66
-		$draft_entity_ids = wl_core_get_related_entity_ids( $post->ID, array(
66
+		$draft_entity_ids = wl_core_get_related_entity_ids($post->ID, array(
67 67
                     'predicate' => $relation_name,
68 68
                     'status'    => 'draft'
69
-                ) );
70
-                $publish_entity_ids = wl_core_get_related_entity_ids( $post->ID, array(
69
+                ));
70
+                $publish_entity_ids = wl_core_get_related_entity_ids($post->ID, array(
71 71
                     'predicate' => $relation_name,
72 72
                     'status'    => 'publish'
73
-                ) );
74
-                $entity_ids = array_unique( array_merge( $draft_entity_ids, $publish_entity_ids ) );
73
+                ));
74
+                $entity_ids = array_unique(array_merge($draft_entity_ids, $publish_entity_ids));
75 75
                 
76 76
                 // Store the entity ids for all the 4W
77
-                $all_referenced_entities_ids = array_merge( $all_referenced_entities_ids, $entity_ids );
77
+                $all_referenced_entities_ids = array_merge($all_referenced_entities_ids, $entity_ids);
78 78
 	
79 79
 		// Transform entity ids array in entity uris array
80 80
 		array_walk($entity_ids, function(&$entity_id) {
81 81
                     // Retrieve the entity uri for the given entity id
82
-                    $entity_id = wl_get_entity_uri( $entity_id );
82
+                    $entity_id = wl_get_entity_uri($entity_id);
83 83
 		});
84 84
 		
85 85
 		// Enhance current box selected entities
86
-		$classification_boxes[ $i ]['selectedEntities'] = $entity_ids;
86
+		$classification_boxes[$i]['selectedEntities'] = $entity_ids;
87 87
 	}
88 88
 	// Json encoding for classification boxes structure
89
-	$classification_boxes = json_encode( $classification_boxes );
89
+	$classification_boxes = json_encode($classification_boxes);
90 90
         
91 91
         // Ensure there are no repetitions of the referenced entities
92
-        $all_referenced_entities_ids = array_unique( $all_referenced_entities_ids );
92
+        $all_referenced_entities_ids = array_unique($all_referenced_entities_ids);
93 93
 	
94 94
     // Build the entity storage object
95 95
     $referenced_entities_obj = array();
96
-    foreach ( $all_referenced_entities_ids as $referenced_entity ) {
97
-        $entity = wl_serialize_entity( $referenced_entity );
98
-        $referenced_entities_obj[ $entity['id'] ] = $entity;
96
+    foreach ($all_referenced_entities_ids as $referenced_entity) {
97
+        $entity = wl_serialize_entity($referenced_entity);
98
+        $referenced_entities_obj[$entity['id']] = $entity;
99 99
     }
100 100
 
101 101
     $referenced_entities_obj = empty($referenced_entities_obj) ? 
102
-        '{}' : json_encode( $referenced_entities_obj );
102
+        '{}' : json_encode($referenced_entities_obj);
103 103
 	
104 104
 	$default_thumbnail_path = WL_DEFAULT_THUMBNAIL_PATH;
105 105
 	$dataset_uri = wl_configuration_get_redlink_dataset_uri();
Please login to merge, or discard this patch.