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
Next revision
Previous revision
Last revisionBoth sides next revision
wordpress:disqusrecents [2014/01/09 15:30] gfsadministratorwordpress:disqusrecents [2018/02/21 11:24] gfsadministrator
Line 2: Line 2:
 ====== Disqus: Recent Comments for Wordpress ====== ====== Disqus: Recent Comments for Wordpress ======
  
-Work in progress.+Riporto direttamente dall'[[http://gioxx.org/2014/01/10/disqus-recent-comments-per-wordpress/|articolo originale sul blog]]:
  
-<file php disqusrecents.php> +>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 soloLa 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.
-<?php +
-/* +
-  Plugin Name: Disqus: Recent Comments +
-  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.2 +
-  Author: Gioxx +
-  Author URI: http://gioxx.org +
-  License: CC BY-NC-SA 3.0 IT +
- */+
  
-/* +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**
-  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-2014 Gioxx (dev@gfsolone.com) +
-  IL CONTENUTO DI QUESTO FILE PHP VIENE FORNITO AS-IS +
-   +
- *+
-  +
-class DsqRecents_Widget extends WP_Widget {+
  
- /** +Puoi segnalarmi qualsiasi anomalia tramite l'area commenti del blogSe vuoi suggerire ulteriori modifiche personalizzazioni tramite CSS sei il benvenutopuoi contattarmi pure tramite mail (l'indirizzo lo trovi nella home di questo Wiki).
- * 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="http://<?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 Recent Comments</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 (ID.disqus.com):' ); ?></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>+
wordpress/disqusrecents.txt · Last modified: 2020/10/25 19:39 by gfsadministrator