1 | <?php |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
2 | /** |
||
3 | * LSX Projects Widget Class |
||
4 | * |
||
5 | * @package LSX Projects |
||
6 | * @author LightSpeed |
||
0 ignored issues
–
show
|
|||
7 | * @license GPL3 |
||
8 | * @link |
||
9 | * @copyright 2016 LightSpeed |
||
10 | */ |
||
11 | class LSX_Projects_Widget extends WP_Widget { |
||
12 | |||
13 | public function __construct() { |
||
0 ignored issues
–
show
|
|||
14 | $widget_ops = array( |
||
15 | 'classname' => 'lsx-projects', |
||
16 | ); |
||
17 | |||
18 | parent::__construct( 'LSX_Projects_Widget', esc_html__( 'LSX Projects', 'lsx-projects' ), $widget_ops ); |
||
19 | } |
||
0 ignored issues
–
show
|
|||
20 | |||
21 | function widget( $args, $instance ) { |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
It is recommend to declare an explicit visibility for
widget .
Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed. If you are not sure which visibility to choose, it is a good idea to start with
the most restrictive visibility, and then raise visibility as needed, i.e.
start with ![]() |
|||
22 | extract( $args ); |
||
0 ignored issues
–
show
|
|||
23 | |||
24 | $title = $instance['title']; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
25 | $title_link = $instance['title_link']; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
26 | $tagline = $instance['tagline']; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
27 | $columns = $instance['columns']; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
28 | $orderby = $instance['orderby']; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
29 | $order = $instance['order']; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
30 | $limit = $instance['limit']; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
31 | $include = $instance['include']; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
32 | $display = $instance['display']; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
33 | $size = $instance['size']; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 8 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
34 | $button_text = $instance['button_text']; |
||
35 | $responsive = $instance['responsive']; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
36 | $show_image = $instance['show_image']; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
37 | $carousel = $instance['carousel']; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
38 | $featured = $instance['featured']; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
39 | |||
40 | // If limit not set, display 99 posts |
||
0 ignored issues
–
show
|
|||
41 | if ( empty( $limit ) ) { |
||
0 ignored issues
–
show
|
|||
42 | $limit = '99'; |
||
43 | } |
||
44 | |||
45 | // If specific posts included, display 99 posts |
||
0 ignored issues
–
show
|
|||
46 | if ( ! empty( $include ) ) { |
||
0 ignored issues
–
show
|
|||
47 | $limit = '99'; |
||
48 | } |
||
49 | |||
50 | if ( '1' == $responsive ) { |
||
0 ignored issues
–
show
|
|||
51 | $responsive = 'true'; |
||
52 | } else { |
||
53 | $responsive = 'false'; |
||
54 | } |
||
55 | |||
56 | if ( '1' == $show_image ) { |
||
0 ignored issues
–
show
|
|||
57 | $show_image = 'true'; |
||
58 | } else { |
||
59 | $show_image = 'false'; |
||
60 | } |
||
61 | |||
62 | if ( '1' == $carousel ) { |
||
0 ignored issues
–
show
|
|||
63 | $carousel = 'true'; |
||
64 | } else { |
||
65 | $carousel = 'false'; |
||
66 | } |
||
67 | |||
68 | if ( '1' == $featured ) { |
||
0 ignored issues
–
show
|
|||
69 | $featured = 'true'; |
||
70 | } else { |
||
71 | $featured = 'false'; |
||
72 | } |
||
73 | |||
74 | if ( $title_link ) { |
||
0 ignored issues
–
show
|
|||
75 | //$link_open = '<a href="' . $title_link . '">'; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
43% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
76 | $link_open = ''; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
77 | $link_btn_open = '<a href="' . $title_link . '" class="btn border-btn">'; |
||
78 | //$link_close = '</a>'; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
67% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
79 | $link_close = ''; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
80 | $link_btn_close = '</a>'; |
||
81 | } else { |
||
82 | $link_open = ''; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
83 | $link_btn_open = ''; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
84 | $link_close = ''; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
85 | $link_btn_close = ''; |
||
86 | } |
||
87 | |||
88 | echo wp_kses_post( $before_widget ); |
||
89 | |||
90 | if ( $title ) { |
||
0 ignored issues
–
show
|
|||
91 | echo wp_kses_post( $before_title . $link_open . $title . $link_close . $after_title ); |
||
92 | } |
||
93 | |||
94 | if ( $tagline ) { |
||
0 ignored issues
–
show
|
|||
95 | echo '<p class="tagline text-center">' . esc_html( $tagline ) . '</p>'; |
||
96 | } |
||
97 | |||
98 | if ( class_exists( 'LSX_Projects' ) ) { |
||
0 ignored issues
–
show
|
|||
99 | lsx_projects( array( |
||
0 ignored issues
–
show
|
|||
100 | 'columns' => $columns, |
||
0 ignored issues
–
show
|
|||
101 | 'orderby' => $orderby, |
||
0 ignored issues
–
show
|
|||
102 | 'order' => $order, |
||
0 ignored issues
–
show
|
|||
103 | 'limit' => $limit, |
||
0 ignored issues
–
show
|
|||
104 | 'include' => $include, |
||
0 ignored issues
–
show
|
|||
105 | 'display' => $display, |
||
0 ignored issues
–
show
|
|||
106 | 'size' => $size, |
||
0 ignored issues
–
show
|
|||
107 | 'responsive' => $responsive, |
||
108 | 'show_image' => $show_image, |
||
109 | 'carousel' => $carousel, |
||
0 ignored issues
–
show
|
|||
110 | 'featured' => $featured, |
||
0 ignored issues
–
show
|
|||
111 | ) ); |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||
112 | }; |
||
113 | |||
114 | if ( $button_text && $title_link ) { |
||
0 ignored issues
–
show
|
|||
115 | echo wp_kses_post( '<p class="text-center lsx-projects-archive-link-wrap"><span class="lsx-projects-archive-link">' . $link_btn_open . $button_text . ' <i class="fa fa-angle-right"></i>' . $link_btn_close . '</span></p>' ); |
||
116 | } |
||
117 | |||
118 | echo wp_kses_post( $after_widget ); |
||
119 | } |
||
0 ignored issues
–
show
|
|||
120 | |||
121 | function update( $new_instance, $old_instance ) { |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
It is recommend to declare an explicit visibility for
update .
Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed. If you are not sure which visibility to choose, it is a good idea to start with
the most restrictive visibility, and then raise visibility as needed, i.e.
start with ![]() |
|||
122 | $instance = $old_instance; |
||
123 | |||
124 | $instance['title'] = wp_kses_post( force_balance_tags( $new_instance['title'] ) ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
125 | $instance['title_link'] = strip_tags( $new_instance['title_link'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
126 | $instance['tagline'] = wp_kses_post( force_balance_tags( $new_instance['tagline'] ) ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
127 | $instance['columns'] = strip_tags( $new_instance['columns'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
128 | $instance['orderby'] = strip_tags( $new_instance['orderby'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
129 | $instance['order'] = strip_tags( $new_instance['order'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
130 | $instance['limit'] = strip_tags( $new_instance['limit'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
131 | $instance['include'] = strip_tags( $new_instance['include'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
132 | $instance['display'] = strip_tags( $new_instance['display'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
133 | $instance['size'] = strip_tags( $new_instance['size'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 8 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
134 | $instance['button_text'] = strip_tags( $new_instance['button_text'] ); |
||
0 ignored issues
–
show
|
|||
135 | $instance['responsive'] = strip_tags( $new_instance['responsive'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
136 | $instance['show_image'] = strip_tags( $new_instance['show_image'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
137 | $instance['carousel'] = strip_tags( $new_instance['carousel'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
138 | $instance['featured'] = strip_tags( $new_instance['featured'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
139 | |||
140 | return $instance; |
||
141 | } |
||
0 ignored issues
–
show
|
|||
142 | |||
143 | function form( $instance ) { |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
It is recommend to declare an explicit visibility for
form .
Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed. If you are not sure which visibility to choose, it is a good idea to start with
the most restrictive visibility, and then raise visibility as needed, i.e.
start with ![]() |
|||
144 | $defaults = array( |
||
145 | 'title' => 'Projects', |
||
0 ignored issues
–
show
|
|||
146 | 'title_link' => '', |
||
0 ignored issues
–
show
|
|||
147 | 'tagline' => '', |
||
0 ignored issues
–
show
|
|||
148 | 'columns' => '3', |
||
0 ignored issues
–
show
|
|||
149 | 'orderby' => 'name', |
||
0 ignored issues
–
show
|
|||
150 | 'order' => 'ASC', |
||
0 ignored issues
–
show
|
|||
151 | 'limit' => '', |
||
0 ignored issues
–
show
|
|||
152 | 'include' => '', |
||
0 ignored issues
–
show
|
|||
153 | 'display' => 'excerpt', |
||
0 ignored issues
–
show
|
|||
154 | 'size' => 'lsx-thumbnail-single', |
||
0 ignored issues
–
show
|
|||
155 | 'button_text' => '', |
||
156 | 'responsive' => 1, |
||
0 ignored issues
–
show
|
|||
157 | 'show_image' => 1, |
||
0 ignored issues
–
show
|
|||
158 | 'carousel' => 1, |
||
0 ignored issues
–
show
|
|||
159 | 'featured' => 0, |
||
0 ignored issues
–
show
|
|||
160 | ); |
||
161 | |||
162 | $instance = wp_parse_args( (array) $instance, $defaults ); |
||
163 | |||
164 | $title = esc_attr( $instance['title'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 10 spaces
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
165 | $title_link = esc_attr( $instance['title_link'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 5 spaces
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
166 | $tagline = esc_attr( $instance['tagline'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 8 spaces
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
167 | $columns = esc_attr( $instance['columns'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 8 spaces
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
168 | $orderby = esc_attr( $instance['orderby'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 8 spaces
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
169 | $order = esc_attr( $instance['order'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 10 spaces
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
170 | $limit = esc_attr( $instance['limit'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 10 spaces
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
171 | $include = esc_attr( $instance['include'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 8 spaces
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
172 | $display = esc_attr( $instance['display'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 8 spaces
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
173 | $size = esc_attr( $instance['size'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 8 spaces but found 11 spaces
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
174 | $button_text = esc_attr( $instance['button_text'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 1 space but found 4 spaces
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
175 | $responsive = esc_attr( $instance['responsive'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 5 spaces
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
176 | $show_image = esc_attr( $instance['show_image'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 5 spaces
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
177 | $carousel = esc_attr( $instance['carousel'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 7 spaces
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
178 | $featured = esc_attr( $instance['featured'] ); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 7 spaces
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
179 | ?> |
||
180 | <p> |
||
181 | <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'lsx-projects' ); ?></label> |
||
182 | <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /> |
||
183 | </p> |
||
184 | <p> |
||
185 | <label for="<?php echo esc_attr( $this->get_field_id( 'title_link' ) ); ?>"><?php esc_html_e( 'Page Link:', 'lsx-projects' ); ?></label> |
||
186 | <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title_link' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title_link' ) ); ?>" type="text" value="<?php echo esc_attr( $title_link ); ?>" /> |
||
187 | <small><?php esc_html_e( 'Link the widget to a page', 'lsx-projects' ); ?></small> |
||
188 | </p> |
||
189 | <p> |
||
190 | <label for="<?php echo esc_attr( $this->get_field_id( 'tagline' ) ); ?>"><?php esc_html_e( 'Tagline:', 'lsx-projects' ); ?></label> |
||
191 | <textarea class="widefat" rows="8" cols="20" id="<?php echo esc_attr( $this->get_field_id( 'tagline' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'tagline' ) ); ?>"><?php echo esc_html( $tagline ); ?></textarea> |
||
192 | <small><?php esc_html_e( 'Tagline to display below the widget title', 'lsx-projects' ); ?></small> |
||
193 | </p> |
||
194 | <p> |
||
195 | <label for="<?php echo esc_attr( $this->get_field_id( 'columns' ) ); ?>"><?php esc_html_e( 'Columns:', 'lsx-projects' ); ?></label> |
||
196 | <select name="<?php echo esc_attr( $this->get_field_name( 'columns' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'columns' ) ); ?>" class="widefat"> |
||
197 | <?php |
||
198 | $options = array( '1', '2', '3', '4' ); |
||
199 | |||
200 | foreach ( $options as $option ) { |
||
0 ignored issues
–
show
|
|||
201 | echo '<option value="' . esc_attr( lcfirst( $option ) ) . '" id="' . esc_attr( $option ) . '"', lcfirst( $option ) == $columns ? ' selected="selected"' : '', '>', esc_html( $option ), '</option>'; |
||
0 ignored issues
–
show
|
|||
202 | } |
||
203 | ?> |
||
204 | </select> |
||
205 | </p> |
||
206 | <p> |
||
207 | <label for="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>"><?php esc_html_e( 'Order By:', 'lsx-projects' ); ?></label> |
||
208 | <select name="<?php echo esc_attr( $this->get_field_name( 'orderby' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>" class="widefat"> |
||
209 | <?php |
||
210 | $options = array( |
||
211 | esc_html__( 'None', 'lsx-projects' ) => 'none', |
||
0 ignored issues
–
show
|
|||
212 | esc_html__( 'ID', 'lsx-projects' ) => 'ID', |
||
0 ignored issues
–
show
|
|||
213 | esc_html__( 'Name', 'lsx-projects' ) => 'name', |
||
0 ignored issues
–
show
|
|||
214 | esc_html__( 'Date', 'lsx-projects' ) => 'date', |
||
0 ignored issues
–
show
|
|||
215 | esc_html__( 'Modified Date', 'lsx-projects' ) => 'modified', |
||
216 | esc_html__( 'Random', 'lsx-projects' ) => 'rand', |
||
217 | esc_html__( 'Menu (WP dashboard order)', 'lsx-projects' ) => 'menu_order', |
||
218 | ); |
||
219 | |||
220 | foreach ( $options as $name => $value ) { |
||
0 ignored issues
–
show
|
|||
221 | echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $orderby == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>'; |
||
0 ignored issues
–
show
|
|||
222 | } |
||
223 | ?> |
||
224 | </select> |
||
225 | </p> |
||
226 | <p> |
||
227 | <label for="<?php echo esc_attr( $this->get_field_id( 'order' ) ); ?>"><?php esc_html_e( 'Order:', 'lsx-projects' ); ?></label> |
||
228 | <select name="<?php echo esc_attr( $this->get_field_name( 'order' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'order' ) ); ?>" class="widefat"> |
||
229 | <?php |
||
230 | $options = array( |
||
231 | esc_html__( 'Ascending', 'lsx-projects' ) => 'ASC', |
||
232 | esc_html__( 'Descending', 'lsx-projects' ) => 'DESC', |
||
233 | ); |
||
234 | |||
235 | foreach ( $options as $name => $value ) { |
||
0 ignored issues
–
show
|
|||
236 | echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $order == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>'; |
||
0 ignored issues
–
show
|
|||
237 | } |
||
238 | ?> |
||
239 | </select> |
||
240 | </p> |
||
241 | <p class="limit"> |
||
242 | <label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php esc_html_e( 'Maximum amount:', 'lsx-projects' ); ?></label> |
||
243 | <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" type="text" value="<?php echo esc_attr( $limit ); ?>" /> |
||
244 | <small><?php esc_html_e( 'Leave empty to display all', 'lsx-projects' ); ?></small> |
||
245 | </p> |
||
246 | <p> |
||
247 | <label for="<?php echo esc_attr( $this->get_field_id( 'include' ) ); ?>"><?php esc_html_e( 'Specify Projects by ID:', 'lsx-projects' ); ?></label> |
||
248 | <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'include' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'include' ) ); ?>" type="text" value="<?php echo esc_attr( $include ); ?>" /> |
||
249 | <small><?php esc_html_e( 'Comma separated list, overrides limit and order settings', 'lsx-projects' ); ?></small> |
||
250 | </p> |
||
251 | <p> |
||
252 | <label for="<?php echo esc_attr( $this->get_field_id( 'display' ) ); ?>"><?php esc_html_e( 'Display:', 'lsx-projects' ); ?></label> |
||
253 | <select name="<?php echo esc_attr( $this->get_field_name( 'display' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'display' ) ); ?>" class="widefat"> |
||
254 | <?php |
||
255 | $options = array( |
||
256 | esc_html__( 'Excerpt', 'lsx-projects' ) => 'excerpt', |
||
257 | esc_html__( 'Full Content', 'lsx-projects' ) => 'full', |
||
258 | ); |
||
259 | |||
260 | foreach ( $options as $name => $value ) { |
||
0 ignored issues
–
show
|
|||
261 | echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $display == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>'; |
||
0 ignored issues
–
show
|
|||
262 | } |
||
263 | ?> |
||
264 | </select> |
||
265 | </p> |
||
266 | <p> |
||
267 | <label for="<?php echo esc_attr( $this->get_field_id( 'size' ) ); ?>"><?php esc_html_e( 'Image size:', 'lsx-projects' ); ?></label> |
||
268 | <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'size' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'size' ) ); ?>" type="text" value="<?php echo esc_attr( $size ); ?>" /> |
||
269 | </p> |
||
270 | <p> |
||
271 | <label for="<?php echo esc_attr( $this->get_field_id( 'button_text' ) ); ?>"><?php esc_html_e( 'Button "view all" text:', 'lsx-projects' ); ?></label> |
||
272 | <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'button_text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'button_text' ) ); ?>" type="text" value="<?php echo esc_attr( $button_text ); ?>" /> |
||
273 | <small><?php esc_html_e( 'Leave empty to not display the button', 'lsx-projects' ); ?></small> |
||
274 | </p> |
||
275 | <p> |
||
276 | <input id="<?php echo esc_attr( $this->get_field_id( 'show_image' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_image' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $show_image ); ?> /> |
||
277 | <label for="<?php echo esc_attr( $this->get_field_id( 'show_image' ) ); ?>"><?php esc_html_e( 'Display Images', 'lsx-projects' ); ?></label> |
||
278 | </p> |
||
279 | <p> |
||
280 | <input id="<?php echo esc_attr( $this->get_field_id( 'responsive' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'responsive' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $responsive ); ?> /> |
||
281 | <label for="<?php echo esc_attr( $this->get_field_id( 'responsive' ) ); ?>"><?php esc_html_e( 'Responsive Images', 'lsx-projects' ); ?></label> |
||
282 | </p> |
||
283 | <p> |
||
284 | <input id="<?php echo esc_attr( $this->get_field_id( 'carousel' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'carousel' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $carousel ); ?> /> |
||
285 | <label for="<?php echo esc_attr( $this->get_field_id( 'carousel' ) ); ?>"><?php esc_html_e( 'Carousel', 'lsx-projects' ); ?></label> |
||
286 | </p> |
||
287 | <p> |
||
288 | <input id="<?php echo esc_attr( $this->get_field_id( 'featured' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'featured' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $featured ); ?> /> |
||
289 | <label for="<?php echo esc_attr( $this->get_field_id( 'featured' ) ); ?>"><?php esc_html_e( 'Featured posts', 'lsx-projects' ); ?></label> |
||
290 | </p> |
||
291 | <?php |
||
292 | } |
||
0 ignored issues
–
show
|
|||
293 | |||
294 | } |
||
295 | |||
296 | function lsx_projects_register_widget() { |
||
0 ignored issues
–
show
|
|||
297 | return register_widget( 'LSX_Projects_Widget' ); |
||
298 | } |
||
0 ignored issues
–
show
|
|||
299 | add_action( 'widgets_init', 'lsx_projects_register_widget' ); |
||
300 |