Completed
Pull Request — master (#206)
by Kiran
05:47
created

Geodir_Features_Widget::widget()   F

Complexity

Conditions 75
Paths > 20000

Size

Total Lines 226
Code Lines 161

Duplication

Lines 156
Ratio 69.03 %
Metric Value
dl 156
loc 226
rs 2
cc 75
eloc 161
nc 4294967295
nop 2

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
class Geodir_Features_Widget extends WP_Widget {
4
5
    /**
6
     * Class constructor.
7
     */
8
    public function __construct() {
9
        $widget_ops = array(
10
            'description' => __( 'Displays "GD Features" widget', 'geodirectory' ),
11
            'classname' => 'widget_gd_features',
12
        );
13
        parent::__construct( false, $name = _x( 'GD > Features', 'widget name', 'geodirectory' ), $widget_ops );
14
15
    }
16
17
    /**
18
     * Display the widget.
19
     *
20
     * @param array $args Widget arguments.
21
     * @param array $instance The widget settings, as saved by the user.
22
     */
23
    function widget( $args, $instance ) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
24
        extract( $args );
25
26
        $title = empty($instance['title']) ? '' : apply_filters('gd_features_widget_title', __($instance['title'], 'geodirectory'));
27
        $icon_color = $instance['icon_color'];
28
29
        $title1 = $instance['title1'];
30
        $title2 = $instance['title2'];
31
        $title3 = $instance['title3'];
32
        $title4 = $instance['title4'];
33
        $title5 = $instance['title5'];
34
        $title6 = $instance['title6'];
35
        $title7 = $instance['title7'];
36
        $title8 = $instance['title8'];
37
        $title9 = $instance['title9'];
38
        $title10 = $instance['title10'];
39
        $title11 = $instance['title11'];
40
        $title12 = $instance['title12'];
41
42
        $image1 = $instance['image1'];
43
        $image2 = $instance['image2'];
44
        $image3 = $instance['image3'];
45
        $image4 = $instance['image4'];
46
        $image5 = $instance['image5'];
47
        $image6 = $instance['image6'];
48
        $image7 = $instance['image7'];
49
        $image8 = $instance['image8'];
50
        $image9 = $instance['image9'];
51
        $image10 = $instance['image10'];
52
        $image11 = $instance['image11'];
53
        $image12 = $instance['image12'];
54
55
        $desc1 = $instance['desc1'];
56
        $desc2 = $instance['desc2'];
57
        $desc3 = $instance['desc3'];
58
        $desc4 = $instance['desc4'];
59
        $desc5 = $instance['desc5'];
60
        $desc6 = $instance['desc6'];
61
        $desc7 = $instance['desc7'];
62
        $desc8 = $instance['desc8'];
63
        $desc9 = $instance['desc9'];
64
        $desc10 = $instance['desc10'];
65
        $desc11 = $instance['desc11'];
66
        $desc12 = $instance['desc12'];
67
68
        echo $before_widget;
69
        ?>
70
        <?php if ($title) {
71
            echo '<div class="geodir_list_heading clearfix">';
72
            echo $before_title . $title . $after_title;
73
            echo '</div>';
74
        } ?>
75
        <?php
76
        echo "<ul class='gd-features'>";
77 View Code Duplication
        if ($title1 OR $image1 OR $desc1) {
78
            echo "<li>";
79
            if ($title1) {
80
                echo "<h3 class='gd-fe-title'>" . $title1 . "</h3>";
81
            }
82
            if ($image1) {
83
                echo "<div class='gd-fe-image'>" . gd_features_parse_image($image1, $icon_color) . "</div>";
84
            }
85
            if ($desc1) {
86
                echo "<div class='gd-fe-desc'>" . gd_features_parse_desc($desc1) . "</div>";
87
            }
88
            echo "</li>";
89
        }
90
91 View Code Duplication
        if ($title2 OR $image2 OR $desc2) {
92
            echo "<li>";
93
            if ($title2) {
94
                echo "<h3 class='gd-fe-title'>" . $title2 . "</h3>";
95
            }
96
            if ($image2) {
97
                echo "<div class='gd-fe-image'>" . gd_features_parse_image($image2, $icon_color) . "</div>";
98
            }
99
            if ($desc2) {
100
                echo "<div class='gd-fe-desc'>" . gd_features_parse_desc($desc2) . "</div>";
101
            }
102
            echo "</li>";
103
        }
104
105 View Code Duplication
        if ($title3 OR $image3 OR $desc3) {
106
            echo "<li>";
107
            if ($title3) {
108
                echo "<h3 class='gd-fe-title'>" . $title3 . "</h3>";
109
            }
110
            if ($image3) {
111
                echo "<div class='gd-fe-image'>" . gd_features_parse_image($image3, $icon_color) . "</div>";
112
            }
113
            if ($desc3) {
114
                echo "<div class='gd-fe-desc'>" . gd_features_parse_desc($desc3) . "</div>";
115
            }
116
            echo "</li>";
117
        }
118
119 View Code Duplication
        if ($title4 OR $image4 OR $desc4) {
120
            echo "<li>";
121
            if ($title4) {
122
                echo "<h3 class='gd-fe-title'>" . $title4 . "</h3>";
123
            }
124
            if ($image4) {
125
                echo "<div class='gd-fe-image'>" . gd_features_parse_image($image4, $icon_color) . "</div>";
126
            }
127
            if ($desc4) {
128
                echo "<div class='gd-fe-desc'>" . gd_features_parse_desc($desc4) . "</div>";
129
            }
130
            echo "</li>";
131
        }
132
133 View Code Duplication
        if ($title5 OR $image5 OR $desc5) {
134
            echo "<li>";
135
            if ($title5) {
136
                echo "<h3 class='gd-fe-title'>" . $title5 . "</h3>";
137
            }
138
            if ($image5) {
139
                echo "<div class='gd-fe-image'>" . gd_features_parse_image($image5, $icon_color) . "</div>";
140
            }
141
            if ($desc5) {
142
                echo "<div class='gd-fe-desc'>" . gd_features_parse_desc($desc5) . "</div>";
143
            }
144
            echo "</li>";
145
        }
146
147 View Code Duplication
        if ($title6 OR $image6 OR $desc6) {
148
            echo "<li>";
149
            if ($title6) {
150
                echo "<h3 class='gd-fe-title'>" . $title6 . "</h3>";
151
            }
152
            if ($image6) {
153
                echo "<div class='gd-fe-image'>" . gd_features_parse_image($image6, $icon_color) . "</div>";
154
            }
155
            if ($desc6) {
156
                echo "<div class='gd-fe-desc'>" . gd_features_parse_desc($desc6) . "</div>";
157
            }
158
            echo "</li>";
159
        }
160
161 View Code Duplication
        if ($title7 OR $image7 OR $desc7) {
162
            echo "<li>";
163
            if ($title7) {
164
                echo "<h3 class='gd-fe-title'>" . $title7 . "</h3>";
165
            }
166
            if ($image7) {
167
                echo "<div class='gd-fe-image'>" . gd_features_parse_image($image7, $icon_color) . "</div>";
168
            }
169
            if ($desc7) {
170
                echo "<div class='gd-fe-desc'>" . gd_features_parse_desc($desc7) . "</div>";
171
            }
172
            echo "</li>";
173
        }
174
175 View Code Duplication
        if ($title8 OR $image8 OR $desc8) {
176
            echo "<li>";
177
            if ($title8) {
178
                echo "<h3 class='gd-fe-title'>" . $title8 . "</h3>";
179
            }
180
            if ($image8) {
181
                echo "<div class='gd-fe-image'>" . gd_features_parse_image($image8, $icon_color) . "</div>";
182
            }
183
            if ($desc8) {
184
                echo "<div class='gd-fe-desc'>" . gd_features_parse_desc($desc8) . "</div>";
185
            }
186
            echo "</li>";
187
        }
188
189 View Code Duplication
        if ($title9 OR $image9 OR $desc9) {
190
            echo "<li>";
191
            if ($title9) {
192
                echo "<h3 class='gd-fe-title'>" . $title9 . "</h3>";
193
            }
194
            if ($image9) {
195
                echo "<div class='gd-fe-image'>" . gd_features_parse_image($image9, $icon_color) . "</div>";
196
            }
197
            if ($desc9) {
198
                echo "<div class='gd-fe-desc'>" . gd_features_parse_desc($desc9) . "</div>";
199
            }
200
            echo "</li>";
201
        }
202
203 View Code Duplication
        if ($title10 OR $image10 OR $desc10) {
204
            echo "<li>";
205
            if ($title10) {
206
                echo "<h3 class='gd-fe-title'>" . $title10 . "</h3>";
207
            }
208
            if ($image10) {
209
                echo "<div class='gd-fe-image'>" . gd_features_parse_image($image10, $icon_color) . "</div>";
210
            }
211
            if ($desc10) {
212
                echo "<div class='gd-fe-desc'>" . gd_features_parse_desc($desc10) . "</div>";
213
            }
214
            echo "</li>";
215
        }
216
217 View Code Duplication
        if ($title11 OR $image11 OR $desc11) {
218
            echo "<li>";
219
            if ($title11) {
220
                echo "<h3 class='gd-fe-title'>" . $title11 . "</h3>";
221
            }
222
            if ($image11) {
223
                echo "<div class='gd-fe-image'>" . gd_features_parse_image($image11, $icon_color) . "</div>";
224
            }
225
            if ($desc11) {
226
                echo "<div class='gd-fe-desc'>" . gd_features_parse_desc($desc11) . "</div>";
227
            }
228
            echo "</li>";
229
        }
230
231 View Code Duplication
        if ($title12 OR $image12 OR $desc12) {
232
            echo "<li>";
233
            if ($title12) {
234
                echo "<h3 class='gd-fe-title'>" . $title12 . "</h3>";
235
            }
236
            if ($image12) {
237
                echo "<div class='gd-fe-image'>" . gd_features_parse_image($image12, $icon_color) . "</div>";
238
            }
239
            if ($desc12) {
240
                echo "<div class='gd-fe-desc'>" . gd_features_parse_desc($desc12) . "</div>";
241
            }
242
            echo "</li>";
243
        }
244
        echo "</ul>";
245
        ?>
246
        <?php echo $after_widget; ?>
247
        <?php
248
    }
249
250
    function update($new_instance, $old_instance)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
251
    {
252
        //save the widget
253
        $instance = $old_instance;
254
255
        $instance['title'] = strip_tags($new_instance['title']);
256
        $instance['icon_color'] = strip_tags($new_instance['icon_color']);
257
258
        $instance['title1'] = $new_instance['title1'];
259
        $instance['title2'] = $new_instance['title2'];
260
        $instance['title3'] = $new_instance['title3'];
261
        $instance['title4'] = $new_instance['title4'];
262
        $instance['title5'] = $new_instance['title5'];
263
        $instance['title6'] = $new_instance['title6'];
264
        $instance['title7'] = $new_instance['title7'];
265
        $instance['title8'] = $new_instance['title8'];
266
        $instance['title9'] = $new_instance['title9'];
267
        $instance['title10'] = $new_instance['title10'];
268
        $instance['title11'] = $new_instance['title11'];
269
        $instance['title12'] = $new_instance['title12'];
270
        //image
271
        $instance['image1'] = $new_instance['image1'];
272
        $instance['image2'] = $new_instance['image2'];
273
        $instance['image3'] = $new_instance['image3'];
274
        $instance['image4'] = $new_instance['image4'];
275
        $instance['image5'] = $new_instance['image5'];
276
        $instance['image6'] = $new_instance['image6'];
277
        $instance['image7'] = $new_instance['image7'];
278
        $instance['image8'] = $new_instance['image8'];
279
        $instance['image9'] = $new_instance['image9'];
280
        $instance['image10'] = $new_instance['image10'];
281
        $instance['image11'] = $new_instance['image11'];
282
        $instance['image12'] = $new_instance['image12'];
283
        //Description
284
        $instance['desc1'] = $new_instance['desc1'];
285
        $instance['desc2'] = $new_instance['desc2'];
286
        $instance['desc3'] = $new_instance['desc3'];
287
        $instance['desc4'] = $new_instance['desc4'];
288
        $instance['desc5'] = $new_instance['desc5'];
289
        $instance['desc6'] = $new_instance['desc6'];
290
        $instance['desc7'] = $new_instance['desc7'];
291
        $instance['desc8'] = $new_instance['desc8'];
292
        $instance['desc9'] = $new_instance['desc9'];
293
        $instance['desc10'] = $new_instance['desc10'];
294
        $instance['desc11'] = $new_instance['desc11'];
295
        $instance['desc12'] = $new_instance['desc12'];
296
        return $instance;
297
    }
298
299
    function form($instance)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
300
    {
301
        //widgetform in backend
302
        $instance = wp_parse_args((array)$instance, array(
303
            'title' => '',
304
            'icon_color' => '#757575',
305
            'title1' => '',
306
            'title2' => '',
307
            'title3' => '',
308
            'title4' => '',
309
            'title5' => '',
310
            'title6' => '',
311
            'title7' => '',
312
            'title8' => '',
313
            'title9' => '',
314
            'title10' => '',
315
            'title11' => '',
316
            'title12' => '',
317
            'image1' => '',
318
            'image2' => '',
319
            'image3' => '',
320
            'image4' => '',
321
            'image5' => '',
322
            'image6' => '',
323
            'image7' => '',
324
            'image8' => '',
325
            'image9' => '',
326
            'image10' => '',
327
            'image11' => '',
328
            'image12' => '',
329
            'desc1' => '',
330
            'desc2' => '',
331
            'desc3' => '',
332
            'desc4' => '',
333
            'desc5' => '',
334
            'desc6' => '',
335
            'desc7' => '',
336
            'desc8' => '',
337
            'desc9' => '',
338
            'desc10' => '',
339
            'desc11' => '',
340
            'desc12' => '',
341
        ));
342
        $title = strip_tags($instance['title']);
343
        $icon_color = strip_tags($instance['icon_color']);
344
345
        $title1 = strip_tags($instance['title1']);
346
        $title2 = strip_tags($instance['title2']);
347
        $title3 = strip_tags($instance['title3']);
348
        $title4 = strip_tags($instance['title4']);
349
        $title5 = strip_tags($instance['title5']);
350
        $title6 = strip_tags($instance['title6']);
351
        $title7 = strip_tags($instance['title7']);
352
        $title8 = strip_tags($instance['title8']);
353
        $title9 = strip_tags($instance['title9']);
354
        $title10 = strip_tags($instance['title10']);
355
        $title11 = strip_tags($instance['title11']);
356
        $title12 = strip_tags($instance['title12']);
357
358
        $image1 = strip_tags($instance['image1']);
359
        $image2 = strip_tags($instance['image2']);
360
        $image3 = strip_tags($instance['image3']);
361
        $image4 = strip_tags($instance['image4']);
362
        $image5 = strip_tags($instance['image5']);
363
        $image6 = strip_tags($instance['image6']);
364
        $image7 = strip_tags($instance['image7']);
365
        $image8 = strip_tags($instance['image8']);
366
        $image9 = strip_tags($instance['image9']);
367
        $image10 = strip_tags($instance['image10']);
368
        $image11 = strip_tags($instance['image11']);
369
        $image12 = strip_tags($instance['image12']);
370
371
        $desc1 = strip_tags($instance['desc1']);
372
        $desc2 = strip_tags($instance['desc2']);
373
        $desc3 = strip_tags($instance['desc3']);
374
        $desc4 = strip_tags($instance['desc4']);
375
        $desc5 = strip_tags($instance['desc5']);
376
        $desc6 = strip_tags($instance['desc6']);
377
        $desc7 = strip_tags($instance['desc7']);
378
        $desc8 = strip_tags($instance['desc8']);
379
        $desc9 = strip_tags($instance['desc9']);
380
        $desc10 = strip_tags($instance['desc10']);
381
        $desc11 = strip_tags($instance['desc11']);
382
        $desc12 = strip_tags($instance['desc12']);
383
        ?>
384
        <p>
385
            <b>Heads Up!</b> If you don't have enough content, You can keep some boxes blank.
386
        </p>
387
        <p>
388
            For font awesome icons refer <a href="https://fortawesome.github.io/Font-Awesome/icons/" target="_blank">this page</a>. You must enter "icon class" if you are planning to use font awesome icons.
389
            For example if you planning to use "recycle" icon as your image, then you have to enter "fa-recycle" as class name which you can find in <a href="http://fortawesome.github.io/Font-Awesome/icon/recycle/" target="_blank">this page</a>
390
        </p>
391
392
        <p>
393
            <label><?php echo __("Widget Title (Optional):", 'geodirectory'); ?></label>
394
            <input name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" class="widefat"/>
395
        </p>
396
397
        <p>
398
            <label><?php echo __("Font Awesome Icon Color:", 'geodirectory'); ?></label>
399
            <input name="<?php echo $this->get_field_name('icon_color'); ?>" type="text" value="<?php echo esc_attr($icon_color); ?>" class="widefat"/>
400
        </p>
401
402
        <p class="features-title">
403
            <label><?php echo __( 'Title 1:', 'geodirectory' ); ?></label>
404
            <input name="<?php echo $this->get_field_name( 'title1' ); ?>" type="text" value="<?php echo esc_attr($title1); ?>" class="widefat" />
405
        </p>
406
407
        <p class="features-image">
408
            <label><?php echo __( 'Image URL:', 'geodirectory' ); ?></label>
409
            <input type="text" class="widefat" name="<?php echo $this->get_field_name( 'image1' ); ?>" value="<?php echo esc_attr($image1); ?>" />
410
        </p>
411
412
        <p class="features-desc">
413
            <label><?php echo __( 'Description:', 'geodirectory' ); ?></label>
414
            <textarea name="<?php echo $this->get_field_name( 'desc1' ); ?>" rows="3" class="widefat"><?php echo esc_attr($desc1); ?></textarea>
415
        </p>
416
417
        <p class="features-title">
418
            <label><?php echo __( 'Title 2:', 'geodirectory' ); ?></label>
419
            <input name="<?php echo $this->get_field_name( 'title2' ); ?>" type="text" value="<?php echo esc_attr($title2); ?>" class="widefat" />
420
        </p>
421
422
        <p class="features-image">
423
            <label><?php echo __( 'Image URL:', 'geodirectory' ); ?></label>
424
            <input type="text" class="widefat" name="<?php echo $this->get_field_name( 'image2' ); ?>" value="<?php echo esc_attr($image2); ?>" />
425
        </p>
426
427
        <p class="features-desc">
428
            <label><?php echo __( 'Description:', 'geodirectory' ); ?></label>
429
            <textarea name="<?php echo $this->get_field_name( 'desc2' ); ?>" rows="3" class="widefat"><?php echo esc_attr($desc2); ?></textarea>
430
        </p>
431
432
        <p class="features-title">
433
            <label><?php echo __( 'Title 3:', 'geodirectory' ); ?></label>
434
            <input name="<?php echo $this->get_field_name( 'title3' ); ?>" type="text" value="<?php echo esc_attr($title3); ?>" class="widefat" />
435
        </p>
436
437
        <p class="features-image">
438
            <label><?php echo __( 'Image URL:', 'geodirectory' ); ?></label>
439
            <input type="text" class="widefat" name="<?php echo $this->get_field_name( 'image3' ); ?>" value="<?php echo esc_attr($image3); ?>" />
440
        </p>
441
442
        <p class="features-desc">
443
            <label><?php echo __( 'Description:', 'geodirectory' ); ?></label>
444
            <textarea name="<?php echo $this->get_field_name( 'desc3' ); ?>" rows="3" class="widefat"><?php echo esc_attr($desc3); ?></textarea>
445
        </p>
446
447
        <p class="features-title">
448
            <label><?php echo __( 'Title 4:', 'geodirectory' ); ?></label>
449
            <input name="<?php echo $this->get_field_name( 'title4' ); ?>" type="text" value="<?php echo esc_attr($title4); ?>" class="widefat" />
450
        </p>
451
452
        <p class="features-image">
453
            <label><?php echo __( 'Image URL:', 'geodirectory' ); ?></label>
454
            <input type="text" class="widefat" name="<?php echo $this->get_field_name( 'image4' ); ?>" value="<?php echo esc_attr($image4); ?>" />
455
        </p>
456
457
        <p class="features-desc">
458
            <label><?php echo __( 'Description:', 'geodirectory' ); ?></label>
459
            <textarea name="<?php echo $this->get_field_name( 'desc4' ); ?>" rows="3" class="widefat"><?php echo esc_attr($desc4); ?></textarea>
460
        </p>
461
462
        <p class="features-title">
463
            <label><?php echo __( 'Title 5:', 'geodirectory' ); ?></label>
464
            <input name="<?php echo $this->get_field_name( 'title5' ); ?>" type="text" value="<?php echo esc_attr($title5); ?>" class="widefat" />
465
        </p>
466
467
        <p class="features-image">
468
            <label><?php echo __( 'Image URL:', 'geodirectory' ); ?></label>
469
            <input type="text" class="widefat" name="<?php echo $this->get_field_name( 'image5' ); ?>" value="<?php echo esc_attr($image5); ?>" />
470
        </p>
471
472
        <p class="features-desc">
473
            <label><?php echo __( 'Description:', 'geodirectory' ); ?></label>
474
            <textarea name="<?php echo $this->get_field_name( 'desc5' ); ?>" rows="3" class="widefat"><?php echo esc_attr($desc5); ?></textarea>
475
        </p>
476
477
        <p class="features-title">
478
            <label><?php echo __( 'Title 6:', 'geodirectory' ); ?></label>
479
            <input name="<?php echo $this->get_field_name( 'title6' ); ?>" type="text" value="<?php echo esc_attr($title6); ?>" class="widefat" />
480
        </p>
481
482
        <p class="features-image">
483
            <label><?php echo __( 'Image URL:', 'geodirectory' ); ?></label>
484
            <input type="text" class="widefat" name="<?php echo $this->get_field_name( 'image6' ); ?>" value="<?php echo esc_attr($image6); ?>" />
485
        </p>
486
487
        <p class="features-desc">
488
            <label><?php echo __( 'Description:', 'geodirectory' ); ?></label>
489
            <textarea name="<?php echo $this->get_field_name( 'desc6' ); ?>" rows="3" class="widefat"><?php echo esc_attr($desc6); ?></textarea>
490
        </p>
491
492
        <p class="features-title">
493
            <label><?php echo __( 'Title 7:', 'geodirectory' ); ?></label>
494
            <input name="<?php echo $this->get_field_name( 'title7' ); ?>" type="text" value="<?php echo esc_attr($title7); ?>" class="widefat" />
495
        </p>
496
497
        <p class="features-image">
498
            <label><?php echo __( 'Image URL:', 'geodirectory' ); ?></label>
499
            <input type="text" class="widefat" name="<?php echo $this->get_field_name( 'image7' ); ?>" value="<?php echo esc_attr($image7); ?>" />
500
        </p>
501
502
        <p class="features-desc">
503
            <label><?php echo __( 'Description:', 'geodirectory' ); ?></label>
504
            <textarea name="<?php echo $this->get_field_name( 'desc7' ); ?>" rows="3" class="widefat"><?php echo esc_attr($desc7); ?></textarea>
505
        </p>
506
507
        <p class="features-title">
508
            <label><?php echo __( 'Title 8:', 'geodirectory' ); ?></label>
509
            <input name="<?php echo $this->get_field_name( 'title8' ); ?>" type="text" value="<?php echo esc_attr($title8); ?>" class="widefat" />
510
        </p>
511
512
        <p class="features-image">
513
            <label><?php echo __( 'Image URL:', 'geodirectory' ); ?></label>
514
            <input type="text" class="widefat" name="<?php echo $this->get_field_name( 'image8' ); ?>" value="<?php echo esc_attr($image8); ?>" />
515
        </p>
516
517
        <p class="features-desc">
518
            <label><?php echo __( 'Description:', 'geodirectory' ); ?></label>
519
            <textarea name="<?php echo $this->get_field_name( 'desc8' ); ?>" rows="3" class="widefat"><?php echo esc_attr($desc8); ?></textarea>
520
        </p>
521
522
        <p class="features-title">
523
            <label><?php echo __( 'Title 9:', 'geodirectory' ); ?></label>
524
            <input name="<?php echo $this->get_field_name( 'title9' ); ?>" type="text" value="<?php echo esc_attr($title9); ?>" class="widefat" />
525
        </p>
526
527
        <p class="features-image">
528
            <label><?php echo __( 'Image URL:', 'geodirectory' ); ?></label>
529
            <input type="text" class="widefat" name="<?php echo $this->get_field_name( 'image9' ); ?>" value="<?php echo esc_attr($image9); ?>" />
530
        </p>
531
532
        <p class="features-desc">
533
            <label><?php echo __( 'Description:', 'geodirectory' ); ?></label>
534
            <textarea name="<?php echo $this->get_field_name( 'desc9' ); ?>" rows="3" class="widefat"><?php echo esc_attr($desc9); ?></textarea>
535
        </p>
536
537
        <p class="features-title">
538
            <label><?php echo __( 'Title 10:', 'geodirectory' ); ?></label>
539
            <input name="<?php echo $this->get_field_name( 'title10' ); ?>" type="text" value="<?php echo esc_attr($title10); ?>" class="widefat" />
540
        </p>
541
542
        <p class="features-image">
543
            <label><?php echo __( 'Image URL:', 'geodirectory' ); ?></label>
544
            <input type="text" class="widefat" name="<?php echo $this->get_field_name( 'image10' ); ?>" value="<?php echo esc_attr($image10); ?>" />
545
        </p>
546
547
        <p class="features-desc">
548
            <label><?php echo __( 'Description:', 'geodirectory' ); ?></label>
549
            <textarea name="<?php echo $this->get_field_name( 'desc10' ); ?>" rows="3" class="widefat"><?php echo esc_attr($desc10); ?></textarea>
550
        </p>
551
552
        <p class="features-title">
553
            <label><?php echo __( 'Title 11:', 'geodirectory' ); ?></label>
554
            <input name="<?php echo $this->get_field_name( 'title11' ); ?>" type="text" value="<?php echo esc_attr($title11); ?>" class="widefat" />
555
        </p>
556
557
        <p class="features-image">
558
            <label><?php echo __( 'Image URL:', 'geodirectory' ); ?></label>
559
            <input type="text" class="widefat" name="<?php echo $this->get_field_name( 'image11' ); ?>" value="<?php echo esc_attr($image11); ?>" />
560
        </p>
561
562
        <p class="features-desc">
563
            <label><?php echo __( 'Description:', 'geodirectory' ); ?></label>
564
            <textarea name="<?php echo $this->get_field_name( 'desc11' ); ?>" rows="3" class="widefat"><?php echo esc_attr($desc11); ?></textarea>
565
        </p>
566
567
        <p class="features-title">
568
            <label><?php echo __( 'Title 12:', 'geodirectory' ); ?></label>
569
            <input name="<?php echo $this->get_field_name( 'title12' ); ?>" type="text" value="<?php echo esc_attr($title12); ?>" class="widefat" />
570
        </p>
571
572
        <p class="features-image">
573
            <label><?php echo __( 'Image URL:', 'geodirectory' ); ?></label>
574
            <input type="text" class="widefat" name="<?php echo $this->get_field_name( 'image12' ); ?>" value="<?php echo esc_attr($image12); ?>" />
575
        </p>
576
577
        <p class="features-desc">
578
            <label><?php echo __( 'Description:', 'geodirectory' ); ?></label>
579
            <textarea name="<?php echo $this->get_field_name( 'desc12' ); ?>" rows="3" class="widefat"><?php echo esc_attr($desc12); ?></textarea>
580
        </p>
581
        <?php
582
    }
583
584
}
585
register_widget("Geodir_Features_Widget");
586
function gd_features_parse_image($image, $icon_color) {
587
    if (substr( $image, 0, 4 ) === "http") {
588
        $image = '<img src="'.$image.'" />';
589
    } elseif (substr( $image, 0, 3 ) === "fa-") {
590
        if (empty($icon_color)) {
591
            $icon_color = '#757575';
592
        }
593
        $image = '<i style="color:'.$icon_color.'" class="fa '.$image.'"></i>';
594
    }
595
    return $image;
596
}
597
598
function gd_features_parse_desc($desc) {
599
    return $desc;
600
}