Plugin Directory

Changeset 635012


Ignore:
Timestamp:
12/06/2012 06:03:09 PM (13 years ago)
Author:
fsquared
Message:

Added new tag formatting options

Location:
f2-tag-cloud-widget
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • f2-tag-cloud-widget/tags/0.3.0/f2-tagcloud.php

    r594867 r635012  
    33Plugin Name: F2 Tag Cloud Widget
    44Plugin URI: http://www.fsquared.co.uk/software/f2-tagcloud/
    5 Version: 0.2.0
     5Version: 0.3.0
    66Author: fsquared limited
    77Author URI: http://www.fsquared.co.uk
     
    5050        'orderby'    => 'name',
    5151        'order'      => 'ASC',
     52        'alignment'  => 'default',
     53        'padding'    => '0',
    5254        'taxonomy'   => 'post_tag',
    5355        'exclude'    => null,
     
    9597
    9698        /* The actual content. */
    97         echo '<div class="tagcloud">';
    9899        $l_tag_params = wp_parse_args( $p_instance, $this->m_defaults );
    99         wp_tag_cloud( apply_filters('widget_tag_cloud_args', $l_tag_params ) );
     100        $l_tag_params["echo"] = 0;
     101        $l_tag_cloud_text = wp_tag_cloud( apply_filters('widget_tag_cloud_args', $l_tag_params ) );
     102
     103        echo '<div class="tagcloud"';
     104        if ( 'default' != $l_tag_params["alignment"] ) {
     105            echo ' style="text-align: ' . $l_tag_params["alignment"] . ';"';
     106        }
     107        echo '>';
     108        echo preg_replace( '/style=\'/', 'style=\'padding: ' .
     109            $l_tag_params["padding"] . 'px; ', $l_tag_cloud_text );
    100110        echo '</div>';
    101111
     
    183193            ' value="RAND">random</option>';
    184194        echo '</select>';
     195        echo '</p>';
     196
     197        echo '<p>';
     198        echo '<label for="' . $this->get_field_id( 'alignment' ) . '">' .
     199            __( 'Tag cloud alignment:' ) . '</label>';
     200        echo '<select class="widefat" id="' . $this->get_field_id( 'alignment' ) .
     201            '" name="' . $this->get_field_name( 'alignment' ) . '">';
     202        echo '<option ' . selected( 'default', $l_instance['alignment'], false ) .
     203            ' value="default">theme default</option>';
     204        echo '<option ' . selected( 'left', $l_instance['alignment'], false ) .
     205            ' value="left">left</option>';
     206        echo '<option ' . selected( 'center', $l_instance['alignment'], false ) .
     207            ' value="center">center</option>';
     208        echo '<option ' . selected( 'right', $l_instance['alignment'], false ) .
     209            ' value="right">right</option>';
     210        echo '</select>';
     211        echo '</p>';
     212
     213        echo '<p>';
     214        echo '<label for="' . $this->get_field_id( 'padding' ) . '">' .
     215            __( 'Padding between tags:' ) . '</label>';
     216        echo '<input class="widefat" id="' . $this->get_field_id( 'padding' ) .
     217            '" name="' . $this->get_field_name( 'padding' ) . '" type="text" ' .
     218            'value="' . esc_attr( $l_instance['padding'] ) . '" />';
    185219        echo '</p>';
    186220
     
    265299        }
    266300
     301        if ( 'default' == $p_new_instance['alignment'] ) {
     302            $l_instance['default'] = 'default';
     303        } else if ( 'left' == $p_new_instance['alignment'] ) {
     304            $l_instance['alignment'] = 'left';
     305        } else if ( 'center' == $p_new_instance['alignment'] ) {
     306            $l_instance['alignment'] = 'center';
     307        } else if ( 'right' == $p_new_instance['alignment'] ) {
     308            $l_instance['alignment'] = 'right';
     309        } else {
     310            $l_instance['alignment'] = $p_old_instance['alignment'];
     311        }
     312
     313        if ( is_numeric( $p_new_instance['padding'] ) ) {
     314            /* Force it to be a number. */
     315            $l_instance['padding'] = $p_new_instance['padding'] + 0;
     316        } else {
     317            /* Return to the original value. */
     318            $l_instance['padding'] = $p_old_instance['padding'] + 0;
     319        }
     320
    267321        if ( "" !=
    268322            get_taxonomy( stripslashes( $p_new_instance['taxonomy'] ) ) ) {
  • f2-tag-cloud-widget/tags/0.3.0/readme.txt

    r594867 r635012  
    33Tags: tags widget
    44Requires at least: 2.8
    5 Tested up to: 3.4.1
     5Tested up to: 3.4.2
    66Stable tag: trunk
    77License: GPLv2 or later
     
    2727of these options are explained in the main WordPress documentation.
    2828
     29In addition, there are additional options now available to control the
     30typography of tags with greater precision.
     31
     32* tag cloud alignment - left, center, right or theme default (default)
     33* tag padding - defaults to 0
     34
    2935== Installation ==
    3036
     
    4955Added the ability to select different taxonomies.
    5056
     57= 0.3.0 =
     58Added new options, to set padding between individual tags, and also to set
     59the horizontal alignment of the tags within the cloud.
     60
    5161== Upgrade Notice ==
    5262
    5363= 0.2.0 =
    5464Adds the ability to render clouds for different taxonomies.
     65
     66= 0.3.0 =
     67Adds the ability to set padding and alignment of tags.
  • f2-tag-cloud-widget/trunk/f2-tagcloud.php

    r594867 r635012  
    33Plugin Name: F2 Tag Cloud Widget
    44Plugin URI: http://www.fsquared.co.uk/software/f2-tagcloud/
    5 Version: 0.2.0
     5Version: 0.3.0
    66Author: fsquared limited
    77Author URI: http://www.fsquared.co.uk
     
    5050        'orderby'    => 'name',
    5151        'order'      => 'ASC',
     52        'alignment'  => 'default',
     53        'padding'    => '0',
    5254        'taxonomy'   => 'post_tag',
    5355        'exclude'    => null,
     
    9597
    9698        /* The actual content. */
    97         echo '<div class="tagcloud">';
    9899        $l_tag_params = wp_parse_args( $p_instance, $this->m_defaults );
    99         wp_tag_cloud( apply_filters('widget_tag_cloud_args', $l_tag_params ) );
     100        $l_tag_params["echo"] = 0;
     101        $l_tag_cloud_text = wp_tag_cloud( apply_filters('widget_tag_cloud_args', $l_tag_params ) );
     102
     103        echo '<div class="tagcloud"';
     104        if ( 'default' != $l_tag_params["alignment"] ) {
     105            echo ' style="text-align: ' . $l_tag_params["alignment"] . ';"';
     106        }
     107        echo '>';
     108        echo preg_replace( '/style=\'/', 'style=\'padding: ' .
     109            $l_tag_params["padding"] . 'px; ', $l_tag_cloud_text );
    100110        echo '</div>';
    101111
     
    183193            ' value="RAND">random</option>';
    184194        echo '</select>';
     195        echo '</p>';
     196
     197        echo '<p>';
     198        echo '<label for="' . $this->get_field_id( 'alignment' ) . '">' .
     199            __( 'Tag cloud alignment:' ) . '</label>';
     200        echo '<select class="widefat" id="' . $this->get_field_id( 'alignment' ) .
     201            '" name="' . $this->get_field_name( 'alignment' ) . '">';
     202        echo '<option ' . selected( 'default', $l_instance['alignment'], false ) .
     203            ' value="default">theme default</option>';
     204        echo '<option ' . selected( 'left', $l_instance['alignment'], false ) .
     205            ' value="left">left</option>';
     206        echo '<option ' . selected( 'center', $l_instance['alignment'], false ) .
     207            ' value="center">center</option>';
     208        echo '<option ' . selected( 'right', $l_instance['alignment'], false ) .
     209            ' value="right">right</option>';
     210        echo '</select>';
     211        echo '</p>';
     212
     213        echo '<p>';
     214        echo '<label for="' . $this->get_field_id( 'padding' ) . '">' .
     215            __( 'Padding between tags:' ) . '</label>';
     216        echo '<input class="widefat" id="' . $this->get_field_id( 'padding' ) .
     217            '" name="' . $this->get_field_name( 'padding' ) . '" type="text" ' .
     218            'value="' . esc_attr( $l_instance['padding'] ) . '" />';
    185219        echo '</p>';
    186220
     
    265299        }
    266300
     301        if ( 'default' == $p_new_instance['alignment'] ) {
     302            $l_instance['default'] = 'default';
     303        } else if ( 'left' == $p_new_instance['alignment'] ) {
     304            $l_instance['alignment'] = 'left';
     305        } else if ( 'center' == $p_new_instance['alignment'] ) {
     306            $l_instance['alignment'] = 'center';
     307        } else if ( 'right' == $p_new_instance['alignment'] ) {
     308            $l_instance['alignment'] = 'right';
     309        } else {
     310            $l_instance['alignment'] = $p_old_instance['alignment'];
     311        }
     312
     313        if ( is_numeric( $p_new_instance['padding'] ) ) {
     314            /* Force it to be a number. */
     315            $l_instance['padding'] = $p_new_instance['padding'] + 0;
     316        } else {
     317            /* Return to the original value. */
     318            $l_instance['padding'] = $p_old_instance['padding'] + 0;
     319        }
     320
    267321        if ( "" !=
    268322            get_taxonomy( stripslashes( $p_new_instance['taxonomy'] ) ) ) {
  • f2-tag-cloud-widget/trunk/readme.txt

    r594867 r635012  
    33Tags: tags widget
    44Requires at least: 2.8
    5 Tested up to: 3.4.1
     5Tested up to: 3.4.2
    66Stable tag: trunk
    77License: GPLv2 or later
     
    2727of these options are explained in the main WordPress documentation.
    2828
     29In addition, there are additional options now available to control the
     30typography of tags with greater precision.
     31
     32* tag cloud alignment - left, center, right or theme default (default)
     33* tag padding - defaults to 0
     34
    2935== Installation ==
    3036
     
    4955Added the ability to select different taxonomies.
    5056
     57= 0.3.0 =
     58Added new options, to set padding between individual tags, and also to set
     59the horizontal alignment of the tags within the cloud.
     60
    5161== Upgrade Notice ==
    5262
    5363= 0.2.0 =
    5464Adds the ability to render clouds for different taxonomies.
     65
     66= 0.3.0 =
     67Adds the ability to set padding and alignment of tags.
Note: See TracChangeset for help on using the changeset viewer.