• chrillep

    (@chrillep)


    what would be the best way to change the output of wpsc_fancy_notifications() ?
    There is a filter for the image but not for the output.

    /**
     * Get the URL of the loading animation image.
     * Can be filtered using the wpsc_loading_animation_url filter.
     */
    function wpsc_loading_animation_url() {
    	return apply_filters( 'wpsc_loading_animation_url', WPSC_CORE_THEME_URL . 'wpsc-images/indicator.gif' );
    }
    
    function fancy_notifications() {
    	return wpsc_fancy_notifications( true );
    }
    function wpsc_fancy_notifications( $return = false ) {
    	static $already_output = false;
    
    	if ( $already_output )
    		return '';
    
    	$output = "";
    	if ( get_option( 'fancy_notifications' ) == 1 ) {
    		$output = "";
    		$output .= "<div id='fancy_notification'>\n\r";
    		$output .= "  <div id='loading_animation'>\n\r";
    		$output .= '<img id="fancy_notificationimage" title="' . esc_attr__( 'Loading', 'wpsc' ) . '" alt="' . esc_attr__( 'Loading', 'wpsc' ) . '" src="' . wpsc_loading_animation_url() . '" />' . __( 'Updating', 'wpsc' ) . "...\n\r";
    		$output .= "  </div>\n\r";
    		$output .= "  <div id='fancy_notification_content'>\n\r";
    		$output .= "  </div>\n\r";
    		$output .= "</div>\n\r";
    	}
    
    	$already_output = true;
    
    	if ( $return )
    		return $output;
    	else
    		echo $output;
    }
    
    function fancy_notification_content( $cart_messages ) {
    	$siteurl = get_option( 'siteurl' );
    	$output = '';
    	foreach ( (array)$cart_messages as $cart_message ) {
    		$output .= "<span>" . $cart_message . "</span><br />";
    	}
    	$output .= "<a href='" . get_option( 'shopping_cart_url' ) . "' class='go_to_checkout'>" . __( 'Go to Checkout', 'wpsc' ) . "</a>";
    	$output .= "<a href='#' onclick='jQuery(\"#fancy_notification\").css(\"display\", \"none\"); return false;' class='continue_shopping'>" . __( 'Continue Shopping', 'wpsc' ) . "</a>";
    	return $output;
    }

    https://www.ads-software.com/plugins/wp-e-commerce/

  • The topic ‘Extend or apply filter for $output on wpsc_fancy_notifications’ is closed to new replies.