Esempio n. 1
0
 public function __construct($config)
 {
     $config['link'] = sprintf('http://dribbble.com/players/%s/', $config['username']);
     $config['url'] = sprintf('http://dribbble.com/players/%s/shots.rss', $config['username']);
     parent::__construct($config);
     $this->setItemTemplate('<li><a href="{{{link}}}"><strong>{{{title}}}</strong> <img src="{{{image}}}" alt="{{title}}" /></a></li>' . "\n");
 }
Esempio n. 2
0
<?php

//To avoid direct access by URL (i.e. http://yoursite.com/Dribbble/shots/1234) remove this routing rule
Route::get('(:bundle)/(:any)/(:any)/(:num?)/(:num?)', function ($method, $param, $page = 0, $per_page = 0) {
    return Response::json(Dribbble::callMethod($method, $param, $page, $per_page));
});
Esempio n. 3
0
 public function getData()
 {
     return parent::getData()->shots;
 }
Esempio n. 4
0
 function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     $username = $instance['username'];
     require_once 'vendor/dribbble/src/Dribbble/Dribbble.php';
     require_once 'vendor/dribbble/src/Dribbble/Exception.php';
     $dribbble = new Dribbble();
     echo $before_widget;
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     try {
         //limit the number of images
         $count = isset($args['count']) ? absint($args['count']) : 8;
         $my_shots = $dribbble->getPlayerShots($username, 0, $count);
         // $my_shots = array_slice( $my_shots, 0, $count );
         echo '<ul class="wpgrade-dribbble-items">';
         foreach ($my_shots->shots as $shot) {
             echo '<li class="wpgrade-dribbble-item"><a href="' . $shot->url . '"><img src="' . $shot->image_teaser_url . '" alt="' . $shot->title . '"></a></li>';
         }
         echo '</ul>';
     } catch (DribbbleException $e) {
         echo 'Upss... Something is wrong. Check the widget settings.';
     }
     echo $after_widget;
 }