Changeset 3087130
- Timestamp:
- 05/15/2024 12:22:31 PM (23 months ago)
- Location:
- chords-and-lyrics/trunk
- Files:
-
- 2 edited
-
ChordsAndLyrics.php (modified) (8 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
chords-and-lyrics/trunk/ChordsAndLyrics.php
r1860019 r3087130 3 3 * @package Chords_And_Lyrics 4 4 * @author Ron Lisle 5 * @version 1.75 * @version 2.0 6 6 */ 7 7 /* … … 9 9 Plugin URI: http://Lisles.net/ 10 10 Description: This plugin assists in the creation of staffless lead sheets. 11 Version: 1.711 Version: 2.0 12 12 Author: Ron Lisle 13 13 Author URI: http://Lisles.net … … 15 15 Refer to Readme.txt file for more information. 16 16 17 Copyright 2008-20 12Ron Lisle17 Copyright 2008-2024 Ron Lisle 18 18 19 19 This program is free software; you can redistribute it and/or modify … … 40 40 41 41 function chordsandlyrics_settings_init(){ 42 global $userdata; 43 wp_get_current_user(); 44 $user_settings_name = 'cnl_setting_values_for_' . $userdata->user_login; 42 $setting_prefix = cnl_setting_prefix(); 45 43 add_settings_section('cnl_setting_section','Chords and Lyrics Options','cnl_setting_section','reading'); 46 44 add_settings_field('lyrics-only','Display chords or lyrics only?','cnl_lyrics_only_enabled', … … 48 46 add_settings_field('european-chords','Display European chords?','cnl_european_chords_enabled', 49 47 'reading','cnl_setting_section'); 50 register_setting('reading',$user_settings_name); 48 register_setting('reading',$setting_prefix . 'lyrics_only'); 49 register_setting('reading',$setting_prefix . 'european'); 50 } 51 52 function cnl_setting_prefix(){ 53 $current_user = wp_get_current_user(); 54 if($current_user->exists()){ 55 return 'cnl_' . $current_user->user_login . '_'; 56 } 57 return 'cnl_unknown_'; 51 58 } 52 59 53 60 function cnl_setting_section(){ 54 echo '<p>Select options for displaying chords</p>'; 61 $current_user = wp_get_current_user(); 62 $debug_name = $current_user->user_login; 63 echo '<p>Select options for displaying chords for ' . $debug_name . '</p>'; 55 64 } 56 65 57 66 function cnl_lyrics_only_enabled(){ 58 global $userdata; 59 wp_get_current_user(); 60 $user_settings_name = 'cnl_setting_values_for_' . $userdata->user_login; 61 $cnl_options = get_option($user_settings_name); 62 if($cnl_options['lyrics-only']){ 67 $option_name = cnl_setting_prefix() . 'lyrics_only'; 68 $option = get_option($option_name); 69 if($option){ 63 70 $checked = ' checked="checked" '; 64 71 } 65 echo '<input '.$checked.' name="'.$ user_settings_name.'[lyrics-only]" type="checkbox" />Lyrics Only';72 echo '<input '.$checked.' name="'.$option_name.'" type="checkbox" />Lyrics Only'; 66 73 } 67 74 68 75 function cnl_european_chords_enabled(){ 69 global $userdata; 70 wp_get_current_user(); 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']){ 76 $option_name = cnl_setting_prefix() . 'european'; 77 $option = get_option($option_name); 78 if($option){ 74 79 $checked = ' checked="checked" '; 75 80 } 76 echo '<input '.$checked.' name="'.$ user_settings_name.'[european-chords]" type="checkbox" />European chords';81 echo '<input '.$checked.' name="'.$option_name.'" type="checkbox" />European chords'; 77 82 } 78 83 … … 125 130 { 126 131 private $lyricsOnly; 127 private $twoPages;128 132 private $transpose; 129 133 private $size; … … 133 137 public function __construct() 134 138 { 135 global $userdata; 136 wp_get_current_user(); 137 $user_settings_name = 'cnl_setting_values_for_' . $userdata->user_login; 138 $cnl_options = get_option($user_settings_name); 139 $this->lyricsOnly = $cnl_options['lyrics-only']; 140 $this->twoPages = $cnl_options['two-pages']; 139 $this->lyricsOnly = get_option(cnl_setting_prefix().'lyrics_only'); 141 140 $this->transpose = 0; 142 $this->displayEuropean = $cnl_options['european-chords'];141 $this->displayEuropean = get_option(cnl_setting_prefix().'european'); 143 142 } 144 143 … … 182 181 $lineNum = 1; 183 182 foreach( $text as $line ){ 184 if($this->twoPages=='on'){185 //TODO: provide a mechanism to allow the author to split pages186 }187 183 $returnText .= $this->FormatAndDisplayLine($line,$lineNum++); 188 184 } -
chords-and-lyrics/trunk/readme.txt
r1859971 r3087130 77 77 == Changelog == 78 78 79 = 1.8.0 = 80 * Fix deprecated get_currentuserinfo error 81 79 82 = 1.7.0 = 80 83 * Add support for European chord style (aHcdefg, B=Bb)
Note: See TracChangeset
for help on using the changeset viewer.