Plugin Directory

Changeset 539307


Ignore:
Timestamp:
05/03/2012 04:09:21 AM (14 years ago)
Author:
rlisle
Message:

Version 1.7 Add European chord support.

Location:
chords-and-lyrics/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • chords-and-lyrics/trunk/ChordsAndLyrics.php

    r250154 r539307  
    33 * @package Chords_And_Lyrics
    44 * @author  Ron Lisle
    5  * @version 1.6
     5 * @version 1.7
    66 */
    77/*
    88Plugin Name: ChordsAndLyrics
    9 Plugin URI: http://BuildAWebsiteWorkshops.com/
     9Plugin URI: http://Lisles.net/
    1010Description: This plugin assists in the creation of staffless lead sheets.
    11 Version: 1.6
     11Version: 1.7
    1212Author: Ron Lisle
    1313Author URI: http://Lisles.net
     
    1515Refer to Readme.txt file for more information.
    1616
    17 Copyright 2008-2010 Ron Lisle
     17Copyright 2008-2012 Ron Lisle
    1818
    1919This program is free software; you can redistribute it and/or modify
     
    4646    add_settings_field('lyrics-only','Display chords or lyrics only?','cnl_lyrics_only_enabled',
    4747                    'reading','cnl_setting_section');
     48    add_settings_field('european-chords','Display European chords?','cnl_european_chords_enabled',
     49                    'reading','cnl_setting_section');
    4850    register_setting('reading',$user_settings_name);
    4951}
    5052
    5153function cnl_setting_section(){
    52     echo '<p>Choose whether to display both chords and lyrics or lyrics only</p>';
     54    echo '<p>Select options for displaying chords</p>';
    5355}
    5456
     
    6466}
    6567
     68function cnl_european_chords_enabled(){
     69    global $userdata;
     70    get_currentuserinfo();
     71    $user_settings_name = 'cnl_setting_values_for_' . $userdata->user_login;
     72    $cnl_options = get_option($user_settings_name);
     73    if($cnl_options['european-chords']){
     74        $checked = ' checked="checked" ';
     75    }
     76    echo '<input '.$checked.' name="'.$user_settings_name.'[european-chords]" type="checkbox" />European chords';
     77}
    6678
    6779/*
     
    8597// [chordsandlyrics parm=val...] ... [/chordsandlyrics]
    8698// Parameters:
     99//      format="yes"                Enable/disable formatting
     100//      size="normal"               Adjust display size
    87101//      transpose="#"               Sets the # +/- half-steps to adjust chords.
     102//      european="yes"              Interpret input using european convention (aHcdefg and B=Bb)
    88103function chordsandlyricstag_func($atts, $content = null){
    89104    $cnlData = new ChordsAndLyricsData();
    90     extract(shortcode_atts(array('format' => 'yes', 'size' => 'normal', 'transpose' => '0'), $atts));
     105    extract(shortcode_atts(array('format' => 'yes', 'size' => 'normal', 'transpose' => '0', 'european' => 'no'), $atts));
    91106
    92107    if($format != 'yes') return "[chordsandlyrics]" . $content . "[/chordsandlyrics]";
     
    94109    $cnlData->setTranspose($transpose);
    95110    $cnlData->setSize($size);
     111    $cnlData->setEuropean($european);
    96112   
    97113    // Break content into separate lines.
     
    112128    private $transpose;
    113129    private $size;
     130    private $european;
     131    private $displayEuropean;
    114132   
    115133    public function __construct()
     
    122140        $this->twoPages = $cnl_options['two-pages'];
    123141        $this->transpose = 0;
     142        $this->displayEuropean = $cnl_options['european-chords'];
    124143    }
    125144
     
    136155    public function getSize(){
    137156        return $this->size;
     157    }
     158   
     159    public function setEuropean( $e ){
     160        $this->european = $e;
     161    }
     162    public function getEuropean(){
     163        return $this->european;
     164    }
     165    public function setDisplayEuropean( $e ){
     166        $this->displayEuropean = $e;
     167    }
     168    public function getDisplayEuropean(){
     169        return $this->displayEuropean;
    138170    }
    139171   
     
    306338        case 'b':
    307339        case 'B':
    308             $noteVal = 2;
     340            if($this->european == 'yes'){
     341                $noteVal = 1;
     342            }else{
     343                $noteVal = 2;
     344            }
    309345            break;
    310346        case 'c':
     
    327363        case 'G':
    328364            $noteVal = 10;
     365            break;
     366        case 'h':
     367        case 'H':
     368            $noteVal = 2;
    329369            break;
    330370        default:
     
    357397            break;
    358398        case 1:
    359             if($useFlats) $xlatedNote = "Bb";
    360             else $xlatedNote = "A#";
     399            if($this->displayEuropean){
     400                $xlatedNote = 'B';
     401            }else{
     402                if($useFlats) $xlatedNote = "Bb";
     403                else $xlatedNote = "A#";
     404            }
    361405            break;
    362406        case 2:
    363             $xlatedNote = 'B';
     407            if($this->displayEuropean){
     408                $xlatedNote = 'H';
     409            }else{
     410                $xlatedNote = 'B';
     411            }
    364412            break;
    365413        case 3:
  • chords-and-lyrics/trunk/readme.txt

    r250154 r539307  
    4747     
    4848== Frequently Asked Questions ==
    49 = Is it possible to customize the formatting of the lyrics and chord symbols =
     49= Is it possible to customize the formatting of the lyrics and chord symbols? =
    5050Yes. Adjust the CSS in your theme.
    5151Chords are wrapped within <div class="cnl"><div class="chord"><strong> tags.
    5252Lyrics are wrapped within a <div class="cnl"><div class="lyric"> tags.
     53= Can I display European chords? =
     54Yes. Beginning with version 1.7, European chord convention is supported.
     55A new option in the Reading Settings allows enabling display using aHcdefg instead of abcdefg.
     56For entering chords in a post using European chord convention, add the european=yes argument
     57to the chordsandlyrics short tag (eg. [chordsandlyrics european=yes])
    5358
    5459== Directions for Use ==
     
    7277== Changelog ==
    7378
     79= 1.7.0 =
     80* Add support for European chord style (aHcdefg, B=Bb)
     81
    7482= 1.6.0 =
    7583* Fix bug preventing headings from showing.
Note: See TracChangeset for help on using the changeset viewer.