User Tools

Site Tools


wordpress:disqusrecents

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Last revisionBoth sides next revision
wordpress:disqusrecents [2016/08/30 16:59] gfsadministratorwordpress:disqusrecents [2018/02/21 11:24] gfsadministrator
Line 6: Line 6:
 >Come forse molti di voi sapranno già Disqus è un sistema di commenti per siti web, blog e comunità online che si integra perfettamente con i social network, permettendo infatti il login con il proprio utente Twitter, Facebook e non solo. La gestione dello spam, gli strumenti di moderazione e analisi, le notifiche mail, il pannello commenti e molto altro ancora è centralizzato per offrire a utilizzatori e possessori dei siti il massimo della praticità. Il fatto che vengano poi supportati tutti i principali browser da PC ed in parte quelli mobile per smartphone e tablet è un valore aggiunto non da poco. >Come forse molti di voi sapranno già Disqus è un sistema di commenti per siti web, blog e comunità online che si integra perfettamente con i social network, permettendo infatti il login con il proprio utente Twitter, Facebook e non solo. La gestione dello spam, gli strumenti di moderazione e analisi, le notifiche mail, il pannello commenti e molto altro ancora è centralizzato per offrire a utilizzatori e possessori dei siti il massimo della praticità. Il fatto che vengano poi supportati tutti i principali browser da PC ed in parte quelli mobile per smartphone e tablet è un valore aggiunto non da poco.
  
-Ecco quindi il codice sorgente di cui vi parlo nell'articolo:+A partire dalla versione 0.8 del widget, ho preferito spostare su GitHub il codice, lo puoi trovare all'indirizzo **https://gist.github.com/gioxx/219fa0546e252091503bec965a9f01f8**
  
-<file php disqusrecents.php> +Puoi segnalarmi qualsiasi anomalia tramite l'area commenti del blog. Se vuoi suggerire ulteriori modifiche / personalizzazioni tramite CSS sei il benvenutopuoi contattarmi pure tramite mail (l'indirizzo lo trovi nella home di questo Wiki).
-<?php +
-/* +
-  Plugin Name: Disqus Recents Widget +
-  Plugin URI: http://public.gfsolone.com/wiki/doku.php?id=wordpress:disqusrecents +
-  Description: Mostra gli ultimi commenti lasciati nel sistema Disqus installato nel vostro Wordpress. +
-  Version: 0.6 +
-  Author: Gioxx +
-  Author URI: http://gioxx.org +
-  License: CC BY-NC-SA 3.0 IT +
- */ +
- +
-/* +
-  Vedi dettaglio licenza di rilascio: http://creativecommons.org/licenses/by-nc-sa/3.0/it/deed.it +
-  Basato su Codex Wordpress: http://codex.wordpress.org/Widgets_API +
-  Grazie a: https://gist.github.com/flowcomm/4174893 +
-  -2013- Gioxx (dev@gfsolone.com) +
-  Ult. mod. 30/8/16 +
- 0.6- i contenuti vengono caricati da Disqus in HTTPS. Migliorato hint su DISQUS ID da inserire nel widget. +
-  IL CONTENUTO DI QUESTO FILE PHP VIENE FORNITO AS-IS +
-   +
- */ +
-  +
-class DsqRecents_Widget extends WP_Widget { +
- +
- /** +
- * Register widget with WordPress. +
- */ +
- public function __construct() { +
- parent::__construct( +
- 'dsqrecents_widget', // Base ID +
- 'Disqus Recents Widget', // Name +
- array( 'description' => __( 'Mostra gli ultimi commenti recuperati dal sistema Disqus (vedi documentazione)', 'text_domain' ), ) // Args +
- ); +
-+
- +
- /** +
- * Front-end display of widget. +
-+
- * @see WP_Widget::widget() +
-+
- * @param array $args     Widget arguments. +
- * @param array $instance Saved values from database. +
- */ +
- public function widget( $args, $instance ) { +
- extract( $args ); +
- $title = apply_filters( 'widget_title', $instance['title'] ); +
- $dsqid = apply_filters( 'widget_dsqid', $instance['dsqid'] ); +
- $dsqitems = apply_filters( 'widget_dsqid', $instance['dsqitems'] ); +
- +
- echo $before_widget; +
- if ( ! empty( $title ) ) +
- echo $before_title . $title . $after_title; +
- // echo __( 'Stringa debug, dovrebbe comparire nel widget', 'text_domain' ); +
- ?> +
- <!-- Blocco commenti Disqus --> +
- <div id="recentcomments" class="dsq-widget"> +
- <script type="text/javascript" src="https://<?php echo $dsqid; ?>.disqus.com/recent_comments_widget.js?num_items=<?php echo $dsqitems; ?>&hide_avatars=0&avatar_size=32&excerpt_length=200"></script> +
- </div><img src="http://public.gfsolone.com/wiki/lib/tpl/dokuwiki/images/logo.png" style="max-width: 16px; float: left;"><a href="http://public.gfsolone.com/wiki/doku.php?id=wordpress:disqusrecents" style="font-size: x-small; font-variant: small-caps;">Disqus Recents Widget</a> +
- <?php +
- echo $after_widget; +
-+
- +
- /** +
- * Sanitize widget form values as they are saved. +
-+
- * @see WP_Widget::update() +
-+
- * @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 ) { +
- $instance = array(); +
- $instance['title'] = strip_tags( $new_instance['title'] ); +
- $instance['dsqid'] = strip_tags( $new_instance['dsqid'] ); +
- $instance['dsqitems'] = strip_tags( $new_instance['dsqitems'] ); +
- +
- return $instance; +
-+
- +
- /** +
- * Back-end widget form. +
-+
- * @see WP_Widget::form() +
-+
- * @param array $instance Previously saved values from database. +
- */ +
- public function form( $instance ) { +
- if ( isset( $instance[ 'title' ] ) ) { +
- $title = $instance[ 'title' ]; +
-+
- else { +
- $title = __( 'Recent Comments', 'text_domain' ); +
-+
- if ( isset( $instance[ 'dsqid' ] ) ) { +
- $dsqid = $instance[ 'dsqid' ]; +
-+
- else { +
- $dsqid = __( 'gioxx', 'text_domain' ); +
-+
- if ( isset( $instance[ 'dsqitems' ] ) ) { +
- $dsqitems = $instance[ 'dsqitems' ]; +
-+
- else { +
- $dsqitems = __( '5', 'text_domain' ); +
-+
- ?> +
- <p> +
- <!-- Titolo del widget --> +
- <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>  +
- <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 ); ?>" /> +
- <!-- ID DISQUS: ID.disqus.com --> +
- <label for="<?php echo $this->get_field_id( 'dsqid' ); ?>"><?php _e( 'Disqus ID (insert only first part of the URL, for example: <strong>UTENTE</strong>.disqus.com &rarr; utente):' ); ?></label>  +
- <input class="widefat" id="<?php echo $this->get_field_id( 'dsqid' ); ?>" name="<?php echo $this->get_field_name( 'dsqid' ); ?>" type="text" value="<?php echo esc_attr( $dsqid ); ?>" /> +
- <!-- Numero commenti da caricare --> +
- <label for="<?php echo $this->get_field_id( 'dsqitems' ); ?>"><?php _e( 'Items to load:' ); ?></label>  +
- <input class="widefat" id="<?php echo $this->get_field_id( 'dsqitems' ); ?>" name="<?php echo $this->get_field_name( 'dsqitems' ); ?>" type="text" value="<?php echo esc_attr( $dsqitems ); ?>" /> +
- <br /><br /> +
- <a href="http://public.gfsolone.com/wiki/doku.php?id=wordpress:disqusrecents">Help me!</a><br /> +
- <a href="http://gfsolone.com"><img src="http://gfsolone.com/images/gfsolone.footer.png"></a> +
- </p> +
- <?php  +
-+
- +
-} // class Widget terminata +
- +
-// Registrazione del widget +
-add_action( 'widgets_init', create_function( '', 'register_widget( "dsqrecents_widget" );' ) ); +
-?> +
-</file> +
- +
-Allo stato attuale non ci sono ulteriori aggiornamenti e l'ultima versione del widget è la 0.6 (30082016). Potete segnalarmi qualsiasi anomalia tramite l'area commenti del blog. Se volete suggerire ulteriori modifiche / personalizzazioni tramite CSS siete i benvenuticontattatemi pure tramite mail (l'indirizzo lo trovate nella home di questo Wiki!).+
wordpress/disqusrecents.txt · Last modified: 2020/10/25 19:39 by gfsadministrator