Completed
Pull Request — develop (#1553)
by Naveen
01:05
created
src/admin/class-wordlift-admin-not-enriched-filter.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -4,53 +4,53 @@
 block discarded – undo
4 4
 
5 5
 class Wordlift_Admin_Not_Enriched_Filter {
6 6
 
7
-	const PARAMETER_NAME = 'wl_enriched';
7
+    const PARAMETER_NAME = 'wl_enriched';
8 8
 
9
-	public function __construct() {
9
+    public function __construct() {
10 10
 
11
-		// Hook to `views_edit-post`.
12
-		add_filter( 'views_edit-post', array( $this, 'view_edit' ) );
11
+        // Hook to `views_edit-post`.
12
+        add_filter( 'views_edit-post', array( $this, 'view_edit' ) );
13 13
 
14
-		// Add the `posts_where` filter if the filter is active.
15
-		if ( $this->is_filter_active() ) {
16
-			add_filter( 'posts_where', array( $this, 'posts_where' ) );
17
-		}
14
+        // Add the `posts_where` filter if the filter is active.
15
+        if ( $this->is_filter_active() ) {
16
+            add_filter( 'posts_where', array( $this, 'posts_where' ) );
17
+        }
18 18
 
19
-	}
19
+    }
20 20
 
21
-	public function posts_where( $where ) {
22
-		global $wpdb;
21
+    public function posts_where( $where ) {
22
+        global $wpdb;
23 23
 
24
-		return $where .
25
-		       " AND {$wpdb->posts}.ID NOT IN ( SELECT DISTINCT subject_id FROM {$wpdb->prefix}wl_relation_instances )";
26
-	}
24
+        return $where .
25
+                " AND {$wpdb->posts}.ID NOT IN ( SELECT DISTINCT subject_id FROM {$wpdb->prefix}wl_relation_instances )";
26
+    }
27 27
 
28
-	public function view_edit( $views ) {
29
-		global $wpdb;
28
+    public function view_edit( $views ) {
29
+        global $wpdb;
30 30
 
31
-		$url = add_query_arg( array( self::PARAMETER_NAME => 'no', 'post_type' => 'post', ), 'edit.php' );
31
+        $url = add_query_arg( array( self::PARAMETER_NAME => 'no', 'post_type' => 'post', ), 'edit.php' );
32 32
 
33
-		$not_enriched_count = $wpdb->get_var( <<<EOF
33
+        $not_enriched_count = $wpdb->get_var( <<<EOF
34 34
 SELECT COUNT( 1 ) FROM $wpdb->posts p
35 35
  WHERE p.post_type = 'post'
36 36
    AND p.post_status <> 'trash' 
37 37
    AND p.post_status <> 'auto-draft'
38 38
    AND p.ID NOT IN ( SELECT DISTINCT subject_id FROM {$wpdb->prefix}wl_relation_instances )
39 39
 EOF
40
-		);
40
+        );
41 41
 
42
-		$link = '<a href="'
43
-		        . esc_url( $url ) . '"'
44
-		        . ( $this->is_filter_active() ? ' class="current" aria-current="page"' : '' )
45
-		        . '>' . esc_html( __( 'Not enriched', 'wordlift' ) ) . '</a> (' . $not_enriched_count . ')';
42
+        $link = '<a href="'
43
+                . esc_url( $url ) . '"'
44
+                . ( $this->is_filter_active() ? ' class="current" aria-current="page"' : '' )
45
+                . '>' . esc_html( __( 'Not enriched', 'wordlift' ) ) . '</a> (' . $not_enriched_count . ')';
46 46
 
47
-		$views['wl_not_enriched'] = $link;
47
+        $views['wl_not_enriched'] = $link;
48 48
 
49
-		return $views;
50
-	}
49
+        return $views;
50
+    }
51 51
 
52
-	public function is_filter_active() {
53
-		return 'no' === filter_input( INPUT_GET, self::PARAMETER_NAME );
54
-	}
52
+    public function is_filter_active() {
53
+        return 'no' === filter_input( INPUT_GET, self::PARAMETER_NAME );
54
+    }
55 55
 
56 56
 }
57 57
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -9,28 +9,28 @@  discard block
 block discarded – undo
9 9
 	public function __construct() {
10 10
 
11 11
 		// Hook to `views_edit-post`.
12
-		add_filter( 'views_edit-post', array( $this, 'view_edit' ) );
12
+		add_filter('views_edit-post', array($this, 'view_edit'));
13 13
 
14 14
 		// Add the `posts_where` filter if the filter is active.
15
-		if ( $this->is_filter_active() ) {
16
-			add_filter( 'posts_where', array( $this, 'posts_where' ) );
15
+		if ($this->is_filter_active()) {
16
+			add_filter('posts_where', array($this, 'posts_where'));
17 17
 		}
18 18
 
19 19
 	}
20 20
 
21
-	public function posts_where( $where ) {
21
+	public function posts_where($where) {
22 22
 		global $wpdb;
23 23
 
24
-		return $where .
24
+		return $where.
25 25
 		       " AND {$wpdb->posts}.ID NOT IN ( SELECT DISTINCT subject_id FROM {$wpdb->prefix}wl_relation_instances )";
26 26
 	}
27 27
 
28
-	public function view_edit( $views ) {
28
+	public function view_edit($views) {
29 29
 		global $wpdb;
30 30
 
31
-		$url = add_query_arg( array( self::PARAMETER_NAME => 'no', 'post_type' => 'post', ), 'edit.php' );
31
+		$url = add_query_arg(array(self::PARAMETER_NAME => 'no', 'post_type' => 'post',), 'edit.php');
32 32
 
33
-		$not_enriched_count = $wpdb->get_var( <<<EOF
33
+		$not_enriched_count = $wpdb->get_var(<<<EOF
34 34
 SELECT COUNT( 1 ) FROM $wpdb->posts p
35 35
  WHERE p.post_type = 'post'
36 36
    AND p.post_status <> 'trash' 
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 		);
41 41
 
42 42
 		$link = '<a href="'
43
-		        . esc_url( $url ) . '"'
44
-		        . ( $this->is_filter_active() ? ' class="current" aria-current="page"' : '' )
45
-		        . '>' . esc_html( __( 'Not enriched', 'wordlift' ) ) . '</a> (' . $not_enriched_count . ')';
43
+		        . esc_url($url).'"'
44
+		        . ($this->is_filter_active() ? ' class="current" aria-current="page"' : '')
45
+		        . '>'.esc_html(__('Not enriched', 'wordlift')).'</a> ('.$not_enriched_count.')';
46 46
 
47 47
 		$views['wl_not_enriched'] = $link;
48 48
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	}
51 51
 
52 52
 	public function is_filter_active() {
53
-		return 'no' === filter_input( INPUT_GET, self::PARAMETER_NAME );
53
+		return 'no' === filter_input(INPUT_GET, self::PARAMETER_NAME);
54 54
 	}
55 55
 
56 56
 }
57 57
\ No newline at end of file
Please login to merge, or discard this patch.
src/admin/partials/wordlift-admin-settings-general-page.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 if ( ! defined( 'ABSPATH' ) ) {
10
-	exit;
10
+    exit;
11 11
 }
12 12
 ?>
13 13
 
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
 
16 16
 <form action="options.php" method="post">
17 17
 	<?php
18
-	settings_fields( 'wl_general_settings' );
19
-	do_settings_sections( 'wl_general_settings' );
20
-	submit_button();
21
-	?>
18
+    settings_fields( 'wl_general_settings' );
19
+    do_settings_sections( 'wl_general_settings' );
20
+    submit_button();
21
+    ?>
22 22
 </form>
23 23
\ 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
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package Wordlift/admin
7 7
  */
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 ?>
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
 
16 16
 <form action="options.php" method="post">
17 17
 	<?php
18
-	settings_fields( 'wl_general_settings' );
19
-	do_settings_sections( 'wl_general_settings' );
18
+	settings_fields('wl_general_settings');
19
+	do_settings_sections('wl_general_settings');
20 20
 	submit_button();
21 21
 	?>
22 22
 </form>
23 23
\ No newline at end of file
Please login to merge, or discard this patch.
src/admin/partials/wordlift-admin-mappings-page.php 2 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -17,50 +17,50 @@  discard block
 block discarded – undo
17 17
 
18 18
 	<?php
19 19
 
20
-	$mappings = array_reduce(
21
-	// The list of valid post types.
22
-		Wordlift_Entity_Service::valid_entity_post_types(),
20
+    $mappings = array_reduce(
21
+    // The list of valid post types.
22
+        Wordlift_Entity_Service::valid_entity_post_types(),
23 23
 
24
-		function ( $carry, $post_type ) use ( $mapping_service ) {
25
-			$entity_types = array_filter( Wordlift_Entity_Type_Adapter::get_entity_types( $post_type ),
26
-				function ( $item ) {
27
-					return 'http://schema.org/Article' !== $item;
28
-				} );
24
+        function ( $carry, $post_type ) use ( $mapping_service ) {
25
+            $entity_types = array_filter( Wordlift_Entity_Type_Adapter::get_entity_types( $post_type ),
26
+                function ( $item ) {
27
+                    return 'http://schema.org/Article' !== $item;
28
+                } );
29 29
 
30
-			if ( empty( $entity_types ) ) {
31
-				return $carry;
32
-			}
30
+            if ( empty( $entity_types ) ) {
31
+                return $carry;
32
+            }
33 33
 
34
-			return $carry + array(
35
-					$post_type => array(
36
-						'entity_types' => $entity_types,
37
-						'count'        => $mapping_service->count( $post_type, $entity_types ),
38
-					),
39
-				);
40
-		},
41
-		array() );
34
+            return $carry + array(
35
+                    $post_type => array(
36
+                        'entity_types' => $entity_types,
37
+                        'count'        => $mapping_service->count( $post_type, $entity_types ),
38
+                    ),
39
+                );
40
+        },
41
+        array() );
42 42
 
43
-	$mappings['_nonce'] = wp_create_nonce( 'update_post_type_entity_types' );
43
+    $mappings['_nonce'] = wp_create_nonce( 'update_post_type_entity_types' );
44 44
 
45 45
 
46
-	$json = wp_json_encode( $mappings );
47
-	echo "<script type='application/javascript'>var wlMappings = $json;</script>";
46
+    $json = wp_json_encode( $mappings );
47
+    echo "<script type='application/javascript'>var wlMappings = $json;</script>";
48 48
 
49
-	?>
49
+    ?>
50 50
 
51 51
 	<?php
52 52
 
53
-	foreach ( $mappings as $key => $value ) {
54
-		// Continue if this is the nonce.
55
-		if ( '_nonce' == $key ) {
56
-			continue;
57
-		}
58
-
59
-		// Continue if the count isn't set or it's zero, i.e. no need to apply the taxonomy.
60
-		if ( ! isset( $value['count'] ) || 0 === $value['count'] ) {
61
-			continue;
62
-		}
63
-		?>
53
+    foreach ( $mappings as $key => $value ) {
54
+        // Continue if this is the nonce.
55
+        if ( '_nonce' == $key ) {
56
+            continue;
57
+        }
58
+
59
+        // Continue if the count isn't set or it's zero, i.e. no need to apply the taxonomy.
60
+        if ( ! isset( $value['count'] ) || 0 === $value['count'] ) {
61
+            continue;
62
+        }
63
+        ?>
64 64
         <div class="post-type-to-entity-types">
65 65
             <button data-post-type="<?php echo esc_attr( $key ); ?>"
66 66
                     data-entity-types="<?php echo esc_attr( wp_json_encode( $value['entity_types'] ) ); ?>"
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
             <div><?php echo esc_html( $value['count'] ); ?></div>
69 69
         </div>
70 70
 		<?php
71
-	}
71
+    }
72 72
 
73
-	?>
73
+    ?>
74 74
 
75 75
     <div id="schemaorg-sync">
76 76
         <button>Sync Schema.org classes</button>
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@  discard block
 block discarded – undo
6 6
  * @package Wordlift
7 7
  * @subpackage Wordlift/admin/partials
8 8
  */
9
-wp_enqueue_script( 'wp-util' );
9
+wp_enqueue_script('wp-util');
10 10
 
11 11
 $mapping_service = Wordlift_Mapping_Service::get_instance();
12 12
 ?>
13 13
 <div id="wpbody-content" aria-label="Main content" tabindex="0">
14 14
     <div class="wrap">
15
-        <h1><?php echo esc_html__( 'Mappings', 'wordlift' ); ?></h1>
15
+        <h1><?php echo esc_html__('Mappings', 'wordlift'); ?></h1>
16 16
     </div>
17 17
 
18 18
 	<?php
@@ -21,51 +21,51 @@  discard block
 block discarded – undo
21 21
 	// The list of valid post types.
22 22
 		Wordlift_Entity_Service::valid_entity_post_types(),
23 23
 
24
-		function ( $carry, $post_type ) use ( $mapping_service ) {
25
-			$entity_types = array_filter( Wordlift_Entity_Type_Adapter::get_entity_types( $post_type ),
26
-				function ( $item ) {
24
+		function($carry, $post_type) use ($mapping_service) {
25
+			$entity_types = array_filter(Wordlift_Entity_Type_Adapter::get_entity_types($post_type),
26
+				function($item) {
27 27
 					return 'http://schema.org/Article' !== $item;
28 28
 				} );
29 29
 
30
-			if ( empty( $entity_types ) ) {
30
+			if (empty($entity_types)) {
31 31
 				return $carry;
32 32
 			}
33 33
 
34 34
 			return $carry + array(
35 35
 					$post_type => array(
36 36
 						'entity_types' => $entity_types,
37
-						'count'        => $mapping_service->count( $post_type, $entity_types ),
37
+						'count'        => $mapping_service->count($post_type, $entity_types),
38 38
 					),
39 39
 				);
40 40
 		},
41 41
 		array() );
42 42
 
43
-	$mappings['_nonce'] = wp_create_nonce( 'update_post_type_entity_types' );
43
+	$mappings['_nonce'] = wp_create_nonce('update_post_type_entity_types');
44 44
 
45 45
 
46
-	$json = wp_json_encode( $mappings );
46
+	$json = wp_json_encode($mappings);
47 47
 	echo "<script type='application/javascript'>var wlMappings = $json;</script>";
48 48
 
49 49
 	?>
50 50
 
51 51
 	<?php
52 52
 
53
-	foreach ( $mappings as $key => $value ) {
53
+	foreach ($mappings as $key => $value) {
54 54
 		// Continue if this is the nonce.
55
-		if ( '_nonce' == $key ) {
55
+		if ('_nonce' == $key) {
56 56
 			continue;
57 57
 		}
58 58
 
59 59
 		// Continue if the count isn't set or it's zero, i.e. no need to apply the taxonomy.
60
-		if ( ! isset( $value['count'] ) || 0 === $value['count'] ) {
60
+		if ( ! isset($value['count']) || 0 === $value['count']) {
61 61
 			continue;
62 62
 		}
63 63
 		?>
64 64
         <div class="post-type-to-entity-types">
65
-            <button data-post-type="<?php echo esc_attr( $key ); ?>"
66
-                    data-entity-types="<?php echo esc_attr( wp_json_encode( $value['entity_types'] ) ); ?>"
67
-            ><?php echo esc_html( $key ); ?></button>
68
-            <div><?php echo esc_html( $value['count'] ); ?></div>
65
+            <button data-post-type="<?php echo esc_attr($key); ?>"
66
+                    data-entity-types="<?php echo esc_attr(wp_json_encode($value['entity_types'])); ?>"
67
+            ><?php echo esc_html($key); ?></button>
68
+            <div><?php echo esc_html($value['count']); ?></div>
69 69
         </div>
70 70
 		<?php
71 71
 	}
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
     <div id="schemaorg-sync">
76 76
         <button>Sync Schema.org classes</button>
77
-        <div class="count"><?php echo esc_html( Wordlift_Schemaorg_Sync_Batch_Operation::get_instance()->count() ); ?></div>
77
+        <div class="count"><?php echo esc_html(Wordlift_Schemaorg_Sync_Batch_Operation::get_instance()->count()); ?></div>
78 78
     </div>
79 79
 
80 80
     <div class="clear"></div>
Please login to merge, or discard this patch.
src/includes/class-wordlift-batch-action.php 2 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -9,58 +9,58 @@
 block discarded – undo
9 9
 class Wordlift_Batch_Action {
10 10
 
11 11
 
12
-	public static function process( $post_type, $offset, $query, $callback ) {
12
+    public static function process( $post_type, $offset, $query, $callback ) {
13 13
 
14
-		$posts_per_page = 10;
14
+        $posts_per_page = 10;
15 15
 
16
-		$args = array_merge(
17
-			self::get_args( $post_type, $query ),
18
-			array(
19
-				'offset'         => $offset,
20
-				'posts_per_page' => $posts_per_page,
21
-			)
22
-		);
16
+        $args = array_merge(
17
+            self::get_args( $post_type, $query ),
18
+            array(
19
+                'offset'         => $offset,
20
+                'posts_per_page' => $posts_per_page,
21
+            )
22
+        );
23 23
 
24
-		$post_ids = get_posts( $args );
24
+        $post_ids = get_posts( $args );
25 25
 
26
-		foreach ( $post_ids as $post_id ) {
27
-			call_user_func( $callback, $post_id );
28
-		}
26
+        foreach ( $post_ids as $post_id ) {
27
+            call_user_func( $callback, $post_id );
28
+        }
29 29
 
30
-		return array(
31
-			'current' => $offset,
32
-			'next'    => $offset + $posts_per_page,
33
-			'count'   => self::count( $post_type, $query ),
34
-		);
35
-	}
30
+        return array(
31
+            'current' => $offset,
32
+            'next'    => $offset + $posts_per_page,
33
+            'count'   => self::count( $post_type, $query ),
34
+        );
35
+    }
36 36
 
37
-	public static function count( $post_type, $query ) {
38
-		$args = array_merge(
39
-			self::get_args( $post_type, $query ),
40
-			array(
41
-				'posts_per_page' => - 1,
42
-			)
43
-		);
37
+    public static function count( $post_type, $query ) {
38
+        $args = array_merge(
39
+            self::get_args( $post_type, $query ),
40
+            array(
41
+                'posts_per_page' => - 1,
42
+            )
43
+        );
44 44
 
45
-		return count( get_posts( $args ) );
46
-	}
45
+        return count( get_posts( $args ) );
46
+    }
47 47
 
48
-	private static function get_args( $post_type, $query ) {
48
+    private static function get_args( $post_type, $query ) {
49 49
 
50
-		return array_merge( array(
51
-			'fields'        => 'ids',
52
-			'post_type'     => $post_type,
53
-			'post_status'   => array(
54
-				'publish',
55
-				'future',
56
-				'draft',
57
-				'pending',
58
-				'private',
59
-				'auto-draft',
60
-				'inherit',
61
-			),
62
-			'cache_results' => false,
63
-		), $query );
64
-	}
50
+        return array_merge( array(
51
+            'fields'        => 'ids',
52
+            'post_type'     => $post_type,
53
+            'post_status'   => array(
54
+                'publish',
55
+                'future',
56
+                'draft',
57
+                'pending',
58
+                'private',
59
+                'auto-draft',
60
+                'inherit',
61
+            ),
62
+            'cache_results' => false,
63
+        ), $query );
64
+    }
65 65
 
66 66
 }
67 67
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -9,45 +9,45 @@  discard block
 block discarded – undo
9 9
 class Wordlift_Batch_Action {
10 10
 
11 11
 
12
-	public static function process( $post_type, $offset, $query, $callback ) {
12
+	public static function process($post_type, $offset, $query, $callback) {
13 13
 
14 14
 		$posts_per_page = 10;
15 15
 
16 16
 		$args = array_merge(
17
-			self::get_args( $post_type, $query ),
17
+			self::get_args($post_type, $query),
18 18
 			array(
19 19
 				'offset'         => $offset,
20 20
 				'posts_per_page' => $posts_per_page,
21 21
 			)
22 22
 		);
23 23
 
24
-		$post_ids = get_posts( $args );
24
+		$post_ids = get_posts($args);
25 25
 
26
-		foreach ( $post_ids as $post_id ) {
27
-			call_user_func( $callback, $post_id );
26
+		foreach ($post_ids as $post_id) {
27
+			call_user_func($callback, $post_id);
28 28
 		}
29 29
 
30 30
 		return array(
31 31
 			'current' => $offset,
32 32
 			'next'    => $offset + $posts_per_page,
33
-			'count'   => self::count( $post_type, $query ),
33
+			'count'   => self::count($post_type, $query),
34 34
 		);
35 35
 	}
36 36
 
37
-	public static function count( $post_type, $query ) {
37
+	public static function count($post_type, $query) {
38 38
 		$args = array_merge(
39
-			self::get_args( $post_type, $query ),
39
+			self::get_args($post_type, $query),
40 40
 			array(
41
-				'posts_per_page' => - 1,
41
+				'posts_per_page' => -1,
42 42
 			)
43 43
 		);
44 44
 
45
-		return count( get_posts( $args ) );
45
+		return count(get_posts($args));
46 46
 	}
47 47
 
48
-	private static function get_args( $post_type, $query ) {
48
+	private static function get_args($post_type, $query) {
49 49
 
50
-		return array_merge( array(
50
+		return array_merge(array(
51 51
 			'fields'        => 'ids',
52 52
 			'post_type'     => $post_type,
53 53
 			'post_status'   => array(
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 				'inherit',
61 61
 			),
62 62
 			'cache_results' => false,
63
-		), $query );
63
+		), $query);
64 64
 	}
65 65
 
66 66
 }
67 67
\ No newline at end of file
Please login to merge, or discard this patch.
src/includes/schemaorg/class-wordlift-schemaorg-sync-service.php 2 patches
Indentation   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -16,127 +16,127 @@
 block discarded – undo
16 16
  */
17 17
 class Wordlift_Schemaorg_Sync_Service {
18 18
 
19
-	/**
20
-	 * A {@link Wordlift_Log_Service} instance.
21
-	 *
22
-	 * @since 3.20.0
23
-	 * @access private
24
-	 * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
25
-	 */
26
-	private $log;
27
-
28
-	/**
29
-	 * The singleton instance.
30
-	 *
31
-	 * @since 3.20.0
32
-	 * @access private
33
-	 * @var \Wordlift_Schemaorg_Sync_Service $instance The singleton instance.
34
-	 */
35
-	private static $instance;
36
-
37
-	/**
38
-	 * Create a {@link Wordlift_Schemaorg_Sync_Service} instance.
39
-	 *
40
-	 * @since 3.20.0
41
-	 */
42
-	public function __construct() {
43
-
44
-		$this->log = Wordlift_Log_Service::get_logger( get_class() );
45
-
46
-		// Hook the `wl_sync_schemaorg` ajax action.
47
-		add_action( 'wp_ajax_wl_sync_schemaorg', array( $this, 'load' ) );
48
-
49
-		self::$instance = $this;
50
-
51
-	}
52
-
53
-	/**
54
-	 * Get the singleton instance.
55
-	 *
56
-	 * @since 3.20.0
57
-	 *
58
-	 * @return \Wordlift_Schemaorg_Sync_Service The singleton instance.
59
-	 */
60
-	public static function get_instance() {
61
-
62
-		return self::$instance;
63
-	}
64
-
65
-	/**
66
-	 * Load the Schema.org classes from a file.
67
-	 *
68
-	 * @since 3.20.0
69
-	 *
70
-	 * @return bool True if successful otherwise false.
71
-	 */
72
-	public function load_from_file() {
73
-
74
-		// Load the file contents.
75
-		$contents = file_get_contents( dirname( __FILE__ ) . '/schema-classes.json' );
76
-
77
-		// Load the file contents.
78
-		return $this->load( $contents );
79
-	}
80
-
81
-	/**
82
-	 * Load the Schema.org classes from the provided contents.
83
-	 *
84
-	 * @param $contents
85
-	 *
86
-	 * @return bool
87
-	 */
88
-	private function load( $contents ) {
89
-
90
-		// Decode the JSON contents.
91
-		$json = json_decode( $contents, true );
92
-
93
-		if ( null === $json ) {
94
-			$this->log->error( 'Invalid json.' );
95
-
96
-			// Error: invalid body.
97
-			return false;
98
-		}
99
-
100
-		if ( ! isset( $json['schemaClasses'] ) ) {
101
-			$this->log->error( '`schemaClasses` missing from json.' );
102
-
103
-			// Error: invalid json.
104
-			return false;
105
-		}
106
-
107
-		// Load the Schema.org classes.
108
-		foreach ( $json['schemaClasses'] as $schema_class ) {
109
-			$slug = $schema_class['dashname'];
110
-			$term = term_exists( $slug, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
111
-
112
-			$args = array(
113
-				'parent'      => 0,
114
-				'description' => $schema_class['description'],
115
-				'slug'        => $schema_class['dashname'],
116
-			);
117
-			if ( null !== $term ) {
118
-				wp_update_term( $term['term_id'], Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, $args );
119
-			} else {
120
-				$term = wp_insert_term( $schema_class['name'], Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, $args );
121
-			}
122
-
123
-			// Update the parents/children relationship.
124
-			delete_term_meta( $term['term_id'], Wordlift_Schemaorg_Class_Service::PARENT_OF_META_KEY );
125
-			foreach ( $schema_class['children'] as $child ) {
126
-				add_term_meta( $term['term_id'], Wordlift_Schemaorg_Class_Service::PARENT_OF_META_KEY, $child['dashname'] );
127
-			}
128
-
129
-			// Update the term name.
130
-			delete_term_meta( $term['term_id'], Wordlift_Schemaorg_Class_Service::NAME_META_KEY );
131
-			update_term_meta( $term['term_id'], Wordlift_Schemaorg_Class_Service::NAME_META_KEY, $schema_class['name'] );
132
-
133
-			// Update the term URI.
134
-			delete_term_meta( $term['term_id'], Wordlift_Schemaorg_Class_Service::URI_META_KEY );
135
-			update_term_meta( $term['term_id'], Wordlift_Schemaorg_Class_Service::URI_META_KEY, "http://schema.org/{$schema_class['name']}" );
136
-
137
-		}
138
-
139
-		return true;
140
-	}
19
+    /**
20
+     * A {@link Wordlift_Log_Service} instance.
21
+     *
22
+     * @since 3.20.0
23
+     * @access private
24
+     * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
25
+     */
26
+    private $log;
27
+
28
+    /**
29
+     * The singleton instance.
30
+     *
31
+     * @since 3.20.0
32
+     * @access private
33
+     * @var \Wordlift_Schemaorg_Sync_Service $instance The singleton instance.
34
+     */
35
+    private static $instance;
36
+
37
+    /**
38
+     * Create a {@link Wordlift_Schemaorg_Sync_Service} instance.
39
+     *
40
+     * @since 3.20.0
41
+     */
42
+    public function __construct() {
43
+
44
+        $this->log = Wordlift_Log_Service::get_logger( get_class() );
45
+
46
+        // Hook the `wl_sync_schemaorg` ajax action.
47
+        add_action( 'wp_ajax_wl_sync_schemaorg', array( $this, 'load' ) );
48
+
49
+        self::$instance = $this;
50
+
51
+    }
52
+
53
+    /**
54
+     * Get the singleton instance.
55
+     *
56
+     * @since 3.20.0
57
+     *
58
+     * @return \Wordlift_Schemaorg_Sync_Service The singleton instance.
59
+     */
60
+    public static function get_instance() {
61
+
62
+        return self::$instance;
63
+    }
64
+
65
+    /**
66
+     * Load the Schema.org classes from a file.
67
+     *
68
+     * @since 3.20.0
69
+     *
70
+     * @return bool True if successful otherwise false.
71
+     */
72
+    public function load_from_file() {
73
+
74
+        // Load the file contents.
75
+        $contents = file_get_contents( dirname( __FILE__ ) . '/schema-classes.json' );
76
+
77
+        // Load the file contents.
78
+        return $this->load( $contents );
79
+    }
80
+
81
+    /**
82
+     * Load the Schema.org classes from the provided contents.
83
+     *
84
+     * @param $contents
85
+     *
86
+     * @return bool
87
+     */
88
+    private function load( $contents ) {
89
+
90
+        // Decode the JSON contents.
91
+        $json = json_decode( $contents, true );
92
+
93
+        if ( null === $json ) {
94
+            $this->log->error( 'Invalid json.' );
95
+
96
+            // Error: invalid body.
97
+            return false;
98
+        }
99
+
100
+        if ( ! isset( $json['schemaClasses'] ) ) {
101
+            $this->log->error( '`schemaClasses` missing from json.' );
102
+
103
+            // Error: invalid json.
104
+            return false;
105
+        }
106
+
107
+        // Load the Schema.org classes.
108
+        foreach ( $json['schemaClasses'] as $schema_class ) {
109
+            $slug = $schema_class['dashname'];
110
+            $term = term_exists( $slug, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
111
+
112
+            $args = array(
113
+                'parent'      => 0,
114
+                'description' => $schema_class['description'],
115
+                'slug'        => $schema_class['dashname'],
116
+            );
117
+            if ( null !== $term ) {
118
+                wp_update_term( $term['term_id'], Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, $args );
119
+            } else {
120
+                $term = wp_insert_term( $schema_class['name'], Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, $args );
121
+            }
122
+
123
+            // Update the parents/children relationship.
124
+            delete_term_meta( $term['term_id'], Wordlift_Schemaorg_Class_Service::PARENT_OF_META_KEY );
125
+            foreach ( $schema_class['children'] as $child ) {
126
+                add_term_meta( $term['term_id'], Wordlift_Schemaorg_Class_Service::PARENT_OF_META_KEY, $child['dashname'] );
127
+            }
128
+
129
+            // Update the term name.
130
+            delete_term_meta( $term['term_id'], Wordlift_Schemaorg_Class_Service::NAME_META_KEY );
131
+            update_term_meta( $term['term_id'], Wordlift_Schemaorg_Class_Service::NAME_META_KEY, $schema_class['name'] );
132
+
133
+            // Update the term URI.
134
+            delete_term_meta( $term['term_id'], Wordlift_Schemaorg_Class_Service::URI_META_KEY );
135
+            update_term_meta( $term['term_id'], Wordlift_Schemaorg_Class_Service::URI_META_KEY, "http://schema.org/{$schema_class['name']}" );
136
+
137
+        }
138
+
139
+        return true;
140
+    }
141 141
 
142 142
 }
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public function __construct() {
43 43
 
44
-		$this->log = Wordlift_Log_Service::get_logger( get_class() );
44
+		$this->log = Wordlift_Log_Service::get_logger(get_class());
45 45
 
46 46
 		// Hook the `wl_sync_schemaorg` ajax action.
47
-		add_action( 'wp_ajax_wl_sync_schemaorg', array( $this, 'load' ) );
47
+		add_action('wp_ajax_wl_sync_schemaorg', array($this, 'load'));
48 48
 
49 49
 		self::$instance = $this;
50 50
 
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
 	public function load_from_file() {
73 73
 
74 74
 		// Load the file contents.
75
-		$contents = file_get_contents( dirname( __FILE__ ) . '/schema-classes.json' );
75
+		$contents = file_get_contents(dirname(__FILE__).'/schema-classes.json');
76 76
 
77 77
 		// Load the file contents.
78
-		return $this->load( $contents );
78
+		return $this->load($contents);
79 79
 	}
80 80
 
81 81
 	/**
@@ -85,54 +85,54 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @return bool
87 87
 	 */
88
-	private function load( $contents ) {
88
+	private function load($contents) {
89 89
 
90 90
 		// Decode the JSON contents.
91
-		$json = json_decode( $contents, true );
91
+		$json = json_decode($contents, true);
92 92
 
93
-		if ( null === $json ) {
94
-			$this->log->error( 'Invalid json.' );
93
+		if (null === $json) {
94
+			$this->log->error('Invalid json.');
95 95
 
96 96
 			// Error: invalid body.
97 97
 			return false;
98 98
 		}
99 99
 
100
-		if ( ! isset( $json['schemaClasses'] ) ) {
101
-			$this->log->error( '`schemaClasses` missing from json.' );
100
+		if ( ! isset($json['schemaClasses'])) {
101
+			$this->log->error('`schemaClasses` missing from json.');
102 102
 
103 103
 			// Error: invalid json.
104 104
 			return false;
105 105
 		}
106 106
 
107 107
 		// Load the Schema.org classes.
108
-		foreach ( $json['schemaClasses'] as $schema_class ) {
108
+		foreach ($json['schemaClasses'] as $schema_class) {
109 109
 			$slug = $schema_class['dashname'];
110
-			$term = term_exists( $slug, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
110
+			$term = term_exists($slug, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME);
111 111
 
112 112
 			$args = array(
113 113
 				'parent'      => 0,
114 114
 				'description' => $schema_class['description'],
115 115
 				'slug'        => $schema_class['dashname'],
116 116
 			);
117
-			if ( null !== $term ) {
118
-				wp_update_term( $term['term_id'], Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, $args );
117
+			if (null !== $term) {
118
+				wp_update_term($term['term_id'], Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, $args);
119 119
 			} else {
120
-				$term = wp_insert_term( $schema_class['name'], Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, $args );
120
+				$term = wp_insert_term($schema_class['name'], Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, $args);
121 121
 			}
122 122
 
123 123
 			// Update the parents/children relationship.
124
-			delete_term_meta( $term['term_id'], Wordlift_Schemaorg_Class_Service::PARENT_OF_META_KEY );
125
-			foreach ( $schema_class['children'] as $child ) {
126
-				add_term_meta( $term['term_id'], Wordlift_Schemaorg_Class_Service::PARENT_OF_META_KEY, $child['dashname'] );
124
+			delete_term_meta($term['term_id'], Wordlift_Schemaorg_Class_Service::PARENT_OF_META_KEY);
125
+			foreach ($schema_class['children'] as $child) {
126
+				add_term_meta($term['term_id'], Wordlift_Schemaorg_Class_Service::PARENT_OF_META_KEY, $child['dashname']);
127 127
 			}
128 128
 
129 129
 			// Update the term name.
130
-			delete_term_meta( $term['term_id'], Wordlift_Schemaorg_Class_Service::NAME_META_KEY );
131
-			update_term_meta( $term['term_id'], Wordlift_Schemaorg_Class_Service::NAME_META_KEY, $schema_class['name'] );
130
+			delete_term_meta($term['term_id'], Wordlift_Schemaorg_Class_Service::NAME_META_KEY);
131
+			update_term_meta($term['term_id'], Wordlift_Schemaorg_Class_Service::NAME_META_KEY, $schema_class['name']);
132 132
 
133 133
 			// Update the term URI.
134
-			delete_term_meta( $term['term_id'], Wordlift_Schemaorg_Class_Service::URI_META_KEY );
135
-			update_term_meta( $term['term_id'], Wordlift_Schemaorg_Class_Service::URI_META_KEY, "http://schema.org/{$schema_class['name']}" );
134
+			delete_term_meta($term['term_id'], Wordlift_Schemaorg_Class_Service::URI_META_KEY);
135
+			update_term_meta($term['term_id'], Wordlift_Schemaorg_Class_Service::URI_META_KEY, "http://schema.org/{$schema_class['name']}");
136 136
 
137 137
 		}
138 138
 
Please login to merge, or discard this patch.
src/includes/batch/intf-wordlift-batch-operation.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -15,32 +15,32 @@
 block discarded – undo
15 15
  */
16 16
 interface Wordlift_Batch_Operation_Interface {
17 17
 
18
-	/**
19
-	 * Process the batch operation starting from the specified offset.
20
-	 *
21
-	 * @since 3.20.0
22
-	 *
23
-	 * @param int $offset Start from the specified offset (or 0 if not specified).
24
-	 * @param int $limit Process the specified amount of items per call (or 10 if not specified).
25
-	 *
26
-	 * @return array {
27
-	 * The operation result.
28
-	 *
29
-	 * @type int  $next The next offset.
30
-	 * @type int  $limit The amount of items to process per call.
31
-	 * @type int  $remaining The remaining number of elements to process.
32
-	 * @type bool $complete Whether the operation completed.
33
-	 * }
34
-	 */
35
-	public function process( $offset = 0, $limit = 10 );
18
+    /**
19
+     * Process the batch operation starting from the specified offset.
20
+     *
21
+     * @since 3.20.0
22
+     *
23
+     * @param int $offset Start from the specified offset (or 0 if not specified).
24
+     * @param int $limit Process the specified amount of items per call (or 10 if not specified).
25
+     *
26
+     * @return array {
27
+     * The operation result.
28
+     *
29
+     * @type int  $next The next offset.
30
+     * @type int  $limit The amount of items to process per call.
31
+     * @type int  $remaining The remaining number of elements to process.
32
+     * @type bool $complete Whether the operation completed.
33
+     * }
34
+     */
35
+    public function process( $offset = 0, $limit = 10 );
36 36
 
37
-	/**
38
-	 * Count the number of elements that would be affected by the operation.
39
-	 *
40
-	 * @since 3.20.0
41
-	 *
42
-	 * @return int The number of elements that would be affected.
43
-	 */
44
-	public function count();
37
+    /**
38
+     * Count the number of elements that would be affected by the operation.
39
+     *
40
+     * @since 3.20.0
41
+     *
42
+     * @return int The number of elements that would be affected.
43
+     */
44
+    public function count();
45 45
 
46 46
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 	 * @type bool $complete Whether the operation completed.
33 33
 	 * }
34 34
 	 */
35
-	public function process( $offset = 0, $limit = 10 );
35
+	public function process($offset = 0, $limit = 10);
36 36
 
37 37
 	/**
38 38
 	 * Count the number of elements that would be affected by the operation.
Please login to merge, or discard this patch.
includes/linked-data/storage/class-wordlift-post-schema-class-storage.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -18,34 +18,34 @@
 block discarded – undo
18 18
  */
19 19
 class Wordlift_Post_Schema_Class_Storage extends Wordlift_Storage {
20 20
 
21
-	/**
22
-	 * Get the schema class for the specified {@link WP_Post}.
23
-	 *
24
-	 * @since 3.15.0
25
-	 *
26
-	 * @param int $post_id The {@link WP_Post}'s id.
27
-	 *
28
-	 * @return string|array An array of schema classes.
29
-	 */
30
-	public function get( $post_id ) {
31
-
32
-		// Get the type names (CamelCase).
33
-		$names = Wordlift_Entity_Type_Service::get_instance()->get_names( $post_id );
34
-
35
-		// If we don't find any type use the legacy function to get the URI.
36
-		if ( empty( $names ) ) {
37
-			$type = Wordlift_Entity_Type_Service::get_instance()->get( $post_id );
38
-
39
-			return $type['uri'];
40
-		}
41
-
42
-		// Prepend the `schema.org` base URI.
43
-		$uris = array_map( function( $item ) {
44
-			return "http://schema.org/$item";
45
-		}, $names );
46
-
47
-		// Finally return the schema uri.
48
-		return 1 === count( $uris ) ? $uris[0] : $uris;
49
-	}
21
+    /**
22
+     * Get the schema class for the specified {@link WP_Post}.
23
+     *
24
+     * @since 3.15.0
25
+     *
26
+     * @param int $post_id The {@link WP_Post}'s id.
27
+     *
28
+     * @return string|array An array of schema classes.
29
+     */
30
+    public function get( $post_id ) {
31
+
32
+        // Get the type names (CamelCase).
33
+        $names = Wordlift_Entity_Type_Service::get_instance()->get_names( $post_id );
34
+
35
+        // If we don't find any type use the legacy function to get the URI.
36
+        if ( empty( $names ) ) {
37
+            $type = Wordlift_Entity_Type_Service::get_instance()->get( $post_id );
38
+
39
+            return $type['uri'];
40
+        }
41
+
42
+        // Prepend the `schema.org` base URI.
43
+        $uris = array_map( function( $item ) {
44
+            return "http://schema.org/$item";
45
+        }, $names );
46
+
47
+        // Finally return the schema uri.
48
+        return 1 === count( $uris ) ? $uris[0] : $uris;
49
+    }
50 50
 
51 51
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,25 +27,25 @@
 block discarded – undo
27 27
 	 *
28 28
 	 * @return string|array An array of schema classes.
29 29
 	 */
30
-	public function get( $post_id ) {
30
+	public function get($post_id) {
31 31
 
32 32
 		// Get the type names (CamelCase).
33
-		$names = Wordlift_Entity_Type_Service::get_instance()->get_names( $post_id );
33
+		$names = Wordlift_Entity_Type_Service::get_instance()->get_names($post_id);
34 34
 
35 35
 		// If we don't find any type use the legacy function to get the URI.
36
-		if ( empty( $names ) ) {
37
-			$type = Wordlift_Entity_Type_Service::get_instance()->get( $post_id );
36
+		if (empty($names)) {
37
+			$type = Wordlift_Entity_Type_Service::get_instance()->get($post_id);
38 38
 
39 39
 			return $type['uri'];
40 40
 		}
41 41
 
42 42
 		// Prepend the `schema.org` base URI.
43
-		$uris = array_map( function( $item ) {
43
+		$uris = array_map(function($item) {
44 44
 			return "http://schema.org/$item";
45
-		}, $names );
45
+		}, $names);
46 46
 
47 47
 		// Finally return the schema uri.
48
-		return 1 === count( $uris ) ? $uris[0] : $uris;
48
+		return 1 === count($uris) ? $uris[0] : $uris;
49 49
 	}
50 50
 
51 51
 }
Please login to merge, or discard this patch.
src/modules/core/wordlift_core_constants.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -14,55 +14,55 @@
 block discarded – undo
14 14
 // Mapping options / validations rules used by wl_core_get_posts to perform validation on args
15 15
 // The array is serialized because array constants are only from php 5.6 on.
16 16
 define( 'WL_CORE_GET_POSTS_VALIDATION_RULES', serialize( array(
17
-	'get'            => array( 'posts', 'post_ids' ),
18
-	'as'             => array( 'object', 'subject' ),
19
-	'post_type'      => array( 'post', 'entity' ),
20
-	'post_status'    => array( 'draft', 'trash', 'publish' ),
21
-	'with_predicate' => array(
22
-		WL_WHAT_RELATION,
23
-		WL_WHEN_RELATION,
24
-		WL_WHERE_RELATION,
25
-		WL_WHO_RELATION,
26
-	),
17
+    'get'            => array( 'posts', 'post_ids' ),
18
+    'as'             => array( 'object', 'subject' ),
19
+    'post_type'      => array( 'post', 'entity' ),
20
+    'post_status'    => array( 'draft', 'trash', 'publish' ),
21
+    'with_predicate' => array(
22
+        WL_WHAT_RELATION,
23
+        WL_WHEN_RELATION,
24
+        WL_WHERE_RELATION,
25
+        WL_WHO_RELATION,
26
+    ),
27 27
 ) ) );
28 28
 
29 29
 // Classification boxes configuration for angularjs edit-post widget
30 30
 // The array is serialized because array constants are only from php 5.6 on.
31 31
 
32 32
 define( 'WL_CORE_POST_CLASSIFICATION_BOXES', serialize( array(
33
-	array(
34
-		'id'               => WL_WHAT_RELATION,
35
-		'label'            => 'What',
36
-		'registeredTypes'  => array(
37
-			'thing',
38
-			'creative-work',
39
-			'recipe',
40
-		),
41
-		'selectedEntities' => array(),
42
-	),
43
-	array(
44
-		'id'               => WL_WHO_RELATION,
45
-		'label'            => 'Who',
46
-		'registeredTypes'  => array(
47
-			'organization',
48
-			'person',
49
-			'local-business',
50
-			'localbusiness',
51
-		),
52
-		'selectedEntities' => array(),
53
-	),
54
-	array(
55
-		'id'               => WL_WHERE_RELATION,
56
-		'label'            => 'Where',
57
-		'registeredTypes'  => array( 'place' ),
58
-		'selectedEntities' => array(),
59
-	),
60
-	array(
61
-		'id'               => WL_WHEN_RELATION,
62
-		'label'            => 'When',
63
-		'registeredTypes'  => array( 'event' ),
64
-		'selectedEntities' => array(),
65
-	),
33
+    array(
34
+        'id'               => WL_WHAT_RELATION,
35
+        'label'            => 'What',
36
+        'registeredTypes'  => array(
37
+            'thing',
38
+            'creative-work',
39
+            'recipe',
40
+        ),
41
+        'selectedEntities' => array(),
42
+    ),
43
+    array(
44
+        'id'               => WL_WHO_RELATION,
45
+        'label'            => 'Who',
46
+        'registeredTypes'  => array(
47
+            'organization',
48
+            'person',
49
+            'local-business',
50
+            'localbusiness',
51
+        ),
52
+        'selectedEntities' => array(),
53
+    ),
54
+    array(
55
+        'id'               => WL_WHERE_RELATION,
56
+        'label'            => 'Where',
57
+        'registeredTypes'  => array( 'place' ),
58
+        'selectedEntities' => array(),
59
+    ),
60
+    array(
61
+        'id'               => WL_WHEN_RELATION,
62
+        'label'            => 'When',
63
+        'registeredTypes'  => array( 'event' ),
64
+        'selectedEntities' => array(),
65
+    ),
66 66
 ) ) );
67 67
 
68 68
 // Default namespace for wp-json
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,63 +1,63 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-define( 'WL_DEFAULT_THUMBNAIL_PATH', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/public/images/missing-image-150x150.png' );
4
-define( 'WL_DEFAULT_PATH', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/' );
3
+define('WL_DEFAULT_THUMBNAIL_PATH', dirname(dirname(plugin_dir_url(__FILE__))).'/public/images/missing-image-150x150.png');
4
+define('WL_DEFAULT_PATH', dirname(dirname(plugin_dir_url(__FILE__))).'/');
5 5
 
6 6
 // Custom table name
7
-define( 'WL_DB_RELATION_INSTANCES_TABLE_NAME', 'wl_relation_instances' );
7
+define('WL_DB_RELATION_INSTANCES_TABLE_NAME', 'wl_relation_instances');
8 8
 
9
-define( 'WL_WHAT_RELATION', 'what' );
10
-define( 'WL_WHO_RELATION', 'who' );
11
-define( 'WL_WHERE_RELATION', 'where' );
12
-define( 'WL_WHEN_RELATION', 'when' );
9
+define('WL_WHAT_RELATION', 'what');
10
+define('WL_WHO_RELATION', 'who');
11
+define('WL_WHERE_RELATION', 'where');
12
+define('WL_WHEN_RELATION', 'when');
13 13
 
14 14
 /**
15 15
  * Define wl_mapping_table_name
16 16
  *
17 17
  * @since 3.25.0
18 18
  */
19
-define( 'WL_MAPPING_TABLE_NAME', 'wl_mapping' );
19
+define('WL_MAPPING_TABLE_NAME', 'wl_mapping');
20 20
 
21 21
 /**
22 22
  * Define wl_rule_group_table_name
23 23
  *
24 24
  * @since 3.25.0
25 25
  */
26
-define( 'WL_RULE_GROUP_TABLE_NAME', 'wl_mapping_rule_group' );
26
+define('WL_RULE_GROUP_TABLE_NAME', 'wl_mapping_rule_group');
27 27
 
28 28
 /**
29 29
  * Define wl_rule_table_name
30 30
  *
31 31
  * @since 3.25.0
32 32
  */
33
-define( 'WL_RULE_TABLE_NAME', 'wl_mapping_rule' );
33
+define('WL_RULE_TABLE_NAME', 'wl_mapping_rule');
34 34
 
35 35
 /**
36 36
  * Define wl_property_table_name
37 37
  *
38 38
  * @since 3.25.0
39 39
  */
40
-define( 'WL_PROPERTY_TABLE_NAME', 'wl_mapping_property' );
40
+define('WL_PROPERTY_TABLE_NAME', 'wl_mapping_property');
41 41
 
42 42
 // Mapping options / validations rules used by wl_core_get_posts to perform validation on args
43 43
 // The array is serialized because array constants are only from php 5.6 on.
44
-define( 'WL_CORE_GET_POSTS_VALIDATION_RULES', serialize( array(
45
-	'get'            => array( 'posts', 'post_ids' ),
46
-	'as'             => array( 'object', 'subject' ),
47
-	'post_type'      => array( 'post', 'entity' ),
48
-	'post_status'    => array( 'draft', 'trash', 'publish' ),
44
+define('WL_CORE_GET_POSTS_VALIDATION_RULES', serialize(array(
45
+	'get'            => array('posts', 'post_ids'),
46
+	'as'             => array('object', 'subject'),
47
+	'post_type'      => array('post', 'entity'),
48
+	'post_status'    => array('draft', 'trash', 'publish'),
49 49
 	'with_predicate' => array(
50 50
 		WL_WHAT_RELATION,
51 51
 		WL_WHEN_RELATION,
52 52
 		WL_WHERE_RELATION,
53 53
 		WL_WHO_RELATION,
54 54
 	),
55
-) ) );
55
+)));
56 56
 
57 57
 // Classification boxes configuration for angularjs edit-post widget
58 58
 // The array is serialized because array constants are only from php 5.6 on.
59 59
 
60
-define( 'WL_CORE_POST_CLASSIFICATION_BOXES', serialize( array(
60
+define('WL_CORE_POST_CLASSIFICATION_BOXES', serialize(array(
61 61
 	array(
62 62
 		'id'               => WL_WHAT_RELATION,
63 63
 		'label'            => 'What',
@@ -82,16 +82,16 @@  discard block
 block discarded – undo
82 82
 	array(
83 83
 		'id'               => WL_WHERE_RELATION,
84 84
 		'label'            => 'Where',
85
-		'registeredTypes'  => array( 'place' ),
85
+		'registeredTypes'  => array('place'),
86 86
 		'selectedEntities' => array(),
87 87
 	),
88 88
 	array(
89 89
 		'id'               => WL_WHEN_RELATION,
90 90
 		'label'            => 'When',
91
-		'registeredTypes'  => array( 'event' ),
91
+		'registeredTypes'  => array('event'),
92 92
 		'selectedEntities' => array(),
93 93
 	),
94
-) ) );
94
+)));
95 95
 
96 96
 // Default namespace for wp-json
97
-define( 'WL_REST_ROUTE_DEFAULT_NAMESPACE', 'wordlift/v1' );
97
+define('WL_REST_ROUTE_DEFAULT_NAMESPACE', 'wordlift/v1');
Please login to merge, or discard this patch.
src/public/class-wordlift-amp-service.php 2 patches
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -21,75 +21,75 @@
 block discarded – undo
21 21
  */
22 22
 class Wordlift_AMP_Service {
23 23
 
24
-	/**
25
-	 * The {@link \Wordlift_Jsonld_Service} instance.
26
-	 *
27
-	 * @since 3.19.1
28
-	 * @access private
29
-	 * @var \Wordlift_Jsonld_Service $jsonld_service The {@link \Wordlift_Jsonld_Service} instance.
30
-	 */
31
-	private $jsonld_service;
24
+    /**
25
+     * The {@link \Wordlift_Jsonld_Service} instance.
26
+     *
27
+     * @since 3.19.1
28
+     * @access private
29
+     * @var \Wordlift_Jsonld_Service $jsonld_service The {@link \Wordlift_Jsonld_Service} instance.
30
+     */
31
+    private $jsonld_service;
32 32
 
33
-	/**
34
-	 * Create a {@link Wordlift_AMP_Service} instance.
35
-	 * @since 3.19.1
36
-	 *
37
-	 * @param \Wordlift_Jsonld_Service $jsonld_service
38
-	 */
39
-	function __construct( $jsonld_service ) {
33
+    /**
34
+     * Create a {@link Wordlift_AMP_Service} instance.
35
+     * @since 3.19.1
36
+     *
37
+     * @param \Wordlift_Jsonld_Service $jsonld_service
38
+     */
39
+    function __construct( $jsonld_service ) {
40 40
 
41
-		$this->jsonld_service = $jsonld_service;
41
+        $this->jsonld_service = $jsonld_service;
42 42
 
43
-		add_action( 'amp_init', array( $this, 'register_entity_cpt_with_amp_plugin', ) );
44
-		add_filter( 'amp_post_template_metadata', array( $this, 'amp_post_template_metadata', ), 99, 2 );
43
+        add_action( 'amp_init', array( $this, 'register_entity_cpt_with_amp_plugin', ) );
44
+        add_filter( 'amp_post_template_metadata', array( $this, 'amp_post_template_metadata', ), 99, 2 );
45 45
 
46
-	}
46
+    }
47 47
 
48
-	/**
49
-	 * Register the `entity` post type with the AMP plugin.
50
-	 *
51
-	 * @since 3.12.0
52
-	 */
53
-	function register_entity_cpt_with_amp_plugin() {
48
+    /**
49
+     * Register the `entity` post type with the AMP plugin.
50
+     *
51
+     * @since 3.12.0
52
+     */
53
+    function register_entity_cpt_with_amp_plugin() {
54 54
 
55
-		if ( ! defined( 'AMP_QUERY_VAR' ) ) {
56
-			return;
57
-		}
55
+        if ( ! defined( 'AMP_QUERY_VAR' ) ) {
56
+            return;
57
+        }
58 58
 
59
-		foreach ( Wordlift_Entity_Service::valid_entity_post_types() as $post_type ) {
60
-			// Do not change anything for posts and pages.
61
-			if ( 'post' === $post_type || 'page' === $post_type ) {
62
-				continue;
63
-			}
64
-			add_post_type_support( $post_type, AMP_QUERY_VAR );
65
-		}
59
+        foreach ( Wordlift_Entity_Service::valid_entity_post_types() as $post_type ) {
60
+            // Do not change anything for posts and pages.
61
+            if ( 'post' === $post_type || 'page' === $post_type ) {
62
+                continue;
63
+            }
64
+            add_post_type_support( $post_type, AMP_QUERY_VAR );
65
+        }
66 66
 
67
-	}
67
+    }
68 68
 
69
-	/**
70
-	 * Filters Schema.org metadata for a post.
71
-	 *
72
-	 * @since 3.19.1
73
-	 *
74
-	 * @param array $metadata Metadata.
75
-	 * @param WP_Post $post Post.
76
-	 *
77
-	 * @return array Return WordLift's generated JSON-LD.
78
-	 */
79
-	function amp_post_template_metadata( $metadata, $post ) {
69
+    /**
70
+     * Filters Schema.org metadata for a post.
71
+     *
72
+     * @since 3.19.1
73
+     *
74
+     * @param array $metadata Metadata.
75
+     * @param WP_Post $post Post.
76
+     *
77
+     * @return array Return WordLift's generated JSON-LD.
78
+     */
79
+    function amp_post_template_metadata( $metadata, $post ) {
80 80
 
81
-		return $this->jsonld_service->get_jsonld( false, $post->ID );
82
-	}
81
+        return $this->jsonld_service->get_jsonld( false, $post->ID );
82
+    }
83 83
 
84
-	/**
85
-	 * Check if current page is amp endpoint.
86
-	 *
87
-	 * @since 3.20.0
88
-	 * 
89
-	 * @return bool
90
-	 */
91
-	public static function is_amp_endpoint() {
92
-		return function_exists('is_amp_endpoint') && is_amp_endpoint();
93
-	}
84
+    /**
85
+     * Check if current page is amp endpoint.
86
+     *
87
+     * @since 3.20.0
88
+     * 
89
+     * @return bool
90
+     */
91
+    public static function is_amp_endpoint() {
92
+        return function_exists('is_amp_endpoint') && is_amp_endpoint();
93
+    }
94 94
 
95 95
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
 	 *
37 37
 	 * @param \Wordlift_Jsonld_Service $jsonld_service
38 38
 	 */
39
-	function __construct( $jsonld_service ) {
39
+	function __construct($jsonld_service) {
40 40
 
41 41
 		$this->jsonld_service = $jsonld_service;
42 42
 
43
-		add_action( 'amp_init', array( $this, 'register_entity_cpt_with_amp_plugin', ) );
44
-		add_filter( 'amp_post_template_metadata', array( $this, 'amp_post_template_metadata', ), 99, 2 );
43
+		add_action('amp_init', array($this, 'register_entity_cpt_with_amp_plugin',));
44
+		add_filter('amp_post_template_metadata', array($this, 'amp_post_template_metadata',), 99, 2);
45 45
 
46 46
 	}
47 47
 
@@ -52,16 +52,16 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	function register_entity_cpt_with_amp_plugin() {
54 54
 
55
-		if ( ! defined( 'AMP_QUERY_VAR' ) ) {
55
+		if ( ! defined('AMP_QUERY_VAR')) {
56 56
 			return;
57 57
 		}
58 58
 
59
-		foreach ( Wordlift_Entity_Service::valid_entity_post_types() as $post_type ) {
59
+		foreach (Wordlift_Entity_Service::valid_entity_post_types() as $post_type) {
60 60
 			// Do not change anything for posts and pages.
61
-			if ( 'post' === $post_type || 'page' === $post_type ) {
61
+			if ('post' === $post_type || 'page' === $post_type) {
62 62
 				continue;
63 63
 			}
64
-			add_post_type_support( $post_type, AMP_QUERY_VAR );
64
+			add_post_type_support($post_type, AMP_QUERY_VAR);
65 65
 		}
66 66
 
67 67
 	}
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @return array Return WordLift's generated JSON-LD.
78 78
 	 */
79
-	function amp_post_template_metadata( $metadata, $post ) {
79
+	function amp_post_template_metadata($metadata, $post) {
80 80
 
81
-		return $this->jsonld_service->get_jsonld( false, $post->ID );
81
+		return $this->jsonld_service->get_jsonld(false, $post->ID);
82 82
 	}
83 83
 
84 84
 	/**
Please login to merge, or discard this patch.