* @copyright (C) 2011-2014 Luca Grandicelli * @package special-recent-posts-free * @version 2.0.4 * @access public */ class WDG_SpecialRecentPostsFree extends WP_Widget { // Declaring global plugin values. private $plugin_args; /** * __construct() * * The main SRP Widget Class constructor * * @author Luca Grandicelli * @copyright (C) 2011-2014 Luca Grandicelli * @package special-recent-posts-free * @version 2.0.4 * @access public * @return boolean true */ function __construct() { // Initializing parent constructor. parent::__construct( 'wdg_specialrecentpostsfree', // Base ID __( 'Special Recent Posts FREE', SRP_TRANSLATION_ID ), array( 'description' => __( 'The Special Recent Posts FREE Edition widget. Drag to configure.', SRP_TRANSLATION_ID ), 'classname' => 'widget_specialrecentpostsFree' ) ); // Assigning global plugin option values to local variable. $this->plugin_args = get_option( 'srp_plugin_options' ); // Returning true. return true; } /** * form() * * This function updates the current user values for this widget instance * * @author Luca Grandicelli * @copyright (C) 2011-2014 Luca Grandicelli * @package special-recent-posts-free * @version 2.0.4 * @access public * @param array $instance The current widget values set by the user. * @return boolean true */ function form( $instance ) { // Outputs the options form on widget panel. $this->buildWidgetForm( $instance ); } /** * update() * * This function updates the current user values for this widget instance * * @author Luca Grandicelli * @copyright (C) 2011-2014 Luca Grandicelli * @package special-recent-posts-free * @version 2.0.4 * @access public * @global $srp_default_widget_values The global plugin values. * @param array $new_instance The new widget values to be saved. * @param array $old_instance The old widget values to be replaced. * @return array $instance It returns the current widget instance */ function update( $new_instance, $old_instance ) { // Declaring global plugin values. global $srp_default_widget_values; // Processes widget options to be saved. $instance = SpecialRecentPostsFree::srp_version_map_check( $old_instance ); // Looping through the entire list of widget options values. foreach( $srp_default_widget_values as $k => $v ) { // Switching through each option. switch( $k ) { case "category_title": case "ext_shortcodes_compatibility": case "nofollow_links": case "post_random": case "post_current_hide": case "post_date": case "show_all_posts": case "show_sticky_posts": case "string_break_link": case "thumbnail_link": case "widget_title_hide": case "wp_filters_enabled": case "widget_title_show_default_wp": // Fixing all the NULL values coming from unchecked checkboxes. $instance[ $k ] = ( !isset( $new_instance[ $k ] ) ) ? 'no' : $new_instance[ $k ]; break; case "thumbnail_height": case "thumbnail_width": // Checking if the new value is numeric. Then assign it. if ( is_numeric( $new_instance[ $k ] ) ) $instance[ $k ] = trim( $new_instance[ $k ] ); break; case "post_content_length": case "post_limit": case "post_title_length": // Checking if the new value is numeric and not zero. Then assign it. if ( (is_numeric( $new_instance[ $k ] ) ) && ( $new_instance[ $k ] != 0) ) $instance[ $k ] = trim( $new_instance[ $k ] ); break; case "post_offset": // Checking if the new value is numeric and is > zero. Then assign it. $instance[ $k ] = ( ( is_numeric( $new_instance[ $k ] ) ) && ( $new_instance[ $k ] > 0) ) ? trim( $new_instance[ $k ] ) : 0; break; default: // Default behaviour: for all other options, assign the new value. $instance[ $k ] = $new_instance[ $k ]; break; } } // Returning new widget instance. return $instance; } /** * widget() * * This is the main function that initializes the SRP rendering process. * * @author Luca Grandicelli * @copyright (C) 2011-2014 Luca Grandicelli * @package special-recent-posts-free * @version 2.0.4 * @access public * @param array $args The option values args. * @param array $instance The current widget instance. * @return boolean true */ function widget( $args, $instance ) { // Checking Visualization Filter. if ( SpecialRecentPostsFree::visualization_check( $instance, 'widget' ) ) { // Extracting arguments. extract( $args, EXTR_SKIP ); // Printing pre-widget stuff. echo $before_widget; // Checking for 'Use default Wordpress HTML layout for widget title' option value. if ( isset( $instance['widget_title_show_default_wp'] ) && 'yes' == $instance['widget_title_show_default_wp'] ) { // Checking that this option exists. if ( isset( $instance['widget_title_hide'] ) ) { // Fetching widget title. $widget_title = apply_filters( 'widget_title', $instance['widget_title'] ); // Checking for "widget title hide" option. if ( 'yes' != $instance['widget_title_hide'] ) { // Printing default Widget Title HTML layout. echo $before_title . $widget_title . $after_title; } } } // Creating an instance of the Special Recent Posts Class. $srp = new SpecialRecentPostsFree( $instance, $this->id ); // Checking that the $srp is a valid SRP class object. if ( is_object( $srp ) ) { // Displaying posts. $srp->display_posts( true, 'print' ); } // Printing after widget stuff. echo $after_widget; } // Returning true. return true; } /** * buildWidgetForm() * * This method build the widget layout. * * @author Luca Grandicelli * @copyright (C) 2011-2014 Luca Grandicelli * @package special-recent-posts-free * @version 2.0.4 * @access public * @global $srp_default_widget_values The default widget presets. * @param array $instance The current widget instance. * @return boolean true */ function buildWidgetForm( $instance ) { // Loading default widget values. global $srp_default_widget_values; // Loading default plugin presets. $plugin_args = get_option( 'srp_plugin_options' ); // Merging default values with instance array, in case this is empty. $instance = wp_parse_args( (array) SpecialRecentPostsFree::srp_version_map_check( $instance ), $srp_default_widget_values ); ?>
<?php esc_attr_e( 'The Special Recent Posts FREE logo', SRP_TRANSLATION_ID ); ?>


  • />
  • />


  • px

  • px
  • />


  • " size="4" style="float: left;" />



  • />
  • />
  • />

  • />

  • " />
  • />
  • '), SRP_TRANSLATION_ID );?>


  • " />
  • />
  • " />
  • />

  • />


  • ', '' ); ?>




    • http://www.specialrecentposts.com/', esc_url( 'http://www.specialrecentposts.com/?ref=uri_w' ), __( 'The Special Recent Posts Official Website.', SRP_TRANSLATION_ID ) );?>

    • http://wordpress.org/support/plugin/special-recent-posts/', esc_url( 'http://wordpress.org/support/plugin/special-recent-posts/' ), __( 'Visit the online Wordpress.org forum to get instant support.', SRP_TRANSLATION_ID ) );?>

    • http://www.specialrecentposts.com/docs/', esc_url( 'http://www.specialrecentposts.com/docs/?ref=docs_w' ), __( 'Learn how to use SRP. View the online documentation.', SRP_TRANSLATION_ID ) );?>