• User

    wordpress vivistats widget

    
    <?php
    /*
    Plugin Name: Vivistats Widget
    Plugin URI: forum.myflashxml.it/plugins-f198/vivistats-widget-t71564 .html
    Description: vivistats sidebar widget.
    Author: Marco Sottana
    Version: 0.1
    Author URI: forum.myflashxml .it
    
        
    */
    
    // We're putting the plugin's functions in one big function we then
    // call at 'plugins_loaded' (add_action() at bottom) to ensure the
    // required Sidebar Widget functions are available.
    
    
    
    function widget_vivistats_init() {
    
        // Check to see required Widget API functions are defined...
        if ( !function_exists('register_sidebar_widget') || !function_exists('register_widget_control') )
            return; // ...and if not, exit gracefully from the script.
    
        // This function prints the sidebar widget--the cool stuff!
        function widget_vivistats($args) {
        $number=0;
            // $args is an array of strings which help your widget
            // conform to the active theme: before_widget, before_title,
            // after_widget, and after_title are the array keys.
            extract($args);
    
            // Collect our widget's options, or define their defaults.
            $options = get_option('widget_vivistats');
            //$title = empty($options['title']) ? 'My Widget' : $options['title'];
            //$text = empty($options['text']) ? 'Hello World!' : $options['text'];
             $title = attribute_escape($options[$number]['title']);
             $code = attribute_escape($options[$number]['code']);
    
             // It's important to use the $before_widget, $before_title,
             // $after_title and $after_widget variables in your output.
            echo $before_widget;
            echo $before_title . $title . $after_title;
              
            echo '<!-- inizio codice vivistats.com -->'.chr(13);
        echo '<script type="text/javascript" language="JavaScript" src="htt p :// count.vivistats.com/laser.asp?CountId='.$code.'"></script>'.chr(13);
        echo '<noscript>'.chr(13);
        echo '<a href="htt p: //it.vivistats.com/"><img src="ht tp: //count.vivistats.com/laser.asp?CountId='.$code.'&js=off" border="0" alt="contatore sito web"></a>'.chr(13);
       echo '</noscript>'.chr(13);
       echo '<!-- fine codice vivistats.com -->'.chr(13);
    
            
    //        echo $code."";
    //        echo $text;
            echo $after_widget;
        }
    
    
        
    function widget_vivistats_control() {
       $number=0;
       $options = $newoptions = get_option('widget_vivistats');
       if ( !is_array($options) )
          $options = $newoptions = array();
       if ( $_POST["widget_vivistats-$number"] ) {
          $newoptions[$number]['title'] = strip_tags(stripslashes($_POST["widget_vivistats-$number"]));
          $newoptions[$number]['code'] = strip_tags(stripslashes($_POST["widget_vivistats-code-$number"]));
          }
       if ( $options != $newoptions ) {
          $options = $newoptions;
          update_option('widget_vivistats', $options);
       }
       $title = attribute_escape($options[$number]['title']);
       $code = attribute_escape($options[$number]['code']);
    ?>
    <p><label for="advertising_widget-title"><?php _e('Title:'); ?> <input style="width: 250px;" id="widget_vivistats-<?php echo $number; ?>" name="widget_vivistats-<?php echo $number; ?>" type="text" value="<?php echo $title; ?>" /></label></p>
    <p><label for="advertising_widget-code"><?php _e('Code:'); ?> <input style="width: 250px;" id="widget_vivistats-code-<?php echo $number; ?>" name="widget_vivistats-code-<?php echo $number; ?>" type="text" value="<?php echo $code; ?>" /></label></p>
    <input type="hidden" id="widget_vivistats-submit-<?php echo "$number"; ?>" name="widget_vivistats-submit-<?php echo "$number"; ?>" value="1" />
    <?php
    }
    
    
        // This registers the widget. About time.
        register_sidebar_widget('Vivistats Widget', 'widget_vivistats');
    
        // This registers the (optional!) widget control form.
        register_widget_control('Vivistats Widget', 'widget_vivistats_control');
    }
    
    // Delays plugin execution until Dynamic Sidebar has loaded first.
    add_action('plugins_loaded', 'widget_vivistats_init');
    ?>
    
    
    
    

  • User

    Edit:

    • Inizia con una maiuscola e termina con un punto.