Completed
Pull Request — develop (#1554)
by Naveen
48s
created
src/wordlift/autocomplete/class-all-autocomplete-service.php 2 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -12,55 +12,55 @@
 block discarded – undo
12 12
 
13 13
 class All_Autocomplete_Service implements Autocomplete_Service {
14 14
 
15
-	/**
16
-	 * One ore more {@link Autocomplete_Service} instances.
17
-	 *
18
-	 * @var Autocomplete_Service|Autocomplete_Service[] $autocomplete_services
19
-	 */
20
-	private $autocomplete_services;
15
+    /**
16
+     * One ore more {@link Autocomplete_Service} instances.
17
+     *
18
+     * @var Autocomplete_Service|Autocomplete_Service[] $autocomplete_services
19
+     */
20
+    private $autocomplete_services;
21 21
 
22
-	/**
23
-	 * All_Autocomplete_Service constructor.
24
-	 *
25
-	 * @param Autocomplete_Service|Autocomplete_Service[] $autocomplete_services
26
-	 */
27
-	public function __construct( $autocomplete_services ) {
22
+    /**
23
+     * All_Autocomplete_Service constructor.
24
+     *
25
+     * @param Autocomplete_Service|Autocomplete_Service[] $autocomplete_services
26
+     */
27
+    public function __construct( $autocomplete_services ) {
28 28
 
29
-		$this->autocomplete_services = (array) $autocomplete_services;
30
-	}
29
+        $this->autocomplete_services = (array) $autocomplete_services;
30
+    }
31 31
 
32
-	/**
33
-	 * {@inheritDoc}
34
-	 */
35
-	public function query( $query, $scope, $excludes ) {
32
+    /**
33
+     * {@inheritDoc}
34
+     */
35
+    public function query( $query, $scope, $excludes ) {
36 36
 
37
-		/**
38
-		 * Filter to show local entities on the entity autocompletion field.
39
-		 *
40
-		 * @param $state bool
41
-		 *
42
-		 * @return bool Whether to show local entities in the page or not.
43
-		 * @since 3.26.1
44
-		 */
45
-		$show_local_entities = apply_filters( 'wl_show_local_entities', false );
37
+        /**
38
+         * Filter to show local entities on the entity autocompletion field.
39
+         *
40
+         * @param $state bool
41
+         *
42
+         * @return bool Whether to show local entities in the page or not.
43
+         * @since 3.26.1
44
+         */
45
+        $show_local_entities = apply_filters( 'wl_show_local_entities', false );
46 46
 
47
-		$autocomplete_services = $this->autocomplete_services;
47
+        $autocomplete_services = $this->autocomplete_services;
48 48
 
49
-		// Remove the local autocomplete services.
50
-		if ( ! $show_local_entities ) {
51
-			$autocomplete_services = array_filter( $autocomplete_services, function ( $service ) {
52
-				return ! $service instanceof Local_Autocomplete_Service;
53
-			} );
54
-		}
49
+        // Remove the local autocomplete services.
50
+        if ( ! $show_local_entities ) {
51
+            $autocomplete_services = array_filter( $autocomplete_services, function ( $service ) {
52
+                return ! $service instanceof Local_Autocomplete_Service;
53
+            } );
54
+        }
55 55
 
56
-		// Query each Autocomplete service and merge the results.
57
-		return array_reduce( $autocomplete_services, function ( $carry, $item ) use ( $query, $scope, $excludes ) {
56
+        // Query each Autocomplete service and merge the results.
57
+        return array_reduce( $autocomplete_services, function ( $carry, $item ) use ( $query, $scope, $excludes ) {
58 58
 
59
-			$results = $item->query( $query, $scope, $excludes );
59
+            $results = $item->query( $query, $scope, $excludes );
60 60
 
61
-			return array_merge( $carry, $results );
62
-		}, array() );
61
+            return array_merge( $carry, $results );
62
+        }, array() );
63 63
 
64
-	}
64
+    }
65 65
 
66 66
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @param Autocomplete_Service|Autocomplete_Service[] $autocomplete_services
26 26
 	 */
27
-	public function __construct( $autocomplete_services ) {
27
+	public function __construct($autocomplete_services) {
28 28
 
29 29
 		$this->autocomplete_services = (array) $autocomplete_services;
30 30
 	}
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	/**
33 33
 	 * {@inheritDoc}
34 34
 	 */
35
-	public function query( $query, $scope, $excludes ) {
35
+	public function query($query, $scope, $excludes) {
36 36
 
37 37
 		/**
38 38
 		 * Filter to show local entities on the entity autocompletion field.
@@ -42,24 +42,24 @@  discard block
 block discarded – undo
42 42
 		 * @return bool Whether to show local entities in the page or not.
43 43
 		 * @since 3.26.1
44 44
 		 */
45
-		$show_local_entities = apply_filters( 'wl_show_local_entities', false );
45
+		$show_local_entities = apply_filters('wl_show_local_entities', false);
46 46
 
47 47
 		$autocomplete_services = $this->autocomplete_services;
48 48
 
49 49
 		// Remove the local autocomplete services.
50
-		if ( ! $show_local_entities ) {
51
-			$autocomplete_services = array_filter( $autocomplete_services, function ( $service ) {
50
+		if ( ! $show_local_entities) {
51
+			$autocomplete_services = array_filter($autocomplete_services, function($service) {
52 52
 				return ! $service instanceof Local_Autocomplete_Service;
53 53
 			} );
54 54
 		}
55 55
 
56 56
 		// Query each Autocomplete service and merge the results.
57
-		return array_reduce( $autocomplete_services, function ( $carry, $item ) use ( $query, $scope, $excludes ) {
57
+		return array_reduce($autocomplete_services, function($carry, $item) use ($query, $scope, $excludes) {
58 58
 
59
-			$results = $item->query( $query, $scope, $excludes );
59
+			$results = $item->query($query, $scope, $excludes);
60 60
 
61
-			return array_merge( $carry, $results );
62
-		}, array() );
61
+			return array_merge($carry, $results);
62
+		}, array());
63 63
 
64 64
 	}
65 65
 
Please login to merge, or discard this patch.
src/includes/class-wordlift-autocomplete-adapter.php 3 patches
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 use Wordlift\Autocomplete\Autocomplete_Service;
14 14
 
15 15
 if ( ! defined( 'ABSPATH' ) ) {
16
-	exit;
16
+    exit;
17 17
 }
18 18
 
19 19
 /**
@@ -23,76 +23,76 @@  discard block
 block discarded – undo
23 23
  */
24 24
 class Wordlift_Autocomplete_Adapter {
25 25
 
26
-	/**
27
-	 * The {@link Autocomplete_Service} instance.
28
-	 *
29
-	 * @since  3.15.0
30
-	 * @access private
31
-	 * @var Autocomplete_Service $configuration_service The {@link Autocomplete_Service} instance.
32
-	 */
33
-	private $autocomplete_service;
34
-
35
-
36
-	/**
37
-	 * Wordlift_Autocomplete_Adapter constructor.
38
-	 *
39
-	 * @param Autocomplete_Service $autocomplete_service The {@link Autocomplete_Service} instance.
40
-	 *
41
-	 * @since 3.14.2
42
-	 *
43
-	 */
44
-	public function __construct( $autocomplete_service ) {
45
-		$this->autocomplete_service = $autocomplete_service;
46
-	}
47
-
48
-	/**
49
-	 * Handle the autocomplete ajax request.
50
-	 *
51
-	 * @since 3.15.0
52
-	 */
53
-	public function wl_autocomplete() {
54
-
55
-		check_ajax_referer( 'wl_autocomplete' );
56
-
57
-		// Return error if the query param is empty.
58
-		if ( ! empty( $_REQUEST['query'] ) ) { // Input var okay.
59
-			$query = sanitize_text_field( wp_unslash( $_REQUEST['query'] ) ); // Input var okay.
60
-		} else {
61
-			wp_send_json_error( array(
62
-				'message' => __( 'The query param is empty.', 'wordlift' ),
63
-			) );
64
-		}
65
-
66
-		// Get the exclude parameter.
67
-		$exclude = ! empty( $_REQUEST['exclude'] )
68
-			? sanitize_text_field( wp_unslash( $_REQUEST['exclude'] ) ) : '';
69
-
70
-		$scope = ! empty( $_REQUEST['scope'] )
71
-			? sanitize_text_field( wp_unslash( $_REQUEST['scope'] ) ) : WL_AUTOCOMPLETE_SCOPE;
72
-
73
-		/**
74
-		 * @since 3.26.1
75
-		 * Providing a way for term pages to show and save local entities.
76
-		 */
77
-		$show_local_entities = false;
78
-
79
-		if ( isset( $_REQUEST['show_local_entities'] )
80
-		     && ! empty( $_REQUEST['show_local_entities'] ) ) // Make request.
81
-		{
82
-			$show_local_entities = filter_var( $_REQUEST['show_local_entities'], FILTER_VALIDATE_BOOLEAN );
83
-		}
84
-
85
-		// Add the filter to check if we need to show local entities or not.
86
-		add_filter( 'wl_show_local_entities', function ( $state ) use ( $show_local_entities ) {
87
-			return $show_local_entities;
88
-		} );
89
-
90
-		$results = $this->autocomplete_service->query( $query, $scope, $exclude );
91
-
92
-		// Clear any buffer.
93
-		ob_clean();
94
-
95
-		wp_send_json_success( $results );
96
-
97
-	}
26
+    /**
27
+     * The {@link Autocomplete_Service} instance.
28
+     *
29
+     * @since  3.15.0
30
+     * @access private
31
+     * @var Autocomplete_Service $configuration_service The {@link Autocomplete_Service} instance.
32
+     */
33
+    private $autocomplete_service;
34
+
35
+
36
+    /**
37
+     * Wordlift_Autocomplete_Adapter constructor.
38
+     *
39
+     * @param Autocomplete_Service $autocomplete_service The {@link Autocomplete_Service} instance.
40
+     *
41
+     * @since 3.14.2
42
+     *
43
+     */
44
+    public function __construct( $autocomplete_service ) {
45
+        $this->autocomplete_service = $autocomplete_service;
46
+    }
47
+
48
+    /**
49
+     * Handle the autocomplete ajax request.
50
+     *
51
+     * @since 3.15.0
52
+     */
53
+    public function wl_autocomplete() {
54
+
55
+        check_ajax_referer( 'wl_autocomplete' );
56
+
57
+        // Return error if the query param is empty.
58
+        if ( ! empty( $_REQUEST['query'] ) ) { // Input var okay.
59
+            $query = sanitize_text_field( wp_unslash( $_REQUEST['query'] ) ); // Input var okay.
60
+        } else {
61
+            wp_send_json_error( array(
62
+                'message' => __( 'The query param is empty.', 'wordlift' ),
63
+            ) );
64
+        }
65
+
66
+        // Get the exclude parameter.
67
+        $exclude = ! empty( $_REQUEST['exclude'] )
68
+            ? sanitize_text_field( wp_unslash( $_REQUEST['exclude'] ) ) : '';
69
+
70
+        $scope = ! empty( $_REQUEST['scope'] )
71
+            ? sanitize_text_field( wp_unslash( $_REQUEST['scope'] ) ) : WL_AUTOCOMPLETE_SCOPE;
72
+
73
+        /**
74
+         * @since 3.26.1
75
+         * Providing a way for term pages to show and save local entities.
76
+         */
77
+        $show_local_entities = false;
78
+
79
+        if ( isset( $_REQUEST['show_local_entities'] )
80
+             && ! empty( $_REQUEST['show_local_entities'] ) ) // Make request.
81
+        {
82
+            $show_local_entities = filter_var( $_REQUEST['show_local_entities'], FILTER_VALIDATE_BOOLEAN );
83
+        }
84
+
85
+        // Add the filter to check if we need to show local entities or not.
86
+        add_filter( 'wl_show_local_entities', function ( $state ) use ( $show_local_entities ) {
87
+            return $show_local_entities;
88
+        } );
89
+
90
+        $results = $this->autocomplete_service->query( $query, $scope, $exclude );
91
+
92
+        // Clear any buffer.
93
+        ob_clean();
94
+
95
+        wp_send_json_success( $results );
96
+
97
+    }
98 98
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 use Wordlift\Autocomplete\Autocomplete_Service;
14 14
 
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * @since 3.14.2
42 42
 	 *
43 43
 	 */
44
-	public function __construct( $autocomplete_service ) {
44
+	public function __construct($autocomplete_service) {
45 45
 		$this->autocomplete_service = $autocomplete_service;
46 46
 	}
47 47
 
@@ -52,23 +52,23 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function wl_autocomplete() {
54 54
 
55
-		check_ajax_referer( 'wl_autocomplete' );
55
+		check_ajax_referer('wl_autocomplete');
56 56
 
57 57
 		// Return error if the query param is empty.
58
-		if ( ! empty( $_REQUEST['query'] ) ) { // Input var okay.
59
-			$query = sanitize_text_field( wp_unslash( $_REQUEST['query'] ) ); // Input var okay.
58
+		if ( ! empty($_REQUEST['query'])) { // Input var okay.
59
+			$query = sanitize_text_field(wp_unslash($_REQUEST['query'])); // Input var okay.
60 60
 		} else {
61
-			wp_send_json_error( array(
62
-				'message' => __( 'The query param is empty.', 'wordlift' ),
63
-			) );
61
+			wp_send_json_error(array(
62
+				'message' => __('The query param is empty.', 'wordlift'),
63
+			));
64 64
 		}
65 65
 
66 66
 		// Get the exclude parameter.
67
-		$exclude = ! empty( $_REQUEST['exclude'] )
68
-			? sanitize_text_field( wp_unslash( $_REQUEST['exclude'] ) ) : '';
67
+		$exclude = ! empty($_REQUEST['exclude'])
68
+			? sanitize_text_field(wp_unslash($_REQUEST['exclude'])) : '';
69 69
 
70
-		$scope = ! empty( $_REQUEST['scope'] )
71
-			? sanitize_text_field( wp_unslash( $_REQUEST['scope'] ) ) : WL_AUTOCOMPLETE_SCOPE;
70
+		$scope = ! empty($_REQUEST['scope'])
71
+			? sanitize_text_field(wp_unslash($_REQUEST['scope'])) : WL_AUTOCOMPLETE_SCOPE;
72 72
 
73 73
 		/**
74 74
 		 * @since 3.26.1
@@ -76,23 +76,23 @@  discard block
 block discarded – undo
76 76
 		 */
77 77
 		$show_local_entities = false;
78 78
 
79
-		if ( isset( $_REQUEST['show_local_entities'] )
80
-		     && ! empty( $_REQUEST['show_local_entities'] ) ) // Make request.
79
+		if (isset($_REQUEST['show_local_entities'])
80
+		     && ! empty($_REQUEST['show_local_entities'])) // Make request.
81 81
 		{
82
-			$show_local_entities = filter_var( $_REQUEST['show_local_entities'], FILTER_VALIDATE_BOOLEAN );
82
+			$show_local_entities = filter_var($_REQUEST['show_local_entities'], FILTER_VALIDATE_BOOLEAN);
83 83
 		}
84 84
 
85 85
 		// Add the filter to check if we need to show local entities or not.
86
-		add_filter( 'wl_show_local_entities', function ( $state ) use ( $show_local_entities ) {
86
+		add_filter('wl_show_local_entities', function($state) use ($show_local_entities) {
87 87
 			return $show_local_entities;
88 88
 		} );
89 89
 
90
-		$results = $this->autocomplete_service->query( $query, $scope, $exclude );
90
+		$results = $this->autocomplete_service->query($query, $scope, $exclude);
91 91
 
92 92
 		// Clear any buffer.
93 93
 		ob_clean();
94 94
 
95
-		wp_send_json_success( $results );
95
+		wp_send_json_success($results);
96 96
 
97 97
 	}
98 98
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,10 +77,12 @@
 block discarded – undo
77 77
 		$show_local_entities = false;
78 78
 
79 79
 		if ( isset( $_REQUEST['show_local_entities'] )
80
-		     && ! empty( $_REQUEST['show_local_entities'] ) ) // Make request.
80
+		     && ! empty( $_REQUEST['show_local_entities'] ) ) {
81
+		    // Make request.
81 82
 		{
82 83
 			$show_local_entities = filter_var( $_REQUEST['show_local_entities'], FILTER_VALIDATE_BOOLEAN );
83 84
 		}
85
+		}
84 86
 
85 87
 		// Add the filter to check if we need to show local entities or not.
86 88
 		add_filter( 'wl_show_local_entities', function ( $state ) use ( $show_local_entities ) {
Please login to merge, or discard this patch.
src/wordlift_editor.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -9,32 +9,32 @@  discard block
 block discarded – undo
9 9
  */
10 10
 function wordlift_mce_css( $mce_css ) {
11 11
 
12
-	/*
12
+    /*
13 13
 	 * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box.
14 14
 	 *
15 15
 	 * @since 3.20.3
16 16
 	 *
17 17
 	 * @see https://github.com/insideout10/wordlift-plugin/issues/914
18 18
 	 */
19
-	if ( ! apply_filters( 'wl_can_see_classification_box', true ) ) {
20
-		return $mce_css;
21
-	}
22
-
23
-	if ( ! empty( $mce_css ) ) {
24
-		$mce_css .= ',';
25
-	}
26
-
27
-	/**
28
-	 * Replacing the legacy `wordlift-reloaded.min.css` with tiny-mce.css.
29
-	 *
30
-	 * tiny-mce.css is generated using the new webpack project and its rules are shared with Gutenberg.
31
-	 *
32
-	 * @author David Riccitelli <[email protected]>
33
-	 * @since 3.23.0
34
-	 */
35
-	$mce_css .= plugin_dir_url( __FILE__ ) . 'js/dist/tiny-mce.css';
36
-
37
-	return $mce_css;
19
+    if ( ! apply_filters( 'wl_can_see_classification_box', true ) ) {
20
+        return $mce_css;
21
+    }
22
+
23
+    if ( ! empty( $mce_css ) ) {
24
+        $mce_css .= ',';
25
+    }
26
+
27
+    /**
28
+     * Replacing the legacy `wordlift-reloaded.min.css` with tiny-mce.css.
29
+     *
30
+     * tiny-mce.css is generated using the new webpack project and its rules are shared with Gutenberg.
31
+     *
32
+     * @author David Riccitelli <[email protected]>
33
+     * @since 3.23.0
34
+     */
35
+    $mce_css .= plugin_dir_url( __FILE__ ) . 'js/dist/tiny-mce.css';
36
+
37
+    return $mce_css;
38 38
 }
39 39
 
40 40
 // hook the TinyMCE custom styles function.
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
  */
50 50
 function wordlift_filter_tiny_mce_before_init( $options ) {
51 51
 
52
-	if ( ! isset( $options['extended_valid_elements'] ) ) {
53
-		$options['extended_valid_elements'] = '';
54
-	}
52
+    if ( ! isset( $options['extended_valid_elements'] ) ) {
53
+        $options['extended_valid_elements'] = '';
54
+    }
55 55
 
56
-	$options['extended_valid_elements'] .= ",span[*]";
56
+    $options['extended_valid_elements'] .= ",span[*]";
57 57
 
58
-	return $options;
58
+    return $options;
59 59
 }
60 60
 
61 61
 add_filter( 'tiny_mce_before_init', 'wordlift_filter_tiny_mce_before_init', PHP_INT_MAX );
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  *
8 8
  * @return string The updated list of styles, including the custom style provided by WordLift.
9 9
  */
10
-function wordlift_mce_css( $mce_css ) {
10
+function wordlift_mce_css($mce_css) {
11 11
 
12 12
 	/*
13 13
 	 * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box.
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
 	 *
17 17
 	 * @see https://github.com/insideout10/wordlift-plugin/issues/914
18 18
 	 */
19
-	if ( ! apply_filters( 'wl_can_see_classification_box', true ) ) {
19
+	if ( ! apply_filters('wl_can_see_classification_box', true)) {
20 20
 		return $mce_css;
21 21
 	}
22 22
 
23
-	if ( ! empty( $mce_css ) ) {
23
+	if ( ! empty($mce_css)) {
24 24
 		$mce_css .= ',';
25 25
 	}
26 26
 
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 	 * @author David Riccitelli <[email protected]>
33 33
 	 * @since 3.23.0
34 34
 	 */
35
-	$mce_css .= plugin_dir_url( __FILE__ ) . 'js/dist/tiny-mce.css';
35
+	$mce_css .= plugin_dir_url(__FILE__).'js/dist/tiny-mce.css';
36 36
 
37 37
 	return $mce_css;
38 38
 }
39 39
 
40 40
 // hook the TinyMCE custom styles function.
41
-add_filter( 'mce_css', 'wordlift_mce_css' );
41
+add_filter('mce_css', 'wordlift_mce_css');
42 42
 
43 43
 /**
44 44
  * Set TinyMCE options, in particular enable microdata tagging.
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
  *
48 48
  * @return mixed
49 49
  */
50
-function wordlift_filter_tiny_mce_before_init( $options ) {
50
+function wordlift_filter_tiny_mce_before_init($options) {
51 51
 
52
-	if ( ! isset( $options['extended_valid_elements'] ) ) {
52
+	if ( ! isset($options['extended_valid_elements'])) {
53 53
 		$options['extended_valid_elements'] = '';
54 54
 	}
55 55
 
@@ -58,4 +58,4 @@  discard block
 block discarded – undo
58 58
 	return $options;
59 59
 }
60 60
 
61
-add_filter( 'tiny_mce_before_init', 'wordlift_filter_tiny_mce_before_init', PHP_INT_MAX );
61
+add_filter('tiny_mce_before_init', 'wordlift_filter_tiny_mce_before_init', PHP_INT_MAX);
Please login to merge, or discard this patch.
src/wordlift/mappings/class-taxonomy-option.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -14,58 +14,58 @@
 block discarded – undo
14 14
  */
15 15
 class Taxonomy_Option {
16 16
 
17
-	/**
18
-	 * This value is used in rule field one and rule field two
19
-	 * options are linked to one by this value
20
-	 */
21
-	const PARENT_VALUE = 'taxonomy';
17
+    /**
18
+     * This value is used in rule field one and rule field two
19
+     * options are linked to one by this value
20
+     */
21
+    const PARENT_VALUE = 'taxonomy';
22 22
 
23
-	public function add_taxonomy_option() {
24
-		$this->add_rule_field_one_options();
25
-		$this->add_rule_field_two_options();
26
-	}
23
+    public function add_taxonomy_option() {
24
+        $this->add_rule_field_one_options();
25
+        $this->add_rule_field_two_options();
26
+    }
27 27
 
28
-	private function add_rule_field_one_options() {
28
+    private function add_rule_field_one_options() {
29 29
 
30
-		add_filter( 'wl_mappings_rule_field_one_options', function ( $rule_field_one_options ) {
30
+        add_filter( 'wl_mappings_rule_field_one_options', function ( $rule_field_one_options ) {
31 31
 
32
-			$rule_field_one_options[] = array(
33
-				'label'      => __( 'Taxonomy', 'wordlift' ),
34
-				'value'      => Taxonomy_Option::PARENT_VALUE,
35
-				// Left empty since these values are provided locally, not needed to be fetched from
36
-				// api.
37
-				'api_source' => ''
38
-			);
32
+            $rule_field_one_options[] = array(
33
+                'label'      => __( 'Taxonomy', 'wordlift' ),
34
+                'value'      => Taxonomy_Option::PARENT_VALUE,
35
+                // Left empty since these values are provided locally, not needed to be fetched from
36
+                // api.
37
+                'api_source' => ''
38
+            );
39 39
 
40
-			return $rule_field_one_options;
40
+            return $rule_field_one_options;
41 41
 
42
-		} );
43
-	}
42
+        } );
43
+    }
44 44
 
45
-	private function add_rule_field_two_options() {
45
+    private function add_rule_field_two_options() {
46 46
 
47
-		add_filter( 'wl_mappings_rule_field_two_options', function ( $rule_field_two_options ) {
47
+        add_filter( 'wl_mappings_rule_field_two_options', function ( $rule_field_two_options ) {
48 48
 
49
-			$taxonomies = get_object_taxonomies( 'post', 'objects' );
49
+            $taxonomies = get_object_taxonomies( 'post', 'objects' );
50 50
 
51
-			$taxonomy_options = array();
51
+            $taxonomy_options = array();
52 52
 
53
-			foreach ( $taxonomies as $item ) {
54
-				/**
55
-				 * $item Taxonomy
56
-				 */
57
-				$taxonomy_options[] = array(
58
-					'label'        => __( $item->label, 'wordlift' ),
59
-					'value'        => $item->name,
60
-					// The value of parent option on rule field one.
61
-					'parent_value' => Taxonomy_Option::PARENT_VALUE
62
-				);
63
-			}
53
+            foreach ( $taxonomies as $item ) {
54
+                /**
55
+                 * $item Taxonomy
56
+                 */
57
+                $taxonomy_options[] = array(
58
+                    'label'        => __( $item->label, 'wordlift' ),
59
+                    'value'        => $item->name,
60
+                    // The value of parent option on rule field one.
61
+                    'parent_value' => Taxonomy_Option::PARENT_VALUE
62
+                );
63
+            }
64 64
 
65
-			return array_merge( $rule_field_two_options, $taxonomy_options );
65
+            return array_merge( $rule_field_two_options, $taxonomy_options );
66 66
 
67
-		} );
67
+        } );
68 68
 
69
-	}
69
+    }
70 70
 
71 71
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 
28 28
 	private function add_rule_field_one_options() {
29 29
 
30
-		add_filter( 'wl_mappings_rule_field_one_options', function ( $rule_field_one_options ) {
30
+		add_filter('wl_mappings_rule_field_one_options', function($rule_field_one_options) {
31 31
 
32 32
 			$rule_field_one_options[] = array(
33
-				'label'      => __( 'Taxonomy', 'wordlift' ),
33
+				'label'      => __('Taxonomy', 'wordlift'),
34 34
 				'value'      => Taxonomy_Option::PARENT_VALUE,
35 35
 				// Left empty since these values are provided locally, not needed to be fetched from
36 36
 				// api.
@@ -44,25 +44,25 @@  discard block
 block discarded – undo
44 44
 
45 45
 	private function add_rule_field_two_options() {
46 46
 
47
-		add_filter( 'wl_mappings_rule_field_two_options', function ( $rule_field_two_options ) {
47
+		add_filter('wl_mappings_rule_field_two_options', function($rule_field_two_options) {
48 48
 
49
-			$taxonomies = get_object_taxonomies( 'post', 'objects' );
49
+			$taxonomies = get_object_taxonomies('post', 'objects');
50 50
 
51 51
 			$taxonomy_options = array();
52 52
 
53
-			foreach ( $taxonomies as $item ) {
53
+			foreach ($taxonomies as $item) {
54 54
 				/**
55 55
 				 * $item Taxonomy
56 56
 				 */
57 57
 				$taxonomy_options[] = array(
58
-					'label'        => __( $item->label, 'wordlift' ),
58
+					'label'        => __($item->label, 'wordlift'),
59 59
 					'value'        => $item->name,
60 60
 					// The value of parent option on rule field one.
61 61
 					'parent_value' => Taxonomy_Option::PARENT_VALUE
62 62
 				);
63 63
 			}
64 64
 
65
-			return array_merge( $rule_field_two_options, $taxonomy_options );
65
+			return array_merge($rule_field_two_options, $taxonomy_options);
66 66
 
67 67
 		} );
68 68
 
Please login to merge, or discard this patch.
src/install/class-wordlift-install-3-27-0.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -14,19 +14,19 @@  discard block
 block discarded – undo
14 14
 
15 15
 class Wordlift_Install_3_27_0 extends Wordlift_Install {
16 16
 
17
-	/**
18
-	 * {@inheritdoc}
19
-	 */
20
-	protected static $version = '3.27.0';
17
+    /**
18
+     * {@inheritdoc}
19
+     */
20
+    protected static $version = '3.27.0';
21 21
 
22
-	/**
23
-	 * @inheritDoc
24
-	 */
25
-	public function install() {
22
+    /**
23
+     * @inheritDoc
24
+     */
25
+    public function install() {
26 26
 
27
-		global $wpdb;
27
+        global $wpdb;
28 28
 
29
-		$empty_post_name_query = "
29
+        $empty_post_name_query = "
30 30
 		    SELECT ID, post_title 
31 31
 		    FROM $wpdb->posts
32 32
 		    WHERE post_type = 'entity'
@@ -34,15 +34,15 @@  discard block
 block discarded – undo
34 34
 		    AND post_name = ''
35 35
 		";
36 36
 
37
-		$posts_with_empty_post_name = $wpdb->get_results($empty_post_name_query, OBJECT);
37
+        $posts_with_empty_post_name = $wpdb->get_results($empty_post_name_query, OBJECT);
38 38
 
39
-		foreach ($posts_with_empty_post_name as $post){
40
-			wp_update_post(array(
41
-				'ID' => $post->ID,
42
-				'post_name' => sanitize_title( $post->post_title )
43
-			));
44
-		}
39
+        foreach ($posts_with_empty_post_name as $post){
40
+            wp_update_post(array(
41
+                'ID' => $post->ID,
42
+                'post_name' => sanitize_title( $post->post_title )
43
+            ));
44
+        }
45 45
 
46
-	}
46
+    }
47 47
 
48 48
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,10 +36,10 @@
 block discarded – undo
36 36
 
37 37
 		$posts_with_empty_post_name = $wpdb->get_results($empty_post_name_query, OBJECT);
38 38
 
39
-		foreach ($posts_with_empty_post_name as $post){
39
+		foreach ($posts_with_empty_post_name as $post) {
40 40
 			wp_update_post(array(
41 41
 				'ID' => $post->ID,
42
-				'post_name' => sanitize_title( $post->post_title )
42
+				'post_name' => sanitize_title($post->post_title)
43 43
 			));
44 44
 		}
45 45
 
Please login to merge, or discard this patch.
src/wordlift/mappings/formatters/class-acf-group-formatter.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -9,23 +9,23 @@
 block discarded – undo
9 9
  */
10 10
 class Acf_Group_Formatter {
11 11
 
12
-	public function __construct() {
13
-		// Hook in to format value filter and apply format value.
14
-		add_filter( 'wl_mapping_acf_format_value', array( $this, 'format_group_value' ), 10, 2 );
15
-	}
12
+    public function __construct() {
13
+        // Hook in to format value filter and apply format value.
14
+        add_filter( 'wl_mapping_acf_format_value', array( $this, 'format_group_value' ), 10, 2 );
15
+    }
16 16
 
17
-	public function format_group_value( $field_data, $field_type ) {
18
-		if ( $field_type !== 'group' ) {
19
-			// Return early if the field type is not group
20
-			return $field_data;
21
-		}
22
-		// we need to check if atleast one key is present.
23
-		$filtered_group_data = array_filter( $field_data, 'strlen' );
24
-		if ( ! $filtered_group_data ) {
25
-			return false;
26
-		}
17
+    public function format_group_value( $field_data, $field_type ) {
18
+        if ( $field_type !== 'group' ) {
19
+            // Return early if the field type is not group
20
+            return $field_data;
21
+        }
22
+        // we need to check if atleast one key is present.
23
+        $filtered_group_data = array_filter( $field_data, 'strlen' );
24
+        if ( ! $filtered_group_data ) {
25
+            return false;
26
+        }
27 27
 
28
-		return $filtered_group_data;
28
+        return $filtered_group_data;
29 29
 
30
-	}
30
+    }
31 31
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,17 +11,17 @@
 block discarded – undo
11 11
 
12 12
 	public function __construct() {
13 13
 		// Hook in to format value filter and apply format value.
14
-		add_filter( 'wl_mapping_acf_format_value', array( $this, 'format_group_value' ), 10, 2 );
14
+		add_filter('wl_mapping_acf_format_value', array($this, 'format_group_value'), 10, 2);
15 15
 	}
16 16
 
17
-	public function format_group_value( $field_data, $field_type ) {
18
-		if ( $field_type !== 'group' ) {
17
+	public function format_group_value($field_data, $field_type) {
18
+		if ($field_type !== 'group') {
19 19
 			// Return early if the field type is not group
20 20
 			return $field_data;
21 21
 		}
22 22
 		// we need to check if atleast one key is present.
23
-		$filtered_group_data = array_filter( $field_data, 'strlen' );
24
-		if ( ! $filtered_group_data ) {
23
+		$filtered_group_data = array_filter($field_data, 'strlen');
24
+		if ( ! $filtered_group_data) {
25 25
 			return false;
26 26
 		}
27 27
 
Please login to merge, or discard this patch.
src/public/class-wordlift-chord-shortcode.php 2 patches
Indentation   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -16,93 +16,93 @@  discard block
 block discarded – undo
16 16
  */
17 17
 class Wordlift_Chord_Shortcode extends Wordlift_Shortcode {
18 18
 
19
-	/**
20
-	 * {@inheritdoc}
21
-	 */
22
-	const SHORTCODE = 'wl_chord';
23
-
24
-	/**
25
-	 * Create a {@link Wordlift_Chord_Shortcode} instance.
26
-	 *
27
-	 * @since      3.5.4
28
-	 */
29
-	public function __construct() {
30
-		parent::__construct();
31
-
32
-		// Hook to the `amp_post_template_css` to hide ourselves when in AMP
33
-		// rendering.
34
-		add_action( 'amp_post_template_css', array(
35
-			$this,
36
-			'amp_post_template_css',
37
-		) );
38
-		$this->register_block_type();
39
-
40
-	}
41
-
42
-	/**
43
-	 * Render shordcode.
44
-	 *
45
-	 * @param array $atts shortcode attributes.
46
-	 *
47
-	 * @return string The HTML output.
48
-	 */
49
-	public function render( $atts ) {
50
-
51
-		// extract attributes and set default values.
52
-		$chord_atts = shortcode_atts( array(
53
-			'width'      => '100%',
54
-			'height'     => '500px',
55
-			'main_color' => '000',
56
-			'depth'      => 2,
57
-			'global'     => false,
58
-		), $atts );
59
-
60
-		if ( $chord_atts['global'] ) {
61
-
62
-			$post_id = wl_shortcode_chord_most_referenced_entity_id();
63
-
64
-			if ( null === $post_id ) {
65
-				return 'WordLift Chord: no entities found.';
66
-			}
67
-
68
-			// Use the provided height if any, otherwise use a default of 200px.
69
-			//
70
-			// See https://github.com/insideout10/wordlift-plugin/issues/443.
71
-			$chord_atts['height'] = isset( $chord_atts['height'] ) ? $chord_atts['height'] : '200px';
72
-
73
-		} else {
74
-			$post_id = get_the_ID();
75
-		}
76
-
77
-		// Use the registered style which define an optional dependency to font-awesome.
78
-		//
79
-		// @see https://github.com/insideout10/wordlift-plugin/issues/699
80
-		//		wp_enqueue_style( 'wordlift-ui', dirname( plugin_dir_url( __FILE__ ) ) . '/css/wordlift-ui.min.css' );
81
-		wp_enqueue_style( 'wordlift-ui' );
82
-
83
-		// Adding javascript code.
84
-		wp_enqueue_script( 'd3', dirname( plugin_dir_url( __FILE__ ) ) . '/bower_components/d3/d3.min.js' );
85
-
86
-		$this->enqueue_scripts();
87
-
88
-		wp_localize_script( 'wordlift-ui', 'wl_chord_params', array(
89
-			'ajax_url' => admin_url( 'admin-ajax.php' ),
90
-			'action'   => 'wl_chord',
91
-		) );
92
-
93
-		// Escaping atts.
94
-		$esc_class  = esc_attr( 'wl-chord' );
95
-		$esc_id     = esc_attr( uniqid( 'wl-chord-' ) );
96
-		$esc_width  = esc_attr( $chord_atts['width'] );
97
-		$esc_height = esc_attr( $chord_atts['height'] );
98
-
99
-		$esc_post_id    = esc_attr( $post_id );
100
-		$esc_depth      = esc_attr( $chord_atts['depth'] );
101
-		$esc_main_color = esc_attr( $chord_atts['main_color'] );
102
-
103
-		// Building template.
104
-		// TODO: in the HTML code there are static CSS rules. Move them to the CSS file.
105
-		return <<<EOF
19
+    /**
20
+     * {@inheritdoc}
21
+     */
22
+    const SHORTCODE = 'wl_chord';
23
+
24
+    /**
25
+     * Create a {@link Wordlift_Chord_Shortcode} instance.
26
+     *
27
+     * @since      3.5.4
28
+     */
29
+    public function __construct() {
30
+        parent::__construct();
31
+
32
+        // Hook to the `amp_post_template_css` to hide ourselves when in AMP
33
+        // rendering.
34
+        add_action( 'amp_post_template_css', array(
35
+            $this,
36
+            'amp_post_template_css',
37
+        ) );
38
+        $this->register_block_type();
39
+
40
+    }
41
+
42
+    /**
43
+     * Render shordcode.
44
+     *
45
+     * @param array $atts shortcode attributes.
46
+     *
47
+     * @return string The HTML output.
48
+     */
49
+    public function render( $atts ) {
50
+
51
+        // extract attributes and set default values.
52
+        $chord_atts = shortcode_atts( array(
53
+            'width'      => '100%',
54
+            'height'     => '500px',
55
+            'main_color' => '000',
56
+            'depth'      => 2,
57
+            'global'     => false,
58
+        ), $atts );
59
+
60
+        if ( $chord_atts['global'] ) {
61
+
62
+            $post_id = wl_shortcode_chord_most_referenced_entity_id();
63
+
64
+            if ( null === $post_id ) {
65
+                return 'WordLift Chord: no entities found.';
66
+            }
67
+
68
+            // Use the provided height if any, otherwise use a default of 200px.
69
+            //
70
+            // See https://github.com/insideout10/wordlift-plugin/issues/443.
71
+            $chord_atts['height'] = isset( $chord_atts['height'] ) ? $chord_atts['height'] : '200px';
72
+
73
+        } else {
74
+            $post_id = get_the_ID();
75
+        }
76
+
77
+        // Use the registered style which define an optional dependency to font-awesome.
78
+        //
79
+        // @see https://github.com/insideout10/wordlift-plugin/issues/699
80
+        //		wp_enqueue_style( 'wordlift-ui', dirname( plugin_dir_url( __FILE__ ) ) . '/css/wordlift-ui.min.css' );
81
+        wp_enqueue_style( 'wordlift-ui' );
82
+
83
+        // Adding javascript code.
84
+        wp_enqueue_script( 'd3', dirname( plugin_dir_url( __FILE__ ) ) . '/bower_components/d3/d3.min.js' );
85
+
86
+        $this->enqueue_scripts();
87
+
88
+        wp_localize_script( 'wordlift-ui', 'wl_chord_params', array(
89
+            'ajax_url' => admin_url( 'admin-ajax.php' ),
90
+            'action'   => 'wl_chord',
91
+        ) );
92
+
93
+        // Escaping atts.
94
+        $esc_class  = esc_attr( 'wl-chord' );
95
+        $esc_id     = esc_attr( uniqid( 'wl-chord-' ) );
96
+        $esc_width  = esc_attr( $chord_atts['width'] );
97
+        $esc_height = esc_attr( $chord_atts['height'] );
98
+
99
+        $esc_post_id    = esc_attr( $post_id );
100
+        $esc_depth      = esc_attr( $chord_atts['depth'] );
101
+        $esc_main_color = esc_attr( $chord_atts['main_color'] );
102
+
103
+        // Building template.
104
+        // TODO: in the HTML code there are static CSS rules. Move them to the CSS file.
105
+        return <<<EOF
106 106
 <div class="$esc_class" 
107 107
 	id="$esc_id"
108 108
 	data-post-id="$esc_post_id"
@@ -115,75 +115,75 @@  discard block
 block discarded – undo
115 115
         margin-bottom:10px">
116 116
 </div>
117 117
 EOF;
118
-	}
119
-
120
-	private function register_block_type() {
121
-
122
-		$scope = $this;
123
-
124
-		add_action( 'init', function () use ( $scope ) {
125
-			if ( ! function_exists( 'register_block_type' ) ) {
126
-				// Gutenberg is not active.
127
-				return;
128
-			}
129
-
130
-			register_block_type( 'wordlift/chord', array(
131
-				'editor_script'   => 'wl-block-editor',
132
-				'render_callback' => function ( $attributes ) use ( $scope ) {
133
-					$attr_code = '';
134
-					foreach ( $attributes as $key => $value ) {
135
-						$attr_code .= $key . '="' . htmlentities( $value ) . '" ';
136
-					}
137
-
138
-					return '[' . $scope::SHORTCODE . ' ' . $attr_code . ']';
139
-				},
140
-				'attributes'      => array(
141
-					'width'      => array(
142
-						'type'    => 'string',
143
-						'default' => '100%',
144
-					),
145
-					'height'     => array(
146
-						'type'    => 'string',
147
-						'default' => '500px',
148
-					),
149
-					'main_color' => array(
150
-						'type'    => 'string',
151
-						'default' => '000',
152
-					),
153
-					'depth'      => array(
154
-						'type'    => 'number',
155
-						'default' => 2,
156
-					),
157
-					'global'     => array(
158
-						'type'    => 'boolean',
159
-						'default' => false,
160
-					),
161
-					'preview'     => array(
162
-						'type'    => 'boolean',
163
-						'default' => false,
164
-					),
165
-					'preview_src'     => array(
166
-						'type'    => 'string',
167
-						'default' => WP_CONTENT_URL . '/plugins/wordlift/images/block-previews/chord.png',
168
-					),
169
-				),
170
-			) );
171
-		} );
172
-	}
173
-
174
-	/**
175
-	 * Customize the CSS when in AMP.
176
-	 *
177
-	 * See https://github.com/Automattic/amp-wp/blob/master/readme.md#custom-css
178
-	 *
179
-	 * @since 3.14.0
180
-	 */
181
-	public function amp_post_template_css( $amp_template ) {
182
-
183
-		// Hide the `wl-chord` when in AMP.
184
-		?>
118
+    }
119
+
120
+    private function register_block_type() {
121
+
122
+        $scope = $this;
123
+
124
+        add_action( 'init', function () use ( $scope ) {
125
+            if ( ! function_exists( 'register_block_type' ) ) {
126
+                // Gutenberg is not active.
127
+                return;
128
+            }
129
+
130
+            register_block_type( 'wordlift/chord', array(
131
+                'editor_script'   => 'wl-block-editor',
132
+                'render_callback' => function ( $attributes ) use ( $scope ) {
133
+                    $attr_code = '';
134
+                    foreach ( $attributes as $key => $value ) {
135
+                        $attr_code .= $key . '="' . htmlentities( $value ) . '" ';
136
+                    }
137
+
138
+                    return '[' . $scope::SHORTCODE . ' ' . $attr_code . ']';
139
+                },
140
+                'attributes'      => array(
141
+                    'width'      => array(
142
+                        'type'    => 'string',
143
+                        'default' => '100%',
144
+                    ),
145
+                    'height'     => array(
146
+                        'type'    => 'string',
147
+                        'default' => '500px',
148
+                    ),
149
+                    'main_color' => array(
150
+                        'type'    => 'string',
151
+                        'default' => '000',
152
+                    ),
153
+                    'depth'      => array(
154
+                        'type'    => 'number',
155
+                        'default' => 2,
156
+                    ),
157
+                    'global'     => array(
158
+                        'type'    => 'boolean',
159
+                        'default' => false,
160
+                    ),
161
+                    'preview'     => array(
162
+                        'type'    => 'boolean',
163
+                        'default' => false,
164
+                    ),
165
+                    'preview_src'     => array(
166
+                        'type'    => 'string',
167
+                        'default' => WP_CONTENT_URL . '/plugins/wordlift/images/block-previews/chord.png',
168
+                    ),
169
+                ),
170
+            ) );
171
+        } );
172
+    }
173
+
174
+    /**
175
+     * Customize the CSS when in AMP.
176
+     *
177
+     * See https://github.com/Automattic/amp-wp/blob/master/readme.md#custom-css
178
+     *
179
+     * @since 3.14.0
180
+     */
181
+    public function amp_post_template_css( $amp_template ) {
182
+
183
+        // Hide the `wl-chord` when in AMP.
184
+        ?>
185 185
 		.wl-chord { display: none; }
186 186
 		<?php
187
-	}
187
+    }
188 188
 
189 189
 }
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 
32 32
 		// Hook to the `amp_post_template_css` to hide ourselves when in AMP
33 33
 		// rendering.
34
-		add_action( 'amp_post_template_css', array(
34
+		add_action('amp_post_template_css', array(
35 35
 			$this,
36 36
 			'amp_post_template_css',
37
-		) );
37
+		));
38 38
 		$this->register_block_type();
39 39
 
40 40
 	}
@@ -46,29 +46,29 @@  discard block
 block discarded – undo
46 46
 	 *
47 47
 	 * @return string The HTML output.
48 48
 	 */
49
-	public function render( $atts ) {
49
+	public function render($atts) {
50 50
 
51 51
 		// extract attributes and set default values.
52
-		$chord_atts = shortcode_atts( array(
52
+		$chord_atts = shortcode_atts(array(
53 53
 			'width'      => '100%',
54 54
 			'height'     => '500px',
55 55
 			'main_color' => '000',
56 56
 			'depth'      => 2,
57 57
 			'global'     => false,
58
-		), $atts );
58
+		), $atts);
59 59
 
60
-		if ( $chord_atts['global'] ) {
60
+		if ($chord_atts['global']) {
61 61
 
62 62
 			$post_id = wl_shortcode_chord_most_referenced_entity_id();
63 63
 
64
-			if ( null === $post_id ) {
64
+			if (null === $post_id) {
65 65
 				return 'WordLift Chord: no entities found.';
66 66
 			}
67 67
 
68 68
 			// Use the provided height if any, otherwise use a default of 200px.
69 69
 			//
70 70
 			// See https://github.com/insideout10/wordlift-plugin/issues/443.
71
-			$chord_atts['height'] = isset( $chord_atts['height'] ) ? $chord_atts['height'] : '200px';
71
+			$chord_atts['height'] = isset($chord_atts['height']) ? $chord_atts['height'] : '200px';
72 72
 
73 73
 		} else {
74 74
 			$post_id = get_the_ID();
@@ -78,27 +78,27 @@  discard block
 block discarded – undo
78 78
 		//
79 79
 		// @see https://github.com/insideout10/wordlift-plugin/issues/699
80 80
 		//		wp_enqueue_style( 'wordlift-ui', dirname( plugin_dir_url( __FILE__ ) ) . '/css/wordlift-ui.min.css' );
81
-		wp_enqueue_style( 'wordlift-ui' );
81
+		wp_enqueue_style('wordlift-ui');
82 82
 
83 83
 		// Adding javascript code.
84
-		wp_enqueue_script( 'd3', dirname( plugin_dir_url( __FILE__ ) ) . '/bower_components/d3/d3.min.js' );
84
+		wp_enqueue_script('d3', dirname(plugin_dir_url(__FILE__)).'/bower_components/d3/d3.min.js');
85 85
 
86 86
 		$this->enqueue_scripts();
87 87
 
88
-		wp_localize_script( 'wordlift-ui', 'wl_chord_params', array(
89
-			'ajax_url' => admin_url( 'admin-ajax.php' ),
88
+		wp_localize_script('wordlift-ui', 'wl_chord_params', array(
89
+			'ajax_url' => admin_url('admin-ajax.php'),
90 90
 			'action'   => 'wl_chord',
91
-		) );
91
+		));
92 92
 
93 93
 		// Escaping atts.
94
-		$esc_class  = esc_attr( 'wl-chord' );
95
-		$esc_id     = esc_attr( uniqid( 'wl-chord-' ) );
96
-		$esc_width  = esc_attr( $chord_atts['width'] );
97
-		$esc_height = esc_attr( $chord_atts['height'] );
94
+		$esc_class  = esc_attr('wl-chord');
95
+		$esc_id     = esc_attr(uniqid('wl-chord-'));
96
+		$esc_width  = esc_attr($chord_atts['width']);
97
+		$esc_height = esc_attr($chord_atts['height']);
98 98
 
99
-		$esc_post_id    = esc_attr( $post_id );
100
-		$esc_depth      = esc_attr( $chord_atts['depth'] );
101
-		$esc_main_color = esc_attr( $chord_atts['main_color'] );
99
+		$esc_post_id    = esc_attr($post_id);
100
+		$esc_depth      = esc_attr($chord_atts['depth']);
101
+		$esc_main_color = esc_attr($chord_atts['main_color']);
102 102
 
103 103
 		// Building template.
104 104
 		// TODO: in the HTML code there are static CSS rules. Move them to the CSS file.
@@ -121,21 +121,21 @@  discard block
 block discarded – undo
121 121
 
122 122
 		$scope = $this;
123 123
 
124
-		add_action( 'init', function () use ( $scope ) {
125
-			if ( ! function_exists( 'register_block_type' ) ) {
124
+		add_action('init', function() use ($scope) {
125
+			if ( ! function_exists('register_block_type')) {
126 126
 				// Gutenberg is not active.
127 127
 				return;
128 128
 			}
129 129
 
130
-			register_block_type( 'wordlift/chord', array(
130
+			register_block_type('wordlift/chord', array(
131 131
 				'editor_script'   => 'wl-block-editor',
132
-				'render_callback' => function ( $attributes ) use ( $scope ) {
132
+				'render_callback' => function($attributes) use ($scope) {
133 133
 					$attr_code = '';
134
-					foreach ( $attributes as $key => $value ) {
135
-						$attr_code .= $key . '="' . htmlentities( $value ) . '" ';
134
+					foreach ($attributes as $key => $value) {
135
+						$attr_code .= $key.'="'.htmlentities($value).'" ';
136 136
 					}
137 137
 
138
-					return '[' . $scope::SHORTCODE . ' ' . $attr_code . ']';
138
+					return '['.$scope::SHORTCODE.' '.$attr_code.']';
139 139
 				},
140 140
 				'attributes'      => array(
141 141
 					'width'      => array(
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
 					),
165 165
 					'preview_src'     => array(
166 166
 						'type'    => 'string',
167
-						'default' => WP_CONTENT_URL . '/plugins/wordlift/images/block-previews/chord.png',
167
+						'default' => WP_CONTENT_URL.'/plugins/wordlift/images/block-previews/chord.png',
168 168
 					),
169 169
 				),
170
-			) );
170
+			));
171 171
 		} );
172 172
 	}
173 173
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 *
179 179
 	 * @since 3.14.0
180 180
 	 */
181
-	public function amp_post_template_css( $amp_template ) {
181
+	public function amp_post_template_css($amp_template) {
182 182
 
183 183
 		// Hide the `wl-chord` when in AMP.
184 184
 		?>
Please login to merge, or discard this patch.
src/public/class-wordlift-geomap-shortcode.php 2 patches
Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -18,145 +18,145 @@
 block discarded – undo
18 18
  */
19 19
 class Wordlift_Geomap_Shortcode extends Wordlift_Shortcode {
20 20
 
21
-	const SHORTCODE = 'wl_geomap';
22
-
23
-	/**
24
-	 * Create a {@link Wordlift_Geomap_Shortcode} instance.
25
-	 *
26
-	 * @since 3.5.4
27
-	 */
28
-	public function __construct() {
29
-		parent::__construct();
30
-
31
-		// Hook to the `amp_post_template_css` to hide ourselves when in AMP
32
-		// rendering.
33
-		add_action( 'amp_post_template_css', array( $this, 'amp_post_template_css', ) );
34
-		$this->register_block_type();
35
-
36
-	}
37
-
38
-	/**
39
-	 * Render the shortcode.
40
-	 *
41
-	 * @param array $atts An array of shortcode attributes as set by the editor.
42
-	 *
43
-	 * @return string The output html code.
44
-	 * @since 3.5.4
45
-	 *
46
-	 */
47
-	public function render( $atts ) {
48
-
49
-		// Extract attributes and set default values.
50
-		$geomap_atts = shortcode_atts( array(
51
-			'width'  => '100%',
52
-			'height' => '300px',
53
-			'global' => false,
54
-		), $atts );
55
-
56
-		// Get id of the post
57
-		$post_id = get_the_ID();
58
-
59
-		if ( $geomap_atts['global'] || is_null( $post_id ) ) {
60
-			// Global geomap
61
-			$geomap_id = 'wl_geomap_global';
62
-			$post_id   = null;
63
-		} else {
64
-			// Post-specific geomap
65
-			$geomap_id = 'wl_geomap_' . $post_id;
66
-		}
67
-
68
-		wp_enqueue_style( 'wl-leaflet', 'https://unpkg.com/[email protected]/dist/leaflet.css', array(), '1.6.0' );
69
-		wp_enqueue_script( 'wl-leaflet', 'https://unpkg.com/[email protected]/dist/leaflet.js', array(), '1.6.0', true );
70
-
71
-		// Use the registered style which define an optional dependency to font-awesome.
72
-		//
73
-		// @see https://github.com/insideout10/wordlift-plugin/issues/699
74
-		//		wp_enqueue_style( 'wordlift-ui', dirname( plugin_dir_url( __FILE__ ) ) . '/css/wordlift-ui.min.css' );
75
-		wp_enqueue_style( 'wordlift-ui' );
76
-
77
-		$this->enqueue_scripts();
78
-
79
-		wp_localize_script( 'wordlift-ui', 'wl_geomap_params', array(
80
-			'ajax_url' => admin_url( 'admin-ajax.php' ),    // Global param
81
-			'action'   => 'wl_geomap'            // Global param
82
-		) );
83
-
84
-		// Escaping atts.
85
-		$esc_id      = esc_attr( $geomap_id );
86
-		$esc_width   = esc_attr( $geomap_atts['width'] );
87
-		$esc_height  = esc_attr( $geomap_atts['height'] );
88
-		$esc_post_id = esc_attr( $post_id );
89
-
90
-		// Return HTML template.
91
-		return <<<EOF
21
+    const SHORTCODE = 'wl_geomap';
22
+
23
+    /**
24
+     * Create a {@link Wordlift_Geomap_Shortcode} instance.
25
+     *
26
+     * @since 3.5.4
27
+     */
28
+    public function __construct() {
29
+        parent::__construct();
30
+
31
+        // Hook to the `amp_post_template_css` to hide ourselves when in AMP
32
+        // rendering.
33
+        add_action( 'amp_post_template_css', array( $this, 'amp_post_template_css', ) );
34
+        $this->register_block_type();
35
+
36
+    }
37
+
38
+    /**
39
+     * Render the shortcode.
40
+     *
41
+     * @param array $atts An array of shortcode attributes as set by the editor.
42
+     *
43
+     * @return string The output html code.
44
+     * @since 3.5.4
45
+     *
46
+     */
47
+    public function render( $atts ) {
48
+
49
+        // Extract attributes and set default values.
50
+        $geomap_atts = shortcode_atts( array(
51
+            'width'  => '100%',
52
+            'height' => '300px',
53
+            'global' => false,
54
+        ), $atts );
55
+
56
+        // Get id of the post
57
+        $post_id = get_the_ID();
58
+
59
+        if ( $geomap_atts['global'] || is_null( $post_id ) ) {
60
+            // Global geomap
61
+            $geomap_id = 'wl_geomap_global';
62
+            $post_id   = null;
63
+        } else {
64
+            // Post-specific geomap
65
+            $geomap_id = 'wl_geomap_' . $post_id;
66
+        }
67
+
68
+        wp_enqueue_style( 'wl-leaflet', 'https://unpkg.com/[email protected]/dist/leaflet.css', array(), '1.6.0' );
69
+        wp_enqueue_script( 'wl-leaflet', 'https://unpkg.com/[email protected]/dist/leaflet.js', array(), '1.6.0', true );
70
+
71
+        // Use the registered style which define an optional dependency to font-awesome.
72
+        //
73
+        // @see https://github.com/insideout10/wordlift-plugin/issues/699
74
+        //		wp_enqueue_style( 'wordlift-ui', dirname( plugin_dir_url( __FILE__ ) ) . '/css/wordlift-ui.min.css' );
75
+        wp_enqueue_style( 'wordlift-ui' );
76
+
77
+        $this->enqueue_scripts();
78
+
79
+        wp_localize_script( 'wordlift-ui', 'wl_geomap_params', array(
80
+            'ajax_url' => admin_url( 'admin-ajax.php' ),    // Global param
81
+            'action'   => 'wl_geomap'            // Global param
82
+        ) );
83
+
84
+        // Escaping atts.
85
+        $esc_id      = esc_attr( $geomap_id );
86
+        $esc_width   = esc_attr( $geomap_atts['width'] );
87
+        $esc_height  = esc_attr( $geomap_atts['height'] );
88
+        $esc_post_id = esc_attr( $post_id );
89
+
90
+        // Return HTML template.
91
+        return <<<EOF
92 92
 <div class="wl-geomap"  id="$esc_id" data-post-id="$esc_post_id"
93 93
 	style="width:$esc_width; height:$esc_height; background-color: gray;">
94 94
 </div>
95 95
 EOF;
96
-	}
97
-
98
-	private function register_block_type() {
99
-
100
-		$scope = $this;
101
-
102
-		add_action( 'init', function () use ( $scope ) {
103
-			if ( ! function_exists( 'register_block_type' ) ) {
104
-				// Gutenberg is not active.
105
-				return;
106
-			}
107
-
108
-			register_block_type( 'wordlift/geomap', array(
109
-				'editor_script'   => 'wl-block-editor',
110
-				'render_callback' => function ( $attributes ) use ( $scope ) {
111
-					$attr_code = '';
112
-					foreach ( $attributes as $key => $value ) {
113
-						$attr_code .= $key . '="' . htmlentities( $value ) . '" ';
114
-					}
115
-
116
-					return '[' . $scope::SHORTCODE . ' ' . $attr_code . ']';
117
-				},
118
-				'attributes'      => array(
119
-					'width'  => array(
120
-						'type'    => 'string',
121
-						'default' => '100%'
122
-					),
123
-					'height' => array(
124
-						'type'    => 'string',
125
-						'default' => '300px'
126
-					),
127
-					'global' => array(
128
-						'type'    => 'boolean',
129
-						'default' => false
130
-					),
131
-					'preview'     => array(
132
-						'type'    => 'boolean',
133
-						'default' => false,
134
-					),
135
-					'preview_src'     => array(
136
-						'type'    => 'string',
137
-						'default' => WP_CONTENT_URL . '/plugins/wordlift/images/block-previews/geomap.png',
138
-					),
139
-				),
140
-			) );
141
-		} );
142
-	}
143
-
144
-	/**
145
-	 * Customize the CSS when in AMP.
146
-	 *
147
-	 * See https://github.com/Automattic/amp-wp/blob/master/readme.md#custom-css
148
-	 *
149
-	 * @param object $amp_template The template.
150
-	 *
151
-	 * @since 3.13.0
152
-	 *
153
-	 */
154
-	public function amp_post_template_css( $amp_template ) {
155
-
156
-		// Hide the `wl-geomap` when in AMP.
157
-		?>
96
+    }
97
+
98
+    private function register_block_type() {
99
+
100
+        $scope = $this;
101
+
102
+        add_action( 'init', function () use ( $scope ) {
103
+            if ( ! function_exists( 'register_block_type' ) ) {
104
+                // Gutenberg is not active.
105
+                return;
106
+            }
107
+
108
+            register_block_type( 'wordlift/geomap', array(
109
+                'editor_script'   => 'wl-block-editor',
110
+                'render_callback' => function ( $attributes ) use ( $scope ) {
111
+                    $attr_code = '';
112
+                    foreach ( $attributes as $key => $value ) {
113
+                        $attr_code .= $key . '="' . htmlentities( $value ) . '" ';
114
+                    }
115
+
116
+                    return '[' . $scope::SHORTCODE . ' ' . $attr_code . ']';
117
+                },
118
+                'attributes'      => array(
119
+                    'width'  => array(
120
+                        'type'    => 'string',
121
+                        'default' => '100%'
122
+                    ),
123
+                    'height' => array(
124
+                        'type'    => 'string',
125
+                        'default' => '300px'
126
+                    ),
127
+                    'global' => array(
128
+                        'type'    => 'boolean',
129
+                        'default' => false
130
+                    ),
131
+                    'preview'     => array(
132
+                        'type'    => 'boolean',
133
+                        'default' => false,
134
+                    ),
135
+                    'preview_src'     => array(
136
+                        'type'    => 'string',
137
+                        'default' => WP_CONTENT_URL . '/plugins/wordlift/images/block-previews/geomap.png',
138
+                    ),
139
+                ),
140
+            ) );
141
+        } );
142
+    }
143
+
144
+    /**
145
+     * Customize the CSS when in AMP.
146
+     *
147
+     * See https://github.com/Automattic/amp-wp/blob/master/readme.md#custom-css
148
+     *
149
+     * @param object $amp_template The template.
150
+     *
151
+     * @since 3.13.0
152
+     *
153
+     */
154
+    public function amp_post_template_css( $amp_template ) {
155
+
156
+        // Hide the `wl-geomap` when in AMP.
157
+        ?>
158 158
         .wl-geomap { display: none; }
159 159
 		<?php
160
-	}
160
+    }
161 161
 
162 162
 }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 		// Hook to the `amp_post_template_css` to hide ourselves when in AMP
32 32
 		// rendering.
33
-		add_action( 'amp_post_template_css', array( $this, 'amp_post_template_css', ) );
33
+		add_action('amp_post_template_css', array($this, 'amp_post_template_css',));
34 34
 		$this->register_block_type();
35 35
 
36 36
 	}
@@ -44,48 +44,48 @@  discard block
 block discarded – undo
44 44
 	 * @since 3.5.4
45 45
 	 *
46 46
 	 */
47
-	public function render( $atts ) {
47
+	public function render($atts) {
48 48
 
49 49
 		// Extract attributes and set default values.
50
-		$geomap_atts = shortcode_atts( array(
50
+		$geomap_atts = shortcode_atts(array(
51 51
 			'width'  => '100%',
52 52
 			'height' => '300px',
53 53
 			'global' => false,
54
-		), $atts );
54
+		), $atts);
55 55
 
56 56
 		// Get id of the post
57 57
 		$post_id = get_the_ID();
58 58
 
59
-		if ( $geomap_atts['global'] || is_null( $post_id ) ) {
59
+		if ($geomap_atts['global'] || is_null($post_id)) {
60 60
 			// Global geomap
61 61
 			$geomap_id = 'wl_geomap_global';
62 62
 			$post_id   = null;
63 63
 		} else {
64 64
 			// Post-specific geomap
65
-			$geomap_id = 'wl_geomap_' . $post_id;
65
+			$geomap_id = 'wl_geomap_'.$post_id;
66 66
 		}
67 67
 
68
-		wp_enqueue_style( 'wl-leaflet', 'https://unpkg.com/[email protected]/dist/leaflet.css', array(), '1.6.0' );
69
-		wp_enqueue_script( 'wl-leaflet', 'https://unpkg.com/[email protected]/dist/leaflet.js', array(), '1.6.0', true );
68
+		wp_enqueue_style('wl-leaflet', 'https://unpkg.com/[email protected]/dist/leaflet.css', array(), '1.6.0');
69
+		wp_enqueue_script('wl-leaflet', 'https://unpkg.com/[email protected]/dist/leaflet.js', array(), '1.6.0', true);
70 70
 
71 71
 		// Use the registered style which define an optional dependency to font-awesome.
72 72
 		//
73 73
 		// @see https://github.com/insideout10/wordlift-plugin/issues/699
74 74
 		//		wp_enqueue_style( 'wordlift-ui', dirname( plugin_dir_url( __FILE__ ) ) . '/css/wordlift-ui.min.css' );
75
-		wp_enqueue_style( 'wordlift-ui' );
75
+		wp_enqueue_style('wordlift-ui');
76 76
 
77 77
 		$this->enqueue_scripts();
78 78
 
79
-		wp_localize_script( 'wordlift-ui', 'wl_geomap_params', array(
80
-			'ajax_url' => admin_url( 'admin-ajax.php' ),    // Global param
79
+		wp_localize_script('wordlift-ui', 'wl_geomap_params', array(
80
+			'ajax_url' => admin_url('admin-ajax.php'), // Global param
81 81
 			'action'   => 'wl_geomap'            // Global param
82
-		) );
82
+		));
83 83
 
84 84
 		// Escaping atts.
85
-		$esc_id      = esc_attr( $geomap_id );
86
-		$esc_width   = esc_attr( $geomap_atts['width'] );
87
-		$esc_height  = esc_attr( $geomap_atts['height'] );
88
-		$esc_post_id = esc_attr( $post_id );
85
+		$esc_id      = esc_attr($geomap_id);
86
+		$esc_width   = esc_attr($geomap_atts['width']);
87
+		$esc_height  = esc_attr($geomap_atts['height']);
88
+		$esc_post_id = esc_attr($post_id);
89 89
 
90 90
 		// Return HTML template.
91 91
 		return <<<EOF
@@ -99,21 +99,21 @@  discard block
 block discarded – undo
99 99
 
100 100
 		$scope = $this;
101 101
 
102
-		add_action( 'init', function () use ( $scope ) {
103
-			if ( ! function_exists( 'register_block_type' ) ) {
102
+		add_action('init', function() use ($scope) {
103
+			if ( ! function_exists('register_block_type')) {
104 104
 				// Gutenberg is not active.
105 105
 				return;
106 106
 			}
107 107
 
108
-			register_block_type( 'wordlift/geomap', array(
108
+			register_block_type('wordlift/geomap', array(
109 109
 				'editor_script'   => 'wl-block-editor',
110
-				'render_callback' => function ( $attributes ) use ( $scope ) {
110
+				'render_callback' => function($attributes) use ($scope) {
111 111
 					$attr_code = '';
112
-					foreach ( $attributes as $key => $value ) {
113
-						$attr_code .= $key . '="' . htmlentities( $value ) . '" ';
112
+					foreach ($attributes as $key => $value) {
113
+						$attr_code .= $key.'="'.htmlentities($value).'" ';
114 114
 					}
115 115
 
116
-					return '[' . $scope::SHORTCODE . ' ' . $attr_code . ']';
116
+					return '['.$scope::SHORTCODE.' '.$attr_code.']';
117 117
 				},
118 118
 				'attributes'      => array(
119 119
 					'width'  => array(
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
 					),
135 135
 					'preview_src'     => array(
136 136
 						'type'    => 'string',
137
-						'default' => WP_CONTENT_URL . '/plugins/wordlift/images/block-previews/geomap.png',
137
+						'default' => WP_CONTENT_URL.'/plugins/wordlift/images/block-previews/geomap.png',
138 138
 					),
139 139
 				),
140
-			) );
140
+			));
141 141
 		} );
142 142
 	}
143 143
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * @since 3.13.0
152 152
 	 *
153 153
 	 */
154
-	public function amp_post_template_css( $amp_template ) {
154
+	public function amp_post_template_css($amp_template) {
155 155
 
156 156
 		// Hide the `wl-geomap` when in AMP.
157 157
 		?>
Please login to merge, or discard this patch.
src/public/class-wordlift-timeline-shortcode.php 2 patches
Indentation   +228 added lines, -228 removed lines patch added patch discarded remove patch
@@ -7,258 +7,258 @@
 block discarded – undo
7 7
  */
8 8
 class Wordlift_Timeline_Shortcode extends Wordlift_Shortcode {
9 9
 
10
-	const SHORTCODE = 'wl_timeline';
10
+    const SHORTCODE = 'wl_timeline';
11 11
 
12
-	/**
13
-	 * The list of locales supported by TimelineJS (correspond to the list of
14
-	 * files in the locale subfolder).
15
-	 *
16
-	 * @since 3.7.0
17
-	 * @var array An array of two-letters language codes.
18
-	 */
19
-	private static $supported_locales = array(
20
-		'ur',
21
-		'uk',
22
-		'tr',
23
-		'tl',
24
-		'th',
25
-		'te',
26
-		'ta',
27
-		'sv',
28
-		'sr',
29
-		'sl',
30
-		'sk',
31
-		'si',
32
-		'ru',
33
-		'ro',
34
-		'rm',
35
-		'pt',
36
-		'pl',
37
-		'no',
38
-		'nl',
39
-		'ne',
40
-		'ms',
41
-		'lv',
42
-		'lt',
43
-		'lb',
44
-		'ko',
45
-		'ka',
46
-		'ja',
47
-		'iw',
48
-		'it',
49
-		'is',
50
-		'id',
51
-		'hy',
52
-		'hu',
53
-		'hr',
54
-		'hi',
55
-		'he',
56
-		'gl',
57
-		'ga',
58
-		'fy',
59
-		'fr',
60
-		'fo',
61
-		'fi',
62
-		'fa',
63
-		'eu',
64
-		'et',
65
-		'es',
66
-		'eo',
67
-		'en',
68
-		'el',
69
-		'de',
70
-		'da',
71
-		'cz',
72
-		'ca',
73
-		'bg',
74
-		'be',
75
-		'ar',
76
-		'af'
77
-	);
12
+    /**
13
+     * The list of locales supported by TimelineJS (correspond to the list of
14
+     * files in the locale subfolder).
15
+     *
16
+     * @since 3.7.0
17
+     * @var array An array of two-letters language codes.
18
+     */
19
+    private static $supported_locales = array(
20
+        'ur',
21
+        'uk',
22
+        'tr',
23
+        'tl',
24
+        'th',
25
+        'te',
26
+        'ta',
27
+        'sv',
28
+        'sr',
29
+        'sl',
30
+        'sk',
31
+        'si',
32
+        'ru',
33
+        'ro',
34
+        'rm',
35
+        'pt',
36
+        'pl',
37
+        'no',
38
+        'nl',
39
+        'ne',
40
+        'ms',
41
+        'lv',
42
+        'lt',
43
+        'lb',
44
+        'ko',
45
+        'ka',
46
+        'ja',
47
+        'iw',
48
+        'it',
49
+        'is',
50
+        'id',
51
+        'hy',
52
+        'hu',
53
+        'hr',
54
+        'hi',
55
+        'he',
56
+        'gl',
57
+        'ga',
58
+        'fy',
59
+        'fr',
60
+        'fo',
61
+        'fi',
62
+        'fa',
63
+        'eu',
64
+        'et',
65
+        'es',
66
+        'eo',
67
+        'en',
68
+        'el',
69
+        'de',
70
+        'da',
71
+        'cz',
72
+        'ca',
73
+        'bg',
74
+        'be',
75
+        'ar',
76
+        'af'
77
+    );
78 78
 
79
-	/**
80
-	 * The Log service.
81
-	 *
82
-	 * @since 3.1.0
83
-	 * @access private
84
-	 * @var \Wordlift_Log_Service $log_service The Log service.
85
-	 */
86
-	private $log_service;
79
+    /**
80
+     * The Log service.
81
+     *
82
+     * @since 3.1.0
83
+     * @access private
84
+     * @var \Wordlift_Log_Service $log_service The Log service.
85
+     */
86
+    private $log_service;
87 87
 
88
-	/**
89
-	 * Create a Wordlift_Timeline_Shortcode instance.
90
-	 *
91
-	 * @since 3.1.0
92
-	 */
93
-	public function __construct() {
94
-		parent::__construct();
88
+    /**
89
+     * Create a Wordlift_Timeline_Shortcode instance.
90
+     *
91
+     * @since 3.1.0
92
+     */
93
+    public function __construct() {
94
+        parent::__construct();
95 95
 
96
-		$this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Timeline_Shortcode' );
96
+        $this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Timeline_Shortcode' );
97 97
 
98
-		$this->register_block_type();
98
+        $this->register_block_type();
99 99
 
100
-	}
100
+    }
101 101
 
102
-	public function get_timelinejs_default_options() {
103
-		return array(
104
-			'debug'                            => defined( 'WP_DEBUG' ) && WP_DEBUG,
105
-			'height'                           => null,
106
-			'width'                            => null,
107
-			'is_embed'                         => false,
108
-			'hash_bookmark'                    => false,
109
-			'default_bg_color'                 => 'white',
110
-			'scale_factor'                     => 2,
111
-			'initial_zoom'                     => null,
112
-			'zoom_sequence'                    => '[0.5, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]',
113
-			'timenav_position'                 => 'bottom',
114
-			'optimal_tick_width'               => 100,
115
-			'base_class'                       => 'tl-timeline',
116
-			'timenav_height'                   => 150,
117
-			'timenav_height_percentage'        => null,
118
-			'timenav_mobile_height_percentage' => 40,
119
-			'timenav_height_min'               => 150,
120
-			'marker_height_min'                => 30,
121
-			'marker_width_min'                 => 100,
122
-			'start_at_slide'                   => 0,
123
-			'start_at_end'                     => false,
124
-			'menubar_height'                   => 0,
125
-			'use_bc'                           => false,
126
-			'duration'                         => 1000,
127
-			'ease'                             => 'TL.Ease.easeInOutQuint',
128
-			'slide_default_fade'               => '0%',
129
-			'language'                         => $this->get_locale(),
130
-			'ga_property_id'                   => null,
131
-			'track_events'                     => "['back_to_start','nav_next','nav_previous','zoom_in','zoom_out']"
132
-		);
133
-	}
102
+    public function get_timelinejs_default_options() {
103
+        return array(
104
+            'debug'                            => defined( 'WP_DEBUG' ) && WP_DEBUG,
105
+            'height'                           => null,
106
+            'width'                            => null,
107
+            'is_embed'                         => false,
108
+            'hash_bookmark'                    => false,
109
+            'default_bg_color'                 => 'white',
110
+            'scale_factor'                     => 2,
111
+            'initial_zoom'                     => null,
112
+            'zoom_sequence'                    => '[0.5, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]',
113
+            'timenav_position'                 => 'bottom',
114
+            'optimal_tick_width'               => 100,
115
+            'base_class'                       => 'tl-timeline',
116
+            'timenav_height'                   => 150,
117
+            'timenav_height_percentage'        => null,
118
+            'timenav_mobile_height_percentage' => 40,
119
+            'timenav_height_min'               => 150,
120
+            'marker_height_min'                => 30,
121
+            'marker_width_min'                 => 100,
122
+            'start_at_slide'                   => 0,
123
+            'start_at_end'                     => false,
124
+            'menubar_height'                   => 0,
125
+            'use_bc'                           => false,
126
+            'duration'                         => 1000,
127
+            'ease'                             => 'TL.Ease.easeInOutQuint',
128
+            'slide_default_fade'               => '0%',
129
+            'language'                         => $this->get_locale(),
130
+            'ga_property_id'                   => null,
131
+            'track_events'                     => "['back_to_start','nav_next','nav_previous','zoom_in','zoom_out']"
132
+        );
133
+    }
134 134
 
135
-	/**
136
-	 * Renders the Timeline.
137
-	 *
138
-	 * @param array $atts An array of shortcode attributes.
139
-	 *
140
-	 * @return string The rendered HTML.
141
-	 * @since 3.1.0
142
-	 *
143
-	 */
144
-	public function render( $atts ) {
135
+    /**
136
+     * Renders the Timeline.
137
+     *
138
+     * @param array $atts An array of shortcode attributes.
139
+     *
140
+     * @return string The rendered HTML.
141
+     * @since 3.1.0
142
+     *
143
+     */
144
+    public function render( $atts ) {
145 145
 
146
-		//extract attributes and set default values
147
-		$settings = shortcode_atts( array_merge( $this->get_timelinejs_default_options(), array(
148
-			'global'            => false,
149
-			'display_images_as' => 'media',
150
-			'excerpt_length'    => 55
151
-		) ), $atts );
146
+        //extract attributes and set default values
147
+        $settings = shortcode_atts( array_merge( $this->get_timelinejs_default_options(), array(
148
+            'global'            => false,
149
+            'display_images_as' => 'media',
150
+            'excerpt_length'    => 55
151
+        ) ), $atts );
152 152
 
153
-		// Load the TimelineJS stylesheets and scripts.
154
-		wp_enqueue_style( 'timelinejs', dirname( plugin_dir_url( __FILE__ ) ) . '/timelinejs/css/timeline.css' );
155
-		wp_enqueue_script( 'timelinejs', dirname( plugin_dir_url( __FILE__ ) ) . '/timelinejs/js/timeline' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '-min' : '' ) . '.js' );
153
+        // Load the TimelineJS stylesheets and scripts.
154
+        wp_enqueue_style( 'timelinejs', dirname( plugin_dir_url( __FILE__ ) ) . '/timelinejs/css/timeline.css' );
155
+        wp_enqueue_script( 'timelinejs', dirname( plugin_dir_url( __FILE__ ) ) . '/timelinejs/js/timeline' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '-min' : '' ) . '.js' );
156 156
 
157
-		// Enqueue the scripts for the timeline.
158
-		$this->enqueue_scripts();
157
+        // Enqueue the scripts for the timeline.
158
+        $this->enqueue_scripts();
159 159
 
160
-		// Provide the script with options.
161
-		wp_localize_script( 'timelinejs', 'wl_timeline_params', array(
162
-			'ajax_url'          => admin_url( 'admin-ajax.php' ),
163
-			// TODO: this parameter is already provided by WP
164
-			'action'            => 'wl_timeline',
165
-			// These settings apply to our wl_timeline AJAX endpoint.
166
-			'display_images_as' => $settings['display_images_as'],
167
-			'excerpt_length'    => $settings['excerpt_length'],
168
-			// These settings apply to the timeline javascript client.
169
-			'settings'          => array_filter( $settings, function ( $value ) {
170
-				// Do not set NULL values.
171
-				return ( null !== $value );
172
-			} )
173
-		) );
160
+        // Provide the script with options.
161
+        wp_localize_script( 'timelinejs', 'wl_timeline_params', array(
162
+            'ajax_url'          => admin_url( 'admin-ajax.php' ),
163
+            // TODO: this parameter is already provided by WP
164
+            'action'            => 'wl_timeline',
165
+            // These settings apply to our wl_timeline AJAX endpoint.
166
+            'display_images_as' => $settings['display_images_as'],
167
+            'excerpt_length'    => $settings['excerpt_length'],
168
+            // These settings apply to the timeline javascript client.
169
+            'settings'          => array_filter( $settings, function ( $value ) {
170
+                // Do not set NULL values.
171
+                return ( null !== $value );
172
+            } )
173
+        ) );
174 174
 
175
-		// Get the current post id or set null if global is set to true.
176
-		$post_id = ( $settings['global'] ? null : get_the_ID() );
175
+        // Get the current post id or set null if global is set to true.
176
+        $post_id = ( $settings['global'] ? null : get_the_ID() );
177 177
 
178
-		// Escaping atts.
179
-		$style        = sprintf( 'style="%s%s"', isset( $settings['width'] ) ? "width:{$settings['width']};" : '', isset( $settings['height'] ) ? "height:{$settings['height']};" : '' );
180
-		$data_post_id = ( isset( $post_id ) ? "data-post-id='$post_id'" : '' );
178
+        // Escaping atts.
179
+        $style        = sprintf( 'style="%s%s"', isset( $settings['width'] ) ? "width:{$settings['width']};" : '', isset( $settings['height'] ) ? "height:{$settings['height']};" : '' );
180
+        $data_post_id = ( isset( $post_id ) ? "data-post-id='$post_id'" : '' );
181 181
 
182
-		// Generate a unique ID for this timeline.
183
-		$element_id = uniqid( 'wl-timeline-' );
182
+        // Generate a unique ID for this timeline.
183
+        $element_id = uniqid( 'wl-timeline-' );
184 184
 
185
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
186
-			$this->log_service->trace( "Creating a timeline widget [ element id :: $element_id ][ post id :: $post_id ]" );
187
-		}
185
+        if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
186
+            $this->log_service->trace( "Creating a timeline widget [ element id :: $element_id ][ post id :: $post_id ]" );
187
+        }
188 188
 
189
-		// Building template.
190
-		return sprintf( '<div class="wl-timeline-container" %s><div class="wl-timeline" id="%s" %s></div></div>', $style, $element_id, $data_post_id );
191
-	}
189
+        // Building template.
190
+        return sprintf( '<div class="wl-timeline-container" %s><div class="wl-timeline" id="%s" %s></div></div>', $style, $element_id, $data_post_id );
191
+    }
192 192
 
193
-	private function register_block_type() {
193
+    private function register_block_type() {
194 194
 
195
-		$scope = $this;
195
+        $scope = $this;
196 196
 
197
-		add_action( 'init', function () use ( $scope ) {
198
-			if ( ! function_exists( 'register_block_type' ) ) {
199
-				// Gutenberg is not active.
200
-				return;
201
-			}
197
+        add_action( 'init', function () use ( $scope ) {
198
+            if ( ! function_exists( 'register_block_type' ) ) {
199
+                // Gutenberg is not active.
200
+                return;
201
+            }
202 202
 
203
-			register_block_type( 'wordlift/timeline', array(
204
-				'editor_script'   => 'wl-block-editor',
205
-				'render_callback' => function ( $attributes ) use ( $scope ) {
206
-					$attr_code          = '';
207
-					$timelinejs_options = json_decode( $attributes['timelinejs_options'], true );
208
-					unset( $attributes['timelinejs_options'] );
209
-					$attributes_all = array_merge( $attributes, $timelinejs_options );
210
-					foreach ( $attributes_all as $key => $value ) {
211
-						if ( $value && strpos( $value, '[' ) === false && strpos( $value, ']' ) === false ) {
212
-							$attr_code .= $key . '="' . $value . '" ';
213
-						}
214
-					}
203
+            register_block_type( 'wordlift/timeline', array(
204
+                'editor_script'   => 'wl-block-editor',
205
+                'render_callback' => function ( $attributes ) use ( $scope ) {
206
+                    $attr_code          = '';
207
+                    $timelinejs_options = json_decode( $attributes['timelinejs_options'], true );
208
+                    unset( $attributes['timelinejs_options'] );
209
+                    $attributes_all = array_merge( $attributes, $timelinejs_options );
210
+                    foreach ( $attributes_all as $key => $value ) {
211
+                        if ( $value && strpos( $value, '[' ) === false && strpos( $value, ']' ) === false ) {
212
+                            $attr_code .= $key . '="' . $value . '" ';
213
+                        }
214
+                    }
215 215
 
216
-					return '[' . $scope::SHORTCODE . ' ' . $attr_code . ']';
217
-				},
218
-				'attributes'      => array(
219
-					'display_images_as'  => array(
220
-						'type'    => 'string',
221
-						'default' => 'media'
222
-					),
223
-					'excerpt_length'     => array(
224
-						'type'    => 'number',
225
-						'default' => 55
226
-					),
227
-					'global'             => array(
228
-						'type'    => 'bool',
229
-						'default' => false
230
-					),
231
-					'timelinejs_options' => array(
232
-						'type'    => 'string', // https://timeline.knightlab.com/docs/options.html
233
-						'default' => json_encode( $scope->get_timelinejs_default_options(), JSON_PRETTY_PRINT )
234
-					),
235
-					'preview'     => array(
236
-						'type'    => 'boolean',
237
-						'default' => false,
238
-					),
239
-					'preview_src' => array(
240
-						'type'    => 'string',
241
-						'default' => WP_CONTENT_URL . '/plugins/wordlift/images/block-previews/timeline.png',
242
-					)
243
-				)
244
-			) );
245
-		} );
246
-	}
216
+                    return '[' . $scope::SHORTCODE . ' ' . $attr_code . ']';
217
+                },
218
+                'attributes'      => array(
219
+                    'display_images_as'  => array(
220
+                        'type'    => 'string',
221
+                        'default' => 'media'
222
+                    ),
223
+                    'excerpt_length'     => array(
224
+                        'type'    => 'number',
225
+                        'default' => 55
226
+                    ),
227
+                    'global'             => array(
228
+                        'type'    => 'bool',
229
+                        'default' => false
230
+                    ),
231
+                    'timelinejs_options' => array(
232
+                        'type'    => 'string', // https://timeline.knightlab.com/docs/options.html
233
+                        'default' => json_encode( $scope->get_timelinejs_default_options(), JSON_PRETTY_PRINT )
234
+                    ),
235
+                    'preview'     => array(
236
+                        'type'    => 'boolean',
237
+                        'default' => false,
238
+                    ),
239
+                    'preview_src' => array(
240
+                        'type'    => 'string',
241
+                        'default' => WP_CONTENT_URL . '/plugins/wordlift/images/block-previews/timeline.png',
242
+                    )
243
+                )
244
+            ) );
245
+        } );
246
+    }
247 247
 
248
-	/**
249
-	 * Return the locale for the TimelineJS according to WP's configured locale and
250
-	 * support TimelineJS locales. If WP's locale is not supported, english is used.
251
-	 *
252
-	 * @return string The locale (2 letters code).
253
-	 * @since 3.7.0
254
-	 */
255
-	private function get_locale() {
248
+    /**
249
+     * Return the locale for the TimelineJS according to WP's configured locale and
250
+     * support TimelineJS locales. If WP's locale is not supported, english is used.
251
+     *
252
+     * @return string The locale (2 letters code).
253
+     * @since 3.7.0
254
+     */
255
+    private function get_locale() {
256 256
 
257
-		// Get the first 2 letters.
258
-		$locale = substr( get_locale(), 0, 2 );
257
+        // Get the first 2 letters.
258
+        $locale = substr( get_locale(), 0, 2 );
259 259
 
260
-		// Check that the specified locale is supported otherwise use English.
261
-		return in_array( $locale, self::$supported_locales ) ? $locale : 'en';
262
-	}
260
+        // Check that the specified locale is supported otherwise use English.
261
+        return in_array( $locale, self::$supported_locales ) ? $locale : 'en';
262
+    }
263 263
 
264 264
 }
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	public function __construct() {
94 94
 		parent::__construct();
95 95
 
96
-		$this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Timeline_Shortcode' );
96
+		$this->log_service = Wordlift_Log_Service::get_logger('Wordlift_Timeline_Shortcode');
97 97
 
98 98
 		$this->register_block_type();
99 99
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 
102 102
 	public function get_timelinejs_default_options() {
103 103
 		return array(
104
-			'debug'                            => defined( 'WP_DEBUG' ) && WP_DEBUG,
104
+			'debug'                            => defined('WP_DEBUG') && WP_DEBUG,
105 105
 			'height'                           => null,
106 106
 			'width'                            => null,
107 107
 			'is_embed'                         => false,
@@ -141,79 +141,79 @@  discard block
 block discarded – undo
141 141
 	 * @since 3.1.0
142 142
 	 *
143 143
 	 */
144
-	public function render( $atts ) {
144
+	public function render($atts) {
145 145
 
146 146
 		//extract attributes and set default values
147
-		$settings = shortcode_atts( array_merge( $this->get_timelinejs_default_options(), array(
147
+		$settings = shortcode_atts(array_merge($this->get_timelinejs_default_options(), array(
148 148
 			'global'            => false,
149 149
 			'display_images_as' => 'media',
150 150
 			'excerpt_length'    => 55
151
-		) ), $atts );
151
+		)), $atts);
152 152
 
153 153
 		// Load the TimelineJS stylesheets and scripts.
154
-		wp_enqueue_style( 'timelinejs', dirname( plugin_dir_url( __FILE__ ) ) . '/timelinejs/css/timeline.css' );
155
-		wp_enqueue_script( 'timelinejs', dirname( plugin_dir_url( __FILE__ ) ) . '/timelinejs/js/timeline' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '-min' : '' ) . '.js' );
154
+		wp_enqueue_style('timelinejs', dirname(plugin_dir_url(__FILE__)).'/timelinejs/css/timeline.css');
155
+		wp_enqueue_script('timelinejs', dirname(plugin_dir_url(__FILE__)).'/timelinejs/js/timeline'.( ! defined('SCRIPT_DEBUG') || ! SCRIPT_DEBUG ? '-min' : '').'.js');
156 156
 
157 157
 		// Enqueue the scripts for the timeline.
158 158
 		$this->enqueue_scripts();
159 159
 
160 160
 		// Provide the script with options.
161
-		wp_localize_script( 'timelinejs', 'wl_timeline_params', array(
162
-			'ajax_url'          => admin_url( 'admin-ajax.php' ),
161
+		wp_localize_script('timelinejs', 'wl_timeline_params', array(
162
+			'ajax_url'          => admin_url('admin-ajax.php'),
163 163
 			// TODO: this parameter is already provided by WP
164 164
 			'action'            => 'wl_timeline',
165 165
 			// These settings apply to our wl_timeline AJAX endpoint.
166 166
 			'display_images_as' => $settings['display_images_as'],
167 167
 			'excerpt_length'    => $settings['excerpt_length'],
168 168
 			// These settings apply to the timeline javascript client.
169
-			'settings'          => array_filter( $settings, function ( $value ) {
169
+			'settings'          => array_filter($settings, function($value) {
170 170
 				// Do not set NULL values.
171
-				return ( null !== $value );
171
+				return (null !== $value);
172 172
 			} )
173
-		) );
173
+		));
174 174
 
175 175
 		// Get the current post id or set null if global is set to true.
176
-		$post_id = ( $settings['global'] ? null : get_the_ID() );
176
+		$post_id = ($settings['global'] ? null : get_the_ID());
177 177
 
178 178
 		// Escaping atts.
179
-		$style        = sprintf( 'style="%s%s"', isset( $settings['width'] ) ? "width:{$settings['width']};" : '', isset( $settings['height'] ) ? "height:{$settings['height']};" : '' );
180
-		$data_post_id = ( isset( $post_id ) ? "data-post-id='$post_id'" : '' );
179
+		$style        = sprintf('style="%s%s"', isset($settings['width']) ? "width:{$settings['width']};" : '', isset($settings['height']) ? "height:{$settings['height']};" : '');
180
+		$data_post_id = (isset($post_id) ? "data-post-id='$post_id'" : '');
181 181
 
182 182
 		// Generate a unique ID for this timeline.
183
-		$element_id = uniqid( 'wl-timeline-' );
183
+		$element_id = uniqid('wl-timeline-');
184 184
 
185
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
186
-			$this->log_service->trace( "Creating a timeline widget [ element id :: $element_id ][ post id :: $post_id ]" );
185
+		if (defined('WP_DEBUG') && WP_DEBUG) {
186
+			$this->log_service->trace("Creating a timeline widget [ element id :: $element_id ][ post id :: $post_id ]");
187 187
 		}
188 188
 
189 189
 		// Building template.
190
-		return sprintf( '<div class="wl-timeline-container" %s><div class="wl-timeline" id="%s" %s></div></div>', $style, $element_id, $data_post_id );
190
+		return sprintf('<div class="wl-timeline-container" %s><div class="wl-timeline" id="%s" %s></div></div>', $style, $element_id, $data_post_id);
191 191
 	}
192 192
 
193 193
 	private function register_block_type() {
194 194
 
195 195
 		$scope = $this;
196 196
 
197
-		add_action( 'init', function () use ( $scope ) {
198
-			if ( ! function_exists( 'register_block_type' ) ) {
197
+		add_action('init', function() use ($scope) {
198
+			if ( ! function_exists('register_block_type')) {
199 199
 				// Gutenberg is not active.
200 200
 				return;
201 201
 			}
202 202
 
203
-			register_block_type( 'wordlift/timeline', array(
203
+			register_block_type('wordlift/timeline', array(
204 204
 				'editor_script'   => 'wl-block-editor',
205
-				'render_callback' => function ( $attributes ) use ( $scope ) {
205
+				'render_callback' => function($attributes) use ($scope) {
206 206
 					$attr_code          = '';
207
-					$timelinejs_options = json_decode( $attributes['timelinejs_options'], true );
208
-					unset( $attributes['timelinejs_options'] );
209
-					$attributes_all = array_merge( $attributes, $timelinejs_options );
210
-					foreach ( $attributes_all as $key => $value ) {
211
-						if ( $value && strpos( $value, '[' ) === false && strpos( $value, ']' ) === false ) {
212
-							$attr_code .= $key . '="' . $value . '" ';
207
+					$timelinejs_options = json_decode($attributes['timelinejs_options'], true);
208
+					unset($attributes['timelinejs_options']);
209
+					$attributes_all = array_merge($attributes, $timelinejs_options);
210
+					foreach ($attributes_all as $key => $value) {
211
+						if ($value && strpos($value, '[') === false && strpos($value, ']') === false) {
212
+							$attr_code .= $key.'="'.$value.'" ';
213 213
 						}
214 214
 					}
215 215
 
216
-					return '[' . $scope::SHORTCODE . ' ' . $attr_code . ']';
216
+					return '['.$scope::SHORTCODE.' '.$attr_code.']';
217 217
 				},
218 218
 				'attributes'      => array(
219 219
 					'display_images_as'  => array(
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 					),
231 231
 					'timelinejs_options' => array(
232 232
 						'type'    => 'string', // https://timeline.knightlab.com/docs/options.html
233
-						'default' => json_encode( $scope->get_timelinejs_default_options(), JSON_PRETTY_PRINT )
233
+						'default' => json_encode($scope->get_timelinejs_default_options(), JSON_PRETTY_PRINT)
234 234
 					),
235 235
 					'preview'     => array(
236 236
 						'type'    => 'boolean',
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
 					),
239 239
 					'preview_src' => array(
240 240
 						'type'    => 'string',
241
-						'default' => WP_CONTENT_URL . '/plugins/wordlift/images/block-previews/timeline.png',
241
+						'default' => WP_CONTENT_URL.'/plugins/wordlift/images/block-previews/timeline.png',
242 242
 					)
243 243
 				)
244
-			) );
244
+			));
245 245
 		} );
246 246
 	}
247 247
 
@@ -255,10 +255,10 @@  discard block
 block discarded – undo
255 255
 	private function get_locale() {
256 256
 
257 257
 		// Get the first 2 letters.
258
-		$locale = substr( get_locale(), 0, 2 );
258
+		$locale = substr(get_locale(), 0, 2);
259 259
 
260 260
 		// Check that the specified locale is supported otherwise use English.
261
-		return in_array( $locale, self::$supported_locales ) ? $locale : 'en';
261
+		return in_array($locale, self::$supported_locales) ? $locale : 'en';
262 262
 	}
263 263
 
264 264
 }
Please login to merge, or discard this patch.