@@ -7,56 +7,56 @@ discard block |
||
7 | 7 | * Class WordLift_Geo_Widget |
8 | 8 | */ |
9 | 9 | class WordLift_Geo_Widget extends WP_Widget { |
10 | - /** |
|
11 | - * Sets up the widgets name etc |
|
12 | - */ |
|
13 | - public function __construct() { |
|
14 | - // Initialize the Widget. |
|
15 | - parent::__construct( |
|
16 | - 'wl_geo_widget', // Base ID |
|
17 | - __( 'Geo Widget', 'wordlift' ), // Name |
|
18 | - array( 'description' => __( 'Geo Widget description', 'wordlift' ) ) // Args |
|
19 | - ); |
|
20 | - } |
|
10 | + /** |
|
11 | + * Sets up the widgets name etc |
|
12 | + */ |
|
13 | + public function __construct() { |
|
14 | + // Initialize the Widget. |
|
15 | + parent::__construct( |
|
16 | + 'wl_geo_widget', // Base ID |
|
17 | + __( 'Geo Widget', 'wordlift' ), // Name |
|
18 | + array( 'description' => __( 'Geo Widget description', 'wordlift' ) ) // Args |
|
19 | + ); |
|
20 | + } |
|
21 | 21 | |
22 | - /** |
|
23 | - * Outputs the content of the widget |
|
24 | - * |
|
25 | - * @param array $args |
|
26 | - * @param array $instance |
|
27 | - */ |
|
28 | - public function widget( $args, $instance ) { |
|
29 | - // Get the widget's title. |
|
30 | - $title = apply_filters( 'widget_title', $instance['title'] ); |
|
22 | + /** |
|
23 | + * Outputs the content of the widget |
|
24 | + * |
|
25 | + * @param array $args |
|
26 | + * @param array $instance |
|
27 | + */ |
|
28 | + public function widget( $args, $instance ) { |
|
29 | + // Get the widget's title. |
|
30 | + $title = apply_filters( 'widget_title', $instance['title'] ); |
|
31 | 31 | |
32 | - // Print the HTML output. |
|
33 | - echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
34 | - if ( ! empty( $title ) ) { |
|
35 | - echo $args['before_title'] . $title . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
36 | - } |
|
32 | + // Print the HTML output. |
|
33 | + echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
34 | + if ( ! empty( $title ) ) { |
|
35 | + echo $args['before_title'] . $title . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
36 | + } |
|
37 | 37 | |
38 | - // Print the geomap shortcode |
|
39 | - // ( global = true - because it is not post-specific) |
|
40 | - echo do_shortcode( '[wl_geomap global=true]' ); |
|
38 | + // Print the geomap shortcode |
|
39 | + // ( global = true - because it is not post-specific) |
|
40 | + echo do_shortcode( '[wl_geomap global=true]' ); |
|
41 | 41 | |
42 | - echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
43 | - } |
|
42 | + echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Ouputs the options form on admin |
|
47 | - * |
|
48 | - * @param array $instance The widget options |
|
49 | - */ |
|
50 | - public function form( |
|
51 | - $instance |
|
52 | - ) { |
|
45 | + /** |
|
46 | + * Ouputs the options form on admin |
|
47 | + * |
|
48 | + * @param array $instance The widget options |
|
49 | + */ |
|
50 | + public function form( |
|
51 | + $instance |
|
52 | + ) { |
|
53 | 53 | |
54 | - if ( isset( $instance['title'] ) ) { |
|
55 | - $title = $instance['title']; |
|
56 | - } else { |
|
57 | - $title = __( 'New title', 'wordlift' ); |
|
58 | - } |
|
59 | - ?> |
|
54 | + if ( isset( $instance['title'] ) ) { |
|
55 | + $title = $instance['title']; |
|
56 | + } else { |
|
57 | + $title = __( 'New title', 'wordlift' ); |
|
58 | + } |
|
59 | + ?> |
|
60 | 60 | <p> |
61 | 61 | <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'wordlift' ); ?></label> |
62 | 62 | <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" |
@@ -65,24 +65,24 @@ discard block |
||
65 | 65 | </p> |
66 | 66 | <?php |
67 | 67 | |
68 | - } |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * Processing widget options on save |
|
72 | - * |
|
73 | - * @param array $new_instance The new options |
|
74 | - * @param array $old_instance The previous options |
|
75 | - */ |
|
70 | + /** |
|
71 | + * Processing widget options on save |
|
72 | + * |
|
73 | + * @param array $new_instance The new options |
|
74 | + * @param array $old_instance The previous options |
|
75 | + */ |
|
76 | 76 | // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
77 | - public function update( $new_instance, $old_instance ) { |
|
77 | + public function update( $new_instance, $old_instance ) { |
|
78 | 78 | |
79 | - $instance = array(); |
|
80 | - $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? wp_strip_all_tags( $new_instance['title'] ) : ''; |
|
79 | + $instance = array(); |
|
80 | + $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? wp_strip_all_tags( $new_instance['title'] ) : ''; |
|
81 | 81 | |
82 | - return $instance; |
|
83 | - } |
|
82 | + return $instance; |
|
83 | + } |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | function wl_register_geo_widget() { |
87 | - register_widget( 'WordLift_Geo_Widget' ); |
|
87 | + register_widget( 'WordLift_Geo_Widget' ); |
|
88 | 88 | } |
@@ -14,8 +14,8 @@ discard block |
||
14 | 14 | // Initialize the Widget. |
15 | 15 | parent::__construct( |
16 | 16 | 'wl_geo_widget', // Base ID |
17 | - __( 'Geo Widget', 'wordlift' ), // Name |
|
18 | - array( 'description' => __( 'Geo Widget description', 'wordlift' ) ) // Args |
|
17 | + __('Geo Widget', 'wordlift'), // Name |
|
18 | + array('description' => __('Geo Widget description', 'wordlift')) // Args |
|
19 | 19 | ); |
20 | 20 | } |
21 | 21 | |
@@ -25,19 +25,19 @@ discard block |
||
25 | 25 | * @param array $args |
26 | 26 | * @param array $instance |
27 | 27 | */ |
28 | - public function widget( $args, $instance ) { |
|
28 | + public function widget($args, $instance) { |
|
29 | 29 | // Get the widget's title. |
30 | - $title = apply_filters( 'widget_title', $instance['title'] ); |
|
30 | + $title = apply_filters('widget_title', $instance['title']); |
|
31 | 31 | |
32 | 32 | // Print the HTML output. |
33 | 33 | echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
34 | - if ( ! empty( $title ) ) { |
|
35 | - echo $args['before_title'] . $title . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
34 | + if ( ! empty($title)) { |
|
35 | + echo $args['before_title'].$title.$args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | // Print the geomap shortcode |
39 | 39 | // ( global = true - because it is not post-specific) |
40 | - echo do_shortcode( '[wl_geomap global=true]' ); |
|
40 | + echo do_shortcode('[wl_geomap global=true]'); |
|
41 | 41 | |
42 | 42 | echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
43 | 43 | } |
@@ -51,17 +51,17 @@ discard block |
||
51 | 51 | $instance |
52 | 52 | ) { |
53 | 53 | |
54 | - if ( isset( $instance['title'] ) ) { |
|
54 | + if (isset($instance['title'])) { |
|
55 | 55 | $title = $instance['title']; |
56 | 56 | } else { |
57 | - $title = __( 'New title', 'wordlift' ); |
|
57 | + $title = __('New title', 'wordlift'); |
|
58 | 58 | } |
59 | 59 | ?> |
60 | 60 | <p> |
61 | - <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'wordlift' ); ?></label> |
|
62 | - <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" |
|
63 | - name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" |
|
64 | - value="<?php echo esc_attr( $title ); ?>"> |
|
61 | + <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title:', 'wordlift'); ?></label> |
|
62 | + <input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" |
|
63 | + name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" |
|
64 | + value="<?php echo esc_attr($title); ?>"> |
|
65 | 65 | </p> |
66 | 66 | <?php |
67 | 67 | |
@@ -74,15 +74,15 @@ discard block |
||
74 | 74 | * @param array $old_instance The previous options |
75 | 75 | */ |
76 | 76 | // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
77 | - public function update( $new_instance, $old_instance ) { |
|
77 | + public function update($new_instance, $old_instance) { |
|
78 | 78 | |
79 | 79 | $instance = array(); |
80 | - $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? wp_strip_all_tags( $new_instance['title'] ) : ''; |
|
80 | + $instance['title'] = ( ! empty($new_instance['title'])) ? wp_strip_all_tags($new_instance['title']) : ''; |
|
81 | 81 | |
82 | 82 | return $instance; |
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | 86 | function wl_register_geo_widget() { |
87 | - register_widget( 'WordLift_Geo_Widget' ); |
|
87 | + register_widget('WordLift_Geo_Widget'); |
|
88 | 88 | } |
@@ -2,53 +2,53 @@ |
||
2 | 2 | |
3 | 3 | class Wordlift_Timeline_Widget extends WP_Widget { |
4 | 4 | |
5 | - /** |
|
6 | - * Sets up the widgets name etc |
|
7 | - */ |
|
8 | - public function __construct() { |
|
9 | - // widget actual processes |
|
10 | - parent::__construct( |
|
11 | - 'wl_timeline_widget', // Base ID |
|
12 | - __( 'WordLift Timeline Widget', 'wordlift' ), // Name |
|
13 | - array( 'description' => __( 'Displays entities of type event using an interactive timeline.', 'wordlift' ) ) // Args |
|
14 | - ); |
|
15 | - } |
|
5 | + /** |
|
6 | + * Sets up the widgets name etc |
|
7 | + */ |
|
8 | + public function __construct() { |
|
9 | + // widget actual processes |
|
10 | + parent::__construct( |
|
11 | + 'wl_timeline_widget', // Base ID |
|
12 | + __( 'WordLift Timeline Widget', 'wordlift' ), // Name |
|
13 | + array( 'description' => __( 'Displays entities of type event using an interactive timeline.', 'wordlift' ) ) // Args |
|
14 | + ); |
|
15 | + } |
|
16 | 16 | |
17 | - /** |
|
18 | - * Outputs the content of the widget |
|
19 | - * |
|
20 | - * @param array $args |
|
21 | - * @param array $instance |
|
22 | - */ |
|
23 | - // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
|
24 | - public function widget( $args, $instance ) { |
|
25 | - // outputs the content of the widget |
|
26 | - echo do_shortcode( '[wl_timeline global=true]' ); |
|
27 | - } |
|
17 | + /** |
|
18 | + * Outputs the content of the widget |
|
19 | + * |
|
20 | + * @param array $args |
|
21 | + * @param array $instance |
|
22 | + */ |
|
23 | + // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
|
24 | + public function widget( $args, $instance ) { |
|
25 | + // outputs the content of the widget |
|
26 | + echo do_shortcode( '[wl_timeline global=true]' ); |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Outputs the options form on admin |
|
31 | - * |
|
32 | - * @param array $instance The widget options |
|
33 | - */ |
|
34 | - // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
|
35 | - public function form( $instance ) { |
|
36 | - // outputs the options form on admin |
|
37 | - } |
|
29 | + /** |
|
30 | + * Outputs the options form on admin |
|
31 | + * |
|
32 | + * @param array $instance The widget options |
|
33 | + */ |
|
34 | + // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
|
35 | + public function form( $instance ) { |
|
36 | + // outputs the options form on admin |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * Processing widget options on save |
|
41 | - * |
|
42 | - * @param array $new_instance The new options |
|
43 | - * @param array $old_instance The previous options |
|
44 | - */ |
|
45 | - // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
|
46 | - public function update( $new_instance, $old_instance ) { |
|
47 | - // processes widget options to be saved |
|
48 | - } |
|
39 | + /** |
|
40 | + * Processing widget options on save |
|
41 | + * |
|
42 | + * @param array $new_instance The new options |
|
43 | + * @param array $old_instance The previous options |
|
44 | + */ |
|
45 | + // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
|
46 | + public function update( $new_instance, $old_instance ) { |
|
47 | + // processes widget options to be saved |
|
48 | + } |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | function wl_register_timeline_widget() { |
52 | 52 | |
53 | - register_widget( 'WordLift_Timeline_Widget' ); |
|
53 | + register_widget( 'WordLift_Timeline_Widget' ); |
|
54 | 54 | } |
@@ -9,8 +9,8 @@ discard block |
||
9 | 9 | // widget actual processes |
10 | 10 | parent::__construct( |
11 | 11 | 'wl_timeline_widget', // Base ID |
12 | - __( 'WordLift Timeline Widget', 'wordlift' ), // Name |
|
13 | - array( 'description' => __( 'Displays entities of type event using an interactive timeline.', 'wordlift' ) ) // Args |
|
12 | + __('WordLift Timeline Widget', 'wordlift'), // Name |
|
13 | + array('description' => __('Displays entities of type event using an interactive timeline.', 'wordlift')) // Args |
|
14 | 14 | ); |
15 | 15 | } |
16 | 16 | |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | * @param array $instance |
22 | 22 | */ |
23 | 23 | // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
24 | - public function widget( $args, $instance ) { |
|
24 | + public function widget($args, $instance) { |
|
25 | 25 | // outputs the content of the widget |
26 | - echo do_shortcode( '[wl_timeline global=true]' ); |
|
26 | + echo do_shortcode('[wl_timeline global=true]'); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @param array $instance The widget options |
33 | 33 | */ |
34 | 34 | // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
35 | - public function form( $instance ) { |
|
35 | + public function form($instance) { |
|
36 | 36 | // outputs the options form on admin |
37 | 37 | } |
38 | 38 | |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | * @param array $old_instance The previous options |
44 | 44 | */ |
45 | 45 | // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
46 | - public function update( $new_instance, $old_instance ) { |
|
46 | + public function update($new_instance, $old_instance) { |
|
47 | 47 | // processes widget options to be saved |
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | 51 | function wl_register_timeline_widget() { |
52 | 52 | |
53 | - register_widget( 'WordLift_Timeline_Widget' ); |
|
53 | + register_widget('WordLift_Timeline_Widget'); |
|
54 | 54 | } |
@@ -10,56 +10,56 @@ discard block |
||
10 | 10 | */ |
11 | 11 | class Wordlift_Chord_Widget extends WP_Widget { |
12 | 12 | |
13 | - /** |
|
14 | - * Sets up the widgets name etc |
|
15 | - */ |
|
16 | - public function __construct() { |
|
17 | - // widget actual processes. |
|
18 | - parent::__construct( |
|
19 | - 'wl_chord_widget', // Base ID. |
|
20 | - __( 'Chord Widget', 'wordlift' ), // Name. |
|
21 | - array( |
|
22 | - 'description' => __( 'The Chord Widget depicts the main topics of your blog in concise graph.', 'wordlift' ), |
|
23 | - ) // Args. |
|
24 | - ); |
|
25 | - } |
|
13 | + /** |
|
14 | + * Sets up the widgets name etc |
|
15 | + */ |
|
16 | + public function __construct() { |
|
17 | + // widget actual processes. |
|
18 | + parent::__construct( |
|
19 | + 'wl_chord_widget', // Base ID. |
|
20 | + __( 'Chord Widget', 'wordlift' ), // Name. |
|
21 | + array( |
|
22 | + 'description' => __( 'The Chord Widget depicts the main topics of your blog in concise graph.', 'wordlift' ), |
|
23 | + ) // Args. |
|
24 | + ); |
|
25 | + } |
|
26 | 26 | |
27 | - /** |
|
28 | - * Outputs the content of the widget |
|
29 | - * |
|
30 | - * @param array $args widget args. |
|
31 | - * @param array $instance widget instance. |
|
32 | - */ |
|
33 | - // @codingStandardsIgnoreLine Generic.CodeAnalysis.UnusedFunctionParameter.Found |
|
34 | - public function widget( $args, $instance ) { |
|
35 | - // outputs the content of the widget. |
|
36 | - echo do_shortcode( '[wl_chord global=true]' ); |
|
37 | - } |
|
27 | + /** |
|
28 | + * Outputs the content of the widget |
|
29 | + * |
|
30 | + * @param array $args widget args. |
|
31 | + * @param array $instance widget instance. |
|
32 | + */ |
|
33 | + // @codingStandardsIgnoreLine Generic.CodeAnalysis.UnusedFunctionParameter.Found |
|
34 | + public function widget( $args, $instance ) { |
|
35 | + // outputs the content of the widget. |
|
36 | + echo do_shortcode( '[wl_chord global=true]' ); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * Outputs the options form on admin |
|
41 | - * |
|
42 | - * @param array $instance The widget options. |
|
43 | - * |
|
44 | - * @return string|void |
|
45 | - */ |
|
46 | - // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
|
47 | - public function form( $instance ) { |
|
48 | - // outputs the options form on admin. |
|
49 | - } |
|
39 | + /** |
|
40 | + * Outputs the options form on admin |
|
41 | + * |
|
42 | + * @param array $instance The widget options. |
|
43 | + * |
|
44 | + * @return string|void |
|
45 | + */ |
|
46 | + // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
|
47 | + public function form( $instance ) { |
|
48 | + // outputs the options form on admin. |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * Processing widget options on save |
|
53 | - * |
|
54 | - * @param array $new_instance The new options. |
|
55 | - * @param array $old_instance The previous options. |
|
56 | - * |
|
57 | - * @return array|void |
|
58 | - */ |
|
59 | - // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
|
60 | - public function update( $new_instance, $old_instance ) { |
|
61 | - // processes widget options to be saved. |
|
62 | - } |
|
51 | + /** |
|
52 | + * Processing widget options on save |
|
53 | + * |
|
54 | + * @param array $new_instance The new options. |
|
55 | + * @param array $old_instance The previous options. |
|
56 | + * |
|
57 | + * @return array|void |
|
58 | + */ |
|
59 | + // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
|
60 | + public function update( $new_instance, $old_instance ) { |
|
61 | + // processes widget options to be saved. |
|
62 | + } |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -69,5 +69,5 @@ discard block |
||
69 | 69 | */ |
70 | 70 | function wl_register_chord_widget() { |
71 | 71 | |
72 | - register_widget( 'WordLift_Chord_Widget' ); |
|
72 | + register_widget( 'WordLift_Chord_Widget' ); |
|
73 | 73 | } |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | // widget actual processes. |
18 | 18 | parent::__construct( |
19 | 19 | 'wl_chord_widget', // Base ID. |
20 | - __( 'Chord Widget', 'wordlift' ), // Name. |
|
20 | + __('Chord Widget', 'wordlift'), // Name. |
|
21 | 21 | array( |
22 | - 'description' => __( 'The Chord Widget depicts the main topics of your blog in concise graph.', 'wordlift' ), |
|
22 | + 'description' => __('The Chord Widget depicts the main topics of your blog in concise graph.', 'wordlift'), |
|
23 | 23 | ) // Args. |
24 | 24 | ); |
25 | 25 | } |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | * @param array $instance widget instance. |
32 | 32 | */ |
33 | 33 | // @codingStandardsIgnoreLine Generic.CodeAnalysis.UnusedFunctionParameter.Found |
34 | - public function widget( $args, $instance ) { |
|
34 | + public function widget($args, $instance) { |
|
35 | 35 | // outputs the content of the widget. |
36 | - echo do_shortcode( '[wl_chord global=true]' ); |
|
36 | + echo do_shortcode('[wl_chord global=true]'); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @return string|void |
45 | 45 | */ |
46 | 46 | // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
47 | - public function form( $instance ) { |
|
47 | + public function form($instance) { |
|
48 | 48 | // outputs the options form on admin. |
49 | 49 | } |
50 | 50 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @return array|void |
58 | 58 | */ |
59 | 59 | // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
60 | - public function update( $new_instance, $old_instance ) { |
|
60 | + public function update($new_instance, $old_instance) { |
|
61 | 61 | // processes widget options to be saved. |
62 | 62 | } |
63 | 63 | } |
@@ -69,5 +69,5 @@ discard block |
||
69 | 69 | */ |
70 | 70 | function wl_register_chord_widget() { |
71 | 71 | |
72 | - register_widget( 'WordLift_Chord_Widget' ); |
|
72 | + register_widget('WordLift_Chord_Widget'); |
|
73 | 73 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | // Use the WordLift API URL set on the command line. |
15 | 15 | if ( ! defined( 'WORDLIFT_API_URL' ) && false !== getenv( 'WORDLIFT_API_URL' ) ) { |
16 | - define( 'WORDLIFT_API_URL', getenv( 'WORDLIFT_API_URL' ) ); |
|
16 | + define( 'WORDLIFT_API_URL', getenv( 'WORDLIFT_API_URL' ) ); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | // 3.13.0, we use by default WLS 1.11 which provides us with the new, faster |
@@ -52,15 +52,15 @@ discard block |
||
52 | 52 | * @since 3.16.0 |
53 | 53 | */ |
54 | 54 | function wl_temp_dir() { |
55 | - $tempdir = get_temp_dir(); |
|
56 | - $unique = md5( site_url() . get_current_blog_id() ); |
|
57 | - $unique_temp_dir = $tempdir . 'wl_' . $unique; // $tempdir should have a trailing slash. |
|
55 | + $tempdir = get_temp_dir(); |
|
56 | + $unique = md5( site_url() . get_current_blog_id() ); |
|
57 | + $unique_temp_dir = $tempdir . 'wl_' . $unique; // $tempdir should have a trailing slash. |
|
58 | 58 | |
59 | - // If directory do not exist, create it. |
|
60 | - if ( ! file_exists( $unique_temp_dir ) ) { |
|
61 | - // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged |
|
62 | - @mkdir( $unique_temp_dir ); |
|
63 | - } |
|
59 | + // If directory do not exist, create it. |
|
60 | + if ( ! file_exists( $unique_temp_dir ) ) { |
|
61 | + // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged |
|
62 | + @mkdir( $unique_temp_dir ); |
|
63 | + } |
|
64 | 64 | |
65 | - return $unique_temp_dir . '/'; |
|
65 | + return $unique_temp_dir . '/'; |
|
66 | 66 | } |
@@ -6,40 +6,40 @@ discard block |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | // Set the temporary files folder. |
9 | -defined( 'WL_TEMP_DIR' ) || define( 'WL_TEMP_DIR', wl_temp_dir() ); |
|
9 | +defined('WL_TEMP_DIR') || define('WL_TEMP_DIR', wl_temp_dir()); |
|
10 | 10 | |
11 | 11 | // Define the meta name used to store the entity URL. |
12 | -define( 'WL_ENTITY_URL_META_NAME', 'entity_url' ); |
|
12 | +define('WL_ENTITY_URL_META_NAME', 'entity_url'); |
|
13 | 13 | |
14 | 14 | // Use the WordLift API URL set on the command line. |
15 | -if ( ! defined( 'WORDLIFT_API_URL' ) && false !== getenv( 'WORDLIFT_API_URL' ) ) { |
|
16 | - define( 'WORDLIFT_API_URL', getenv( 'WORDLIFT_API_URL' ) ); |
|
15 | +if ( ! defined('WORDLIFT_API_URL') && false !== getenv('WORDLIFT_API_URL')) { |
|
16 | + define('WORDLIFT_API_URL', getenv('WORDLIFT_API_URL')); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | // 3.13.0, we use by default WLS 1.11 which provides us with the new, faster |
20 | 20 | // chunked analysis. |
21 | -define( 'WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE', defined( 'WORDLIFT_API_URL' ) ? WORDLIFT_API_URL . '/' : 'https://api.wordlift.io/' ); |
|
21 | +define('WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE', defined('WORDLIFT_API_URL') ? WORDLIFT_API_URL . '/' : 'https://api.wordlift.io/'); |
|
22 | 22 | |
23 | 23 | // @since 3.29.0 we do not use https://developers.google.com/structured-data/testing-tool/?url= |
24 | -define( 'WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL', 'https://search.google.com/test/rich-results?url=' ); |
|
24 | +define('WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL', 'https://search.google.com/test/rich-results?url='); |
|
25 | 25 | |
26 | 26 | // If is set to true, there will be additional button in 'Download Your Data' page |
27 | 27 | // that will allow users to download their data in JSON-LD format. |
28 | -defined( 'WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA' ) || define( 'WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA', false ); |
|
28 | +defined('WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA') || define('WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA', false); |
|
29 | 29 | |
30 | 30 | /* |
31 | 31 | * Define the default scope for autocomplete requests. |
32 | 32 | * |
33 | 33 | * @see https://github.com/insideout10/wordlift-plugin/issues/839 |
34 | 34 | */ |
35 | -defined( 'WL_AUTOCOMPLETE_SCOPE' ) || define( 'WL_AUTOCOMPLETE_SCOPE', 'cloud' ); |
|
35 | +defined('WL_AUTOCOMPLETE_SCOPE') || define('WL_AUTOCOMPLETE_SCOPE', 'cloud'); |
|
36 | 36 | |
37 | 37 | /* |
38 | 38 | * Enable/disable the `all entity types` feature. Initially we keep the feature disabled to enture proper Q/A. |
39 | 39 | * |
40 | 40 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
41 | 41 | */ |
42 | -defined( 'WL_ALL_ENTITY_TYPES' ) || define( 'WL_ALL_ENTITY_TYPES', false ); |
|
42 | +defined('WL_ALL_ENTITY_TYPES') || define('WL_ALL_ENTITY_TYPES', false); |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * Get a site unique directory under the system or WordPress temporary directory. |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | */ |
54 | 54 | function wl_temp_dir() { |
55 | 55 | $tempdir = get_temp_dir(); |
56 | - $unique = md5( site_url() . get_current_blog_id() ); |
|
57 | - $unique_temp_dir = $tempdir . 'wl_' . $unique; // $tempdir should have a trailing slash. |
|
56 | + $unique = md5(site_url().get_current_blog_id()); |
|
57 | + $unique_temp_dir = $tempdir.'wl_'.$unique; // $tempdir should have a trailing slash. |
|
58 | 58 | |
59 | 59 | // If directory do not exist, create it. |
60 | - if ( ! file_exists( $unique_temp_dir ) ) { |
|
60 | + if ( ! file_exists($unique_temp_dir)) { |
|
61 | 61 | // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged |
62 | - @mkdir( $unique_temp_dir ); |
|
62 | + @mkdir($unique_temp_dir); |
|
63 | 63 | } |
64 | 64 | |
65 | - return $unique_temp_dir . '/'; |
|
65 | + return $unique_temp_dir.'/'; |
|
66 | 66 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | function wl_write_log( $log ) { |
19 | 19 | |
20 | - Wordlift_Log_Service::get_instance()->debug( $log ); |
|
20 | + Wordlift_Log_Service::get_instance()->debug( $log ); |
|
21 | 21 | |
22 | 22 | } |
23 | 23 | |
@@ -26,21 +26,21 @@ discard block |
||
26 | 26 | * see http://vip.wordpress.com/documentation/register-additional-html-attributes-for-tinymce-and-wp-kses/ |
27 | 27 | */ |
28 | 28 | function wordlift_allowed_post_tags() { |
29 | - global $allowedposttags; |
|
30 | - |
|
31 | - $tags = array( 'span' ); |
|
32 | - $new_attributes = array( |
|
33 | - 'itemscope' => array(), |
|
34 | - 'itemtype' => array(), |
|
35 | - 'itemprop' => array(), |
|
36 | - 'itemid' => array(), |
|
37 | - ); |
|
38 | - |
|
39 | - foreach ( $tags as $tag ) { |
|
40 | - if ( isset( $allowedposttags[ $tag ] ) && is_array( $allowedposttags[ $tag ] ) ) { |
|
41 | - $allowedposttags[ $tag ] = array_merge( $allowedposttags[ $tag ], $new_attributes ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited |
|
42 | - } |
|
43 | - } |
|
29 | + global $allowedposttags; |
|
30 | + |
|
31 | + $tags = array( 'span' ); |
|
32 | + $new_attributes = array( |
|
33 | + 'itemscope' => array(), |
|
34 | + 'itemtype' => array(), |
|
35 | + 'itemprop' => array(), |
|
36 | + 'itemid' => array(), |
|
37 | + ); |
|
38 | + |
|
39 | + foreach ( $tags as $tag ) { |
|
40 | + if ( isset( $allowedposttags[ $tag ] ) && is_array( $allowedposttags[ $tag ] ) ) { |
|
41 | + $allowedposttags[ $tag ] = array_merge( $allowedposttags[ $tag ], $new_attributes ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited |
|
42 | + } |
|
43 | + } |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | // add allowed post tags. |
@@ -51,18 +51,18 @@ discard block |
||
51 | 51 | */ |
52 | 52 | function wordlift_admin_enqueue_scripts() { |
53 | 53 | |
54 | - // Added for compatibility with WordPress 3.9 (see http://make.wordpress.org/core/2014/04/16/jquery-ui-and-wpdialogs-in-wordpress-3-9/) |
|
55 | - wp_enqueue_script( 'wpdialogs' ); |
|
56 | - wp_enqueue_style( 'wp-jquery-ui-dialog' ); |
|
54 | + // Added for compatibility with WordPress 3.9 (see http://make.wordpress.org/core/2014/04/16/jquery-ui-and-wpdialogs-in-wordpress-3-9/) |
|
55 | + wp_enqueue_script( 'wpdialogs' ); |
|
56 | + wp_enqueue_style( 'wp-jquery-ui-dialog' ); |
|
57 | 57 | |
58 | - wp_enqueue_style( 'wordlift-reloaded', plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css', array(), WORDLIFT_VERSION ); |
|
58 | + wp_enqueue_style( 'wordlift-reloaded', plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css', array(), WORDLIFT_VERSION ); |
|
59 | 59 | |
60 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
60 | + wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
61 | 61 | |
62 | - // Disable auto-save for custom entity posts only |
|
63 | - if ( Wordlift_Entity_Service::TYPE_NAME === get_post_type() ) { |
|
64 | - wp_dequeue_script( 'autosave' ); |
|
65 | - } |
|
62 | + // Disable auto-save for custom entity posts only |
|
63 | + if ( Wordlift_Entity_Service::TYPE_NAME === get_post_type() ) { |
|
64 | + wp_dequeue_script( 'autosave' ); |
|
65 | + } |
|
66 | 66 | |
67 | 67 | } |
68 | 68 | |
@@ -78,21 +78,21 @@ discard block |
||
78 | 78 | */ |
79 | 79 | function wordlift_allowed_html( $allowedtags, $context ) { |
80 | 80 | |
81 | - if ( 'post' !== $context ) { |
|
82 | - return $allowedtags; |
|
83 | - } |
|
84 | - |
|
85 | - return array_merge_recursive( |
|
86 | - $allowedtags, |
|
87 | - array( |
|
88 | - 'span' => array( |
|
89 | - 'itemscope' => true, |
|
90 | - 'itemtype' => true, |
|
91 | - 'itemid' => true, |
|
92 | - 'itemprop' => true, |
|
93 | - ), |
|
94 | - ) |
|
95 | - ); |
|
81 | + if ( 'post' !== $context ) { |
|
82 | + return $allowedtags; |
|
83 | + } |
|
84 | + |
|
85 | + return array_merge_recursive( |
|
86 | + $allowedtags, |
|
87 | + array( |
|
88 | + 'span' => array( |
|
89 | + 'itemscope' => true, |
|
90 | + 'itemtype' => true, |
|
91 | + 'itemid' => true, |
|
92 | + 'itemprop' => true, |
|
93 | + ), |
|
94 | + ) |
|
95 | + ); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | add_filter( 'wp_kses_allowed_html', 'wordlift_allowed_html', 10, 2 ); |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | */ |
108 | 108 | function wl_get_image_urls( $post_id ) { |
109 | 109 | |
110 | - return Wordlift_Storage_Factory::get_instance() |
|
111 | - ->post_images() |
|
112 | - ->get( $post_id ); |
|
110 | + return Wordlift_Storage_Factory::get_instance() |
|
111 | + ->post_images() |
|
112 | + ->get( $post_id ); |
|
113 | 113 | |
114 | 114 | } |
115 | 115 | |
@@ -123,26 +123,26 @@ discard block |
||
123 | 123 | */ |
124 | 124 | function wl_get_attachment_for_source_url( $parent_post_id, $source_url ) { |
125 | 125 | |
126 | - // wl_write_log( "wl_get_attachment_for_source_url [ parent post id :: $parent_post_id ][ source url :: $source_url ]" ); |
|
127 | - |
|
128 | - $posts = get_posts( |
|
129 | - array( |
|
130 | - 'post_type' => 'attachment', |
|
131 | - 'posts_per_page' => 1, |
|
132 | - 'post_status' => 'any', |
|
133 | - 'post_parent' => $parent_post_id, |
|
134 | - 'meta_key' => 'wl_source_url', |
|
135 | - 'meta_value' => $source_url, |
|
136 | - ) |
|
137 | - ); |
|
138 | - |
|
139 | - // Return the found post. |
|
140 | - if ( 1 === count( $posts ) ) { |
|
141 | - return $posts[0]; |
|
142 | - } |
|
143 | - |
|
144 | - // Return null. |
|
145 | - return null; |
|
126 | + // wl_write_log( "wl_get_attachment_for_source_url [ parent post id :: $parent_post_id ][ source url :: $source_url ]" ); |
|
127 | + |
|
128 | + $posts = get_posts( |
|
129 | + array( |
|
130 | + 'post_type' => 'attachment', |
|
131 | + 'posts_per_page' => 1, |
|
132 | + 'post_status' => 'any', |
|
133 | + 'post_parent' => $parent_post_id, |
|
134 | + 'meta_key' => 'wl_source_url', |
|
135 | + 'meta_value' => $source_url, |
|
136 | + ) |
|
137 | + ); |
|
138 | + |
|
139 | + // Return the found post. |
|
140 | + if ( 1 === count( $posts ) ) { |
|
141 | + return $posts[0]; |
|
142 | + } |
|
143 | + |
|
144 | + // Return null. |
|
145 | + return null; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | */ |
154 | 154 | function wl_set_source_url( $post_id, $source_url ) { |
155 | 155 | |
156 | - delete_post_meta( $post_id, 'wl_source_url' ); |
|
157 | - add_post_meta( $post_id, 'wl_source_url', $source_url ); |
|
156 | + delete_post_meta( $post_id, 'wl_source_url' ); |
|
157 | + add_post_meta( $post_id, 'wl_source_url', $source_url ); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | function wl_sanitize_uri_path( $path, $char = '_' ) { |
172 | 172 | |
173 | - return Wordlift_Uri_Service::get_instance()->sanitize_path( $path, $char ); |
|
173 | + return Wordlift_Uri_Service::get_instance()->sanitize_path( $path, $char ); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -182,47 +182,47 @@ discard block |
||
182 | 182 | */ |
183 | 183 | function wl_replace_item_id_with_uri( $content ) { |
184 | 184 | |
185 | - $log = Wordlift_Log_Service::get_logger( 'wl_replace_item_id_with_uri' ); |
|
186 | - $log->trace( 'Replacing item IDs with URIs...' ); |
|
185 | + $log = Wordlift_Log_Service::get_logger( 'wl_replace_item_id_with_uri' ); |
|
186 | + $log->trace( 'Replacing item IDs with URIs...' ); |
|
187 | 187 | |
188 | - // Strip slashes, see https://core.trac.wordpress.org/ticket/21767 |
|
189 | - $content = stripslashes( $content ); |
|
188 | + // Strip slashes, see https://core.trac.wordpress.org/ticket/21767 |
|
189 | + $content = stripslashes( $content ); |
|
190 | 190 | |
191 | - // If any match are found. |
|
192 | - $matches = array(); |
|
193 | - if ( 0 < preg_match_all( '/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER ) ) { |
|
191 | + // If any match are found. |
|
192 | + $matches = array(); |
|
193 | + if ( 0 < preg_match_all( '/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER ) ) { |
|
194 | 194 | |
195 | - foreach ( $matches as $match ) { |
|
195 | + foreach ( $matches as $match ) { |
|
196 | 196 | |
197 | - // Get the item ID. |
|
198 | - $item_id = $match[1]; |
|
197 | + // Get the item ID. |
|
198 | + $item_id = $match[1]; |
|
199 | 199 | |
200 | - // Get the post bound to that item ID (looking both in the 'official' URI and in the 'same-as' . |
|
201 | - $post = Wordlift_Entity_Service::get_instance() |
|
202 | - ->get_entity_post_by_uri( $item_id ); |
|
200 | + // Get the post bound to that item ID (looking both in the 'official' URI and in the 'same-as' . |
|
201 | + $post = Wordlift_Entity_Service::get_instance() |
|
202 | + ->get_entity_post_by_uri( $item_id ); |
|
203 | 203 | |
204 | - // If no entity is found, continue to the next one. |
|
205 | - if ( null === $post ) { |
|
206 | - continue; |
|
207 | - } |
|
204 | + // If no entity is found, continue to the next one. |
|
205 | + if ( null === $post ) { |
|
206 | + continue; |
|
207 | + } |
|
208 | 208 | |
209 | - // Get the URI for that post. |
|
210 | - $uri = wl_get_entity_uri( $post->ID ); |
|
209 | + // Get the URI for that post. |
|
210 | + $uri = wl_get_entity_uri( $post->ID ); |
|
211 | 211 | |
212 | - // wl_write_log( "wl_replace_item_id_with_uri [ item id :: $item_id ][ uri :: $uri ]" ); |
|
212 | + // wl_write_log( "wl_replace_item_id_with_uri [ item id :: $item_id ][ uri :: $uri ]" ); |
|
213 | 213 | |
214 | - // If the item ID and the URI differ, replace the item ID with the URI saved in WordPress. |
|
215 | - if ( ! empty( $uri ) && $item_id !== $uri ) { |
|
216 | - $uri_e = esc_html( $uri ); |
|
217 | - $content = str_replace( " itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content ); |
|
218 | - } |
|
219 | - } |
|
220 | - } |
|
214 | + // If the item ID and the URI differ, replace the item ID with the URI saved in WordPress. |
|
215 | + if ( ! empty( $uri ) && $item_id !== $uri ) { |
|
216 | + $uri_e = esc_html( $uri ); |
|
217 | + $content = str_replace( " itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content ); |
|
218 | + } |
|
219 | + } |
|
220 | + } |
|
221 | 221 | |
222 | - // Reapply slashes. |
|
223 | - $content = addslashes( $content ); |
|
222 | + // Reapply slashes. |
|
223 | + $content = addslashes( $content ); |
|
224 | 224 | |
225 | - return $content; |
|
225 | + return $content; |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | add_filter( 'content_save_pre', 'wl_replace_item_id_with_uri', 1, 1 ); |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | * |
16 | 16 | * @deprecated use Wordlift_Log_Service::get_instance()->info( $log ); |
17 | 17 | */ |
18 | -function wl_write_log( $log ) { |
|
18 | +function wl_write_log($log) { |
|
19 | 19 | |
20 | - Wordlift_Log_Service::get_instance()->debug( $log ); |
|
20 | + Wordlift_Log_Service::get_instance()->debug($log); |
|
21 | 21 | |
22 | 22 | } |
23 | 23 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | function wordlift_allowed_post_tags() { |
29 | 29 | global $allowedposttags; |
30 | 30 | |
31 | - $tags = array( 'span' ); |
|
31 | + $tags = array('span'); |
|
32 | 32 | $new_attributes = array( |
33 | 33 | 'itemscope' => array(), |
34 | 34 | 'itemtype' => array(), |
@@ -36,15 +36,15 @@ discard block |
||
36 | 36 | 'itemid' => array(), |
37 | 37 | ); |
38 | 38 | |
39 | - foreach ( $tags as $tag ) { |
|
40 | - if ( isset( $allowedposttags[ $tag ] ) && is_array( $allowedposttags[ $tag ] ) ) { |
|
41 | - $allowedposttags[ $tag ] = array_merge( $allowedposttags[ $tag ], $new_attributes ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited |
|
39 | + foreach ($tags as $tag) { |
|
40 | + if (isset($allowedposttags[$tag]) && is_array($allowedposttags[$tag])) { |
|
41 | + $allowedposttags[$tag] = array_merge($allowedposttags[$tag], $new_attributes); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
46 | 46 | // add allowed post tags. |
47 | -add_action( 'init', 'wordlift_allowed_post_tags' ); |
|
47 | +add_action('init', 'wordlift_allowed_post_tags'); |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Register additional scripts for the admin UI. |
@@ -52,21 +52,21 @@ discard block |
||
52 | 52 | function wordlift_admin_enqueue_scripts() { |
53 | 53 | |
54 | 54 | // Added for compatibility with WordPress 3.9 (see http://make.wordpress.org/core/2014/04/16/jquery-ui-and-wpdialogs-in-wordpress-3-9/) |
55 | - wp_enqueue_script( 'wpdialogs' ); |
|
56 | - wp_enqueue_style( 'wp-jquery-ui-dialog' ); |
|
55 | + wp_enqueue_script('wpdialogs'); |
|
56 | + wp_enqueue_style('wp-jquery-ui-dialog'); |
|
57 | 57 | |
58 | - wp_enqueue_style( 'wordlift-reloaded', plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css', array(), WORDLIFT_VERSION ); |
|
58 | + wp_enqueue_style('wordlift-reloaded', plugin_dir_url(__FILE__).'css/wordlift-reloaded.min.css', array(), WORDLIFT_VERSION); |
|
59 | 59 | |
60 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
60 | + wp_enqueue_script('jquery-ui-autocomplete'); |
|
61 | 61 | |
62 | 62 | // Disable auto-save for custom entity posts only |
63 | - if ( Wordlift_Entity_Service::TYPE_NAME === get_post_type() ) { |
|
64 | - wp_dequeue_script( 'autosave' ); |
|
63 | + if (Wordlift_Entity_Service::TYPE_NAME === get_post_type()) { |
|
64 | + wp_dequeue_script('autosave'); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | } |
68 | 68 | |
69 | -add_action( 'admin_enqueue_scripts', 'wordlift_admin_enqueue_scripts' ); |
|
69 | +add_action('admin_enqueue_scripts', 'wordlift_admin_enqueue_scripts'); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Hooked to *wp_kses_allowed_html* filter, adds microdata attributes. |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @return array An array which contains allowed microdata attributes. |
78 | 78 | */ |
79 | -function wordlift_allowed_html( $allowedtags, $context ) { |
|
79 | +function wordlift_allowed_html($allowedtags, $context) { |
|
80 | 80 | |
81 | - if ( 'post' !== $context ) { |
|
81 | + if ('post' !== $context) { |
|
82 | 82 | return $allowedtags; |
83 | 83 | } |
84 | 84 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ); |
96 | 96 | } |
97 | 97 | |
98 | -add_filter( 'wp_kses_allowed_html', 'wordlift_allowed_html', 10, 2 ); |
|
98 | +add_filter('wp_kses_allowed_html', 'wordlift_allowed_html', 10, 2); |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Get all the images bound to a post. |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | * @return array An array of image URLs. |
106 | 106 | * @deprecated use Wordlift_Storage_Factory::get_instance()->post_images()->get( $post_id ) |
107 | 107 | */ |
108 | -function wl_get_image_urls( $post_id ) { |
|
108 | +function wl_get_image_urls($post_id) { |
|
109 | 109 | |
110 | 110 | return Wordlift_Storage_Factory::get_instance() |
111 | 111 | ->post_images() |
112 | - ->get( $post_id ); |
|
112 | + ->get($post_id); |
|
113 | 113 | |
114 | 114 | } |
115 | 115 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @return WP_Post|null A post instance or null if not found. |
123 | 123 | */ |
124 | -function wl_get_attachment_for_source_url( $parent_post_id, $source_url ) { |
|
124 | +function wl_get_attachment_for_source_url($parent_post_id, $source_url) { |
|
125 | 125 | |
126 | 126 | // wl_write_log( "wl_get_attachment_for_source_url [ parent post id :: $parent_post_id ][ source url :: $source_url ]" ); |
127 | 127 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | ); |
138 | 138 | |
139 | 139 | // Return the found post. |
140 | - if ( 1 === count( $posts ) ) { |
|
140 | + if (1 === count($posts)) { |
|
141 | 141 | return $posts[0]; |
142 | 142 | } |
143 | 143 | |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | * @param int $post_id The post ID. |
152 | 152 | * @param string $source_url The source URL. |
153 | 153 | */ |
154 | -function wl_set_source_url( $post_id, $source_url ) { |
|
154 | +function wl_set_source_url($post_id, $source_url) { |
|
155 | 155 | |
156 | - delete_post_meta( $post_id, 'wl_source_url' ); |
|
157 | - add_post_meta( $post_id, 'wl_source_url', $source_url ); |
|
156 | + delete_post_meta($post_id, 'wl_source_url'); |
|
157 | + add_post_meta($post_id, 'wl_source_url', $source_url); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | * @deprecated use Wordlift_Uri_Service::get_instance()->sanitize_path(); |
169 | 169 | * @see https://codex.wordpress.org/Function_Reference/sanitize_title |
170 | 170 | */ |
171 | -function wl_sanitize_uri_path( $path, $char = '_' ) { |
|
171 | +function wl_sanitize_uri_path($path, $char = '_') { |
|
172 | 172 | |
173 | - return Wordlift_Uri_Service::get_instance()->sanitize_path( $path, $char ); |
|
173 | + return Wordlift_Uri_Service::get_instance()->sanitize_path($path, $char); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -180,52 +180,52 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @return string The updated post content. |
182 | 182 | */ |
183 | -function wl_replace_item_id_with_uri( $content ) { |
|
183 | +function wl_replace_item_id_with_uri($content) { |
|
184 | 184 | |
185 | - $log = Wordlift_Log_Service::get_logger( 'wl_replace_item_id_with_uri' ); |
|
186 | - $log->trace( 'Replacing item IDs with URIs...' ); |
|
185 | + $log = Wordlift_Log_Service::get_logger('wl_replace_item_id_with_uri'); |
|
186 | + $log->trace('Replacing item IDs with URIs...'); |
|
187 | 187 | |
188 | 188 | // Strip slashes, see https://core.trac.wordpress.org/ticket/21767 |
189 | - $content = stripslashes( $content ); |
|
189 | + $content = stripslashes($content); |
|
190 | 190 | |
191 | 191 | // If any match are found. |
192 | 192 | $matches = array(); |
193 | - if ( 0 < preg_match_all( '/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER ) ) { |
|
193 | + if (0 < preg_match_all('/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER)) { |
|
194 | 194 | |
195 | - foreach ( $matches as $match ) { |
|
195 | + foreach ($matches as $match) { |
|
196 | 196 | |
197 | 197 | // Get the item ID. |
198 | 198 | $item_id = $match[1]; |
199 | 199 | |
200 | 200 | // Get the post bound to that item ID (looking both in the 'official' URI and in the 'same-as' . |
201 | 201 | $post = Wordlift_Entity_Service::get_instance() |
202 | - ->get_entity_post_by_uri( $item_id ); |
|
202 | + ->get_entity_post_by_uri($item_id); |
|
203 | 203 | |
204 | 204 | // If no entity is found, continue to the next one. |
205 | - if ( null === $post ) { |
|
205 | + if (null === $post) { |
|
206 | 206 | continue; |
207 | 207 | } |
208 | 208 | |
209 | 209 | // Get the URI for that post. |
210 | - $uri = wl_get_entity_uri( $post->ID ); |
|
210 | + $uri = wl_get_entity_uri($post->ID); |
|
211 | 211 | |
212 | 212 | // wl_write_log( "wl_replace_item_id_with_uri [ item id :: $item_id ][ uri :: $uri ]" ); |
213 | 213 | |
214 | 214 | // If the item ID and the URI differ, replace the item ID with the URI saved in WordPress. |
215 | - if ( ! empty( $uri ) && $item_id !== $uri ) { |
|
216 | - $uri_e = esc_html( $uri ); |
|
217 | - $content = str_replace( " itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content ); |
|
215 | + if ( ! empty($uri) && $item_id !== $uri) { |
|
216 | + $uri_e = esc_html($uri); |
|
217 | + $content = str_replace(" itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content); |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 | } |
221 | 221 | |
222 | 222 | // Reapply slashes. |
223 | - $content = addslashes( $content ); |
|
223 | + $content = addslashes($content); |
|
224 | 224 | |
225 | 225 | return $content; |
226 | 226 | } |
227 | 227 | |
228 | -add_filter( 'content_save_pre', 'wl_replace_item_id_with_uri', 1, 1 ); |
|
228 | +add_filter('content_save_pre', 'wl_replace_item_id_with_uri', 1, 1); |
|
229 | 229 | |
230 | 230 | require_once 'wordlift-entity-functions.php'; |
231 | 231 |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php return array( |
2 | - 'dependencies' => array( 'react', 'react-dom', 'wp-polyfill' ), |
|
3 | - 'version' => 'f3639839f6d33cdc7c6ca16c2178908a', |
|
2 | + 'dependencies' => array( 'react', 'react-dom', 'wp-polyfill' ), |
|
3 | + 'version' => 'f3639839f6d33cdc7c6ca16c2178908a', |
|
4 | 4 | ); |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php return array( |
2 | - 'dependencies' => array( 'react', 'react-dom', 'wp-polyfill' ), |
|
2 | + 'dependencies' => array('react', 'react-dom', 'wp-polyfill'), |
|
3 | 3 | 'version' => 'f3639839f6d33cdc7c6ca16c2178908a', |
4 | 4 | ); |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php return array( |
2 | - 'dependencies' => array( 'react', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-plugins', 'wp-polyfill', 'wp-rich-text' ), |
|
3 | - 'version' => '58771ef40b11db9353dc73af4117a5da', |
|
2 | + 'dependencies' => array( 'react', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-plugins', 'wp-polyfill', 'wp-rich-text' ), |
|
3 | + 'version' => '58771ef40b11db9353dc73af4117a5da', |
|
4 | 4 | ); |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php return array( |
2 | - 'dependencies' => array( 'react', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-plugins', 'wp-polyfill', 'wp-rich-text' ), |
|
2 | + 'dependencies' => array('react', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-plugins', 'wp-polyfill', 'wp-rich-text'), |
|
3 | 3 | 'version' => '58771ef40b11db9353dc73af4117a5da', |
4 | 4 | ); |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php return array( |
2 | - 'dependencies' => array( 'react', 'react-dom', 'wp-polyfill' ), |
|
3 | - 'version' => '0da1bd4b6e30da1da70f8a7521ca7dd3', |
|
2 | + 'dependencies' => array( 'react', 'react-dom', 'wp-polyfill' ), |
|
3 | + 'version' => '0da1bd4b6e30da1da70f8a7521ca7dd3', |
|
4 | 4 | ); |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php return array( |
2 | - 'dependencies' => array( 'react', 'react-dom', 'wp-polyfill' ), |
|
2 | + 'dependencies' => array('react', 'react-dom', 'wp-polyfill'), |
|
3 | 3 | 'version' => '0da1bd4b6e30da1da70f8a7521ca7dd3', |
4 | 4 | ); |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php return array( |
2 | - 'dependencies' => array( 'react', 'wp-polyfill', 'wp-rich-text' ), |
|
3 | - 'version' => '2acea653abe0b60106c905b5a66c405e', |
|
2 | + 'dependencies' => array( 'react', 'wp-polyfill', 'wp-rich-text' ), |
|
3 | + 'version' => '2acea653abe0b60106c905b5a66c405e', |
|
4 | 4 | ); |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php return array( |
2 | - 'dependencies' => array( 'react', 'wp-polyfill', 'wp-rich-text' ), |
|
2 | + 'dependencies' => array('react', 'wp-polyfill', 'wp-rich-text'), |
|
3 | 3 | 'version' => '2acea653abe0b60106c905b5a66c405e', |
4 | 4 | ); |