Plugin Directory

Changeset 140604


Ignore:
Timestamp:
07/29/2009 06:20:29 PM (17 years ago)
Author:
zetxek
Message:

Implemented options page: you can now customize the text shown as description of the hidden texts and the "helper text" of the links.

Location:
wplyrics/trunk/wplyrics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wplyrics/trunk/wplyrics/wp_lyrics.php

    r140600 r140604  
    22/*
    33Plugin Name: WP-Lyrics
    4 Plugin URI: http://bloqnum.com/wp-lyrics/
    5 Description: Simple plugin to hide the lyrics of the songs you publish (they will be between [lyrics] and [/lyrics])
     4Plugin URI: http://wordpress.org/extend/plugins/wplyrics/
     5Description: Simple plugin to hide the lyrics of the songs you publish (they will be between [lyrics] and [/lyrics]). Allows you to customize the replacement text.
    66Author: Adrian Moreno
    7 Version: 0.2
     7Version: 0.3
    88Author URI:  http://bloqnum.com
    99*/
     
    5858        */
    5959        function hidelyrics($content = '') {
     60           
    6061            $options = $this->load_options();
    6162           
    62             $pre = "<h5 class='wplyricstitle'>".$options['title']." <a class='wplyricslink' title='".$options['more']."' onclick='open_lyrics(this);' style='cursor:pointer;display:none;'>[+]</a></h5><div class='wplyrics'>";
     63            $pre = "<h5 class='wplyricstitle'>";
     64            $pre .= $options['title'];
     65            $pre .= " <a class='wplyricslink' title='";
     66            $pre .= $options['more'];
     67            $pre .= "' onclick='open_lyrics(this);' style='cursor:pointer;display:none;' >";
     68            $pre .= $options['symbol1'];
     69            $pre .= "</a></h5><div class='wplyrics'>";
     70           
    6371            $post = "</div>";
    6472           
     
    7381            add_option('wp_lyrics_more', 'Show the lyrics...');
    7482            add_option('wp_lyrics_less', 'Hide the lyrics...');
     83            add_option('wp_lyrics_symbol1', '[+]');
     84            add_option('wp_lyrics_symbol2', '[-]');             
    7585        }
    7686       
     
    7989            $wp_lyrics_more = get_option('wp_lyrics_more');
    8090            $wp_lyrics_less = get_option('wp_lyrics_less');
     91            $wp_lyrics_symbol1 = get_option('wp_lyrics_symbol1');
     92            $wp_lyrics_symbol2 = get_option('wp_lyrics_symbol2');
     93
    8194           
    8295            $options = array(
    8396                'title' => $wp_lyrics_title,
    8497                'more' => $wp_lyrics_more,
    85                 'less' => $wp_lyrics_less   
     98                'less' => $wp_lyrics_less,
     99                'symbol1' => $wp_lyrics_symbol1,
     100                'symbol2' => $wp_lyrics_symbol2             
    86101            );
    87102            return $options;
     
    100115                'title' => $options['title'],
    101116                'more' => $options['more'],
    102                 'less' => $options['less']
     117                'less' => $options['less'],
     118                'symbol1' => $options['symbol1'],
     119                'symbol2' => $options['symbol2']
    103120            ));
    104121           
     
    115132
    116133}
    117 
    118 
    119134       
    120135        /*
     
    123138       
    124139        function add_admin_pages(){
    125                 //add_submenu_page('options-general.php', "WP Lyrics", "WP Lyrics", 10, "WP Lyrics", array(&$this,"output_sub_admin_page_0"));
    126140                add_options_page('WP Lyrics Options', 'WP Lyrics', 8, 'wp_lyrics', 'output_admin_page');
    127141        }
     
    137151        $wp_lyrics_more = get_option('wp_lyrics_more');
    138152        $wp_lyrics_less = get_option('wp_lyrics_less');
    139    
     153        $wp_lyrics_symbol1 = get_option('wp_lyrics_symbol1');
     154        $wp_lyrics_symbol2 = get_option('wp_lyrics_symbol2');
     155       
     156
    140157        // Read in existing option value from database
    141158        $opt_val = get_option( $opt_name );
     
    148165            $wp_lyrics_more_val = $_POST['wp_lyrics_more'];
    149166            $wp_lyrics_less_val = $_POST['wp_lyrics_less'];
     167            $wp_lyrics_symbol1_val = $_POST['wp_lyrics_symbol1'];
     168            $wp_lyrics_symbol2_val = $_POST['wp_lyrics_symbol2'];
     169
    150170   
    151171            // Save the posted value in the database
     
    153173            update_option( 'wp_lyrics_more', $wp_lyrics_more_val );
    154174            update_option( 'wp_lyrics_less', $wp_lyrics_less_val );
     175            update_option( 'wp_lyrics_symbol1', $wp_lyrics_symbol1_val );
     176            update_option( 'wp_lyrics_symbol2', $wp_lyrics_symbol2_val );
     177
    155178   
    156179            // Put an options updated message on the screen
     
    178201                </p>           
    179202               
     203                <p><?php _e("Clickable 'View more' link text:", 'wp_lyrics' ); ?>
     204                <input type="text" name="wp_lyrics_symbol1" value="<?php echo $wp_lyrics_symbol1; ?>" size="4">
     205                </p>
     206               
     207                <p><?php _e("Clickable 'View less' link text:", 'wp_lyrics' ); ?>
     208                <input type="text" name="wp_lyrics_symbol2" value="<?php echo $wp_lyrics_symbol2; ?>" size="4">
     209                </p>                                   
     210               
    180211                <p class="submit">
    181                 <input type="submit" name="Submit" value="<?php _e('Update Options', 'mt_trans_domain' ) ?>" />
     212                <input type="submit" name="Submit" value="<?php _e('Update Options', 'wp_lyrics' ) ?>" />
    182213                </p>
    183214               
  • wplyrics/trunk/wplyrics/wplyrics.js

    r140600 r140604  
    99    more = WPLyricsSettings.more;
    1010    less = WPLyricsSettings.less;
    11 
     11    symb1 = WPLyricsSettings.symbol1;
     12    symb2 = WPLyricsSettings.symbol2;
    1213    //change [+]
    13     if (jQuery(el).html() == '[+]'){
    14         jQuery(el).html('[-]');
     14    if (jQuery(el).html() == symb1){
     15        jQuery(el).html(symb2);
    1516        jQuery(el).attr('title', less);
    1617    }else{
    17         jQuery(el).html('[+]').attr('title', more);
     18        jQuery(el).html(symb1).attr('title', more);
    1819    }
    1920}
Note: See TracChangeset for help on using the changeset viewer.