| @@ 626-719 (lines=94) @@ | ||
| 623 | * |
|
| 624 | * @since 1.0.0 |
|
| 625 | */ |
|
| 626 | class geodiradvtwidget extends WP_Widget |
|
| 627 | {
|
|
| 628 | ||
| 629 | /** |
|
| 630 | * Register the advertise widget with WordPress. |
|
| 631 | * |
|
| 632 | * @since 1.0.0 |
|
| 633 | * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 634 | */ |
|
| 635 | public function __construct() {
|
|
| 636 | $widget_ops = array('classname' => 'GeoDirectory Advertise', 'description' => __('GD > common advertise widget in sidebar, bottom section', 'geodirectory'));
|
|
| 637 | parent::__construct( |
|
| 638 | 'advtwidget', // Base ID |
|
| 639 | __('GD > Advertise', 'geodirectory'), // Name
|
|
| 640 | $widget_ops// Args |
|
| 641 | ); |
|
| 642 | } |
|
| 643 | ||
| 644 | ||
| 645 | /** |
|
| 646 | * Front-end display content for advertise widget. |
|
| 647 | * |
|
| 648 | * @since 1.0.0 |
|
| 649 | * @since 1.5.1 Declare function public. |
|
| 650 | * |
|
| 651 | * @param array $args Widget arguments. |
|
| 652 | * @param array $instance Saved values from database. |
|
| 653 | */ |
|
| 654 | public function widget($args, $instance) |
|
| 655 | {
|
|
| 656 | ||
| 657 | // prints the widget |
|
| 658 | ||
| 659 | extract($args, EXTR_SKIP); |
|
| 660 | ||
| 661 | /** |
|
| 662 | * Filter the description text. |
|
| 663 | * |
|
| 664 | * @since 1.0.0 |
|
| 665 | * @param string $desc1 The widget description text. |
|
| 666 | */ |
|
| 667 | $desc1 = empty($instance['desc1']) ? ' ' : apply_filters('widget_desc1', $instance['desc1']);
|
|
| 668 | echo $before_widget; |
|
| 669 | ?> |
|
| 670 | <?php if ($desc1 <> "") { ?>
|
|
| 671 | <?php echo $desc1; ?> |
|
| 672 | <?php } |
|
| 673 | echo $after_widget; |
|
| 674 | } |
|
| 675 | ||
| 676 | /** |
|
| 677 | * Sanitize advertise widget form values as they are saved. |
|
| 678 | * |
|
| 679 | * @since 1.0.0 |
|
| 680 | * @since 1.5.1 Declare function public. |
|
| 681 | * |
|
| 682 | * @param array $new_instance Values just sent to be saved. |
|
| 683 | * @param array $old_instance Previously saved values from database. |
|
| 684 | * |
|
| 685 | * @return array Updated safe values to be saved. |
|
| 686 | */ |
|
| 687 | public function update($new_instance, $old_instance) |
|
| 688 | {
|
|
| 689 | //save the widget |
|
| 690 | $instance = $old_instance; |
|
| 691 | $instance['desc1'] = ($new_instance['desc1']); |
|
| 692 | return $instance; |
|
| 693 | } |
|
| 694 | ||
| 695 | /** |
|
| 696 | * Back-end advertise widget settings form. |
|
| 697 | * |
|
| 698 | * @since 1.0.0 |
|
| 699 | * @since 1.5.1 Declare function public. |
|
| 700 | * |
|
| 701 | * @param array $instance Previously saved values from database. |
|
| 702 | * @return string|void |
|
| 703 | */ |
|
| 704 | public function form($instance) |
|
| 705 | {
|
|
| 706 | //widgetform in backend |
|
| 707 | $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
|
|
| 708 | ||
| 709 | $desc1 = ($instance['desc1']); |
|
| 710 | ?> |
|
| 711 | <p><label |
|
| 712 | for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your Advt code (ex.google adsense, etc.)', 'geodirectory');?>
|
|
| 713 | <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('desc1'); ?>"
|
|
| 714 | name="<?php echo $this->get_field_name('desc1'); ?>"><?php echo esc_attr($desc1); ?></textarea></label>
|
|
| 715 | </p> |
|
| 716 | ||
| 717 | <?php |
|
| 718 | } |
|
| 719 | } |
|
| 720 | ||
| 721 | register_widget('geodiradvtwidget');
|
|
| 722 | ||
| @@ 856-948 (lines=93) @@ | ||
| 853 | * |
|
| 854 | * @since 1.0.0 |
|
| 855 | */ |
|
| 856 | class geodir_twitter extends WP_Widget |
|
| 857 | {
|
|
| 858 | /** |
|
| 859 | * Register the Twitter widget with WordPress. |
|
| 860 | * |
|
| 861 | * @since 1.0.0 |
|
| 862 | * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 863 | */ |
|
| 864 | public function __construct() {
|
|
| 865 | $widget_ops = array('classname' => 'Twitter', 'description' => __('GD > Twitter Feed', 'geodirectory'));
|
|
| 866 | parent::__construct( |
|
| 867 | 'widget_Twidget', // Base ID |
|
| 868 | __('GD > Twitter', 'geodirectory'), // Name
|
|
| 869 | $widget_ops// Args |
|
| 870 | ); |
|
| 871 | } |
|
| 872 | ||
| 873 | ||
| 874 | /** |
|
| 875 | * Front-end display content for Twitter widget. |
|
| 876 | * |
|
| 877 | * @since 1.0.0 |
|
| 878 | * @since 1.5.1 Declare function public. |
|
| 879 | * |
|
| 880 | * @param array $args Widget arguments. |
|
| 881 | * @param array $instance Saved values from database. |
|
| 882 | */ |
|
| 883 | public function widget($args, $instance) |
|
| 884 | {
|
|
| 885 | ||
| 886 | // prints the widget |
|
| 887 | ||
| 888 | extract($args, EXTR_SKIP); |
|
| 889 | ||
| 890 | /** |
|
| 891 | * Filter the twitter widget description text. |
|
| 892 | * |
|
| 893 | * @since 1.0.0 |
|
| 894 | * @param string $desc1 The widget description text. |
|
| 895 | */ |
|
| 896 | $desc1 = empty($instance['gd_tw_desc1']) ? ' ' : apply_filters('gd_tw_widget_desc1', $instance['gd_tw_desc1']);
|
|
| 897 | echo $before_widget; |
|
| 898 | if ($desc1 <> "") {
|
|
| 899 | echo $desc1; |
|
| 900 | } |
|
| 901 | echo $after_widget; |
|
| 902 | } |
|
| 903 | ||
| 904 | /** |
|
| 905 | * Sanitize twitter widget form values as they are saved. |
|
| 906 | * |
|
| 907 | * @since 1.0.0 |
|
| 908 | * @since 1.5.1 Declare function public. |
|
| 909 | * |
|
| 910 | * @param array $new_instance Values just sent to be saved. |
|
| 911 | * @param array $old_instance Previously saved values from database. |
|
| 912 | * |
|
| 913 | * @return array Updated safe values to be saved. |
|
| 914 | */ |
|
| 915 | public function update($new_instance, $old_instance) |
|
| 916 | {
|
|
| 917 | //save the widget |
|
| 918 | $instance = $old_instance; |
|
| 919 | $instance['gd_tw_desc1'] = ($new_instance['gd_tw_desc1']); |
|
| 920 | return $instance; |
|
| 921 | } |
|
| 922 | ||
| 923 | /** |
|
| 924 | * Back-end twitter widget settings form. |
|
| 925 | * |
|
| 926 | * @since 1.0.0 |
|
| 927 | * @since 1.5.1 Declare function public. |
|
| 928 | * |
|
| 929 | * @param array $instance Previously saved values from database. |
|
| 930 | * @return string|void |
|
| 931 | */ |
|
| 932 | public function form($instance) |
|
| 933 | {
|
|
| 934 | //widgetform in backend |
|
| 935 | $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => ''));
|
|
| 936 | ||
| 937 | $desc1 = ($instance['gd_tw_desc1']); |
|
| 938 | ?> |
|
| 939 | <p><label |
|
| 940 | for="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"><?php _e('Your twitter code', 'geodirectory');?>
|
|
| 941 | <textarea class="widefat" rows="6" cols="20" |
|
| 942 | id="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"
|
|
| 943 | name="<?php echo $this->get_field_name('gd_tw_desc1'); ?>"><?php echo esc_attr($desc1); ?></textarea></label>
|
|
| 944 | </p> |
|
| 945 | ||
| 946 | <?php |
|
| 947 | } |
|
| 948 | } |
|
| 949 | ||
| 950 | register_widget('geodir_twitter');
|
|
| 951 | ||