-
Notifications
You must be signed in to change notification settings - Fork 30
/
geodirectory_widgets.php
1123 lines (943 loc) · 44.7 KB
/
geodirectory_widgets.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* GeoDirectory Widgets
*
* @since 1.0.0
* @package GeoDirectory
*/
/**
* Registers GeoDirectory sidebar.
*
* @since 1.0.0
* @package GeoDirectory
* @global array $geodir_sidebars List of geodirectory sidebars.
*/
function geodir_register_sidebar()
{
global $geodir_sidebars;
if (function_exists('register_sidebar')) {
/*===========================*/
/* Home page sidebars start*/
/*===========================*/
/**
* Filter the `$before_widget` widget opening HTML tag.
*
* @since 1.0.0
* @param string $var The HTML string to filter. Default = '<section id="%1$s" class="widget geodir-widget %2$s">'.
* @see 'geodir_after_widget'
*/
$before_widget = apply_filters('geodir_before_widget', '<section id="%1$s" class="widget geodir-widget %2$s">');
/**
* Filter the `$after_widget` widget closing HTML tag.
*
* @since 1.0.0
* @param string $var The HTML string to filter. Default = '</section>'.
* @see 'geodir_before_widget'
*/
$after_widget = apply_filters('geodir_after_widget', '</section>');
/**
* Filter the `$before_title` widget title opening HTML tag.
*
* @since 1.0.0
* @param string $var The HTML string to filter. Default = '<h3 class="widget-title">'.
* @see 'geodir_after_title'
*/
$before_title = apply_filters('geodir_before_title', '<h3 class="widget-title">');
/**
* Filter the `$after_title` widget title closing HTML tag.
*
* @since 1.0.0
* @param string $var The HTML string to filter. Default = '</h3>'.
* @see 'geodir_before_title'
*/
$after_title = apply_filters('geodir_after_title', '</h3>');
if (get_option('geodir_show_home_top_section')) {
register_sidebars(1, array('id' => 'geodir_home_top', 'name' => __('GD Home Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
$geodir_sidebars[] = 'geodir_home_top';
}
if (get_option('geodir_show_home_contant_section')) {
register_sidebars(1, array('id' => 'geodir_home_content', 'name' => __('GD Home Content Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
$geodir_sidebars[] = 'geodir_home_content';
}
if (get_option('geodir_show_home_right_section')) {
register_sidebars(1, array('id' => 'geodir_home_right', 'name' => __('GD Home Right Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
$geodir_sidebars[] = 'geodir_home_right';
}
if (get_option('geodir_show_home_left_section')) {
register_sidebars(1, array('id' => 'geodir_home_left', 'name' => __('GD Home Left Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
$geodir_sidebars[] = 'geodir_home_left';
}
if (get_option('geodir_show_home_bottom_section')) {
register_sidebars(1, array('id' => 'geodir_home_bottom', 'name' => __('GD Home Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
$geodir_sidebars[] = 'geodir_home_bottom';
}
/*===========================*/
/* Home page sidebars end*/
/*===========================*/
/*===========================*/
/* Listing page sidebars start*/
/*===========================*/
if (get_option('geodir_show_listing_top_section')) {
register_sidebars(1, array('id' => 'geodir_listing_top', 'name' => __('GD Listing Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
$geodir_sidebars[] = 'geodir_listing_top';
}
if (get_option('geodir_show_listing_left_section')) {
register_sidebars(1, array('id' => 'geodir_listing_left_sidebar', 'name' => __('GD Listing Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
$geodir_sidebars[] = 'geodir_listing_left_sidebar';
}
if (get_option('geodir_show_listing_right_section')) {
register_sidebars(1, array('id' => 'geodir_listing_right_sidebar', 'name' => __('GD Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
$geodir_sidebars[] = 'geodir_listing_right_sidebar';
}
if (get_option('geodir_show_listing_bottom_section')) {
register_sidebars(1, array('id' => 'geodir_listing_bottom', 'name' => __('GD Listing Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
$geodir_sidebars[] = 'geodir_listing_bottom';
}
/*===========================*/
/* Listing page sidebars start*/
/*===========================*/
/*===========================*/
/* Search page sidebars start*/
/*===========================*/
if (get_option('geodir_show_search_top_section')) {
register_sidebars(1, array('id' => 'geodir_search_top', 'name' => __('GD Search Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
$geodir_sidebars[] = 'geodir_search_top';
}
if (get_option('geodir_show_search_left_section')) {
register_sidebars(1, array('id' => 'geodir_search_left_sidebar', 'name' => __('GD Search Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
$geodir_sidebars[] = 'geodir_search_left_sidebar';
}
if (get_option('geodir_show_search_right_section')) {
register_sidebars(1, array('id' => 'geodir_search_right_sidebar', 'name' => __('GD Search Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
$geodir_sidebars[] = 'geodir_search_right_sidebar';
}
if (get_option('geodir_show_search_bottom_section')) {
register_sidebars(1, array('id' => 'geodir_search_bottom', 'name' => __('GD Search Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
$geodir_sidebars[] = 'geodir_search_bottom';
}
/*===========================*/
/* Search page sidebars end*/
/*===========================*/
/*==================================*/
/* Detail/Single page sidebars start*/
/*==================================*/
if (get_option('geodir_show_detail_top_section')) {
register_sidebars(1, array('id' => 'geodir_detail_top', 'name' => __('GD Detail Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
$geodir_sidebars[] = 'geodir_detail_top';
}
register_sidebars(1, array('id' => 'geodir_detail_sidebar', 'name' => __('GD Detail Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
$geodir_sidebars[] = 'geodir_detail_sidebar';
if (get_option('geodir_show_detail_bottom_section')) {
register_sidebars(1, array('id' => 'geodir_detail_bottom', 'name' => __('GD Detail Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
$geodir_sidebars[] = 'geodir_detail_bottom';
}
/*==================================*/
/* Detail/Single page sidebars end*/
/*==================================*/
/*==================================*/
/* Author page sidebars start */
/*==================================*/
if (get_option('geodir_show_author_top_section')) {
register_sidebars(1, array('id' => 'geodir_author_top', 'name' => __('GD Author Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
$geodir_sidebars[] = 'geodir_author_top';
}
if (get_option('geodir_show_author_left_section')) {
register_sidebars(1, array('id' => 'geodir_author_left_sidebar', 'name' => __('GD Author Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
$geodir_sidebars[] = 'geodir_author_left_sidebar';
}
if (get_option('geodir_show_author_right_section')) {
register_sidebars(1, array('id' => 'geodir_author_right_sidebar', 'name' => __('GD Author Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
$geodir_sidebars[] = 'geodir_author_right_sidebar';
}
if (get_option('geodir_show_author_bottom_section')) {
register_sidebars(1, array('id' => 'geodir_author_bottom', 'name' => __('GD Author Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
$geodir_sidebars[] = 'geodir_author_bottom';
}
/*==================================*/
/* Author page sidebars end */
/*==================================*/
/*==================================*/
/* Add listing page sidebars start */
/*==================================*/
register_sidebars(1, array('id' => 'geodir_add_listing_sidebar', 'name' => __('GD Add Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
$geodir_sidebars[] = 'geodir_add_listing_sidebar';
/*==================================*/
/* Add listing page sidebars end */
/*==================================*/
}
}
if (!function_exists('register_geodir_widgets')) {
/**
* Registers all Widgets.
*
* @since 1.0.0
* @package GeoDirectory
*/
function register_geodir_widgets()
{
/**
* Login Widget.
*
* @since 1.0.0
*/
class geodir_loginwidget extends WP_Widget
{
/**
* Register the login widget with WordPress.
*
* @since 1.0.0
* @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
*/
public function __construct() {
$widget_ops = array('classname' => 'geodir_loginbox', 'description' => __('Geodirectory Loginbox Widget', 'geodirectory'));
parent::__construct(
'geodir_loginbox', // Base ID
__('GD > Loginbox', 'geodirectory'), // Name
$widget_ops// Args
);
}
/**
* Front-end display content for login widget.
*
* @since 1.0.0
* @since 1.5.1 Declare function public.
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget($args, $instance)
{
geodir_loginwidget_output($args, $instance);
}
/**
* Sanitize login widget form values as they are saved.
*
* @since 1.0.0
* @since 1.5.1 Declare function public.
*
* @param array $new_instance Values just sent to be saved.
* @param array $old_instance Previously saved values from database.
*
* @return array Updated safe values to be saved.
*/
public function update($new_instance, $old_instance)
{
//save the widget
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
return $instance;
}
/**
* Back-end login widget settings form.
*
* @since 1.0.0
* @since 1.5.1 Declare function public.
*
* @param array $instance Previously saved values from database.
* @return string|void
*/
public function form($instance)
{
//widgetform in backend
$instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
$title = strip_tags($instance['title']);
?>
<p><label
for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget Title', 'geodirectory'); ?>
: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
name="<?php echo $this->get_field_name('title'); ?>" type="text"
value="<?php echo esc_attr($title); ?>"/></label></p>
<?php
}
}
register_widget('geodir_loginwidget');
/**
* GeoDirectory Social Like Widget.
*
* @since 1.0.0
*/
class geodir_social_like_widget extends WP_Widget
{
/**
* Register the social like widget with WordPress.
*
* @since 1.0.0
* @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
*/
public function __construct() {
$widget_ops = array('classname' => 'geodir_social_like_widget', 'description' => __('GD > Twitter,Facebook and Google+ buttons', 'geodirectory'));
parent::__construct(
'social_like_widget', // Base ID
__('GD > Social Like', 'geodirectory'), // Name
$widget_ops// Args
);
}
/**
* Front-end display content for social like widget.
*
* @since 1.0.0
* @since 1.5.1 Declare function public.
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget($args, $instance)
{
// prints the widget
extract($args, EXTR_SKIP);
/**
* Filter the widget title text.
*
* @since 1.0.0
* @global object $current_user Current user object.
* @param string $title The widget title text.
*/
$title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
global $current_user, $post;
echo $before_widget;
?>
<?php //if ( get_option('gd_tweet_button') ) {
?>
<a href="http://twitter.com/share"
class="twitter-share-button"><?php _e('Tweet', 'geodirectory');?></a>
<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
<?php //}
?>
<?php // if ( get_option('gd_facebook_button') ) {
?>
<iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
echo 'allowtransparency="true"';
}?> class="facebook"
src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(geodir_curPageURL()); ?>&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light"
style="border:none; overflow:hidden; width:100px; height:20px"></iframe>
<?php //}
?>
<?php //if ( get_option('gd_google_button') ) {
?>
<script>
window.___gcfg = {
parsetags: 'explicit'
}
</script>
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<div id="plusone-div"></div>
<script type="text/javascript">gapi.plusone.render('plusone-div', {
"size": "medium",
"count": "true"
});</script>
<?php //}
echo $after_widget;
}
/**
* Sanitize social like widget form values as they are saved.
*
* @since 1.0.0
* @since 1.5.1 Declare function public.
*
* @param array $new_instance Values just sent to be saved.
* @param array $old_instance Previously saved values from database.
*
* @return array Updated safe values to be saved.
*/
public function update($new_instance, $old_instance)
{
//save the widget
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
return $instance;
}
/**
* Back-end social like widget settings form.
*
* @since 1.0.0
* @since 1.5.1 Declare function public.
*
* @param array $instance Previously saved values from database.
* @return string|void
*/
public function form($instance)
{
//widgetform in backend
$instance = wp_parse_args((array)$instance, array('title' => ''));
$title = strip_tags($instance['title']);
?>
<p>No settings for this widget</p>
<?php
}
}
register_widget('geodir_social_like_widget');
/**
* GeoDirectory Feedburner Subscribe widget.
*
* @since 1.0.0
*/
class geodirsubscribeWidget extends WP_Widget
{
/**
* Register the feedburner subscribe widget with WordPress.
*
* @since 1.0.0
* @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
*/
public function __construct() {
$widget_ops = array('classname' => 'geodir-subscribe', 'description' => __('GD > Google Feedburner Subscribe', 'geodirectory'));
parent::__construct(
'widget_subscribeWidget', // Base ID
__('GD > Subscribe', 'geodirectory'), // Name
$widget_ops// Args
);
}
/**
* Front-end display content for feedburner subscribe widget.
*
* @since 1.0.0
* @since 1.5.1 Declare function public.
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget($args, $instance)
{
// prints the widget
extract($args, EXTR_SKIP);
/**
* Filter the widget instance id.
*
* @since 1.0.0
* @param string $id The widget instance id.
*/
$id = empty($instance['id']) ? '' : apply_filters('widget_id', $instance['id']);
/** This filter is documented in geodirectory_widgets.php */
$title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
/**
* Filter the widget text.
*
* @since 1.0.0
* @param string $text The widget text.
*/
$text = empty($instance['text']) ? '' : apply_filters('widget_text', $instance['text']);
echo $before_widget;
?>
<?php echo $before_title . $title; ?> <a href="<?php if ($id) {
echo 'http://feeds2.feedburner.com/' . $id;
} else {
bloginfo('rss_url');
} ?>"><i class="fas fa-rss-square"></i> </a><?php echo $after_title;?>
<?php if ($text <> "") { ?>
<p><?php echo $text; ?> </p>
<?php } ?>
<form class="geodir-subscribe-form" action="http://feedburner.google.com/fb/a/mailverify" method="post"
target="popupwindow"
onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=<?php echo $id; ?>', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true">
<input type="text" class="field"
onfocus="if (this.value == '<?php _e('Your Email Address', 'geodirectory')?>') {this.value = '';}"
onblur="if (this.value == '') {this.value = '<?php _e('Your Email Address', 'geodirectory')?>';}"
name="email" value="<?php _e('Your Email Address', 'geodirectory')?>"/>
<input type="hidden" value="<?php echo $id; ?>" name="uri"/><input type="hidden" name="loc"
value="en_US"/>
<input class="btn_submit" type="submit" name="submit" value="Submit"/>
</form>
<?php
echo $after_widget;
}
/**
* Sanitize feedburner subscribe widget form values as they are saved.
*
* @since 1.0.0
* @since 1.5.1 Declare function public.
*
* @param array $new_instance Values just sent to be saved.
* @param array $old_instance Previously saved values from database.
*
* @return array Updated safe values to be saved.
*/
public function update($new_instance, $old_instance)
{
//save the widget
$instance = $old_instance;
$instance['id'] = strip_tags($new_instance['id']);
$instance['title'] = ($new_instance['title']);
$instance['text'] = ($new_instance['text']);
return $instance;
}
/**
* Back-end feedburner subscribe widget settings form.
*
* @since 1.0.0
* @since 1.5.1 Declare function public.
*
* @param array $instance Previously saved values from database.
* @return string|void
*/
public function form($instance)
{
//widgetform in backend
$instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => ''));
$id = strip_tags($instance['id']);
$title = strip_tags($instance['title']);
$text = strip_tags($instance['text']);
?>
<p><label
for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'geodirectory');?>:
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
name="<?php echo $this->get_field_name('title'); ?>" type="text"
value="<?php echo esc_attr($title); ?>"/></label></p>
<p><label
for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Feedburner ID (ex :- geotheme)', 'geodirectory');?>
: <input class="widefat" id="<?php echo $this->get_field_id('id'); ?>"
name="<?php echo $this->get_field_name('id'); ?>" type="text"
value="<?php echo esc_attr($id); ?>"/></label></p>
<p><label
for="<?php echo $this->get_field_id('text'); ?>"><?php _e('Short Description', 'geodirectory');?>
<textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('text'); ?>"
name="<?php echo $this->get_field_name('text'); ?>"><?php echo esc_attr($text); ?></textarea></label>
</p>
<?php
}
}
register_widget('geodirsubscribeWidget');
/**
* GeoDirectory advertise widget.
*
* @since 1.0.0
*/
class geodiradvtwidget extends WP_Widget
{
/**
* Register the advertise widget with WordPress.
*
* @since 1.0.0
* @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
*/
public function __construct() {
$widget_ops = array('classname' => 'GeoDirectory Advertise', 'description' => __('GD > common advertise widget in sidebar, bottom section', 'geodirectory'));
parent::__construct(
'advtwidget', // Base ID
__('GD > Advertise', 'geodirectory'), // Name
$widget_ops// Args
);
}
/**
* Front-end display content for advertise widget.
*
* @since 1.0.0
* @since 1.5.1 Declare function public.
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget($args, $instance)
{
// prints the widget
extract($args, EXTR_SKIP);
/**
* Filter the description text.
*
* @since 1.0.0
* @param string $desc1 The widget description text.
*/
$desc1 = empty($instance['desc1']) ? ' ' : apply_filters('widget_desc1', $instance['desc1']);
echo $before_widget;
?>
<?php if ($desc1 <> "") { ?>
<?php echo $desc1; ?>
<?php }
echo $after_widget;
}
/**
* Sanitize advertise widget form values as they are saved.
*
* @since 1.0.0
* @since 1.5.1 Declare function public.
*
* @param array $new_instance Values just sent to be saved.
* @param array $old_instance Previously saved values from database.
*
* @return array Updated safe values to be saved.
*/
public function update($new_instance, $old_instance)
{
//save the widget
$instance = $old_instance;
$instance['desc1'] = ($new_instance['desc1']);
return $instance;
}
/**
* Back-end advertise widget settings form.
*
* @since 1.0.0
* @since 1.5.1 Declare function public.
*
* @param array $instance Previously saved values from database.
* @return string|void
*/
public function form($instance)
{
//widgetform in backend
$instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
$desc1 = ($instance['desc1']);
?>
<p><label
for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your Advt code (ex.google adsense, etc.)', 'geodirectory');?>
<textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('desc1'); ?>"
name="<?php echo $this->get_field_name('desc1'); ?>"><?php echo esc_attr($desc1); ?></textarea></label>
</p>
<?php
}
}
register_widget('geodiradvtwidget');
/**
* GeoDirectory Flickr widget.
*
* @since 1.0.0
*/
class GeodirFlickrWidget extends WP_Widget
{
/**
* Register the flickr widget with WordPress.
*
* @since 1.0.0
* @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
*/
public function __construct() {
$widget_ops = array('classname' => 'Geo Dir Flickr Photos ', 'description' => __('GD > Flickr Photos', 'geodirectory'));
parent::__construct(
'widget_flickrwidget', // Base ID
__('GD > Flickr Photos', 'geodirectory'), // Name
$widget_ops// Args
);
}
/**
* Front-end display content for flickr widget.
*
* @since 1.0.0
* @since 1.5.1 Declare function public.
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget($args, $instance)
{
// prints the widget
extract($args, EXTR_SKIP);
echo $before_widget;
/** This filter is documented in geodirectory_widgets.php */
$id = empty($instance['id']) ? ' ' : apply_filters('widget_id', $instance['id']);
/**
* Filter the widget number.
*
* This is used in the flicker widget to show how many images to show.
*
* @since 1.0.0
* @param string $number The image count.
*/
$number = empty($instance['number']) ? ' ' : apply_filters('widget_number', $instance['number']);
echo $before_title . __('Photo Gallery', 'geodirectory') . $after_title;
?>
<div class="geodir-flickr clearfix">
<script type="text/javascript"
src="https://www.flickr.com/badge_code_v2.gne?count=<?php echo $number; ?>&display=latest&size=s&layout=x&source=user&user=<?php echo $id; ?>"></script>
</div>
<?php echo $after_widget;
}
/**
* Sanitize flickr widget form values as they are saved.
*
* @since 1.0.0
* @since 1.5.1 Declare function public.
*
* @param array $new_instance Values just sent to be saved.
* @param array $old_instance Previously saved values from database.
*
* @return array Updated safe values to be saved.
*/
public function update($new_instance, $old_instance)
{
//save the widget
$instance = $old_instance;
$instance['id'] = strip_tags($new_instance['id']);
$instance['number'] = strip_tags($new_instance['number']);
return $instance;
}
/**
* Back-end flickr widget settings form.
*
* @since 1.0.0
* @since 1.5.1 Declare function public.
*
* @param array $instance Previously saved values from database.
* @return string|void
*/
public function form($instance)
{
//widgetform in backend
$instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'number' => ''));
$id = strip_tags($instance['id']);
$number = strip_tags($instance['number']);
?>
<p>
<label
for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Flickr ID', 'geodirectory');?>
(<a href="http://www.idgettr.com">idGettr</a>):
<input class="widefat" id="<?php echo $this->get_field_id('id'); ?>"
name="<?php echo $this->get_field_name('id'); ?>" type="text"
value="<?php echo esc_attr($id); ?>"/>
</label>
</p>
<p>
<label
for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of photos:', 'geodirectory');?>
<input class="widefat" id="<?php echo $this->get_field_id('number'); ?>"
name="<?php echo $this->get_field_name('number'); ?>" type="text"
value="<?php echo esc_attr($number); ?>"/>
</label>
</p>
<?php
}
}
register_widget('GeodirFlickrWidget');
/**
* GeoDirectory Twitter widget.
*
* @since 1.0.0
*/
class geodir_twitter extends WP_Widget
{
/**
* Register the Twitter widget with WordPress.
*
* @since 1.0.0
* @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
*/
public function __construct() {
$widget_ops = array('classname' => 'Twitter', 'description' => __('GD > Twitter Feed', 'geodirectory'));
parent::__construct(
'widget_Twidget', // Base ID
__('GD > Twitter', 'geodirectory'), // Name
$widget_ops// Args
);
}
/**
* Front-end display content for Twitter widget.
*
* @since 1.0.0
* @since 1.5.1 Declare function public.
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget($args, $instance)
{
// prints the widget
extract($args, EXTR_SKIP);
/**
* Filter the twitter widget description text.
*
* @since 1.0.0
* @param string $desc1 The widget description text.
*/
$desc1 = empty($instance['gd_tw_desc1']) ? ' ' : apply_filters('gd_tw_widget_desc1', $instance['gd_tw_desc1']);
echo $before_widget;
if ($desc1 <> "") {
echo $desc1;
}
echo $after_widget;
}
/**
* Sanitize twitter widget form values as they are saved.
*
* @since 1.0.0
* @since 1.5.1 Declare function public.
*
* @param array $new_instance Values just sent to be saved.
* @param array $old_instance Previously saved values from database.
*
* @return array Updated safe values to be saved.
*/
public function update($new_instance, $old_instance)
{
//save the widget
$instance = $old_instance;
$instance['gd_tw_desc1'] = ($new_instance['gd_tw_desc1']);
return $instance;
}
/**
* Back-end twitter widget settings form.
*
* @since 1.0.0
* @since 1.5.1 Declare function public.
*
* @param array $instance Previously saved values from database.
* @return string|void
*/
public function form($instance)
{
//widgetform in backend
$instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => ''));
$desc1 = ($instance['gd_tw_desc1']);
?>
<p><label
for="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"><?php _e('Your twitter code', 'geodirectory');?>
<textarea class="widefat" rows="6" cols="20"
id="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"
name="<?php echo $this->get_field_name('gd_tw_desc1'); ?>"><?php echo esc_attr($desc1); ?></textarea></label>
</p>
<?php
}
}
register_widget('geodir_twitter');
/**
* GeoDirectory Advanced Search widget.
*
* @since 1.0.0
*/
class geodir_advance_search_widget extends WP_Widget
{
/**
* Register the advanced search widget with WordPress.
*
* @since 1.0.0
* @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
*/
public function __construct() {
$widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'),'post_type'=>'');
parent::__construct(
'geodir_advance_search', // Base ID
__('GD > Search', 'geodirectory'), // Name
$widget_ops// Args
);
}
/**
* Front-end display content for advanced search widget.
*
* @since 1.0.0
* @since 1.5.1 Declare function public.
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget($args, $instance)
{
/**
* Filter the search widget arguments.
*
* @since 1.5.7
* @param array $args The widget arguments.
* @param array $instance The widget instance.
*/
$args = apply_filters('widget_geodir_advance_search_args',$args,$instance);
// prints the widget
extract($args, EXTR_SKIP);
if(isset($post_type) && $post_type){
geodir_get_search_post_type($post_type);// set the post type
}else{