prefix = 'dp'; $this->textdomain = 'dp-flickr-widget'; $this->plugin_file = 'dp-flickr-widget/dp-flickr-widget.php'; $this->settings_url = admin_url( 'widgets.php' ); $this->donate_url = !empty($this->donate_url) ? $this->donate_url : 'http://dedepress.com/donate/'; $this->support_url = !empty($this->support_url) ? $this->support_url : 'http://dedepress.com/support/'; $widget_ops = array('classname' => 'widget-flickr', 'description' => __('Displays photos on flickr.', $this->textdomain) ); $this->WP_Widget("{$this->prefix}-flickr-widget", __('DP Flickr', $this->textdomain), $widget_ops); // Filtering pluginn action links and plugin row meta add_filter( 'plugin_action_links', array(&$this, 'plugin_action_links'), 10, 2 ); add_filter( 'plugin_row_meta', array(&$this, 'plugin_row_meta'), 10, 2 ); } /** * Outputs the widget based on the arguments input through the widget controls. * @since 0.7 */ function widget($args, $instance) { extract( $args ); echo $before_widget; /* If there is a title given, add it along with the $before_title and $after_title variables. */ $title = $instance['title']; if ( $title) { $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); $title = str_replace('flickr', 'flickr', $title); echo $before_title . $title . $after_title; } $query_args = array(); $query_args['size'] = !empty($instance['size']) ? $instance['size'] : ''; $query_args['count'] = !empty($instance['count']) ? $instance['count'] : ''; $query_args['display'] = !empty($instance['display']) ? $instance['display'] : 'latest'; $query_args['layout'] = !empty($instance['layout']) ? $instance['layout'] : 'x'; $query_args['source'] = !empty($instance['source']) ? $instance['source'] : 'user'; if(!empty($instance['tag'])) { if($instance['source'] == 'user') $query_args['source'] = 'user_tag'; elseif($instance['source'] == 'group') $query_args['source'] = 'group_tag'; elseif($instance['source'] == 'all') $query_args['source'] = 'all_tag'; } if($instance['source'] == 'user') $query_args['user'] = $instance['id']; elseif($instance['source'] == 'user_set') $query_args['set'] = $instance['id']; elseif($instance['source'] == 'group') $query_args['group'] = $instance['id']; echo '
'; echo ''; echo '
'; echo $after_widget; } /** * Updates the widget control options for the particular instance of the widget. * @since 0.7 */ function update($new_instance, $old_instance) { return $new_instance; } /** * Displays the widget control options in the Widgets admin screen. * @since 0.7 */ function form($instance) { $defaults = array( 'title' => 'Photos on flickr', 'source' => 'user', //user, group, user_set, all 'id' => '', 'size' => 's', 'count' => '9', 'display' => 'latest', // latest, random 'tag' => '' ); $instance = wp_parse_args( (array) $instance, $defaults ); $display = array( 'latest' => __( 'Latest', $this->textdomain ), 'random' => __( 'Random', $this->textdomain ) ); $size = array( 's' => __( 'Small', $this->textdomain ), 't' => __( 'Thumbnail', $this->textdomain ), 'm' => __( 'Medium', $this->textdomain ) ); $source = array( 'user' => __( 'User', $this->textdomain ), 'group' => __( 'Group', $this->textdomain ), 'user_set' => __( 'Set', $this->textdomain ), 'all' => __( 'Public', $this->textdomain ) ); $count = array(1,2,3,4,5,6,7,8,9,10); ?>

plugin_file && $this->settings_url) $actions[] = '' . __('Settings', 'dp-core') .''; return $actions; } function plugin_row_meta( $plugin_meta, $plugin_file ){ if ( $plugin_file == $this->plugin_file ) { $plugin_meta[] = '' . __('Donate', 'dp-core') .''; $plugin_meta[] = '' . __('Support', 'dp-core') .''; } return $plugin_meta; } } add_action('widgets_init', 'register_dp_flickr_widget'); function register_dp_flickr_widget() { register_widget('DP_Flickr_Widget'); }