Plugin Directory

Changeset 2874790


Ignore:
Timestamp:
03/04/2023 06:49:53 PM (3 years ago)
Author:
glewe
Message:

Tagging version 3.3.3

Location:
chordpress
Files:
5 edited
23 copied

Legend:

Unmodified
Added
Removed
  • chordpress/tags/3.3.3/chordpress.php

    r2871185 r2874790  
    1717 * Plugin URI:        https://lewe.gitbook.io/lewe-chordpress/
    1818 * Description:       This plugin renders ChordPro formatted text and chord diagrams in WordPress sites.
    19  * Version:           3.3.2
     19 * Version:           3.3.3
    2020 * Author:            George Lewe
    2121 * Author URI:        https://www.lewe.com
     
    3636 */
    3737define('CHORDPRESS_NAME', 'ChordPress');
    38 define('CHORDPRESS_VERSION', '3.3.2');
     38define('CHORDPRESS_VERSION', '3.3.3');
    3939define('CHORDPRESS_AUTHOR', 'George Lewe');
    4040define('CHORDPRESS_AUTHOR_URI', 'https://www.lewe.com');
  • chordpress/tags/3.3.3/includes/class-chordpress-chord.php

    r2871185 r2874790  
    493493     * Create SVGuitar chord div and script.
    494494     *
    495      * @since     2.1.0
    496      * @return    string             HTML SVGuitar chord div and script.
     495     * @since  2.1.0
     496     * @param  boolean  $floatleft Switch to float left (default: false)
     497     * @return string  HTML SVGuitar chord div and script.
    497498     */
    498499    public function createSvgChord($floatleft = false)
     
    524525    //--------------------------------------------------------------------------
    525526    /**
     527     * Create SVGuitar chord Javascript function.
     528     *
     529     * @since  2.1.0
     530     * @param  string  $id  Unique ID
     531     * @return string  SVGuitar Javascript function
     532     */
     533    public function createSvgChordFunction($id)
     534    {
     535        $output = "\n\n
     536        function drawChord" . $id . "() {
     537            var chart = new svguitar.SVGuitarChord('#" . $id . "')
     538            " . $this->buildChordParmeters() . "
     539            " . $this->buildConfigureParmeters() . "
     540            .draw();
     541        };
     542        \n\n";
     543        return $output;
     544    }
     545
     546    //--------------------------------------------------------------------------
     547    /**
    526548     * Get private property.
    527549     *
  • chordpress/tags/3.3.3/includes/class-chordpress-renderer.php

    r2871185 r2874790  
    346346     * @var      array
    347347     */
    348     private $arrKeys = array('A', 'Am', 'A#', 'Am#', 'Bb', 'Bmb', 'B', 'Bm', 'C', 'Cm', 'C#', 'Cm#', 'Db', 'Dmb', 'D', 'Dm', 'D#', 'Dm#', 'Eb', 'Emb', 'E', 'Em', 'F', 'Fm', 'G', 'Gm', 'G#', 'Gm#', 'Ab', 'Amb');
     348    private $arrKeys = array('A', 'Am', 'A#', 'A#m', 'Bb', 'Bbm', 'B', 'Bm', 'C', 'Cm', 'C#', 'C#m', 'Db', 'Dbm', 'D', 'Dm', 'D#', 'D#m', 'Eb', 'Ebm', 'E', 'Em', 'F', 'Fm', 'G', 'Gm', 'G#', 'G#m', 'Ab', 'Abm');
    349349
    350350    /**
     
    357357    private $arrTransposeValues = array(
    358358        'A' =>  array('A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#'),
    359         'Am' =>  array('Am', 'Am#', 'Bm', 'Cm', 'Cm#', 'Dm', 'Dm#', 'Em', 'Fm', 'Fm#', 'Gm', 'Gm#'),
     359        'Am' =>  array('Am', 'A#m', 'Bm', 'Cm', 'C#m', 'Dm', 'D#m', 'Em', 'Fm', 'F#m', 'Gm', 'G#m'),
    360360        'A#' => array('A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A'),
    361361        'Bb' => array('Bb', 'B', 'C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A'),
    362         'Am#' => array('Am#', 'Bm', 'Cm', 'Cm#', 'Dm', 'Dm#', 'Em', 'Fm', 'Fm#', 'Gm', 'Gm#', 'Am'),
    363         'Bmb' => array('Bmb', 'Bm', 'Cm', 'Dmb', 'Dm', 'Emb', 'Em', 'Fm', 'Gmb', 'Gm', 'Amb', 'Am'),
     362        'A#m' => array('A#m', 'Bm', 'Cm', 'C#m', 'Dm', 'D#m', 'Em', 'Fm', 'F#m', 'Gm', 'G#m', 'Am'),
     363        'Bbm' => array('Bbm', 'Bm', 'Cm', 'Dbm', 'Dm', 'Ebm', 'Em', 'Fm', 'Gbm', 'Gm', 'Abm', 'Am'),
    364364        'B' => array('B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#'),
    365         'Bm' => array('Bm', 'Cm', 'Cm#', 'Dm', 'Dm#', 'Em', 'Fm', 'Fm#', 'Gm', 'Gm#', 'Am', 'Am#'),
     365        'Bm' => array('Bm', 'Cm', 'C#m', 'Dm', 'D#m', 'Em', 'Fm', 'F#m', 'Gm', 'G#m', 'Am', 'A#m'),
    366366        'C' => array('C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'),
    367         'Cm' => array('Cm', 'Cm#', 'Dm', 'Dm#', 'Em', 'Fm', 'Fm#', 'Gm', 'Gm#', 'Am', 'Am#', 'Bm'),
     367        'Cm' => array('Cm', 'C#m', 'Dm', 'D#m', 'Em', 'Fm', 'F#m', 'Gm', 'G#m', 'Am', 'A#m', 'Bm'),
    368368        'C#' => array('C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B', 'C'),
    369369        'Db' => array('Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A', 'Bb', 'B', 'C'),
    370         'Cm#' => array('Cm#', 'Dm', 'Dm#', 'Em', 'Fm', 'Fm#', 'Gm', 'Gm#', 'Am', 'Am#', 'Bm', 'Cm'),
    371         'Dmb' => array('Dmb', 'Dm', 'Emb', 'Em', 'Fm', 'Gmb', 'Gm', 'Amb', 'Am', 'Bmb', 'Bm', 'Cm'),
     370        'C#m' => array('C#m', 'Dm', 'D#m', 'Em', 'Fm', 'F#m', 'Gm', 'G#m', 'Am', 'A#m', 'Bm', 'Cm'),
     371        'Dbm' => array('Dbm', 'Dm', 'Ebm', 'Em', 'Fm', 'Gbm', 'Gm', 'Abm', 'Am', 'Bbm', 'Bm', 'Cm'),
    372372        'D' => array('D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B', 'C', 'C#'),
    373         'Dm' => array('Dm', 'Dm#', 'Em', 'Fm', 'Fm#', 'Gm', 'Gm#', 'Am', 'Am#', 'Bm', 'Cm', 'Cm#'),
     373        'Dm' => array('Dm', 'D#m', 'Em', 'Fm', 'F#m', 'Gm', 'G#m', 'Am', 'A#m', 'Bm', 'Cm', 'C#m'),
    374374        'D#' => array('D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B', 'C', 'C#', 'D'),
    375375        'Eb' => array('Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A', 'Bb', 'B', 'C', 'Db', 'D'),
    376         'Dm#' => array('Dm#', 'Em', 'Fm', 'Fm#', 'Gm', 'Gm#', 'Am', 'Am#', 'Bm', 'Cm', 'Cm#', 'Dm'),
    377         'Emb' => array('Emb', 'Em', 'Fm', 'Gmb', 'Gm', 'Amb', 'Am', 'Bmb', 'Bm', 'Cm', 'Dmb', 'Dm'),
     376        'D#m' => array('D#m', 'Em', 'Fm', 'F#m', 'Gm', 'G#m', 'Am', 'A#m', 'Bm', 'Cm', 'C#m', 'Dm'),
     377        'Ebm' => array('Ebm', 'Em', 'Fm', 'Gbm', 'Gm', 'Abm', 'Am', 'Bbm', 'Bm', 'Cm', 'Dbm', 'Dm'),
    378378        'E' => array('E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B', 'C', 'C#', 'D', 'D#'),
    379         'Em' => array('Em', 'Fm', 'Fm#', 'Gm', 'Gm#', 'Am', 'Am#', 'Bm', 'Cm', 'Cm#', 'Dm', 'Dm#'),
     379        'Em' => array('Em', 'Fm', 'F#m', 'Gm', 'G#m', 'Am', 'A#m', 'Bm', 'Cm', 'C#m', 'Dm', 'D#m'),
    380380        'F' => array('F', 'F#', 'G', 'G#', 'A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E'),
    381         'Fm' => array('Fm', 'Fm#', 'Gm', 'Gm#', 'Am', 'Am#', 'Bm', 'Cm', 'Cm#', 'Dm', 'Dm#', 'Em'),
     381        'Fm' => array('Fm', 'F#m', 'Gm', 'G#m', 'Am', 'A#m', 'Bm', 'Cm', 'C#m', 'Dm', 'D#m', 'Em'),
    382382        'F#' => array('F#', 'G', 'G#', 'A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F'),
    383383        'Gb' => array('Gb', 'G', 'Ab', 'A', 'Bb', 'B', 'C', 'Db', 'D', 'Eb', 'E', 'F'),
    384         'Fm#' => array('Fm#', 'Gm', 'Gm#', 'Am', 'Am#', 'Bm', 'Cm', 'Cm#', 'Dm', 'Dm#', 'Em', 'Fm'),
    385         'Gmb' => array('Gmb', 'Gm', 'Amb', 'Am', 'Bmb', 'Bm', 'Cm', 'Dmb', 'Dm', 'Emb', 'Em', 'Fm'),
     384        'F#m' => array('F#m', 'Gm', 'G#m', 'Am', 'A#m', 'Bm', 'Cm', 'C#m', 'Dm', 'D#m', 'Em', 'Fm'),
     385        'Gbm' => array('Gbm', 'Gm', 'Abm', 'Am', 'Bbm', 'Bm', 'Cm', 'Dbm', 'Dm', 'Ebm', 'Em', 'Fm'),
    386386        'G' => array('G', 'G#', 'A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#'),
    387         'Gm' => array('Gm', 'Gm#', 'Am', 'Am#', 'Bm', 'Cm', 'Cm#', 'Dm', 'Dm#', 'Em', 'Fm', 'Fm#'),
     387        'Gm' => array('Gm', 'G#m', 'Am', 'A#m', 'Bm', 'Cm', 'C#m', 'Dm', 'D#m', 'Em', 'Fm', 'F#m'),
    388388        'G#' => array('G#', 'A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G'),
    389389        'Ab' => array('Ab', 'A', 'Bb', 'B', 'C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G'),
    390         'Gm#' => array('Gm#', 'Am', 'Am#', 'Bm', 'Cm', 'Cm#', 'Dm', 'Dm#', 'Em', 'Fm', 'Fm#', 'Gm'),
    391         'Amb' => array('Amb', 'Am', 'Bmb', 'Bm', 'Cm', 'Dmb', 'Dm', 'Emb', 'Em', 'Fm', 'Gmb', 'Gm'),
     390        'G#m' => array('G#m', 'Am', 'A#m', 'Bm', 'Cm', 'C#m', 'Dm', 'D#m', 'Em', 'Fm', 'F#m', 'Gm'),
     391        'Abm' => array('Abm', 'Am', 'Bbm', 'Bm', 'Cm', 'Dbm', 'Dm', 'Ebm', 'Em', 'Fm', 'Gbm', 'Gm'),
    392392    );
    393393
     
    582582
    583583                $transposeForm = __('Transpose up', 'chordpress') . "
    584                 <select id=\"selTranspose\" onchange=\"transposeChords();return false;\">
     584                <select id=\"selTranspose-%cpressID%\" onchange=\"transposeChords('%cpressID%');return false;\">
    585585                    <option value=\"0\">" . $tvalues[0] . "</option>
    586586                    <option value=\"1\">" . $tvalues[1] . "</option>
     
    608608         * Print header if directives exist
    609609         */
     610        $randId = $this->random_string();
    610611        if (strlen($this->arrDirectives['title']) && !$this->hideTitle) {
    611             $cpressID = str_replace(' ', '-', strtolower(trim($this->arrDirectives['title'])));
     612            $cpressID = str_replace(' ', '-', strtolower(trim($this->arrDirectives['title']))) . '-' . $randId;
    612613            $returnText = str_replace('%cpressID%', $cpressID, $returnText);
    613614            $returnText .= '<' . $this->titleLevel . '>' . $this->arrDirectives['title'] . '</' . $this->titleLevel . '>';
    614615        } else {
    615             $cpressID = 'ccpress-id';
     616            $cpressID = 'ccpress-id-' . $randId;
    616617            $returnText = str_replace('%cpressID%', $cpressID, $returnText);
    617618        }
     
    639640            if (strlen($this->arrDirectives['key'])) {
    640641                $returnText .= esc_html(__('Key (original)', 'chordpress')) . ': ' . $this->arrDirectives['key'] . '<br>';
    641                 $returnText .= esc_html(__('Key (transposed)', 'chordpress')) . ': <span class="chord-hidable key-0">' . $this->arrDirectives['key'] . '</span>';
     642                $returnText .= esc_html(__('Key (transposed)', 'chordpress')) . ': <span class="chord-hidable-%cpressID% key-%cpressID%-0">' . $this->arrDirectives['key'] . '</span>';
    642643                for ($t = 1; $t <= 11; $t++) {
    643                     $returnText .= '<span class="chord-hidable key-' . $t . '" style="display:none">' . $this->arrTransposeValues[$this->arrDirectives['key']][$t] . '</span>';
     644                    $returnText .= '<span class="chord-hidable-%cpressID% key-%cpressID%-' . $t . '" style="display:none">' . $this->arrTransposeValues[$this->arrDirectives['key']][$t] . '</span>';
    644645                }
    645646                $returnText .= '<br>';
     
    656657         */
    657658        foreach ($text as $line) {
    658             $returnText .= $this->formatAndDisplayLine($line);
     659            $returnText .= str_replace('%cpressID%', $cpressID, $this->formatAndDisplayLine($line));
     660            // $returnText .= $this->formatAndDisplayLine($line);
    659661        }
    660662
     
    829831                    if (strlen(trim($arrChords[$i])) > 0) {
    830832
    831                         $returnText .= "<div class=\"chord chord-hidable key-0\"><span class=\"chordshort\">";
     833                        $returnText .= "<div class=\"chord chord-hidable-%cpressID% key-%cpressID%-0\"><span class=\"chordshort\">";
    832834
    833835                        /**
     
    843845                        }
    844846
    845                         $returnText .= '</span>&nbsp;</div>';
     847                        $returnText .= "</span>&nbsp;</div>\n";
    846848
    847849                        /**
     
    859861                             * Allow chords starting with a ~ as chord placeholders. Just return the string.
    860862                             */
    861                             if ($arrChords[$i][0] == '~') {
    862                                 $returnText .= '<div class="chord chord-hidable key-' . $t . '" style="display:none"><span class="chordshort">' . $arrChords[$i] . '</span>&nbsp;</div>';
     863                            if (in_array($arrChords[$i][0], ['~', '|', '/', '.'])) {
     864                                $returnText .= '<div class="chord chord-hidable-%cpressID% key-%cpressID%-' . $t . '" style="display:none"><span class="chordshort">' . $arrChords[$i] . '</span>&nbsp;</div>';
     865                                $returnText .= "\n";
    863866                            } else {
    864867                                /**
     
    866869                                 */
    867870                                $theChord = $this->formatChord($arrChords[$i]);
    868                                 $returnText .= '<div class="chord chord-hidable key-' . $t . '" style="display:none"><span class="chordshort">' . $theChord . '</span>&nbsp;</div>';
     871                                $returnText .= '<div class="chord chord-hidable-%cpressID% key-%cpressID%-' . $t . '" style="display:none"><span class="chordshort">' . $theChord . '</span>&nbsp;</div>';
    869872                            }
    870873                        }
     
    882885                            if ($endOf1stWord > 0 && $numSpaces == 1) {
    883886                                $returnText .= substr($lyrics, 0, $endOf1stWord) . '&nbsp;';
    884                                 // $returnText .= substr($lyrics, 0, $endOf1stWord);
    885887                                $lyrics = substr($lyrics, $endOf1stWord);
    886888                                $returnText .= "</div></div>\n<div class=\"cpress_line_section\">\n<div class=\"chord\">&nbsp;</div><div class=\"lyric\">";
     
    14501452    }
    14511453
     1454    /**
     1455     * Generate random string.
     1456     *
     1457     * @param  integer    $length    Length of random string to generate.
     1458     * @return string                Random string
     1459     */
     1460    private function random_string($length = 10)
     1461    {
     1462        return substr(str_shuffle(str_repeat($x = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil($length / strlen($x)))), 1, $length);
     1463    }
     1464
    14521465    // ---------------------------------------------------------------------------
    14531466    /**
  • chordpress/tags/3.3.3/public/js/chordpress-public.js

    r2752198 r2874790  
    2121function dismissParent(el) {
    2222
    23     el.parentNode.style.display='none';
     23  el.parentNode.style.display = 'none';
    2424
    2525};
     
    3333 * @since       1.3.0
    3434 */
    35 function transposeChords() {
     35function transposeChords(cpressId) {
    3636
    37     /**
    38      * Get value from Transpose listbox
    39      */
    40     var x = document.getElementById("selTranspose").value;
     37  /**
     38   * Get value from Transpose listbox
     39   */
     40  var x = document.getElementById("selTranspose-" + cpressId).value;
    4141
    42     /**
    43      * Hide all hidable chords
    44      */
    45     var divsToHide = document.getElementsByClassName("chord-hidable");
     42  /**
     43   * Hide all hidable chords
     44   */
     45  // var divsToHide = document.getElementsByClassName("chord-hidable");
     46  var divsToHide = document.getElementsByClassName("chord-hidable-" + cpressId);
    4647
    47     for (var i = 0; i < divsToHide.length; i++) {
    48         divsToHide[i].style.display = "none";
    49     }
     48  for (var i = 0; i < divsToHide.length; i++) {
     49    divsToHide[i].style.display = "none";
     50  }
    5051
    51     /**
    52      * Now show those for the selected transpose value
    53      */
    54     var divsToShow = document.getElementsByClassName("key-"+x);
     52  /**
     53   * Now show those for the selected transpose value
     54   */
     55  var divsToShow = document.getElementsByClassName("key-" + cpressId + '-' + x);
    5556
    56     for (var i = 0; i < divsToShow.length; i++) {
    57         divsToShow[i].style.display = "";
    58     }
     57  for (var i = 0; i < divsToShow.length; i++) {
     58    divsToShow[i].style.display = "";
     59  }
    5960
    6061}
     
    7273function printCpress(elem) {
    7374
    74     var mywindow = window.open('', 'PRINT', 'height=400,width=600');
    75     mywindow.document.write('<html><head><title>' + document.title + '</title>');
    76     mywindow.document.write('</head><body style=\"font-family:sans-serif;margin: 1.6cm;\">');
    77     mywindow.document.write('<style>@page { margin: 0; } div.cpress_interaction { display: none; }</style>');
    78     mywindow.document.write(document.getElementById(elem).innerHTML);
    79     mywindow.document.write('</body></html>');
    80     mywindow.document.close(); // necessary for IE >= 10
    81     mywindow.focus(); // necessary for IE >= 10*/
    82     mywindow.print();
    83     mywindow.close();
    84     return true;
    85    
     75  var mywindow = window.open('', 'PRINT', 'height=400,width=600');
     76  mywindow.document.write('<html><head><title>' + document.title + '</title>');
     77  mywindow.document.write('</head><body style=\"font-family:sans-serif;margin: 1.6cm;\">');
     78  mywindow.document.write('<style>@page { margin: 0; } div.cpress_interaction { display: none; }</style>');
     79  mywindow.document.write(document.getElementById(elem).innerHTML);
     80  mywindow.document.write('</body></html>');
     81  mywindow.document.close(); // necessary for IE >= 10
     82  mywindow.focus(); // necessary for IE >= 10*/
     83  mywindow.print();
     84  mywindow.close();
     85  return true;
     86
    8687}
    8788
  • chordpress/tags/3.3.3/readme.txt

    r2871186 r2874790  
    55Requires at least: 4.0
    66Tested up to: 6.1
    7 Stable tag: 3.3.2
     7Stable tag: 3.3.3
    88Requires PHP: 5.2.4
    99License: GPLv3
     
    130130
    131131== Changelog ==
     132= 3.3.3 =
     133* 2023-03-04
     134* Corrected some chord shortnames
     135* Allow multiple interactive songs on one page
     136
    132137= 3.3.2 =
    133138* 2023-02-26
  • chordpress/trunk/chordpress.php

    r2871185 r2874790  
    1717 * Plugin URI:        https://lewe.gitbook.io/lewe-chordpress/
    1818 * Description:       This plugin renders ChordPro formatted text and chord diagrams in WordPress sites.
    19  * Version:           3.3.2
     19 * Version:           3.3.3
    2020 * Author:            George Lewe
    2121 * Author URI:        https://www.lewe.com
     
    3636 */
    3737define('CHORDPRESS_NAME', 'ChordPress');
    38 define('CHORDPRESS_VERSION', '3.3.2');
     38define('CHORDPRESS_VERSION', '3.3.3');
    3939define('CHORDPRESS_AUTHOR', 'George Lewe');
    4040define('CHORDPRESS_AUTHOR_URI', 'https://www.lewe.com');
  • chordpress/trunk/includes/class-chordpress-chord.php

    r2871185 r2874790  
    493493     * Create SVGuitar chord div and script.
    494494     *
    495      * @since     2.1.0
    496      * @return    string             HTML SVGuitar chord div and script.
     495     * @since  2.1.0
     496     * @param  boolean  $floatleft Switch to float left (default: false)
     497     * @return string  HTML SVGuitar chord div and script.
    497498     */
    498499    public function createSvgChord($floatleft = false)
     
    524525    //--------------------------------------------------------------------------
    525526    /**
     527     * Create SVGuitar chord Javascript function.
     528     *
     529     * @since  2.1.0
     530     * @param  string  $id  Unique ID
     531     * @return string  SVGuitar Javascript function
     532     */
     533    public function createSvgChordFunction($id)
     534    {
     535        $output = "\n\n
     536        function drawChord" . $id . "() {
     537            var chart = new svguitar.SVGuitarChord('#" . $id . "')
     538            " . $this->buildChordParmeters() . "
     539            " . $this->buildConfigureParmeters() . "
     540            .draw();
     541        };
     542        \n\n";
     543        return $output;
     544    }
     545
     546    //--------------------------------------------------------------------------
     547    /**
    526548     * Get private property.
    527549     *
  • chordpress/trunk/includes/class-chordpress-renderer.php

    r2871185 r2874790  
    346346     * @var      array
    347347     */
    348     private $arrKeys = array('A', 'Am', 'A#', 'Am#', 'Bb', 'Bmb', 'B', 'Bm', 'C', 'Cm', 'C#', 'Cm#', 'Db', 'Dmb', 'D', 'Dm', 'D#', 'Dm#', 'Eb', 'Emb', 'E', 'Em', 'F', 'Fm', 'G', 'Gm', 'G#', 'Gm#', 'Ab', 'Amb');
     348    private $arrKeys = array('A', 'Am', 'A#', 'A#m', 'Bb', 'Bbm', 'B', 'Bm', 'C', 'Cm', 'C#', 'C#m', 'Db', 'Dbm', 'D', 'Dm', 'D#', 'D#m', 'Eb', 'Ebm', 'E', 'Em', 'F', 'Fm', 'G', 'Gm', 'G#', 'G#m', 'Ab', 'Abm');
    349349
    350350    /**
     
    357357    private $arrTransposeValues = array(
    358358        'A' =>  array('A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#'),
    359         'Am' =>  array('Am', 'Am#', 'Bm', 'Cm', 'Cm#', 'Dm', 'Dm#', 'Em', 'Fm', 'Fm#', 'Gm', 'Gm#'),
     359        'Am' =>  array('Am', 'A#m', 'Bm', 'Cm', 'C#m', 'Dm', 'D#m', 'Em', 'Fm', 'F#m', 'Gm', 'G#m'),
    360360        'A#' => array('A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A'),
    361361        'Bb' => array('Bb', 'B', 'C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A'),
    362         'Am#' => array('Am#', 'Bm', 'Cm', 'Cm#', 'Dm', 'Dm#', 'Em', 'Fm', 'Fm#', 'Gm', 'Gm#', 'Am'),
    363         'Bmb' => array('Bmb', 'Bm', 'Cm', 'Dmb', 'Dm', 'Emb', 'Em', 'Fm', 'Gmb', 'Gm', 'Amb', 'Am'),
     362        'A#m' => array('A#m', 'Bm', 'Cm', 'C#m', 'Dm', 'D#m', 'Em', 'Fm', 'F#m', 'Gm', 'G#m', 'Am'),
     363        'Bbm' => array('Bbm', 'Bm', 'Cm', 'Dbm', 'Dm', 'Ebm', 'Em', 'Fm', 'Gbm', 'Gm', 'Abm', 'Am'),
    364364        'B' => array('B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#'),
    365         'Bm' => array('Bm', 'Cm', 'Cm#', 'Dm', 'Dm#', 'Em', 'Fm', 'Fm#', 'Gm', 'Gm#', 'Am', 'Am#'),
     365        'Bm' => array('Bm', 'Cm', 'C#m', 'Dm', 'D#m', 'Em', 'Fm', 'F#m', 'Gm', 'G#m', 'Am', 'A#m'),
    366366        'C' => array('C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'),
    367         'Cm' => array('Cm', 'Cm#', 'Dm', 'Dm#', 'Em', 'Fm', 'Fm#', 'Gm', 'Gm#', 'Am', 'Am#', 'Bm'),
     367        'Cm' => array('Cm', 'C#m', 'Dm', 'D#m', 'Em', 'Fm', 'F#m', 'Gm', 'G#m', 'Am', 'A#m', 'Bm'),
    368368        'C#' => array('C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B', 'C'),
    369369        'Db' => array('Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A', 'Bb', 'B', 'C'),
    370         'Cm#' => array('Cm#', 'Dm', 'Dm#', 'Em', 'Fm', 'Fm#', 'Gm', 'Gm#', 'Am', 'Am#', 'Bm', 'Cm'),
    371         'Dmb' => array('Dmb', 'Dm', 'Emb', 'Em', 'Fm', 'Gmb', 'Gm', 'Amb', 'Am', 'Bmb', 'Bm', 'Cm'),
     370        'C#m' => array('C#m', 'Dm', 'D#m', 'Em', 'Fm', 'F#m', 'Gm', 'G#m', 'Am', 'A#m', 'Bm', 'Cm'),
     371        'Dbm' => array('Dbm', 'Dm', 'Ebm', 'Em', 'Fm', 'Gbm', 'Gm', 'Abm', 'Am', 'Bbm', 'Bm', 'Cm'),
    372372        'D' => array('D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B', 'C', 'C#'),
    373         'Dm' => array('Dm', 'Dm#', 'Em', 'Fm', 'Fm#', 'Gm', 'Gm#', 'Am', 'Am#', 'Bm', 'Cm', 'Cm#'),
     373        'Dm' => array('Dm', 'D#m', 'Em', 'Fm', 'F#m', 'Gm', 'G#m', 'Am', 'A#m', 'Bm', 'Cm', 'C#m'),
    374374        'D#' => array('D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B', 'C', 'C#', 'D'),
    375375        'Eb' => array('Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A', 'Bb', 'B', 'C', 'Db', 'D'),
    376         'Dm#' => array('Dm#', 'Em', 'Fm', 'Fm#', 'Gm', 'Gm#', 'Am', 'Am#', 'Bm', 'Cm', 'Cm#', 'Dm'),
    377         'Emb' => array('Emb', 'Em', 'Fm', 'Gmb', 'Gm', 'Amb', 'Am', 'Bmb', 'Bm', 'Cm', 'Dmb', 'Dm'),
     376        'D#m' => array('D#m', 'Em', 'Fm', 'F#m', 'Gm', 'G#m', 'Am', 'A#m', 'Bm', 'Cm', 'C#m', 'Dm'),
     377        'Ebm' => array('Ebm', 'Em', 'Fm', 'Gbm', 'Gm', 'Abm', 'Am', 'Bbm', 'Bm', 'Cm', 'Dbm', 'Dm'),
    378378        'E' => array('E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B', 'C', 'C#', 'D', 'D#'),
    379         'Em' => array('Em', 'Fm', 'Fm#', 'Gm', 'Gm#', 'Am', 'Am#', 'Bm', 'Cm', 'Cm#', 'Dm', 'Dm#'),
     379        'Em' => array('Em', 'Fm', 'F#m', 'Gm', 'G#m', 'Am', 'A#m', 'Bm', 'Cm', 'C#m', 'Dm', 'D#m'),
    380380        'F' => array('F', 'F#', 'G', 'G#', 'A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E'),
    381         'Fm' => array('Fm', 'Fm#', 'Gm', 'Gm#', 'Am', 'Am#', 'Bm', 'Cm', 'Cm#', 'Dm', 'Dm#', 'Em'),
     381        'Fm' => array('Fm', 'F#m', 'Gm', 'G#m', 'Am', 'A#m', 'Bm', 'Cm', 'C#m', 'Dm', 'D#m', 'Em'),
    382382        'F#' => array('F#', 'G', 'G#', 'A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F'),
    383383        'Gb' => array('Gb', 'G', 'Ab', 'A', 'Bb', 'B', 'C', 'Db', 'D', 'Eb', 'E', 'F'),
    384         'Fm#' => array('Fm#', 'Gm', 'Gm#', 'Am', 'Am#', 'Bm', 'Cm', 'Cm#', 'Dm', 'Dm#', 'Em', 'Fm'),
    385         'Gmb' => array('Gmb', 'Gm', 'Amb', 'Am', 'Bmb', 'Bm', 'Cm', 'Dmb', 'Dm', 'Emb', 'Em', 'Fm'),
     384        'F#m' => array('F#m', 'Gm', 'G#m', 'Am', 'A#m', 'Bm', 'Cm', 'C#m', 'Dm', 'D#m', 'Em', 'Fm'),
     385        'Gbm' => array('Gbm', 'Gm', 'Abm', 'Am', 'Bbm', 'Bm', 'Cm', 'Dbm', 'Dm', 'Ebm', 'Em', 'Fm'),
    386386        'G' => array('G', 'G#', 'A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#'),
    387         'Gm' => array('Gm', 'Gm#', 'Am', 'Am#', 'Bm', 'Cm', 'Cm#', 'Dm', 'Dm#', 'Em', 'Fm', 'Fm#'),
     387        'Gm' => array('Gm', 'G#m', 'Am', 'A#m', 'Bm', 'Cm', 'C#m', 'Dm', 'D#m', 'Em', 'Fm', 'F#m'),
    388388        'G#' => array('G#', 'A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G'),
    389389        'Ab' => array('Ab', 'A', 'Bb', 'B', 'C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G'),
    390         'Gm#' => array('Gm#', 'Am', 'Am#', 'Bm', 'Cm', 'Cm#', 'Dm', 'Dm#', 'Em', 'Fm', 'Fm#', 'Gm'),
    391         'Amb' => array('Amb', 'Am', 'Bmb', 'Bm', 'Cm', 'Dmb', 'Dm', 'Emb', 'Em', 'Fm', 'Gmb', 'Gm'),
     390        'G#m' => array('G#m', 'Am', 'A#m', 'Bm', 'Cm', 'C#m', 'Dm', 'D#m', 'Em', 'Fm', 'F#m', 'Gm'),
     391        'Abm' => array('Abm', 'Am', 'Bbm', 'Bm', 'Cm', 'Dbm', 'Dm', 'Ebm', 'Em', 'Fm', 'Gbm', 'Gm'),
    392392    );
    393393
     
    582582
    583583                $transposeForm = __('Transpose up', 'chordpress') . "
    584                 <select id=\"selTranspose\" onchange=\"transposeChords();return false;\">
     584                <select id=\"selTranspose-%cpressID%\" onchange=\"transposeChords('%cpressID%');return false;\">
    585585                    <option value=\"0\">" . $tvalues[0] . "</option>
    586586                    <option value=\"1\">" . $tvalues[1] . "</option>
     
    608608         * Print header if directives exist
    609609         */
     610        $randId = $this->random_string();
    610611        if (strlen($this->arrDirectives['title']) && !$this->hideTitle) {
    611             $cpressID = str_replace(' ', '-', strtolower(trim($this->arrDirectives['title'])));
     612            $cpressID = str_replace(' ', '-', strtolower(trim($this->arrDirectives['title']))) . '-' . $randId;
    612613            $returnText = str_replace('%cpressID%', $cpressID, $returnText);
    613614            $returnText .= '<' . $this->titleLevel . '>' . $this->arrDirectives['title'] . '</' . $this->titleLevel . '>';
    614615        } else {
    615             $cpressID = 'ccpress-id';
     616            $cpressID = 'ccpress-id-' . $randId;
    616617            $returnText = str_replace('%cpressID%', $cpressID, $returnText);
    617618        }
     
    639640            if (strlen($this->arrDirectives['key'])) {
    640641                $returnText .= esc_html(__('Key (original)', 'chordpress')) . ': ' . $this->arrDirectives['key'] . '<br>';
    641                 $returnText .= esc_html(__('Key (transposed)', 'chordpress')) . ': <span class="chord-hidable key-0">' . $this->arrDirectives['key'] . '</span>';
     642                $returnText .= esc_html(__('Key (transposed)', 'chordpress')) . ': <span class="chord-hidable-%cpressID% key-%cpressID%-0">' . $this->arrDirectives['key'] . '</span>';
    642643                for ($t = 1; $t <= 11; $t++) {
    643                     $returnText .= '<span class="chord-hidable key-' . $t . '" style="display:none">' . $this->arrTransposeValues[$this->arrDirectives['key']][$t] . '</span>';
     644                    $returnText .= '<span class="chord-hidable-%cpressID% key-%cpressID%-' . $t . '" style="display:none">' . $this->arrTransposeValues[$this->arrDirectives['key']][$t] . '</span>';
    644645                }
    645646                $returnText .= '<br>';
     
    656657         */
    657658        foreach ($text as $line) {
    658             $returnText .= $this->formatAndDisplayLine($line);
     659            $returnText .= str_replace('%cpressID%', $cpressID, $this->formatAndDisplayLine($line));
     660            // $returnText .= $this->formatAndDisplayLine($line);
    659661        }
    660662
     
    829831                    if (strlen(trim($arrChords[$i])) > 0) {
    830832
    831                         $returnText .= "<div class=\"chord chord-hidable key-0\"><span class=\"chordshort\">";
     833                        $returnText .= "<div class=\"chord chord-hidable-%cpressID% key-%cpressID%-0\"><span class=\"chordshort\">";
    832834
    833835                        /**
     
    843845                        }
    844846
    845                         $returnText .= '</span>&nbsp;</div>';
     847                        $returnText .= "</span>&nbsp;</div>\n";
    846848
    847849                        /**
     
    859861                             * Allow chords starting with a ~ as chord placeholders. Just return the string.
    860862                             */
    861                             if ($arrChords[$i][0] == '~') {
    862                                 $returnText .= '<div class="chord chord-hidable key-' . $t . '" style="display:none"><span class="chordshort">' . $arrChords[$i] . '</span>&nbsp;</div>';
     863                            if (in_array($arrChords[$i][0], ['~', '|', '/', '.'])) {
     864                                $returnText .= '<div class="chord chord-hidable-%cpressID% key-%cpressID%-' . $t . '" style="display:none"><span class="chordshort">' . $arrChords[$i] . '</span>&nbsp;</div>';
     865                                $returnText .= "\n";
    863866                            } else {
    864867                                /**
     
    866869                                 */
    867870                                $theChord = $this->formatChord($arrChords[$i]);
    868                                 $returnText .= '<div class="chord chord-hidable key-' . $t . '" style="display:none"><span class="chordshort">' . $theChord . '</span>&nbsp;</div>';
     871                                $returnText .= '<div class="chord chord-hidable-%cpressID% key-%cpressID%-' . $t . '" style="display:none"><span class="chordshort">' . $theChord . '</span>&nbsp;</div>';
    869872                            }
    870873                        }
     
    882885                            if ($endOf1stWord > 0 && $numSpaces == 1) {
    883886                                $returnText .= substr($lyrics, 0, $endOf1stWord) . '&nbsp;';
    884                                 // $returnText .= substr($lyrics, 0, $endOf1stWord);
    885887                                $lyrics = substr($lyrics, $endOf1stWord);
    886888                                $returnText .= "</div></div>\n<div class=\"cpress_line_section\">\n<div class=\"chord\">&nbsp;</div><div class=\"lyric\">";
     
    14501452    }
    14511453
     1454    /**
     1455     * Generate random string.
     1456     *
     1457     * @param  integer    $length    Length of random string to generate.
     1458     * @return string                Random string
     1459     */
     1460    private function random_string($length = 10)
     1461    {
     1462        return substr(str_shuffle(str_repeat($x = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil($length / strlen($x)))), 1, $length);
     1463    }
     1464
    14521465    // ---------------------------------------------------------------------------
    14531466    /**
  • chordpress/trunk/public/js/chordpress-public.js

    r2752198 r2874790  
    2121function dismissParent(el) {
    2222
    23     el.parentNode.style.display='none';
     23  el.parentNode.style.display = 'none';
    2424
    2525};
     
    3333 * @since       1.3.0
    3434 */
    35 function transposeChords() {
     35function transposeChords(cpressId) {
    3636
    37     /**
    38      * Get value from Transpose listbox
    39      */
    40     var x = document.getElementById("selTranspose").value;
     37  /**
     38   * Get value from Transpose listbox
     39   */
     40  var x = document.getElementById("selTranspose-" + cpressId).value;
    4141
    42     /**
    43      * Hide all hidable chords
    44      */
    45     var divsToHide = document.getElementsByClassName("chord-hidable");
     42  /**
     43   * Hide all hidable chords
     44   */
     45  // var divsToHide = document.getElementsByClassName("chord-hidable");
     46  var divsToHide = document.getElementsByClassName("chord-hidable-" + cpressId);
    4647
    47     for (var i = 0; i < divsToHide.length; i++) {
    48         divsToHide[i].style.display = "none";
    49     }
     48  for (var i = 0; i < divsToHide.length; i++) {
     49    divsToHide[i].style.display = "none";
     50  }
    5051
    51     /**
    52      * Now show those for the selected transpose value
    53      */
    54     var divsToShow = document.getElementsByClassName("key-"+x);
     52  /**
     53   * Now show those for the selected transpose value
     54   */
     55  var divsToShow = document.getElementsByClassName("key-" + cpressId + '-' + x);
    5556
    56     for (var i = 0; i < divsToShow.length; i++) {
    57         divsToShow[i].style.display = "";
    58     }
     57  for (var i = 0; i < divsToShow.length; i++) {
     58    divsToShow[i].style.display = "";
     59  }
    5960
    6061}
     
    7273function printCpress(elem) {
    7374
    74     var mywindow = window.open('', 'PRINT', 'height=400,width=600');
    75     mywindow.document.write('<html><head><title>' + document.title + '</title>');
    76     mywindow.document.write('</head><body style=\"font-family:sans-serif;margin: 1.6cm;\">');
    77     mywindow.document.write('<style>@page { margin: 0; } div.cpress_interaction { display: none; }</style>');
    78     mywindow.document.write(document.getElementById(elem).innerHTML);
    79     mywindow.document.write('</body></html>');
    80     mywindow.document.close(); // necessary for IE >= 10
    81     mywindow.focus(); // necessary for IE >= 10*/
    82     mywindow.print();
    83     mywindow.close();
    84     return true;
    85    
     75  var mywindow = window.open('', 'PRINT', 'height=400,width=600');
     76  mywindow.document.write('<html><head><title>' + document.title + '</title>');
     77  mywindow.document.write('</head><body style=\"font-family:sans-serif;margin: 1.6cm;\">');
     78  mywindow.document.write('<style>@page { margin: 0; } div.cpress_interaction { display: none; }</style>');
     79  mywindow.document.write(document.getElementById(elem).innerHTML);
     80  mywindow.document.write('</body></html>');
     81  mywindow.document.close(); // necessary for IE >= 10
     82  mywindow.focus(); // necessary for IE >= 10*/
     83  mywindow.print();
     84  mywindow.close();
     85  return true;
     86
    8687}
    8788
  • chordpress/trunk/readme.txt

    r2871186 r2874790  
    55Requires at least: 4.0
    66Tested up to: 6.1
    7 Stable tag: 3.3.2
     7Stable tag: 3.3.3
    88Requires PHP: 5.2.4
    99License: GPLv3
     
    130130
    131131== Changelog ==
     132= 3.3.3 =
     133* 2023-03-04
     134* Corrected some chord shortnames
     135* Allow multiple interactive songs on one page
     136
    132137= 3.3.2 =
    133138* 2023-02-26
Note: See TracChangeset for help on using the changeset viewer.