Plugin Directory

Changeset 795804


Ignore:
Timestamp:
10/30/2013 09:56:22 AM (12 years ago)
Author:
deshack
Message:

Version 0.3

Location:
pinit
Files:
6 edited
6 copied

Legend:

Unmodified
Added
Removed
  • pinit/tags/0.3/languages/it_IT.po

    r795787 r795804  
    22msgstr ""
    33"Project-Id-Version: Pinit\n"
    4 "POT-Creation-Date: 2013-10-28 14:52+0100\n"
    5 "PO-Revision-Date: 2013-10-28 14:56+0100\n"
     4"POT-Creation-Date: 2013-10-28 15:48+0100\n"
     5"PO-Revision-Date: 2013-10-28 15:49+0100\n"
    66"Last-Translator: Mattia Migliorini <[email protected]>\n"
    77"Language-Team: Mattia Migliorini <[email protected]>\n"
     
    1616#: ../pinit.php:34
    1717msgid "Pinterest Profile Widget"
    18 msgstr "Pinterest Widget Profilo"
     18msgstr "Widget Profilo Pinterest"
    1919
    2020#: ../pinit.php:35
    21 msgid ""
    22 "Pinterest Profile Widget: show up to 30 of your latest pins on your site."
    23 msgstr ""
    24 "Pinterest Widget Profilo: mostra fino a 30 dei tuoi pin recenti nel tuo sito."
     21msgid "Show up to 30 of your latest pins on your site."
     22msgstr "Mostra fino a 30 dei tuoi pin recenti nel tuo sito."
    2523
    26 #: ../pinit.php:86
     24#: ../pinit.php:86 ../pinit.php:203
    2725msgid "Title:"
    2826msgstr "Titolo:"
    2927
    30 #: ../pinit.php:91
     28#: ../pinit.php:91 ../pinit.php:208
    3129msgid "Pinterest User URL:"
    3230msgstr "URL Profilo Pinterest:"
    3331
    34 #: ../pinit.php:98
     32#: ../pinit.php:98 ../pinit.php:215
    3533msgid "Image Width:"
    3634msgstr "Larghezza immagine:"
    3735
    38 #: ../pinit.php:101
    39 msgid "min: 60; leave 0 for 92"
    40 msgstr "min: 60; lasciare 0 per 92"
     36#: ../pinit.php:101 ../pinit.php:218
     37msgid "min: 60; leave 0 or blank for 92"
     38msgstr "min: 60; lasciare 0 o vuoto per 92"
    4139
    42 #: ../pinit.php:105
     40#: ../pinit.php:105 ../pinit.php:222
    4341msgid "Board Height:"
    44 msgstr "Altezza widget:"
     42msgstr "Altezza bacheca:"
    4543
    46 #: ../pinit.php:108
    47 msgid "min: 60; leave 0 for 175"
    48 msgstr "min: 60; lasciare 0 per 175"
     44#: ../pinit.php:108 ../pinit.php:225
     45msgid "min: 60; leave 0 or blank for 175"
     46msgstr "min: 60; lasciare 0 o vuoto per 175"
    4947
    50 #: ../pinit.php:112
     48#: ../pinit.php:112 ../pinit.php:229
    5149msgid "Board Width:"
    52 msgstr "Larghezza widget:"
     50msgstr "Larghezza bacheca:"
    5351
    54 #: ../pinit.php:115
    55 msgid "min: 130; leave 0 for auto"
    56 msgstr "min: 130; lasciare 0 per auto"
     52#: ../pinit.php:115 ../pinit.php:232
     53msgid "min: 130; leave 0 or blank for auto"
     54msgstr "min: 130; lasciare 0 o vuoto per auto"
     55
     56#: ../pinit.php:151
     57msgid "Pinterest Board Widget"
     58msgstr "Widget Bacheca Pinterest"
     59
     60#: ../pinit.php:152
     61msgid "Show up to 30 of your favorite board's latest pins."
     62msgstr "Mostra fino a 30 dei pin recenti dalla tua bacheca preferita."
  • pinit/tags/0.3/pinit.php

    r795787 r795804  
    55 * Description: Handy plugin that adds Pinterest Follow Button, Pin Widget, Profile Widget and Board Widget to your WordPress site.
    66 * Author: Mattia Migliorini
    7  * Version: 0.1
     7 * Version: 0.3
    88 * Author URI: http://www.deshack.net
    99 * License: GPLv2 or later
     
    3333            'pit_widget_profile', // Base ID
    3434            __( 'Pinterest Profile Widget', 'pit' ), // Name
    35             array( 'description' => __( 'Pinterest Profile Widget: show up to 30 of your latest pins on your site.', 'pit' ) ) // Args
     35            array( 'description' => __( 'Show up to 30 of your latest pins on your site.', 'pit' ) ) // Args
    3636        );
    3737    }
     
    4747    public function widget( $args, $instance ) {
    4848        $title = apply_filters( 'widget_title', $instance['title'] );
    49         $url = $instance['url'];
     49        $user = $instance['user'];
    5050        $image_width = $instance['image_width'];
    5151        $width = $instance['width'];
     
    6767            $data_width = ' data-pin-board-width="' . $width . '"';
    6868
    69         if ( ! empty( $url ) )
    70             echo '<a data-pin-do="embedUser" href="' . $url . '"' . $data_image_width . $data_height . $data_width . '></a>';
     69        if ( ! empty( $user ) )
     70            echo '<a data-pin-do="embedUser" href="http://www.pinterest.com/' . $user . '/"' . $data_image_width . $data_height . $data_width . '></a>';
    7171
    7272        echo $args['after_widget'];
     
    8989
    9090        <p>
    91             <label for="<?php echo $this->get_field_id('url'); ?>"><?php _e( 'Pinterest User URL:', 'pit' ); ?></label>
    92             <input class="widefat" id="<?php echo $this->get_field_id('url'); ?>" name="<?php echo $this->get_field_name('url'); ?>" type="text" value="<?php echo esc_attr( $instance['url'] ); ?>">
    93             <br>
    94             <small>http://www.pinterest.com/username/</small>
     91            <label for="<?php echo $this->get_field_id('user'); ?>"><?php _e( 'Pinterest Username:', 'pit' ); ?></label>
     92            <input class="widefat" id="<?php echo $this->get_field_id('user'); ?>" name="<?php echo $this->get_field_name('user'); ?>" type="text" value="<?php echo esc_attr( $instance['user'] ); ?>">
     93            <br>
     94            <small>http://www.pinterest.com/<strong>username</strong>/</small>
    9595        </p>
    9696
    9797        <p>
    9898            <label for="<?php echo $this->get_field_id('image_width'); ?>"><?php _e( 'Image Width:', 'pit' ); ?></label>
    99             <input class="widefat" id="<?php echo $this->get_field_id('image_width'); ?>" name="<?php echo $this->get_field_name('image_width'); ?>" type="text" value="<?php echo esc_attr( $instance['image_width'] ); ?>">
    100             <br>
    101             <small><?php _e( 'min: 60; leave 0 for 92', 'pit' ); ?></small>
     99            <input class="widefat pit-image-width" id="<?php echo $this->get_field_id('image_width'); ?>" name="<?php echo $this->get_field_name('image_width'); ?>" type="text" value="<?php echo esc_attr( $instance['image_width'] ); ?>">
     100            <br>
     101            <small><?php _e( 'min: 60; leave 0 or blank for 92', 'pit' ); ?></small>
    102102        </p>
    103103
    104104        <p>
    105105            <label for="<?php echo $this->get_field_id('height'); ?>"><?php _e( 'Board Height:', 'pit' ); ?></label>
    106             <input class="widefat" id="<?php echo $this->get_field_id('height'); ?>" name="<?php echo $this->get_field_name('height'); ?>" type="text" value="<?php echo esc_attr( $instance['height'] ); ?>">
    107             <br>
    108             <small><?php _e( 'min: 60; leave 0 for 175', 'pit' ); ?></small>
     106            <input class="widefat pit-height" id="<?php echo $this->get_field_id('height'); ?>" name="<?php echo $this->get_field_name('height'); ?>" type="text" value="<?php echo esc_attr( $instance['height'] ); ?>">
     107            <br>
     108            <small><?php _e( 'min: 60; leave 0 or blank for 175', 'pit' ); ?></small>
    109109        </p>
    110110
    111111        <p>
    112112            <label for="<?php echo $this->get_field_id('width'); ?>"><?php _e( 'Board Width:', 'pit' ); ?></label>
    113             <input class="widefat" id="<?php echo $this->get_field_id('width'); ?>" name="<?php echo $this->get_field_name('width'); ?>" type="text" value="<?php echo esc_attr( $instance['width'] ); ?>">
    114             <br>
    115             <small><?php _e( 'min: 130; leave 0 for auto', 'pit' ); ?></small>
     113            <input class="widefat pit-width" id="<?php echo $this->get_field_id('width'); ?>" name="<?php echo $this->get_field_name('width'); ?>" type="text" value="<?php echo esc_attr( $instance['width'] ); ?>">
     114            <br>
     115            <small><?php _e( 'min: 130; leave 0 or blank for auto', 'pit' ); ?></small>
    116116        </p>
    117117
     
    130130        $instance = $old_instance;
    131131        $instance['title'] = $new_instance['title'];
    132         $instance['url'] = esc_url_raw( $new_instance['url'], array('http', 'https') );
     132        $instance['user'] = $new_instance['user'];
    133133        $instance['image_width'] = intval($new_instance['image_width']);
    134134        $instance['height'] = intval($new_instance['height']);
     
    139139}
    140140
     141/**
     142 * Pinterest Board Widget Class
     143 *
     144 * @since 0.2
     145 */
     146class pit_widget_board extends WP_Widget {
     147    // Constructor
     148    function __construct() {
     149        parent::__construct(
     150            'pit_widget_board', // Base ID
     151            __( 'Pinterest Board Widget', 'pit' ), // Name
     152            array( 'description' => __( 'Show up to 30 of your favorite board\'s latest pins.', 'pit' ) ) // Args
     153        );
     154    }
     155
     156    /**
     157     * Front-end display of widget.
     158     *
     159     * @see WP_Widget::widget()
     160     *
     161     * @param array $args. Widget arguments.
     162     * @param array $instance. Saved values from database.
     163     */
     164    public function widget( $args, $instance ) {
     165        $title = apply_filters( 'widget_title', $instance['title'] );
     166        $user = $instance['user'];
     167        $board = $instance['board'];
     168        $image_width = $instance['image_width'];
     169        $width = $instance['width'];
     170        $height = $instance['height'];
     171
     172        echo $args['before_widget'];
     173        if ( ! empty( $title ) )
     174            echo $args['before_title'] . $title . $args['after_title'];
     175
     176        $data_image_width = '';
     177        $data_width = '';
     178        $data_height = '';
     179
     180        if ( ! empty( $image_width ) )
     181            $data_image_width = ' data-pin-scale-width="' . $image_width . '"';
     182        if ( ! empty( $height ) )
     183            $data_height = ' data-pin-scale-height="' . $height . '"';
     184        if ( ! empty( $width ) )
     185            $data_width = ' data-pin-board-width="' . $width . '"';
     186
     187        if ( ! empty( $user ) && ! empty( $board ) )
     188            echo '<a data-pin-do="embedBoard" href="http://www.pinterest.com/' . $user . '/' . $board . '/"' . $data_image_width . $data_height . $data_width . '></a>';
     189
     190        echo $args['after_widget'];
     191    }
     192
     193    /**
     194     * Back-end widget form.
     195     *
     196     * @see WP_Widget::form()
     197     *
     198     * @param array $instance. Previously saved values from database.
     199     */
     200    public function form( $instance ) {
     201        ?>
     202
     203        <p>
     204            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'pit' ); ?></label>
     205            <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( $instance['title'] ); ?>">
     206        </p>
     207
     208        <p>
     209            <label for="<?php echo $this->get_field_id('user'); ?>"><?php _e( 'Pinterest Username:', 'pit' ); ?></label>
     210            <input class="widefat" id="<?php echo $this->get_field_id('user'); ?>" name="<?php echo $this->get_field_name('user'); ?>" type="text" value="<?php echo esc_attr( $instance['user'] ); ?>">
     211            <br>
     212            <small>http://www.pinterest.com/<strong>username</strong>/boardname/</small>
     213        </p>
     214
     215        <p>
     216            <label for="<?php echo $this->get_field_id('board'); ?>"><?php _e( 'Board:', 'pit' ); ?></label>
     217            <input class="widefat" id="<?php echo $this->get_field_id('board'); ?>" name="<?php echo $this->get_field_name('board'); ?>" type="text" value="<?php echo esc_attr( $instance['board'] ); ?>">
     218            <br>
     219            <small>http://www.pinterest.com/username/<strong>boardname</strong>/</small>
     220        </p>
     221
     222        <p>
     223            <label for="<?php echo $this->get_field_id('image_width'); ?>"><?php _e( 'Image Width:', 'pit' ); ?></label>
     224            <input class="widefat pit-image-width" id="<?php echo $this->get_field_id('image_width'); ?>" name="<?php echo $this->get_field_name('image_width'); ?>" type="text" value="<?php echo esc_attr( $instance['image_width'] ); ?>">
     225            <br>
     226            <small><?php _e( 'min: 60; leave 0 or blank for 92', 'pit' ); ?></small>
     227        </p>
     228
     229        <p>
     230            <label for="<?php echo $this->get_field_id('height'); ?>"><?php _e( 'Board Height:', 'pit' ); ?></label>
     231            <input class="widefat pit-height" id="<?php echo $this->get_field_id('height'); ?>" name="<?php echo $this->get_field_name('height'); ?>" type="text" value="<?php echo esc_attr( $instance['height'] ); ?>">
     232            <br>
     233            <small><?php _e( 'min: 60; leave 0 or blank for 175', 'pit' ); ?></small>
     234        </p>
     235
     236        <p>
     237            <label for="<?php echo $this->get_field_id('width'); ?>"><?php _e( 'Board Width:', 'pit' ); ?></label>
     238            <input class="widefat pit-width" id="<?php echo $this->get_field_id('width'); ?>" name="<?php echo $this->get_field_name('width'); ?>" type="text" value="<?php echo esc_attr( $instance['width'] ); ?>">
     239            <br>
     240            <small><?php _e( 'min: 130; leave 0 or blank for auto', 'pit' ); ?></small>
     241        </p>
     242
     243        <?php
     244    }
     245
     246    /**
     247     * Sanitize widget form values as they are saved.
     248     *
     249     * @see WP_Widget::update()
     250     *
     251     * @param array $new_instance. Values just sent to be saved.
     252     * @param array $old_instance. Previously saved values from database.
     253     */
     254    public function update( $new_instance, $old_instance ) {
     255        $instance = $old_instance;
     256        $instance['title'] = $new_instance['title'];
     257        $instance['user'] = $new_instance['user'];
     258        $instance['board'] = $new_instance['board'];
     259        $instance['image_width'] = intval($new_instance['image_width']);
     260        $instance['height'] = intval($new_instance['height']);
     261        $instance['width'] = intval($new_instance['width']);
     262
     263        return $instance;
     264    }
     265}
     266
     267/**
     268 * Pinterest Pin Widget Class
     269 *
     270 * @since 0.3
     271 */
     272class pit_widget_pin extends WP_Widget {
     273    // Constructor
     274    function __construct() {
     275        parent::__construct(
     276            'pit_widget_pin', // Base ID
     277            __( 'Pinterest Pin Widget', 'pit' ), // Name
     278            array( 'description' => __( 'Embed one of your pins on your site.', 'pit' ) ) // Args
     279        );
     280    }
     281
     282    /**
     283     * Front-end display of widget
     284     *
     285     * @see WP_Widget::widget()
     286     *
     287     * @param array $args. Widget arguments.
     288     * @param rray $instance. Saved values from database.
     289     */
     290    public function widget( $args, $instance ) {
     291        $title = apply_filters( 'widget_title', $instance['title'] );
     292        $id = $instance['id'];
     293
     294        echo $args['before_widget'];
     295        if ( ! empty( $title ) )
     296            echo $args['before_title'] . $title . $args['after_title'];
     297
     298        if ( ! empty( $id ) )
     299            echo '<a data-pin-do="embedPin" href="http://www.pinterest.com/pin/' . $id . '/"></a>';
     300
     301        echo $args['after_widget'];
     302    }
     303
     304    /**
     305     * Back-end widget form.
     306     *
     307     * @see WP_Widget::form()
     308     *
     309     * @param array $instance. Previously saved values from database.
     310     */
     311    public function form( $instance ) {
     312        ?>
     313
     314        <p>
     315            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'pit' ); ?></label>
     316            <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( $instance['title'] ); ?>">
     317        </p>
     318
     319        <p>
     320            <label for="<?php echo $this->get_field_id('id'); ?>"><?php _e( 'Pin ID:', 'pit' ); ?></label>
     321            <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( $instance['id'] ); ?>">
     322            <br>
     323            <small>http://www.pinterest.com/pin/<strong>pin_id</strong>/</small>
     324        </p>
     325
     326        <?php
     327    }
     328
     329    /**
     330     * Sanitize widget form values as they are saved.
     331     *
     332     * @see WP_Widget::update()
     333     *
     334     * @param array $new_instance. Values just sent to be saved.
     335     * @param array $old_instance. Previously saved values from database.
     336     */
     337    public function update( $new_instance, $old_instance ) {
     338        $instance = $old_instance;
     339        $instance['title'] = $new_instance['title'];
     340        $instance['id'] = $new_instance['id'];
     341
     342        return $instance;
     343    }
     344}
     345
     346/**
     347 * Register widgets
     348 */
    141349function pit_register_widget() {
    142350    register_widget('pit_widget_profile');
     351    register_widget('pit_widget_board');
     352    register_widget('pit_widget_pin');
    143353}
    144354add_action( 'widgets_init', 'pit_register_widget' );
  • pinit/tags/0.3/readme.txt

    r795787 r795804  
    44Tags: widget, pinterest
    55Requires at least: 2.8
    6 Tested up to: 3.7
    7 Stable tag: 0.1
     6Tested up to: 3.7.1
     7Stable tag: 0.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.txt
    1010
    11 Handy plugin that adds Pinterest Profile Widget.
     11Handy plugin that adds Pinterest Pin Widget, Profile Widget and Board Widget to your WordPress site.
    1212
    1313== Description ==
     
    1616
    1717Features include:
    18 * Profile Widget
    1918
    20 Will support other resources soon.
     19 * Pin Widget
     20 * Profile Widget
     21 * Board Widget
     22
     23Languages:
     24
     25 * English
     26 * Italian
    2127
    2228== Installation ==
     
    3844== Changelog ==
    3945
     46= 0.3 =
     47* Feature: Pin Widget
     48
     49= 0.2 =
     50* Feature: Board Widget
     51
    4052= 0.1 =
    4153* Feature: Profile Widget
    4254
    4355== Upgrade Notice ==
     56
     57New features: Board and Pin Widgets.
  • pinit/trunk/languages/it_IT.po

    r795787 r795804  
    22msgstr ""
    33"Project-Id-Version: Pinit\n"
    4 "POT-Creation-Date: 2013-10-28 14:52+0100\n"
    5 "PO-Revision-Date: 2013-10-28 14:56+0100\n"
     4"POT-Creation-Date: 2013-10-28 15:48+0100\n"
     5"PO-Revision-Date: 2013-10-28 15:49+0100\n"
    66"Last-Translator: Mattia Migliorini <[email protected]>\n"
    77"Language-Team: Mattia Migliorini <[email protected]>\n"
     
    1616#: ../pinit.php:34
    1717msgid "Pinterest Profile Widget"
    18 msgstr "Pinterest Widget Profilo"
     18msgstr "Widget Profilo Pinterest"
    1919
    2020#: ../pinit.php:35
    21 msgid ""
    22 "Pinterest Profile Widget: show up to 30 of your latest pins on your site."
    23 msgstr ""
    24 "Pinterest Widget Profilo: mostra fino a 30 dei tuoi pin recenti nel tuo sito."
     21msgid "Show up to 30 of your latest pins on your site."
     22msgstr "Mostra fino a 30 dei tuoi pin recenti nel tuo sito."
    2523
    26 #: ../pinit.php:86
     24#: ../pinit.php:86 ../pinit.php:203
    2725msgid "Title:"
    2826msgstr "Titolo:"
    2927
    30 #: ../pinit.php:91
     28#: ../pinit.php:91 ../pinit.php:208
    3129msgid "Pinterest User URL:"
    3230msgstr "URL Profilo Pinterest:"
    3331
    34 #: ../pinit.php:98
     32#: ../pinit.php:98 ../pinit.php:215
    3533msgid "Image Width:"
    3634msgstr "Larghezza immagine:"
    3735
    38 #: ../pinit.php:101
    39 msgid "min: 60; leave 0 for 92"
    40 msgstr "min: 60; lasciare 0 per 92"
     36#: ../pinit.php:101 ../pinit.php:218
     37msgid "min: 60; leave 0 or blank for 92"
     38msgstr "min: 60; lasciare 0 o vuoto per 92"
    4139
    42 #: ../pinit.php:105
     40#: ../pinit.php:105 ../pinit.php:222
    4341msgid "Board Height:"
    44 msgstr "Altezza widget:"
     42msgstr "Altezza bacheca:"
    4543
    46 #: ../pinit.php:108
    47 msgid "min: 60; leave 0 for 175"
    48 msgstr "min: 60; lasciare 0 per 175"
     44#: ../pinit.php:108 ../pinit.php:225
     45msgid "min: 60; leave 0 or blank for 175"
     46msgstr "min: 60; lasciare 0 o vuoto per 175"
    4947
    50 #: ../pinit.php:112
     48#: ../pinit.php:112 ../pinit.php:229
    5149msgid "Board Width:"
    52 msgstr "Larghezza widget:"
     50msgstr "Larghezza bacheca:"
    5351
    54 #: ../pinit.php:115
    55 msgid "min: 130; leave 0 for auto"
    56 msgstr "min: 130; lasciare 0 per auto"
     52#: ../pinit.php:115 ../pinit.php:232
     53msgid "min: 130; leave 0 or blank for auto"
     54msgstr "min: 130; lasciare 0 o vuoto per auto"
     55
     56#: ../pinit.php:151
     57msgid "Pinterest Board Widget"
     58msgstr "Widget Bacheca Pinterest"
     59
     60#: ../pinit.php:152
     61msgid "Show up to 30 of your favorite board's latest pins."
     62msgstr "Mostra fino a 30 dei pin recenti dalla tua bacheca preferita."
  • pinit/trunk/pinit.php

    r795787 r795804  
    55 * Description: Handy plugin that adds Pinterest Follow Button, Pin Widget, Profile Widget and Board Widget to your WordPress site.
    66 * Author: Mattia Migliorini
    7  * Version: 0.1
     7 * Version: 0.3
    88 * Author URI: http://www.deshack.net
    99 * License: GPLv2 or later
     
    3333            'pit_widget_profile', // Base ID
    3434            __( 'Pinterest Profile Widget', 'pit' ), // Name
    35             array( 'description' => __( 'Pinterest Profile Widget: show up to 30 of your latest pins on your site.', 'pit' ) ) // Args
     35            array( 'description' => __( 'Show up to 30 of your latest pins on your site.', 'pit' ) ) // Args
    3636        );
    3737    }
     
    4747    public function widget( $args, $instance ) {
    4848        $title = apply_filters( 'widget_title', $instance['title'] );
    49         $url = $instance['url'];
     49        $user = $instance['user'];
    5050        $image_width = $instance['image_width'];
    5151        $width = $instance['width'];
     
    6767            $data_width = ' data-pin-board-width="' . $width . '"';
    6868
    69         if ( ! empty( $url ) )
    70             echo '<a data-pin-do="embedUser" href="' . $url . '"' . $data_image_width . $data_height . $data_width . '></a>';
     69        if ( ! empty( $user ) )
     70            echo '<a data-pin-do="embedUser" href="http://www.pinterest.com/' . $user . '/"' . $data_image_width . $data_height . $data_width . '></a>';
    7171
    7272        echo $args['after_widget'];
     
    8989
    9090        <p>
    91             <label for="<?php echo $this->get_field_id('url'); ?>"><?php _e( 'Pinterest User URL:', 'pit' ); ?></label>
    92             <input class="widefat" id="<?php echo $this->get_field_id('url'); ?>" name="<?php echo $this->get_field_name('url'); ?>" type="text" value="<?php echo esc_attr( $instance['url'] ); ?>">
    93             <br>
    94             <small>http://www.pinterest.com/username/</small>
     91            <label for="<?php echo $this->get_field_id('user'); ?>"><?php _e( 'Pinterest Username:', 'pit' ); ?></label>
     92            <input class="widefat" id="<?php echo $this->get_field_id('user'); ?>" name="<?php echo $this->get_field_name('user'); ?>" type="text" value="<?php echo esc_attr( $instance['user'] ); ?>">
     93            <br>
     94            <small>http://www.pinterest.com/<strong>username</strong>/</small>
    9595        </p>
    9696
    9797        <p>
    9898            <label for="<?php echo $this->get_field_id('image_width'); ?>"><?php _e( 'Image Width:', 'pit' ); ?></label>
    99             <input class="widefat" id="<?php echo $this->get_field_id('image_width'); ?>" name="<?php echo $this->get_field_name('image_width'); ?>" type="text" value="<?php echo esc_attr( $instance['image_width'] ); ?>">
    100             <br>
    101             <small><?php _e( 'min: 60; leave 0 for 92', 'pit' ); ?></small>
     99            <input class="widefat pit-image-width" id="<?php echo $this->get_field_id('image_width'); ?>" name="<?php echo $this->get_field_name('image_width'); ?>" type="text" value="<?php echo esc_attr( $instance['image_width'] ); ?>">
     100            <br>
     101            <small><?php _e( 'min: 60; leave 0 or blank for 92', 'pit' ); ?></small>
    102102        </p>
    103103
    104104        <p>
    105105            <label for="<?php echo $this->get_field_id('height'); ?>"><?php _e( 'Board Height:', 'pit' ); ?></label>
    106             <input class="widefat" id="<?php echo $this->get_field_id('height'); ?>" name="<?php echo $this->get_field_name('height'); ?>" type="text" value="<?php echo esc_attr( $instance['height'] ); ?>">
    107             <br>
    108             <small><?php _e( 'min: 60; leave 0 for 175', 'pit' ); ?></small>
     106            <input class="widefat pit-height" id="<?php echo $this->get_field_id('height'); ?>" name="<?php echo $this->get_field_name('height'); ?>" type="text" value="<?php echo esc_attr( $instance['height'] ); ?>">
     107            <br>
     108            <small><?php _e( 'min: 60; leave 0 or blank for 175', 'pit' ); ?></small>
    109109        </p>
    110110
    111111        <p>
    112112            <label for="<?php echo $this->get_field_id('width'); ?>"><?php _e( 'Board Width:', 'pit' ); ?></label>
    113             <input class="widefat" id="<?php echo $this->get_field_id('width'); ?>" name="<?php echo $this->get_field_name('width'); ?>" type="text" value="<?php echo esc_attr( $instance['width'] ); ?>">
    114             <br>
    115             <small><?php _e( 'min: 130; leave 0 for auto', 'pit' ); ?></small>
     113            <input class="widefat pit-width" id="<?php echo $this->get_field_id('width'); ?>" name="<?php echo $this->get_field_name('width'); ?>" type="text" value="<?php echo esc_attr( $instance['width'] ); ?>">
     114            <br>
     115            <small><?php _e( 'min: 130; leave 0 or blank for auto', 'pit' ); ?></small>
    116116        </p>
    117117
     
    130130        $instance = $old_instance;
    131131        $instance['title'] = $new_instance['title'];
    132         $instance['url'] = esc_url_raw( $new_instance['url'], array('http', 'https') );
     132        $instance['user'] = $new_instance['user'];
    133133        $instance['image_width'] = intval($new_instance['image_width']);
    134134        $instance['height'] = intval($new_instance['height']);
     
    139139}
    140140
     141/**
     142 * Pinterest Board Widget Class
     143 *
     144 * @since 0.2
     145 */
     146class pit_widget_board extends WP_Widget {
     147    // Constructor
     148    function __construct() {
     149        parent::__construct(
     150            'pit_widget_board', // Base ID
     151            __( 'Pinterest Board Widget', 'pit' ), // Name
     152            array( 'description' => __( 'Show up to 30 of your favorite board\'s latest pins.', 'pit' ) ) // Args
     153        );
     154    }
     155
     156    /**
     157     * Front-end display of widget.
     158     *
     159     * @see WP_Widget::widget()
     160     *
     161     * @param array $args. Widget arguments.
     162     * @param array $instance. Saved values from database.
     163     */
     164    public function widget( $args, $instance ) {
     165        $title = apply_filters( 'widget_title', $instance['title'] );
     166        $user = $instance['user'];
     167        $board = $instance['board'];
     168        $image_width = $instance['image_width'];
     169        $width = $instance['width'];
     170        $height = $instance['height'];
     171
     172        echo $args['before_widget'];
     173        if ( ! empty( $title ) )
     174            echo $args['before_title'] . $title . $args['after_title'];
     175
     176        $data_image_width = '';
     177        $data_width = '';
     178        $data_height = '';
     179
     180        if ( ! empty( $image_width ) )
     181            $data_image_width = ' data-pin-scale-width="' . $image_width . '"';
     182        if ( ! empty( $height ) )
     183            $data_height = ' data-pin-scale-height="' . $height . '"';
     184        if ( ! empty( $width ) )
     185            $data_width = ' data-pin-board-width="' . $width . '"';
     186
     187        if ( ! empty( $user ) && ! empty( $board ) )
     188            echo '<a data-pin-do="embedBoard" href="http://www.pinterest.com/' . $user . '/' . $board . '/"' . $data_image_width . $data_height . $data_width . '></a>';
     189
     190        echo $args['after_widget'];
     191    }
     192
     193    /**
     194     * Back-end widget form.
     195     *
     196     * @see WP_Widget::form()
     197     *
     198     * @param array $instance. Previously saved values from database.
     199     */
     200    public function form( $instance ) {
     201        ?>
     202
     203        <p>
     204            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'pit' ); ?></label>
     205            <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( $instance['title'] ); ?>">
     206        </p>
     207
     208        <p>
     209            <label for="<?php echo $this->get_field_id('user'); ?>"><?php _e( 'Pinterest Username:', 'pit' ); ?></label>
     210            <input class="widefat" id="<?php echo $this->get_field_id('user'); ?>" name="<?php echo $this->get_field_name('user'); ?>" type="text" value="<?php echo esc_attr( $instance['user'] ); ?>">
     211            <br>
     212            <small>http://www.pinterest.com/<strong>username</strong>/boardname/</small>
     213        </p>
     214
     215        <p>
     216            <label for="<?php echo $this->get_field_id('board'); ?>"><?php _e( 'Board:', 'pit' ); ?></label>
     217            <input class="widefat" id="<?php echo $this->get_field_id('board'); ?>" name="<?php echo $this->get_field_name('board'); ?>" type="text" value="<?php echo esc_attr( $instance['board'] ); ?>">
     218            <br>
     219            <small>http://www.pinterest.com/username/<strong>boardname</strong>/</small>
     220        </p>
     221
     222        <p>
     223            <label for="<?php echo $this->get_field_id('image_width'); ?>"><?php _e( 'Image Width:', 'pit' ); ?></label>
     224            <input class="widefat pit-image-width" id="<?php echo $this->get_field_id('image_width'); ?>" name="<?php echo $this->get_field_name('image_width'); ?>" type="text" value="<?php echo esc_attr( $instance['image_width'] ); ?>">
     225            <br>
     226            <small><?php _e( 'min: 60; leave 0 or blank for 92', 'pit' ); ?></small>
     227        </p>
     228
     229        <p>
     230            <label for="<?php echo $this->get_field_id('height'); ?>"><?php _e( 'Board Height:', 'pit' ); ?></label>
     231            <input class="widefat pit-height" id="<?php echo $this->get_field_id('height'); ?>" name="<?php echo $this->get_field_name('height'); ?>" type="text" value="<?php echo esc_attr( $instance['height'] ); ?>">
     232            <br>
     233            <small><?php _e( 'min: 60; leave 0 or blank for 175', 'pit' ); ?></small>
     234        </p>
     235
     236        <p>
     237            <label for="<?php echo $this->get_field_id('width'); ?>"><?php _e( 'Board Width:', 'pit' ); ?></label>
     238            <input class="widefat pit-width" id="<?php echo $this->get_field_id('width'); ?>" name="<?php echo $this->get_field_name('width'); ?>" type="text" value="<?php echo esc_attr( $instance['width'] ); ?>">
     239            <br>
     240            <small><?php _e( 'min: 130; leave 0 or blank for auto', 'pit' ); ?></small>
     241        </p>
     242
     243        <?php
     244    }
     245
     246    /**
     247     * Sanitize widget form values as they are saved.
     248     *
     249     * @see WP_Widget::update()
     250     *
     251     * @param array $new_instance. Values just sent to be saved.
     252     * @param array $old_instance. Previously saved values from database.
     253     */
     254    public function update( $new_instance, $old_instance ) {
     255        $instance = $old_instance;
     256        $instance['title'] = $new_instance['title'];
     257        $instance['user'] = $new_instance['user'];
     258        $instance['board'] = $new_instance['board'];
     259        $instance['image_width'] = intval($new_instance['image_width']);
     260        $instance['height'] = intval($new_instance['height']);
     261        $instance['width'] = intval($new_instance['width']);
     262
     263        return $instance;
     264    }
     265}
     266
     267/**
     268 * Pinterest Pin Widget Class
     269 *
     270 * @since 0.3
     271 */
     272class pit_widget_pin extends WP_Widget {
     273    // Constructor
     274    function __construct() {
     275        parent::__construct(
     276            'pit_widget_pin', // Base ID
     277            __( 'Pinterest Pin Widget', 'pit' ), // Name
     278            array( 'description' => __( 'Embed one of your pins on your site.', 'pit' ) ) // Args
     279        );
     280    }
     281
     282    /**
     283     * Front-end display of widget
     284     *
     285     * @see WP_Widget::widget()
     286     *
     287     * @param array $args. Widget arguments.
     288     * @param rray $instance. Saved values from database.
     289     */
     290    public function widget( $args, $instance ) {
     291        $title = apply_filters( 'widget_title', $instance['title'] );
     292        $id = $instance['id'];
     293
     294        echo $args['before_widget'];
     295        if ( ! empty( $title ) )
     296            echo $args['before_title'] . $title . $args['after_title'];
     297
     298        if ( ! empty( $id ) )
     299            echo '<a data-pin-do="embedPin" href="http://www.pinterest.com/pin/' . $id . '/"></a>';
     300
     301        echo $args['after_widget'];
     302    }
     303
     304    /**
     305     * Back-end widget form.
     306     *
     307     * @see WP_Widget::form()
     308     *
     309     * @param array $instance. Previously saved values from database.
     310     */
     311    public function form( $instance ) {
     312        ?>
     313
     314        <p>
     315            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'pit' ); ?></label>
     316            <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( $instance['title'] ); ?>">
     317        </p>
     318
     319        <p>
     320            <label for="<?php echo $this->get_field_id('id'); ?>"><?php _e( 'Pin ID:', 'pit' ); ?></label>
     321            <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( $instance['id'] ); ?>">
     322            <br>
     323            <small>http://www.pinterest.com/pin/<strong>pin_id</strong>/</small>
     324        </p>
     325
     326        <?php
     327    }
     328
     329    /**
     330     * Sanitize widget form values as they are saved.
     331     *
     332     * @see WP_Widget::update()
     333     *
     334     * @param array $new_instance. Values just sent to be saved.
     335     * @param array $old_instance. Previously saved values from database.
     336     */
     337    public function update( $new_instance, $old_instance ) {
     338        $instance = $old_instance;
     339        $instance['title'] = $new_instance['title'];
     340        $instance['id'] = $new_instance['id'];
     341
     342        return $instance;
     343    }
     344}
     345
     346/**
     347 * Register widgets
     348 */
    141349function pit_register_widget() {
    142350    register_widget('pit_widget_profile');
     351    register_widget('pit_widget_board');
     352    register_widget('pit_widget_pin');
    143353}
    144354add_action( 'widgets_init', 'pit_register_widget' );
  • pinit/trunk/readme.txt

    r795787 r795804  
    44Tags: widget, pinterest
    55Requires at least: 2.8
    6 Tested up to: 3.7
    7 Stable tag: 0.1
     6Tested up to: 3.7.1
     7Stable tag: 0.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.txt
    1010
    11 Handy plugin that adds Pinterest Profile Widget.
     11Handy plugin that adds Pinterest Pin Widget, Profile Widget and Board Widget to your WordPress site.
    1212
    1313== Description ==
     
    1616
    1717Features include:
    18 * Profile Widget
    1918
    20 Will support other resources soon.
     19 * Pin Widget
     20 * Profile Widget
     21 * Board Widget
     22
     23Languages:
     24
     25 * English
     26 * Italian
    2127
    2228== Installation ==
     
    3844== Changelog ==
    3945
     46= 0.3 =
     47* Feature: Pin Widget
     48
     49= 0.2 =
     50* Feature: Board Widget
     51
    4052= 0.1 =
    4153* Feature: Profile Widget
    4254
    4355== Upgrade Notice ==
     56
     57New features: Board and Pin Widgets.
Note: See TracChangeset for help on using the changeset viewer.