Plugin Directory

Changeset 472932


Ignore:
Timestamp:
12/09/2011 07:47:40 PM (14 years ago)
Author:
gregrickaby
Message:

Pushed Version 0.0.5

File:
1 edited

Legend:

Unmodified
Added
Removed
  • dj-rotator-for-wordpress/trunk/dj-rotator-for-wordpress.php

    r468855 r472932  
    55Description: Easily create a DJ Rotator to display which personality is currently on-air. You can upload/delete deejays via the <a href="options-general.php?page=dj-rotator">options panel</a>. To display the DJ Rotator in your theme, use one of the following: 1) <a href="widgets.php">Widget</a>, 2) Template Tag <code>&lt;?php djwp(); ?&gt;</code>, or 3) Shortcode <code>[djwp]</code>.
    66Author: Greg Rickaby
    7 Version: 0.0.4
     7Version: 0.0.5
    88Author URI: http://gregrickaby.com
    99Notes: Big thanks to Nathan Rice and his WP-Cycle Plugin which got me started in the right direction.
     
    349349                <td>               
    350350                <input type="text" name="djwp_settings[header_text]" value="<?php echo $options['header_text'] ?>" class="regular-text" />
    351                 <p><span class="description"><?php _e( 'Give the module a name. Default: <code>On-Air Now</code>', 'djwp' ); ?></span></p>
     351                <p><span class="description"><?php _e( 'Give the module a name. Only applies to Template Tag and Shortcode. Default: <code>On-Air Now</code>', 'djwp' ); ?></span></p>
    352352                </td>
    353353        </tr>       
     
    376376                <td>                   
    377377                    <input type="text" name="djwp_settings[div]" value="<?php echo $options['div'] ?>" class="regular-text code" />
    378                     <p><span class="description"><?php _e( 'Set the CSS <code>ID</code> of the module. Default: <code>dj-rotator</code>', 'djwp' ); ?></span></p>
     378                    <p><span class="description"><?php _e( 'Set the CSS <code>ID</code> of the module. Only applies to Template Tag and Shortcode. Default: <code>dj-rotator</code>', 'djwp' ); ?></span></p>
    379379                </td>
    380380            </tr>
     
    383383                <td>                   
    384384                    <input type="text" name="djwp_settings[header_class]" value="<?php echo $options['header_class'] ?>" class="regular-text code" />
    385                     <p><span class="description"><?php _e( 'Set the CSS <code>class</code> of the <code>&lt;h3&gt;</code>. Default: <code>dj-header</code>', 'djwp' ); ?></span></p>
     385                    <p><span class="description"><?php _e( 'Set the CSS <code>class</code> of the <code>&lt;h3&gt;</code>. Only applies to Template Tag and Shortcode. Default: <code>dj-header</code>', 'djwp' ); ?></span></p>
    386386                </td>
    387387            </tr>
     
    467467    </p>
    468468    &nbsp; &nbsp;
    469     <p><span class="description"><?php _e( 'To display the DJ Rotator in your theme, use one of the following: 1) <a href="widgets.php">Widget</a>, 2) Template Tag <code>&lt;?php djwp(); ?&gt;</code>, or 3) Shortcode <code>[djwp]</code>&nbsp; &nbsp;For support visit <a href="http://gregrickaby.com/go/dj-rotator-for-wordpress" target="_blank">http://gregrickaby.com/</a>', 'djwp' ); ?></span></p>
     469    <p><span class="description"><?php _e( 'To display the DJ Rotator in your theme, use one of the following: 1) <a href="widgets.php">Widget</a>, 2) Template Tag <code>&lt;?php djwp(); ?&gt;</code>, or 3) Shortcode <code>[djwp]</code><br />HTML is allowed in the description field.<br />For support visit: <a href="http://wordpress.org/tags/dj-rotator-for-wordpress" target="_blank">http://wordpress.org/tags/dj-rotator-for-wordpress</a>', 'djwp' ); ?></span></p>
    470470
    471471<?php
     
    484484    $input['img_width'] = intval($input['img_width']);
    485485    $input['img_height'] = intval($input['img_height']);
     486    $input['start_time'] = wp_filter_nohtml_kses($input['start_time']);
     487    $input['end_time'] = wp_filter_nohtml_kses($input['end_time']);
    486488    $input['div'] = wp_filter_nohtml_kses($input['div']);
    487489    $input['header_class'] = wp_filter_nohtml_kses($input['header_class']);
     
    645647
    646648/**
    647  * Mash it all together and form our primary function
     649 * Mash it all together and form our primary function (Template Tag & Shortcode)
    648650 * @since 0.0.1
    649651 *
     
    658660}
    659661
     662/**
     663 * Mash it all together and form our primary function (Sidebar Widget)
     664 * @since 0.0.5
     665 *
     666 */
     667function djwp_widget($args = array(), $content = null) {
     668    global $djwp_settings; 
     669        djwp_image();
     670        djwp_description();
     671}
     672
    660673
    661674/**
     
    674687/**
    675688 * Create the Widget
    676  * @since 0.0.4
     689 * @since 0.0.5
    677690 *
    678691 */
     
    684697    }
    685698
    686     // write the widget
    687     function widget() {
    688             djwp();
    689     }
    690 
    691 }
     699    /** @see WP_Widget::widget */
     700    function widget( $args, $instance ) {
     701        extract( $args );
     702        $title = apply_filters( 'widget_title', $instance['title'] );
     703        echo djwp_before_header(); #hook
     704        echo $before_widget;
     705        if ( $title )
     706            echo $before_title . $title . $after_title;
     707            echo djwp_after_header(); #hook
     708            echo djwp_widget();
     709            echo $after_widget;
     710    }
     711
     712    /** @see WP_Widget::update */
     713    function update( $new_instance, $old_instance ) {
     714        $instance = $old_instance;
     715        $instance['title'] = strip_tags($new_instance['title']);
     716        return $instance;
     717    }
     718
     719    /** @see WP_Widget::form */
     720    function form( $instance ) {
     721        if ( $instance ) {
     722            $title = esc_attr( $instance[ 'title' ] );
     723        }
     724        else {
     725            $title = __( 'On-Air Now', 'text_domain' );
     726        }
     727        ?>
     728        <p>
     729        <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
     730        <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />
     731        </p>
     732        <?php
     733    }
     734}
Note: See TracChangeset for help on using the changeset viewer.