Changeset 2874790
- Timestamp:
- 03/04/2023 06:49:53 PM (3 years ago)
- Location:
- chordpress
- Files:
-
- 5 edited
- 23 copied
-
tags/3.3.3 (copied) (copied from chordpress/trunk)
-
tags/3.3.3/admin/class-chordpress-admin.php (copied) (copied from chordpress/trunk/admin/class-chordpress-admin.php)
-
tags/3.3.3/admin/js/tinymce_buttons.js (copied) (copied from chordpress/trunk/admin/js/tinymce_buttons.js)
-
tags/3.3.3/admin/partials/chordpress-admin-chord-meta-box.php (copied) (copied from chordpress/trunk/admin/partials/chordpress-admin-chord-meta-box.php)
-
tags/3.3.3/admin/partials/chordpress-admin-license.php (copied) (copied from chordpress/trunk/admin/partials/chordpress-admin-license.php)
-
tags/3.3.3/admin/partials/chordpress-admin-options.php (copied) (copied from chordpress/trunk/admin/partials/chordpress-admin-options.php)
-
tags/3.3.3/chordpress.php (copied) (copied from chordpress/trunk/chordpress.php) (2 diffs)
-
tags/3.3.3/includes/class-chordpress-activator.php (copied) (copied from chordpress/trunk/includes/class-chordpress-activator.php)
-
tags/3.3.3/includes/class-chordpress-chord.php (copied) (copied from chordpress/trunk/includes/class-chordpress-chord.php) (2 diffs)
-
tags/3.3.3/includes/class-chordpress-deactivator.php (copied) (copied from chordpress/trunk/includes/class-chordpress-deactivator.php)
-
tags/3.3.3/includes/class-chordpress-i18n.php (copied) (copied from chordpress/trunk/includes/class-chordpress-i18n.php)
-
tags/3.3.3/includes/class-chordpress-license.php (copied) (copied from chordpress/trunk/includes/class-chordpress-license.php)
-
tags/3.3.3/includes/class-chordpress-loader.php (copied) (copied from chordpress/trunk/includes/class-chordpress-loader.php)
-
tags/3.3.3/includes/class-chordpress-plugin.php (copied) (copied from chordpress/trunk/includes/class-chordpress-plugin.php)
-
tags/3.3.3/includes/class-chordpress-renderer.php (copied) (copied from chordpress/trunk/includes/class-chordpress-renderer.php) (12 diffs)
-
tags/3.3.3/languages/chordpress.pot (copied) (copied from chordpress/trunk/languages/chordpress.pot)
-
tags/3.3.3/makepot.cmd (copied) (copied from chordpress/trunk/makepot.cmd)
-
tags/3.3.3/public/class-chordpress-public.php (copied) (copied from chordpress/trunk/public/class-chordpress-public.php)
-
tags/3.3.3/public/css/chordpress-public.css (copied) (copied from chordpress/trunk/public/css/chordpress-public.css)
-
tags/3.3.3/public/js/chordpress-public.js (copied) (copied from chordpress/trunk/public/js/chordpress-public.js) (3 diffs)
-
tags/3.3.3/public/partials/chordpress-public-display.php (copied) (copied from chordpress/trunk/public/partials/chordpress-public-display.php)
-
tags/3.3.3/readme.txt (copied) (copied from chordpress/trunk/readme.txt) (2 diffs)
-
tags/3.3.3/uninstall.php (copied) (copied from chordpress/trunk/uninstall.php)
-
trunk/chordpress.php (modified) (2 diffs)
-
trunk/includes/class-chordpress-chord.php (modified) (2 diffs)
-
trunk/includes/class-chordpress-renderer.php (modified) (12 diffs)
-
trunk/public/js/chordpress-public.js (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
chordpress/tags/3.3.3/chordpress.php
r2871185 r2874790 17 17 * Plugin URI: https://lewe.gitbook.io/lewe-chordpress/ 18 18 * Description: This plugin renders ChordPro formatted text and chord diagrams in WordPress sites. 19 * Version: 3.3. 219 * Version: 3.3.3 20 20 * Author: George Lewe 21 21 * Author URI: https://www.lewe.com … … 36 36 */ 37 37 define('CHORDPRESS_NAME', 'ChordPress'); 38 define('CHORDPRESS_VERSION', '3.3. 2');38 define('CHORDPRESS_VERSION', '3.3.3'); 39 39 define('CHORDPRESS_AUTHOR', 'George Lewe'); 40 40 define('CHORDPRESS_AUTHOR_URI', 'https://www.lewe.com'); -
chordpress/tags/3.3.3/includes/class-chordpress-chord.php
r2871185 r2874790 493 493 * Create SVGuitar chord div and script. 494 494 * 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. 497 498 */ 498 499 public function createSvgChord($floatleft = false) … … 524 525 //-------------------------------------------------------------------------- 525 526 /** 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 /** 526 548 * Get private property. 527 549 * -
chordpress/tags/3.3.3/includes/class-chordpress-renderer.php
r2871185 r2874790 346 346 * @var array 347 347 */ 348 private $arrKeys = array('A', 'Am', 'A#', 'A m#', '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'); 349 349 350 350 /** … … 357 357 private $arrTransposeValues = array( 358 358 'A' => array('A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#'), 359 'Am' => array('Am', 'A m#', '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'), 360 360 'A#' => array('A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A'), 361 361 'Bb' => array('Bb', 'B', 'C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A'), 362 'A m#' => array('Am#', 'Bm', 'Cm', 'Cm#', 'Dm', 'Dm#', 'Em', 'Fm', 'Fm#', 'Gm', 'Gm#', 'Am'),363 'B mb' => 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'), 364 364 'B' => array('B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#'), 365 'Bm' => array('Bm', 'Cm', 'C m#', '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'), 366 366 'C' => array('C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'), 367 'Cm' => array('Cm', 'C m#', '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'), 368 368 'C#' => array('C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B', 'C'), 369 369 'Db' => array('Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A', 'Bb', 'B', 'C'), 370 'C m#' => array('Cm#', 'Dm', 'Dm#', 'Em', 'Fm', 'Fm#', 'Gm', 'Gm#', 'Am', 'Am#', 'Bm', 'Cm'),371 'D mb' => 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'), 372 372 'D' => array('D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B', 'C', 'C#'), 373 'Dm' => array('Dm', 'D m#', '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'), 374 374 'D#' => array('D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B', 'C', 'C#', 'D'), 375 375 'Eb' => array('Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A', 'Bb', 'B', 'C', 'Db', 'D'), 376 'D m#' => array('Dm#', 'Em', 'Fm', 'Fm#', 'Gm', 'Gm#', 'Am', 'Am#', 'Bm', 'Cm', 'Cm#', 'Dm'),377 'E mb' => 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'), 378 378 'E' => array('E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B', 'C', 'C#', 'D', 'D#'), 379 'Em' => array('Em', 'Fm', 'F m#', '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'), 380 380 'F' => array('F', 'F#', 'G', 'G#', 'A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E'), 381 'Fm' => array('Fm', 'F m#', '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'), 382 382 'F#' => array('F#', 'G', 'G#', 'A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F'), 383 383 'Gb' => array('Gb', 'G', 'Ab', 'A', 'Bb', 'B', 'C', 'Db', 'D', 'Eb', 'E', 'F'), 384 'F m#' => array('Fm#', 'Gm', 'Gm#', 'Am', 'Am#', 'Bm', 'Cm', 'Cm#', 'Dm', 'Dm#', 'Em', 'Fm'),385 'G mb' => 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'), 386 386 'G' => array('G', 'G#', 'A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#'), 387 'Gm' => array('Gm', 'G m#', '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'), 388 388 'G#' => array('G#', 'A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G'), 389 389 'Ab' => array('Ab', 'A', 'Bb', 'B', 'C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G'), 390 'G m#' => array('Gm#', 'Am', 'Am#', 'Bm', 'Cm', 'Cm#', 'Dm', 'Dm#', 'Em', 'Fm', 'Fm#', 'Gm'),391 'A mb' => 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'), 392 392 ); 393 393 … … 582 582 583 583 $transposeForm = __('Transpose up', 'chordpress') . " 584 <select id=\"selTranspose \" onchange=\"transposeChords();return false;\">584 <select id=\"selTranspose-%cpressID%\" onchange=\"transposeChords('%cpressID%');return false;\"> 585 585 <option value=\"0\">" . $tvalues[0] . "</option> 586 586 <option value=\"1\">" . $tvalues[1] . "</option> … … 608 608 * Print header if directives exist 609 609 */ 610 $randId = $this->random_string(); 610 611 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; 612 613 $returnText = str_replace('%cpressID%', $cpressID, $returnText); 613 614 $returnText .= '<' . $this->titleLevel . '>' . $this->arrDirectives['title'] . '</' . $this->titleLevel . '>'; 614 615 } else { 615 $cpressID = 'ccpress-id ';616 $cpressID = 'ccpress-id-' . $randId; 616 617 $returnText = str_replace('%cpressID%', $cpressID, $returnText); 617 618 } … … 639 640 if (strlen($this->arrDirectives['key'])) { 640 641 $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>'; 642 643 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>'; 644 645 } 645 646 $returnText .= '<br>'; … … 656 657 */ 657 658 foreach ($text as $line) { 658 $returnText .= $this->formatAndDisplayLine($line); 659 $returnText .= str_replace('%cpressID%', $cpressID, $this->formatAndDisplayLine($line)); 660 // $returnText .= $this->formatAndDisplayLine($line); 659 661 } 660 662 … … 829 831 if (strlen(trim($arrChords[$i])) > 0) { 830 832 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\">"; 832 834 833 835 /** … … 843 845 } 844 846 845 $returnText .= '</span> </div>';847 $returnText .= "</span> </div>\n"; 846 848 847 849 /** … … 859 861 * Allow chords starting with a ~ as chord placeholders. Just return the string. 860 862 */ 861 if ($arrChords[$i][0] == '~') { 862 $returnText .= '<div class="chord chord-hidable key-' . $t . '" style="display:none"><span class="chordshort">' . $arrChords[$i] . '</span> </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> </div>'; 865 $returnText .= "\n"; 863 866 } else { 864 867 /** … … 866 869 */ 867 870 $theChord = $this->formatChord($arrChords[$i]); 868 $returnText .= '<div class="chord chord-hidable key-' . $t . '" style="display:none"><span class="chordshort">' . $theChord . '</span> </div>';871 $returnText .= '<div class="chord chord-hidable-%cpressID% key-%cpressID%-' . $t . '" style="display:none"><span class="chordshort">' . $theChord . '</span> </div>'; 869 872 } 870 873 } … … 882 885 if ($endOf1stWord > 0 && $numSpaces == 1) { 883 886 $returnText .= substr($lyrics, 0, $endOf1stWord) . ' '; 884 // $returnText .= substr($lyrics, 0, $endOf1stWord);885 887 $lyrics = substr($lyrics, $endOf1stWord); 886 888 $returnText .= "</div></div>\n<div class=\"cpress_line_section\">\n<div class=\"chord\"> </div><div class=\"lyric\">"; … … 1450 1452 } 1451 1453 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 1452 1465 // --------------------------------------------------------------------------- 1453 1466 /** -
chordpress/tags/3.3.3/public/js/chordpress-public.js
r2752198 r2874790 21 21 function dismissParent(el) { 22 22 23 el.parentNode.style.display='none';23 el.parentNode.style.display = 'none'; 24 24 25 25 }; … … 33 33 * @since 1.3.0 34 34 */ 35 function transposeChords( ) {35 function transposeChords(cpressId) { 36 36 37 /**38 * Get value from Transpose listbox39 */40 var x = document.getElementById("selTranspose").value;37 /** 38 * Get value from Transpose listbox 39 */ 40 var x = document.getElementById("selTranspose-" + cpressId).value; 41 41 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); 46 47 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 } 50 51 51 /**52 * Now show those for the selected transpose value53 */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); 55 56 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 } 59 60 60 61 } … … 72 73 function printCpress(elem) { 73 74 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 >= 1081 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 86 87 } 87 88 -
chordpress/tags/3.3.3/readme.txt
r2871186 r2874790 5 5 Requires at least: 4.0 6 6 Tested up to: 6.1 7 Stable tag: 3.3. 27 Stable tag: 3.3.3 8 8 Requires PHP: 5.2.4 9 9 License: GPLv3 … … 130 130 131 131 == Changelog == 132 = 3.3.3 = 133 * 2023-03-04 134 * Corrected some chord shortnames 135 * Allow multiple interactive songs on one page 136 132 137 = 3.3.2 = 133 138 * 2023-02-26 -
chordpress/trunk/chordpress.php
r2871185 r2874790 17 17 * Plugin URI: https://lewe.gitbook.io/lewe-chordpress/ 18 18 * Description: This plugin renders ChordPro formatted text and chord diagrams in WordPress sites. 19 * Version: 3.3. 219 * Version: 3.3.3 20 20 * Author: George Lewe 21 21 * Author URI: https://www.lewe.com … … 36 36 */ 37 37 define('CHORDPRESS_NAME', 'ChordPress'); 38 define('CHORDPRESS_VERSION', '3.3. 2');38 define('CHORDPRESS_VERSION', '3.3.3'); 39 39 define('CHORDPRESS_AUTHOR', 'George Lewe'); 40 40 define('CHORDPRESS_AUTHOR_URI', 'https://www.lewe.com'); -
chordpress/trunk/includes/class-chordpress-chord.php
r2871185 r2874790 493 493 * Create SVGuitar chord div and script. 494 494 * 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. 497 498 */ 498 499 public function createSvgChord($floatleft = false) … … 524 525 //-------------------------------------------------------------------------- 525 526 /** 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 /** 526 548 * Get private property. 527 549 * -
chordpress/trunk/includes/class-chordpress-renderer.php
r2871185 r2874790 346 346 * @var array 347 347 */ 348 private $arrKeys = array('A', 'Am', 'A#', 'A m#', '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'); 349 349 350 350 /** … … 357 357 private $arrTransposeValues = array( 358 358 'A' => array('A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#'), 359 'Am' => array('Am', 'A m#', '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'), 360 360 'A#' => array('A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A'), 361 361 'Bb' => array('Bb', 'B', 'C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A'), 362 'A m#' => array('Am#', 'Bm', 'Cm', 'Cm#', 'Dm', 'Dm#', 'Em', 'Fm', 'Fm#', 'Gm', 'Gm#', 'Am'),363 'B mb' => 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'), 364 364 'B' => array('B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#'), 365 'Bm' => array('Bm', 'Cm', 'C m#', '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'), 366 366 'C' => array('C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'), 367 'Cm' => array('Cm', 'C m#', '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'), 368 368 'C#' => array('C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B', 'C'), 369 369 'Db' => array('Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A', 'Bb', 'B', 'C'), 370 'C m#' => array('Cm#', 'Dm', 'Dm#', 'Em', 'Fm', 'Fm#', 'Gm', 'Gm#', 'Am', 'Am#', 'Bm', 'Cm'),371 'D mb' => 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'), 372 372 'D' => array('D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B', 'C', 'C#'), 373 'Dm' => array('Dm', 'D m#', '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'), 374 374 'D#' => array('D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B', 'C', 'C#', 'D'), 375 375 'Eb' => array('Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A', 'Bb', 'B', 'C', 'Db', 'D'), 376 'D m#' => array('Dm#', 'Em', 'Fm', 'Fm#', 'Gm', 'Gm#', 'Am', 'Am#', 'Bm', 'Cm', 'Cm#', 'Dm'),377 'E mb' => 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'), 378 378 'E' => array('E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B', 'C', 'C#', 'D', 'D#'), 379 'Em' => array('Em', 'Fm', 'F m#', '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'), 380 380 'F' => array('F', 'F#', 'G', 'G#', 'A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E'), 381 'Fm' => array('Fm', 'F m#', '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'), 382 382 'F#' => array('F#', 'G', 'G#', 'A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F'), 383 383 'Gb' => array('Gb', 'G', 'Ab', 'A', 'Bb', 'B', 'C', 'Db', 'D', 'Eb', 'E', 'F'), 384 'F m#' => array('Fm#', 'Gm', 'Gm#', 'Am', 'Am#', 'Bm', 'Cm', 'Cm#', 'Dm', 'Dm#', 'Em', 'Fm'),385 'G mb' => 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'), 386 386 'G' => array('G', 'G#', 'A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#'), 387 'Gm' => array('Gm', 'G m#', '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'), 388 388 'G#' => array('G#', 'A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G'), 389 389 'Ab' => array('Ab', 'A', 'Bb', 'B', 'C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G'), 390 'G m#' => array('Gm#', 'Am', 'Am#', 'Bm', 'Cm', 'Cm#', 'Dm', 'Dm#', 'Em', 'Fm', 'Fm#', 'Gm'),391 'A mb' => 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'), 392 392 ); 393 393 … … 582 582 583 583 $transposeForm = __('Transpose up', 'chordpress') . " 584 <select id=\"selTranspose \" onchange=\"transposeChords();return false;\">584 <select id=\"selTranspose-%cpressID%\" onchange=\"transposeChords('%cpressID%');return false;\"> 585 585 <option value=\"0\">" . $tvalues[0] . "</option> 586 586 <option value=\"1\">" . $tvalues[1] . "</option> … … 608 608 * Print header if directives exist 609 609 */ 610 $randId = $this->random_string(); 610 611 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; 612 613 $returnText = str_replace('%cpressID%', $cpressID, $returnText); 613 614 $returnText .= '<' . $this->titleLevel . '>' . $this->arrDirectives['title'] . '</' . $this->titleLevel . '>'; 614 615 } else { 615 $cpressID = 'ccpress-id ';616 $cpressID = 'ccpress-id-' . $randId; 616 617 $returnText = str_replace('%cpressID%', $cpressID, $returnText); 617 618 } … … 639 640 if (strlen($this->arrDirectives['key'])) { 640 641 $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>'; 642 643 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>'; 644 645 } 645 646 $returnText .= '<br>'; … … 656 657 */ 657 658 foreach ($text as $line) { 658 $returnText .= $this->formatAndDisplayLine($line); 659 $returnText .= str_replace('%cpressID%', $cpressID, $this->formatAndDisplayLine($line)); 660 // $returnText .= $this->formatAndDisplayLine($line); 659 661 } 660 662 … … 829 831 if (strlen(trim($arrChords[$i])) > 0) { 830 832 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\">"; 832 834 833 835 /** … … 843 845 } 844 846 845 $returnText .= '</span> </div>';847 $returnText .= "</span> </div>\n"; 846 848 847 849 /** … … 859 861 * Allow chords starting with a ~ as chord placeholders. Just return the string. 860 862 */ 861 if ($arrChords[$i][0] == '~') { 862 $returnText .= '<div class="chord chord-hidable key-' . $t . '" style="display:none"><span class="chordshort">' . $arrChords[$i] . '</span> </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> </div>'; 865 $returnText .= "\n"; 863 866 } else { 864 867 /** … … 866 869 */ 867 870 $theChord = $this->formatChord($arrChords[$i]); 868 $returnText .= '<div class="chord chord-hidable key-' . $t . '" style="display:none"><span class="chordshort">' . $theChord . '</span> </div>';871 $returnText .= '<div class="chord chord-hidable-%cpressID% key-%cpressID%-' . $t . '" style="display:none"><span class="chordshort">' . $theChord . '</span> </div>'; 869 872 } 870 873 } … … 882 885 if ($endOf1stWord > 0 && $numSpaces == 1) { 883 886 $returnText .= substr($lyrics, 0, $endOf1stWord) . ' '; 884 // $returnText .= substr($lyrics, 0, $endOf1stWord);885 887 $lyrics = substr($lyrics, $endOf1stWord); 886 888 $returnText .= "</div></div>\n<div class=\"cpress_line_section\">\n<div class=\"chord\"> </div><div class=\"lyric\">"; … … 1450 1452 } 1451 1453 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 1452 1465 // --------------------------------------------------------------------------- 1453 1466 /** -
chordpress/trunk/public/js/chordpress-public.js
r2752198 r2874790 21 21 function dismissParent(el) { 22 22 23 el.parentNode.style.display='none';23 el.parentNode.style.display = 'none'; 24 24 25 25 }; … … 33 33 * @since 1.3.0 34 34 */ 35 function transposeChords( ) {35 function transposeChords(cpressId) { 36 36 37 /**38 * Get value from Transpose listbox39 */40 var x = document.getElementById("selTranspose").value;37 /** 38 * Get value from Transpose listbox 39 */ 40 var x = document.getElementById("selTranspose-" + cpressId).value; 41 41 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); 46 47 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 } 50 51 51 /**52 * Now show those for the selected transpose value53 */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); 55 56 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 } 59 60 60 61 } … … 72 73 function printCpress(elem) { 73 74 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 >= 1081 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 86 87 } 87 88 -
chordpress/trunk/readme.txt
r2871186 r2874790 5 5 Requires at least: 4.0 6 6 Tested up to: 6.1 7 Stable tag: 3.3. 27 Stable tag: 3.3.3 8 8 Requires PHP: 5.2.4 9 9 License: GPLv3 … … 130 130 131 131 == Changelog == 132 = 3.3.3 = 133 * 2023-03-04 134 * Corrected some chord shortnames 135 * Allow multiple interactive songs on one page 136 132 137 = 3.3.2 = 133 138 * 2023-02-26
Note: See TracChangeset
for help on using the changeset viewer.