Plugin Directory

Changeset 3307608


Ignore:
Timestamp:
06/06/2025 05:42:10 PM (10 months ago)
Author:
glewe
Message:

Tagging version 3.9.3

Location:
chordpress
Files:
5 edited
23 copied

Legend:

Unmodified
Added
Removed
  • chordpress/tags/3.9.3/admin/partials/chordpress-admin-options.php

    r3243398 r3307608  
    392392              <td>
    393393                <input type='checkbox' id='<?php echo $pname; ?>_checkbox_fixed_interaction' name='<?php echo $pname; ?>_checkbox_fixed_interaction' <?php checked(get_option($pname . '_checkbox_fixed_interaction'), 1); ?> value='1'>
    394                 <p class="description"><?php echo esc_html(__('With this option selected, the interaction menu will be fixed at the bottom of the page. Note, that this might lead to unexpected results depending on the WordPress theme you use. You can overwrite this setting per shortcut with "fixedinteraction=yes/no"', 'chordpress')); ?>.</p>
     394                <p class="description"><?php echo esc_html(__('With this option selected, the interaction menu will be fixed at the bottom of the page. Note, that this might lead to unexpected results depending on the WordPress theme you use and if you use more than one ChordPress songsheet on a page. You can overwrite this setting per shortcut with "fixedinteraction=yes/no"', 'chordpress')); ?>.</p>
    395395              </td>
    396396            </tr>
  • chordpress/tags/3.9.3/chordpress.php

    r3305993 r3307608  
    1919 * Plugin URI:        https://lewe.gitbook.io/lewe-chordpress/
    2020 * Description:       This plugin renders ChordPro formatted text and chord diagrams in WordPress sites.
    21  * Version:           3.9.2
     21 * Version:           3.9.3
    2222 * Author:            George Lewe
    2323 * Author URI:        https://www.lewe.com
     
    3838 */
    3939define('CHORDPRESS_NAME', 'ChordPress');
    40 define('CHORDPRESS_VERSION', '3.9.2');
     40define('CHORDPRESS_VERSION', '3.9.3');
    4141define('CHORDPRESS_AUTHOR', 'George Lewe');
    4242define('CHORDPRESS_AUTHOR_URI', 'https://www.lewe.com');
  • chordpress/tags/3.9.3/includes/class-chordpress-renderer.php

    r3305993 r3307608  
    5555   * @var      array $harmonicaTypes Harmonica types.
    5656   */
    57   private $harmonicaTypes = array( 'tremolo', 'diatonic', 'chromatic' );
     57  private $harmonicaTypes = [ 'tremolo', 'diatonic', 'chromatic' ];
    5858
    5959  /**
     
    499499
    500500  private $arrChromaticTranspose = array(
    501     '1' => ['1', '1s', '-1', '-1s', '2', '-2', '-2s', '3', '3s', '-3', '-3s', '-4'],
    502     '1s' => ['1s', '-1', '-1s', '2', '-2', '-2s', '3', '3s', '-3', '-3s', '-4', '4' ],
    503     '-1' => ['-1', '-1s', '2', '-2', '-2s', '3', '3s', '-3', '-3s', '-4', '4', '4s' ],
    504     '-1s' => ['-1s', '2', '-2', '-2s', '3', '3s', '-3', '-3s', '-4', '4', '4s', '-5' ],
    505     '2' => ['2', '-2', '-2s', '3', '3s', '-3', '-3s', '-4', '4', '4s', '-5', '-5s' ],
    506     '-2' => ['-2', '-2s', '3', '3s', '-3', '-3s', '-4', '4', '4s', '-5', '-5s', '6' ],
    507     '-2s' => ['-2s', '3', '3s', '-3', '-3s', '-4', '4', '4s', '-5', '-5s', '6', '-6' ],
    508     '3' => ['3', '3s', '-3', '-3s', '-4', '4', '4s', '-5', '-5s', '6', '-6', '-6s' ],
    509     '3s' => ['3s', '-3', '-3s', '-4', '4', '4s', '-5', '-5s', '6', '-6', '-6s', '7' ],
    510     '-3' => ['-3', '-3s', '-4', '4', '4s', '-5', '-5s', '6', '-6', '-6s', '7', '7s' ],
    511     '-3s' => ['-3s', '-4', '4', '4s', '-5', '-5s', '6', '-6', '-6s', '7', '7s', '-7' ],
    512     '-4' => ['-4', '4', '4s', '-5', '-5s', '6', '-6', '-6s', '7', '7s', '-7', '-7s' ],
    513     '4' => ['4', '4s', '-5', '-5s', '6', '-6', '-6s', '7', '7s', '-7', '-7s', '-8' ],
    514     '4s' => ['4s', '-5', '-5s', '6', '-6', '-6s', '7', '7s', '-7', '-7s', '-8', '8' ],
    515     '-5' => ['-5', '-5s', '6', '-6', '-6s', '7', '7s', '-7', '-7s', '-8', '8', '9' ],
    516     '-5s' => ['-5s', '6', '-6', '-6s', '7', '7s', '-7', '-7s', '-8', '8', '9', '9s' ],
    517     '6' => ['6', '-6', '-6s', '7', '7s', '-7', '-7s', '-8', '8', '9', '9s', '-9' ],
    518     '-6' => ['-6', '-6s', '7', '7s', '-7', '-7s', '-8', '8', '9', '9s', '-9', '-9s' ],
    519     '-6s' => ['-6s', '7', '7s', '-7', '-7s', '-8', '8', '9', '9s', '-9', '-9s', '10' ],
    520     '7' => ['7', '7s', '-7', '-7s', '-8', '8', '9', '9s', '-9', '-9s', '10', '-10' ],
    521     '7s' => ['7s', '-7', '-7s', '-8', '8', '9', '9s', '-9', '-9s', '10', '-10', '-10s' ],
    522     '-7' => ['-7', '-7s', '-8', '8', '9', '9s', '-9', '-9s', '10', '-10', '-10s', '11' ],
    523     '-7s' => ['-7s', '-8', '8', '9', '9s', '-9', '-9s', '10', '-10', '-10s', '11', '11s' ],
    524     '-8' => ['-8', '8', '9', '9s', '-9', '-9s', '10', '-10', '-10s', '11', '11s', '-11' ],
    525     '8' => ['8', '9', '9s', '-9', '-9s', '10', '-10', '-10s', '11', '11s', '-11', '-11s' ],
    526     '9' => ['9', '9s', '-9', '-9s', '10', '-10', '-10s', '11', '11s', '-11', '-11s', '-12' ],
    527     '9s' => ['9s', '-9', '-9s', '10', '-10', '-10s', '11', '11s', '-11', '-11s', '-12', '12' ],
    528     '-9' => ['-9', '-9s', '10', '-10', '-10s', '11', '11s', '-11', '-11s', '-12', '12', '12s' ],
    529     '-9s' => ['-9s', '10', '-10', '-10s', '11', '11s', '-11', '-11s', '-12', '12', '12s', ' ' ],
    530     '10' => ['10', '-10', '-10s', '11', '11s', '-11', '-11s', '-12', '12', '12s', ' ', ' ' ],
    531     '-10' => ['-10', '-10s', '11', '11s', '-11', '-11s', '-12', '12', '12s', ' ', ' ', ' ' ],
    532     '-10s' => ['-10s', '11', '11s', '-11', '-11s', '-12', '12', '12s', ' ', ' ', ' ', ' ' ],
    533     '11' => ['11', '11s', '-11', '-11s', '-12', '12', '12s', ' ', ' ', ' ', ' ', ' ' ],
    534     '11s' => ['11s', '-11', '-11s', '-12', '12', '12s', ' ', ' ', ' ', ' ', ' ', ' ' ],
    535     '-11' => ['-11', '-11s', '-12', '12', '12s', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
    536     '-11s' => ['-11s', '-12', '12', '12s', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
    537     '-12' => ['-12', '12', '12s', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
    538     '12' => ['12', '12s', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
    539     '12s' => ['12s', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
     501    '1' => [ '1', '1s', '-1', '-1s', '2', '-2', '-2s', '3', '3s', '-3', '-3s', '-4' ],
     502    '1s' => [ '1s', '-1', '-1s', '2', '-2', '-2s', '3', '3s', '-3', '-3s', '-4', '4' ],
     503    '-1' => [ '-1', '-1s', '2', '-2', '-2s', '3', '3s', '-3', '-3s', '-4', '4', '4s' ],
     504    '-1s' => [ '-1s', '2', '-2', '-2s', '3', '3s', '-3', '-3s', '-4', '4', '4s', '-5' ],
     505    '2' => [ '2', '-2', '-2s', '3', '3s', '-3', '-3s', '-4', '4', '4s', '-5', '-5s' ],
     506    '-2' => [ '-2', '-2s', '3', '3s', '-3', '-3s', '-4', '4', '4s', '-5', '-5s', '6' ],
     507    '-2s' => [ '-2s', '3', '3s', '-3', '-3s', '-4', '4', '4s', '-5', '-5s', '6', '-6' ],
     508    '3' => [ '3', '3s', '-3', '-3s', '-4', '4', '4s', '-5', '-5s', '6', '-6', '-6s' ],
     509    '3s' => [ '3s', '-3', '-3s', '-4', '4', '4s', '-5', '-5s', '6', '-6', '-6s', '7' ],
     510    '-3' => [ '-3', '-3s', '-4', '4', '4s', '-5', '-5s', '6', '-6', '-6s', '7', '7s' ],
     511    '-3s' => [ '-3s', '-4', '4', '4s', '-5', '-5s', '6', '-6', '-6s', '7', '7s', '-7' ],
     512    '-4' => [ '-4', '4', '4s', '-5', '-5s', '6', '-6', '-6s', '7', '7s', '-7', '-7s' ],
     513    '4' => [ '4', '4s', '-5', '-5s', '6', '-6', '-6s', '7', '7s', '-7', '-7s', '-8' ],
     514    '4s' => [ '4s', '-5', '-5s', '6', '-6', '-6s', '7', '7s', '-7', '-7s', '-8', '8' ],
     515    '-5' => [ '-5', '-5s', '6', '-6', '-6s', '7', '7s', '-7', '-7s', '-8', '8', '9' ],
     516    '-5s' => [ '-5s', '6', '-6', '-6s', '7', '7s', '-7', '-7s', '-8', '8', '9', '9s' ],
     517    '6' => [ '6', '-6', '-6s', '7', '7s', '-7', '-7s', '-8', '8', '9', '9s', '-9' ],
     518    '-6' => [ '-6', '-6s', '7', '7s', '-7', '-7s', '-8', '8', '9', '9s', '-9', '-9s' ],
     519    '-6s' => [ '-6s', '7', '7s', '-7', '-7s', '-8', '8', '9', '9s', '-9', '-9s', '10' ],
     520    '7' => [ '7', '7s', '-7', '-7s', '-8', '8', '9', '9s', '-9', '-9s', '10', '-10' ],
     521    '7s' => [ '7s', '-7', '-7s', '-8', '8', '9', '9s', '-9', '-9s', '10', '-10', '-10s' ],
     522    '-7' => [ '-7', '-7s', '-8', '8', '9', '9s', '-9', '-9s', '10', '-10', '-10s', '11' ],
     523    '-7s' => [ '-7s', '-8', '8', '9', '9s', '-9', '-9s', '10', '-10', '-10s', '11', '11s' ],
     524    '-8' => [ '-8', '8', '9', '9s', '-9', '-9s', '10', '-10', '-10s', '11', '11s', '-11' ],
     525    '8' => [ '8', '9', '9s', '-9', '-9s', '10', '-10', '-10s', '11', '11s', '-11', '-11s' ],
     526    '9' => [ '9', '9s', '-9', '-9s', '10', '-10', '-10s', '11', '11s', '-11', '-11s', '-12' ],
     527    '9s' => [ '9s', '-9', '-9s', '10', '-10', '-10s', '11', '11s', '-11', '-11s', '-12', '12' ],
     528    '-9' => [ '-9', '-9s', '10', '-10', '-10s', '11', '11s', '-11', '-11s', '-12', '12', '12s' ],
     529    '-9s' => [ '-9s', '10', '-10', '-10s', '11', '11s', '-11', '-11s', '-12', '12', '12s', ' ' ],
     530    '10' => [ '10', '-10', '-10s', '11', '11s', '-11', '-11s', '-12', '12', '12s', ' ', ' ' ],
     531    '-10' => [ '-10', '-10s', '11', '11s', '-11', '-11s', '-12', '12', '12s', ' ', ' ', ' ' ],
     532    '-10s' => [ '-10s', '11', '11s', '-11', '-11s', '-12', '12', '12s', ' ', ' ', ' ', ' ' ],
     533    '11' => [ '11', '11s', '-11', '-11s', '-12', '12', '12s', ' ', ' ', ' ', ' ', ' ' ],
     534    '11s' => [ '11s', '-11', '-11s', '-12', '12', '12s', ' ', ' ', ' ', ' ', ' ', ' ' ],
     535    '-11' => [ '-11', '-11s', '-12', '12', '12s', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
     536    '-11s' => [ '-11s', '-12', '12', '12s', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
     537    '-12' => [ '-12', '12', '12s', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
     538    '12' => [ '12', '12s', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
     539    '12s' => [ '12s', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
    540540  );
    541541
     
    558558   */
    559559  private $allowedChordPrefixes = array( '~', '|', '/', '.', '-', '+', '1', '2', '3', '4', '5', '6', '7', '8', '9' );
     560
     561  /**
     562   * Holds the styles for the songsheet
     563   *
     564   * @since    3.9.3
     565   * @access   private
     566   * @var      string
     567   */
     568  private $songsheetStyles = '';
    560569
    561570  /**
     
    616625   * Get the ChordPro directives and store the supported ones in an array.
    617626   *
    618    * @param object $text - Text inside shortcode wrapper.
     627   * @param array $text - Text inside shortcode wrapper in an array (each line is an array element).
    619628   *
    620629   * @since 1.0.0
    621630   */
    622   public function getDirectives($text) {
     631  public function getDirectives(array $text) {
    623632    foreach ($text as $line) {
    624633      $line = trim($this->stripTags($line));
     
    698707   * </div>
    699708   *
    700    * @param object $text - Text inside shortcode wrapper.
     709   * @param array $text - Text inside shortcode wrapper in an array (each line is an array element).
    701710   *
    702711   * @return string - Formatted HTML of the ChordPro text.
    703712   * @since 1.0.0
    704713   */
    705   public function displayText($text): string {
    706     /**
    707      * Start of ChordPress wrapper
    708      */
    709     $cpressStyles = "<style>div.cpress { float: " . $this->float . "; } div.cpress_line { " . $this->lineStyle . "; } div.cpress_line_section { display: inline; float: left; } div.cpress_line_section .chord .chordshort { " . $this->chordStyle . "; } div.cpress_line_section .lyric { " . $this->lyricsStyle . "; } div.cpress_chorus { " . $this->chorusStyle . "; } div.cpress_verse { " . $this->verseStyle . "; } div.cpress_clear { clear: both; } div.cpress_meta { " . $this->metaStyle . "; } div.cpress_interaction { float: right; } div.cpress_interaction select { width: auto; } span.cpress_comment { " . $this->commentStyle . "; } div.cpress_chordsheet { text-align: center; }</style>";
    710 
    711     $returnText = "\n\n
     714  public function displayText(array $text): string {
     715    /**
     716     * The styles need to be a one-line string in a separate variable because it is passed to the Javascript print function
     717     */
     718    $this->songsheetStyles = "<style>div.cpress { float: " . $this->float . "; } div.cpress_line { " . $this->lineStyle . "; } div.cpress_line_section { display: inline; float: left; } div.cpress_line_section .chord .chordshort { " . $this->chordStyle . "; } div.cpress_line_section .lyric { " . $this->lyricsStyle . "; } div.cpress_chorus { " . $this->chorusStyle . "; } div.cpress_verse { " . $this->verseStyle . "; } div.cpress_clear { clear: both; } div.cpress_meta { " . $this->metaStyle . "; } div.cpress_interaction { float: right; } div.cpress_interaction select { width: auto; } span.cpress_comment { " . $this->commentStyle . "; } div.cpress_chordsheet { text-align: center; }</style>";
     719
     720    $songsheetHtml = "\n\n
    712721      <!--begin: ChordPress SongSheet -->
    713722      <div>
    714       " . $cpressStyles . "
     723      " . $this->songsheetStyles . "
    715724      </div>\n";
    716725
     
    719728     */
    720729    if (in_array(strtolower($this->interactive), array( "yes", "1", "true" ))) {
    721       $interactionForm = "<div class=\"cpress-interaction cpress-row";
    722       if ($this->fixedInteraction) {
    723         $interactionForm .= " fixed";
     730      $songsheetHtml .= $this->buildInteractionMenu();
     731    }
     732
     733    $songsheetHtml .= "<div id=\"%cpressID%\" class=\"cpress\">\n";
     734
     735    /**
     736     * Print header and subtitle if directives exist
     737     */
     738    $randId = $this->random_string(true);
     739    if (strlen($this->arrDirectives['title']) && !$this->hideTitle) {
     740      $cpressID = str_replace(' ', '-', strtolower(trim($this->arrDirectives['title']))) . '-' . $randId;
     741      $songsheetHtml = str_replace('%cpressID%', $cpressID, $songsheetHtml);
     742      $songsheetHtml .= '<' . $this->titleLevel . '>' . $this->arrDirectives['title'] . '</' . $this->titleLevel . ">\n";
     743    } else {
     744      $cpressID = 'ccpress-id-' . $randId;
     745      $songsheetHtml = str_replace('%cpressID%', $cpressID, $songsheetHtml);
     746    }
     747    if (strlen($this->arrDirectives['subtitle']) && !$this->hideSubtitle) {
     748      $songsheetHtml .= '<' . $this->subtitleLevel . '>' . $this->arrDirectives['subtitle'] . '</' . $this->subtitleLevel . ">\n";
     749    }
     750
     751    /**
     752     * Print meta data if directives exist
     753     */
     754    if (
     755      strlen($this->arrDirectives['album']) ||
     756      strlen($this->arrDirectives['artist']) ||
     757      strlen($this->arrDirectives['capo']) ||
     758      strlen($this->arrDirectives['composer']) ||
     759      strlen($this->arrDirectives['key']) ||
     760      strlen($this->arrDirectives['tempo']) ||
     761      strlen($this->arrDirectives['time']) ||
     762      strlen($this->arrDirectives['year'])
     763    ) {
     764      $songsheetHtml .= "<div class=\"cpress_meta\">\n";
     765      if (strlen($this->arrDirectives['composer']) && !$this->hideComposer) $songsheetHtml .= esc_html(__('Composer', 'chordpress')) . ': ' . $this->arrDirectives['composer'] . "<br>\n";
     766      if (strlen($this->arrDirectives['artist']) && !$this->hideArtist) $songsheetHtml .= esc_html(__('Artist', 'chordpress')) . ': ' . $this->arrDirectives['artist'] . "<br>\n";
     767      if (strlen($this->arrDirectives['year']) && !$this->hideYear) $songsheetHtml .= esc_html(__('Year', 'chordpress')) . ': ' . $this->arrDirectives['year'] . "<br>\n";
     768      if (strlen($this->arrDirectives['album']) && !$this->hideAlbum) $songsheetHtml .= esc_html(__('Album', 'chordpress')) . ': ' . $this->arrDirectives['album'] . "<br>\n";
     769
     770      if (strlen($this->arrDirectives['key']) && !$this->hideKey) {
     771        $songsheetHtml .= esc_html(__('Key (original)', 'chordpress')) . ': ' . $this->arrDirectives['key'] . "<br>\n";
     772        $songsheetHtml .= esc_html(__('Key (transposed)', 'chordpress')) . ': <span class="chord-hidable-%cpressID% key-%cpressID%-0">' . $this->arrDirectives['key'] . '</span>';
     773        for ($t = 1; $t <= 11; $t++) {
     774          $songsheetHtml .= '<span class="chord-hidable-%cpressID% key-%cpressID%-' . $t . '" style="display:none">' . $this->arrTransposeValues[$this->arrDirectives['key']][$t] . '</span>';
     775        }
     776        $songsheetHtml .= "<br>\n";
    724777      }
    725       $interactionForm .= "\">";
    726 
    727       if (!$this->hideFontsize) {
    728         $interactionForm .= "<div class='cpress-col cpress-pl-0'>" . __('Font', 'chordpress') . "<br>
     778
     779      if (strlen($this->arrDirectives['time'])) $songsheetHtml .= esc_html(__('Time', 'chordpress')) . ': ' . $this->arrDirectives['time'] . "<br>\n";
     780      if (strlen($this->arrDirectives['tempo'])) $songsheetHtml .= esc_html(__('Tempo', 'chordpress')) . ': ' . $this->arrDirectives['tempo'] . "<br>\n";
     781      if (strlen($this->arrDirectives['capo'])) $songsheetHtml .= esc_html(__('Capo', 'chordpress')) . ': ' . $this->arrDirectives['capo'] . "<br>\n";
     782      $songsheetHtml = preg_replace('/<br>$/', '', $songsheetHtml); // Remove last <br>
     783      $songsheetHtml .= "</div>\n";
     784    }
     785
     786    /**
     787     * Go through each line and process it
     788     */
     789    $this->inMonospace = false;
     790    foreach ($text as $line) {
     791      if ($this->inMonospace && strpos($line, "{end_of_monospace}") === false) {
     792        $songsheetHtml .= $line;
     793      } else {
     794        $songsheetHtml .= $this->formatAndDisplayLine($line);
     795      }
     796    }
     797    $songsheetHtml = str_replace('%cpressID%', $cpressID, $songsheetHtml);
     798
     799    /**
     800     * End of ChordPress song
     801     */
     802    $songsheetHtml .= "</div>\n<!--end: ChordPress SongSheet-->\n";
     803
     804    /**
     805     * Build chord sheet if option set to true.
     806     */
     807    if ($this->showChordSheet) {
     808      $chordSheetText = "\n<!--begin: ChordPress ChordSheet-->\n";
     809      $chordSheetText .= "<div class='cpress_chordsheet'>\n";
     810      $chordSheetText .= "<div><hr></div>\n";
     811      $chordSheetText .= "<p><i>" . esc_html(__('These known chords are used in this song', 'chordpress')) . ".</i></p>";
     812      $this->uniqueChords = array_unique($this->allChords);
     813      foreach ($this->uniqueChords as $uc) {
     814        if ($postid = $this->find_guitar_chord_post($uc)) {
     815          $this->load_guitar_chord($postid);
     816          $chordSheetText .= $this->C->createSvgChord(true);
     817        }
     818      }
     819      $chordSheetText .= "</div>\n<div style=\"clear:both; padding: 16px 0 16px 0;\"><hr></div>\n<!--end: ChordPress ChordSheet-->\n\n";
     820      if ($this->showChordSheetOnTop) {
     821        $songsheetHtml = $chordSheetText . $songsheetHtml;
     822      } else {
     823        $songsheetHtml = $songsheetHtml . $chordSheetText;
     824      }
     825    }
     826
     827// $this->C->dnd($songsheetHtml);
     828    return $songsheetHtml . "\n\n";
     829  }
     830
     831  /**
     832   * --------------------------------------------------------------------------
     833   * Builds the Interactive Menu
     834   * --------------------------------------------------------------------------
     835   *
     836   * Builds the interaction menu for the ChordPress song sheet.
     837   *
     838   * This function generates the HTML for the interaction menu, which includes
     839   * options for font size adjustment, transposition, and printing. The menu
     840   * can be fixed at the bottom of the page if the `fixedInteraction` property
     841   * is set. The function also handles harmonica-specific options if applicable.
     842   *
     843   * @return string The HTML string for the interaction menu.
     844   * @since  3.9.2
     845   * @access private
     846   *
     847   */
     848  private function buildInteractionMenu(): string {
     849    $interactionForm = "<div class=\"cpress-interaction cpress-row";
     850    if ($this->fixedInteraction) {
     851      $interactionForm .= " fixed";
     852    }
     853    $interactionForm .= "\">";
     854
     855    if (!$this->hideFontsize) {
     856      $interactionForm .= "<div class='cpress-col cpress-mb-2'>" . __('Font Size', 'chordpress') . "<br>
    729857          <div class='cpress-btn-group' role='group'>
    730858            <button type='button' class='cpress-btn cpress-btn-secondary cpress-btn-sm' onclick=\"changeFontSize('%cpressID%', -5);\">-</button>
     
    733861          </div>
    734862        </div>";
    735       }
    736 
    737       if (!$this->hideTranspose) {
    738         $interactionForm .= "<div class='cpress-col' style='display: inline-block;'>";
    739 
    740         if (!$this->harmonica) {
     863    }
     864
     865    if (!$this->hideTranspose) {
     866      $interactionForm .= "<div class='cpress-col' style='display: inline-block;'>";
     867
     868      if (!$this->harmonica) {
     869        //
     870        // Guitar chords
     871        //
     872        if ($this->showNumericTranspose && !$this->harmonica) {
    741873          //
    742           // Guitar chords
     874          // Let's see if a 'Key' directive was given. If so, we can add the transposed keys to the list.
    743875          //
    744           if ($this->showNumericTranspose && !$this->harmonica) {
    745             //
    746             // Let's see if a 'Key' directive was given. If so, we can add the transposed keys to the list.
    747             //
    748             if (strlen($this->arrDirectives['key']) && in_array($this->arrDirectives['key'], $this->arrKeys)) {
    749               $songKey = "'" . $this->arrDirectives['key'] . "'";
    750               $initialText = '0 (' . $this->arrDirectives['key'] . ')';
    751             } else {
    752               $songKey = "''";
    753               $initialText = '0';
    754             }
    755             $interactionForm .= __('Transpose', 'chordpress') . "<br>
     876          if (strlen($this->arrDirectives['key']) && in_array($this->arrDirectives['key'], $this->arrKeys)) {
     877            $songKey = "'" . $this->arrDirectives['key'] . "'";
     878            $initialText = '0 (' . $this->arrDirectives['key'] . ')';
     879          } else {
     880            $songKey = "''";
     881            $initialText = '0';
     882          }
     883          $interactionForm .= __('Transpose', 'chordpress') . "<br>
    756884              <div class='cpress-btn-group' role='group'>
    757885                <button type='button' class='cpress-btn cpress-btn-secondary cpress-btn-sm' onclick=\"transposeChords('%cpressID%', 'btnTranspose-', 'down', " . $songKey . ");\">-</button>
     
    759887                <button type='button' class='cpress-btn cpress-btn-secondary cpress-btn-sm' onclick=\"transposeChords('%cpressID%', 'btnTranspose-', 'up', " . $songKey . ");\">+</button>
    760888              </div>";
     889        } else {
     890          //
     891          // Let's see if a 'Key' directive was given. If so, we can add the transposed keys to the list.
     892          //
     893          if (strlen($this->arrDirectives['key']) && in_array($this->arrDirectives['key'], $this->arrKeys)) {
     894            $i = 0;
     895            foreach ($this->arrTransposeValues[$this->arrDirectives['key']] as $val) {
     896              $tvalues[] = (string)$i . ' => ' . $val;
     897              $i++;
     898            }
    761899          } else {
    762             //
    763             // Let's see if a 'Key' directive was given. If so, we can add the transposed keys to the list.
    764             //
    765             if (strlen($this->arrDirectives['key']) && in_array($this->arrDirectives['key'], $this->arrKeys)) {
    766               $i = 0;
    767               foreach ($this->arrTransposeValues[$this->arrDirectives['key']] as $val) {
    768                 $tvalues[] = (string)$i . ' => ' . $val;
    769                 $i++;
    770               }
    771             } else {
    772               $tvalues = array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11' );
    773             }
    774             $interactionForm .= __('Transpose', 'chordpress') . "
     900            $tvalues = array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11' );
     901          }
     902          $interactionForm .= __('Transpose', 'chordpress') . "
    775903              <div class=\"float-right\">
    776904                <select class=\"cpress-form-control cpress-form-control-sm cpress-py-0 cpress-px-2\" id=\"selTranspose-%cpressID%\" onchange=\"transposeChords('%cpressID%', 'selTranspose-');return false;\" title=\"" . __('Only works for international key names', 'chordpress') . ".\">
     
    789917                </select>
    790918              </div>";
    791           }
    792         } else {
    793           //
    794           // Harmonica notes
    795           //
    796           switch ($this->harmonica) {
    797             case 'tremolo':
    798               $selectedDiatonic = '';
    799               $selectedChromatic = '';
    800               $selectedTremolo = ' selected';
    801               break;
    802             case 'diatonic':
    803               $selectedDiatonic = ' selected';
    804               $selectedChromatic = '';
    805               $selectedTremolo = '';
    806               break;
    807             case 'chromatic':
    808               $selectedDiatonic = '';
    809               $selectedChromatic = ' selected';
    810               $selectedTremolo = '';
    811               break;
    812             default:
    813               $selectedDiatonic = '';
    814               $selectedChromatic = '';
    815               $selectedTremolo = '';
    816               break;
    817           }
    818 
    819           $interactionForm .=
    820             "<div class='cpress-row'>
     919        }
     920      } else {
     921        //
     922        // Harmonica notes
     923        //
     924        switch ($this->harmonica) {
     925          case 'tremolo':
     926            $selectedDiatonic = '';
     927            $selectedChromatic = '';
     928            $selectedTremolo = ' selected';
     929            break;
     930          case 'diatonic':
     931            $selectedDiatonic = ' selected';
     932            $selectedChromatic = '';
     933            $selectedTremolo = '';
     934            break;
     935          case 'chromatic':
     936            $selectedDiatonic = '';
     937            $selectedChromatic = ' selected';
     938            $selectedTremolo = '';
     939            break;
     940          default:
     941            $selectedDiatonic = '';
     942            $selectedChromatic = '';
     943            $selectedTremolo = '';
     944            break;
     945        }
     946
     947        $interactionForm .=
     948          "<div class='cpress-row'>
    821949              <div class='cpress-col'>";
    822950
    823           $interactionForm .= __('Harmonica', 'chordpress') . "<br>
     951        $interactionForm .= __('Harmonica', 'chordpress') . "<br>
    824952            <select
    825953              class=\"cpress-form-control cpress-form-control-sm cpress-py-0 cpress-px-2\"
     
    834962            </select>";
    835963
    836           $interactionForm .= "
     964        $interactionForm .= "
    837965            </div>
    838966            <div class='cpress-col'>";
    839967
    840           if ($this->harmonica == 'chromatic') {
    841             $baseNote = "''";
    842             $initialText = '0';
    843             $interactionForm .= "<span id='btnTranspose-chromatic'>" . __('Transpose', 'chordpress') . "<br>
     968        if ($this->harmonica == 'chromatic') {
     969          $baseNote = "''";
     970          $initialText = '0';
     971          $interactionForm .= "<span id='btnTranspose-chromatic'>" . __('Transpose', 'chordpress') . "<br>
    844972              <div class='cpress-btn-group' role='group'>
    845973                <button type='button' class='cpress-btn cpress-btn-secondary cpress-btn-sm' onclick=\"transposeChromatic('%cpressID%', 'btnTranspose-', 'down', " . $baseNote . ");\">-</button>
     
    848976              </div>
    849977              </span>";
    850           }
    851           $interactionForm .= "
     978        }
     979        $interactionForm .= "
    852980              </div>
    853981            </div>";
    854         }
    855         $interactionForm .= "</div>";
    856       }
    857       $interactionForm .= "<div class='cpress-col cpress-pr-0'>";
    858       if (!$this->hidePrint) {
    859         $printTitle = 'ChordPress SongSheet';
    860         if (strlen($this->arrDirectives['title']) && !$this->hideTitle) {
    861           $printTitle = $this->arrDirectives['title'];
    862         }
    863         $interactionForm .= "<br><button class='cpress-btn cpress-btn-secondary cpress-btn-sm' onclick=\"printElement('%cpressID%', '" . $printTitle . "', '" . $cpressStyles . "');\">" . __('Print', 'chordpress') . "</button>\n";
    864 //        $interactionForm .= "<br><button class='cpress-btn cpress-btn-secondary cpress-btn-sm' onclick=\"window.print();\">" . __('Print', 'chordpress') . "</button>\n";
    865982      }
    866983      $interactionForm .= "</div>";
    867       $returnText .= $interactionForm . "</div>\n";
    868     }
    869 
    870     $returnText .= "<div id=\"%cpressID%\" class=\"cpress\">\n";
    871 
    872     /**
    873      * Print header if directives exist
    874      */
    875     $randId = $this->random_string(true);
    876     if (strlen($this->arrDirectives['title']) && !$this->hideTitle) {
    877       $cpressID = str_replace(' ', '-', strtolower(trim($this->arrDirectives['title']))) . '-' . $randId;
    878       $returnText = str_replace('%cpressID%', $cpressID, $returnText);
    879       $returnText .= '<' . $this->titleLevel . '>' . $this->arrDirectives['title'] . '</' . $this->titleLevel . ">\n";
    880     } else {
    881       $cpressID = 'ccpress-id-' . $randId;
    882       $returnText = str_replace('%cpressID%', $cpressID, $returnText);
    883     }
    884 
    885     if (strlen($this->arrDirectives['subtitle']) && !$this->hideSubtitle) {
    886       $returnText .= '<' . $this->subtitleLevel . '>' . $this->arrDirectives['subtitle'] . '</' . $this->subtitleLevel . ">\n";
    887     }
    888 
    889     if (
    890       strlen($this->arrDirectives['album']) ||
    891       strlen($this->arrDirectives['artist']) ||
    892       strlen($this->arrDirectives['capo']) ||
    893       strlen($this->arrDirectives['composer']) ||
    894       strlen($this->arrDirectives['key']) ||
    895       strlen($this->arrDirectives['tempo']) ||
    896       strlen($this->arrDirectives['time']) ||
    897       strlen($this->arrDirectives['year'])
    898     ) {
    899       $returnText .= "<div class=\"cpress_meta\">\n";
    900       if (strlen($this->arrDirectives['composer']) && !$this->hideComposer) $returnText .= esc_html(__('Composer', 'chordpress')) . ': ' . $this->arrDirectives['composer'] . "<br>\n";
    901       if (strlen($this->arrDirectives['artist']) && !$this->hideArtist) $returnText .= esc_html(__('Artist', 'chordpress')) . ': ' . $this->arrDirectives['artist'] . "<br>\n";
    902       if (strlen($this->arrDirectives['year']) && !$this->hideYear) $returnText .= esc_html(__('Year', 'chordpress')) . ': ' . $this->arrDirectives['year'] . "<br>\n";
    903       if (strlen($this->arrDirectives['album']) && !$this->hideAlbum) $returnText .= esc_html(__('Album', 'chordpress')) . ': ' . $this->arrDirectives['album'] . "<br>\n";
    904 
    905       if (strlen($this->arrDirectives['key']) && !$this->hideKey) {
    906         $returnText .= esc_html(__('Key (original)', 'chordpress')) . ': ' . $this->arrDirectives['key'] . "<br>\n";
    907         $returnText .= esc_html(__('Key (transposed)', 'chordpress')) . ': <span class="chord-hidable-%cpressID% key-%cpressID%-0">' . $this->arrDirectives['key'] . '</span>';
    908         for ($t = 1; $t <= 11; $t++) {
    909           $returnText .= '<span class="chord-hidable-%cpressID% key-%cpressID%-' . $t . '" style="display:none">' . $this->arrTransposeValues[$this->arrDirectives['key']][$t] . '</span>';
    910         }
    911         $returnText .= "<br>\n";
     984    }
     985    $interactionForm .= "<div class='cpress-col cpress-pr-0'>";
     986    if (!$this->hidePrint) {
     987      $printTitle = 'ChordPress SongSheet';
     988      if (strlen($this->arrDirectives['title']) && !$this->hideTitle) {
     989        $printTitle = $this->arrDirectives['title'];
    912990      }
    913 
    914       if (strlen($this->arrDirectives['time'])) $returnText .= esc_html(__('Time', 'chordpress')) . ': ' . $this->arrDirectives['time'] . "<br>\n";
    915       if (strlen($this->arrDirectives['tempo'])) $returnText .= esc_html(__('Tempo', 'chordpress')) . ': ' . $this->arrDirectives['tempo'] . "<br>\n";
    916       if (strlen($this->arrDirectives['capo'])) $returnText .= esc_html(__('Capo', 'chordpress')) . ': ' . $this->arrDirectives['capo'] . "<br>\n";
    917       $returnText = preg_replace('/<br>$/', '', $returnText); // Remove last <br>
    918       $returnText .= "</div>\n";
    919     }
    920 
    921     /**
    922      * Go through each line and process it
    923      */
    924     $this->inMonospace = false;
    925     foreach ($text as $line) {
    926       if ($this->inMonospace && strpos($line, "{end_of_monospace}") === false) {
    927         $returnText .= $line;
    928       } else {
    929         $returnText .= $this->formatAndDisplayLine($line);
    930       }
    931     }
    932     $returnText = str_replace('%cpressID%', $cpressID, $returnText);
    933 
    934     /**
    935      * End of ChordPress song
    936      */
    937     $returnText .= "</div>\n<!--end: ChordPress SongSheet-->\n";
    938 
    939     /**
    940      * Build chord sheet if option set to true.
    941      */
    942     if ($this->showChordSheet) {
    943       $chordSheetText = "\n<!--begin: ChordPress ChordSheet-->\n";
    944       $chordSheetText .= "<div class='cpress_chordsheet'>\n";
    945       $chordSheetText .= "<div><hr></div>\n";
    946       $chordSheetText .= "<p><i>" . esc_html(__('These known chords are used in this song', 'chordpress')) . ".</i></p>";
    947       $this->uniqueChords = array_unique($this->allChords);
    948       foreach ($this->uniqueChords as $uc) {
    949         if ($postid = $this->find_guitar_chord_post($uc)) {
    950           $this->load_guitar_chord($postid);
    951           $chordSheetText .= $this->C->createSvgChord(true);
    952         }
    953       }
    954       $chordSheetText .= "</div>\n<div style=\"clear:both; padding: 16px 0 16px 0;\"><hr></div>\n<!--end: ChordPress ChordSheet-->\n\n";
    955       if ($this->showChordSheetOnTop) {
    956         $returnText = $chordSheetText . $returnText;
    957       } else {
    958         $returnText = $returnText . $chordSheetText;
    959       }
    960     }
    961 
    962 // $this->C->dnd($returnText);
    963     return $returnText . "\n\n";
     991      $interactionForm .= "<br><button class='cpress-btn cpress-btn-secondary cpress-btn-sm' onclick=\"printElement('%cpressID%', '" . $printTitle . "', '" . $this->songsheetStyles . "');\">" . __('Print', 'chordpress') . "</button>\n";
     992    }
     993    $interactionForm .= "</div>";
     994    return $interactionForm;
    964995  }
    965996
     
    9761007   * @since 1.0.0
    9771008   */
    978   public function formatAndDisplayLine($line) {
     1009  public function formatAndDisplayLine(string $line): string {
    9791010    $returnText = "";
    9801011
     
    12611292   * @since 1.0.0
    12621293   */
    1263   private function stripTags($string) {
     1294  private function stripTags(string $string): string {
    12641295    $retString = "";
    12651296    $isVisible = true;
     
    12891320   * @since 1.0.0
    12901321   */
    1291   public function formatChord($ch) {
     1322  public function formatChord(string $ch): string {
    12921323    $useFlats = false;
    12931324    if (strlen($ch) == 0) return '';
     
    13521383   * Processes a Chromatic harmonica note and returns the formatted HTML.
    13531384   *
    1354    * @param string $note - Chromatic note, e.g. "1" or "1s" or "-1" or "-1s".
     1385   * @param string $note      - Chromatic note, e.g. "1" or "1s" or "-1" or "-1s".
     1386   * @param int    $transpose - Numeric transpose value, 0-11.
    13551387   *
    13561388   * @return string - Transposed chromatic note
    13571389   * @since 2.8.0
    13581390   */
    1359   public function transposeChromaticNote($note, $transpose) {
     1391  public function transposeChromaticNote(string $note, int $transpose): string {
    13601392    if (strlen($note) == 0) return '';
    13611393    if ($transpose === 0 || $transpose > 11) return $note;
     
    13961428   * @since 1.0.0
    13971429   */
    1398   public function formatRemainder($remainder) {
     1430  public function formatRemainder(string $remainder): string {
    13991431    $indexOfSlash = strpos($remainder, '/');
    14001432    if ($indexOfSlash === false) return $remainder;
     
    14651497   * @since 1.0.0
    14661498   */
    1467   public function noteToNumber($n) {
     1499  public function noteToNumber(string $n): int {
    14681500    $regularNotation = array(
    14691501      'A' => 0,
     
    15151547   * @since 1.0.0
    15161548   */
    1517   public function numberToNote($n, $useFlats = false) {
     1549  public function numberToNote(string $n, bool $useFlats = false): string {
    15181550    $retVal = '';
    15191551
     
    15861618   * @since 3.8.0
    15871619   */
    1588   public function translateHarmonicaNote($note, $from, $to) {
     1620  public function translateHarmonicaNote(string $note, string $from, string $to): string {
    15891621
    15901622    $from = strtolower($from);
     
    16871719   * @since 1.0.0
    16881720   */
    1689   public function getDisplayHBNotation() {
     1721  public function getDisplayHBNotation(): bool {
    16901722    return $this->displayHBNotation;
    16911723  }
     
    17021734   * @since 1.0.0
    17031735   */
    1704   public function setDisplayHBNotation($g) {
     1736  public function setDisplayHBNotation(bool $g): void {
    17051737    $this->displayHBNotation = $g;
    17061738  }
     
    17161748   * @since 1.0.0
    17171749   */
    1718   public function getFloat() {
     1750  public function getFloat(): string {
    17191751    return $this->float;
    17201752  }
     
    17311763   * @since 1.0.0
    17321764   */
    1733   public function setFloat($f) {
     1765  public function setFloat(string $f): void {
    17341766    $this->float = $f;
    17351767  }
     
    17451777   * @since 3.8.0
    17461778   */
    1747   public function getHarmonica() {
     1779  public function getHarmonica(): string {
    17481780    return $this->harmonica;
    17491781  }
     
    17601792   * @since 3.8.0
    17611793   */
    1762   public function setHarmonica($h) {
     1794  public function setHarmonica(string $h): void {
    17631795    if (in_array(strtolower($h), $this->harmonicaTypes)) {
    17641796      $this->harmonica = strtolower($h);
     
    17781810   * @since 1.0.0
    17791811   */
    1780   public function getHBNotation() {
     1812  public function getHBNotation(): string {
    17811813    return $this->hbNotation;
    17821814  }
     
    17931825   * @since 1.0.0
    17941826   */
    1795   public function setHBNotation($g) {
     1827  public function setHBNotation(string $g): void {
    17961828    $this->hbNotation = $g;
    17971829  }
     
    18071839   * @since 3.5.0
    18081840   */
    1809   public function getHideChords() {
     1841  public function getHideChords(): string {
    18101842    return $this->hideChords;
    18111843  }
     
    18221854   * @since 3.5.0
    18231855   */
    1824   public function setHideChords($g) {
     1856  public function setHideChords(string $g): void {
    18251857    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    18261858      $this->hideChords = true;
     
    18401872   * @since 3.5.0
    18411873   */
    1842   public function getHideComments() {
     1874  public function getHideComments(): string {
    18431875    return $this->hideComments;
    18441876  }
     
    18551887   * @since 3.5.0
    18561888   */
    1857   public function setHideComments($g) {
     1889  public function setHideComments(string $g): void {
    18581890    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    18591891      $this->hideComments = 1;
     
    18731905   * @since 3.5.0
    18741906   */
    1875   public function getHideComposer() {
     1907  public function getHideComposer(): string {
    18761908    return $this->hideComposer;
    18771909  }
     
    18881920   * @since 3.5.0
    18891921   */
    1890   public function setHideComposer($g) {
     1922  public function setHideComposer(string $g): void {
    18911923    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    18921924      $this->hideComposer = 1;
     
    19061938   * @since 3.5.0
    19071939   */
    1908   public function getHidePrint() {
     1940  public function getHidePrint(): string {
    19091941    return $this->hidePrint;
    19101942  }
     
    19211953   * @since 3.5.0
    19221954   */
    1923   public function setHidePrint($g) {
     1955  public function setHidePrint(string $g): void {
    19241956    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    19251957      $this->hidePrint = 1;
     
    19391971   * @since 3.5.0
    19401972   */
    1941   public function getHideSubtitle() {
     1973  public function getHideSubtitle(): string {
    19421974    return $this->hideSubtitle;
    19431975  }
     
    19541986   * @since 3.5.0
    19551987   */
    1956   public function setHideSubtitle($g) {
     1988  public function setHideSubtitle(string $g): void {
    19571989    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    19581990      $this->hideSubtitle = 1;
     
    19722004   * @since 3.5.0
    19732005   */
    1974   public function getHideTitle() {
     2006  public function getHideTitle(): string {
    19752007    return $this->hideTitle;
    19762008  }
     
    19872019   * @since 3.5.0
    19882020   */
    1989   public function setHideTitle($g) {
     2021  public function setHideTitle(string $g): void {
    19902022    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    19912023      $this->hideTitle = 1;
     
    20052037   * @since 3.8.1
    20062038   */
    2007   public function getFontsize() {
     2039  public function getFontsize(): string {
    20082040    return $this->hideFontsize;
    20092041  }
     
    20202052   * @since 3.8.1
    20212053   */
    2022   public function setHideFontsize($g) {
     2054  public function setHideFontsize(string $g): void {
    20232055    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    20242056      $this->hideFontsize = 1;
     
    20382070   * @since 3.5.0
    20392071   */
    2040   public function getHideTranspose() {
     2072  public function getHideTranspose(): string {
    20412073    return $this->hideTranspose;
    20422074  }
     
    20532085   * @since 3.5.0
    20542086   */
    2055   public function setHideTranspose($g) {
     2087  public function setHideTranspose(string $g): void {
    20562088    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    20572089      $this->hideTranspose = 1;
     
    20712103   * @since 3.6.0
    20722104   */
    2073   public function getNumericTranspose() {
     2105  public function getNumericTranspose(): string {
    20742106    return $this->showNumericTranspose;
    20752107  }
     
    20862118   * @since 3.6.0
    20872119   */
    2088   public function setNumericTranspose($g) {
     2120  public function setNumericTranspose(string $g): void {
    20892121    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    20902122      $this->showNumericTranspose = 1;
     
    21042136   * @since 3.6.0
    21052137   */
    2106   public function getFixedInteraction() {
     2138  public function getFixedInteraction(): string {
    21072139    return $this->fixedInteraction;
    21082140  }
     
    21192151   * @since 3.6.0
    21202152   */
    2121   public function setFixedInteraction($g) {
     2153  public function setFixedInteraction(string $g): void {
    21222154    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    21232155      $this->fixedInteraction = 1;
     
    21372169   * @since 3.5.0
    21382170   */
    2139   public function getHideYear() {
     2171  public function getHideYear(): string {
    21402172    return $this->hideYear;
    21412173  }
     
    21522184   * @since 3.5.0
    21532185   */
    2154   public function setHideYear($g) {
     2186  public function setHideYear(string $g): void {
    21552187    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    21562188      $this->hideYear = 1;
     
    21702202   * @since 1.0.0
    21712203   */
    2172   public function getInteractive() {
     2204  public function getInteractive(): string {
    21732205    return $this->interactive;
    21742206  }
     
    21852217   * @since 1.0.0
    21862218   */
    2187   public function setInteractive($i) {
     2219  public function setInteractive(string $i): void {
    21882220    $this->interactive = $i;
    21892221  }
     
    21992231   * @since 3.5.0
    22002232   */
    2201   public function getShowChordSheet() {
     2233  public function getShowChordSheet(): string {
    22022234    return $this->showChordSheet;
    22032235  }
     
    22142246   * @since 3.5.0
    22152247   */
    2216   public function setShowChordSheet($g) {
     2248  public function setShowChordSheet(string $g): void {
    22172249    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    22182250      $this->showChordSheet = 1;
     
    22322264   * @since 3.5.0
    22332265   */
    2234   public function getShowChordSheetOnTop() {
     2266  public function getShowChordSheetOnTop(): string {
    22352267    return $this->showChordSheetOnTop;
    22362268  }
     
    22472279   * @since 3.5.0
    22482280   */
    2249   public function setShowChordSheetOnTop($g) {
     2281  public function setShowChordSheetOnTop(string $g): void {
    22502282    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    22512283      $this->showChordSheetOnTop = 1;
     
    22652297   * @since 1.0.0
    22662298   */
    2267   public function getTranspose() {
     2299  public function getTranspose(): int {
    22682300    return $this->transpose;
    22692301  }
     
    22802312   * @since 1.0.0
    22812313   */
    2282   public function setTranspose($t) {
     2314  public function setTranspose(int $t): void {
    22832315    $this->transpose = $t;
    22842316  }
     
    22952327   * @return integer - Post ID or NULL
    22962328   */
    2297   private function find_guitar_chord_post($shortname) {
     2329  private function find_guitar_chord_post(string $shortname): int {
    22982330    $query_args = array(
    22992331      'posts_per_page' => 1,
     
    23222354   * @return void
    23232355   */
    2324   private function load_guitar_chord($postid) {
     2356  private function load_guitar_chord(int $postid): void {
    23252357    $my_chord = array();
    23262358    $post = get_post($postid);
     
    23612393   * @return string - Modal chord dialog HTML
    23622394   */
    2363 //    private function create_modal_chord($postid, $chord)
    2364 //    {
     2395//    private function create_modal_chord(int $postid, string $chord): string {
    23652396//        $modal_chord = '<!-- <button id="cpress-chord-' . $postid . '-modal-button">Click here to trigger the modal!</button> -->
    23662397//        <div id="cpress-chord-' . $postid . '-modal" class="cpress-modal">
     
    24052436   * @return false|string
    24062437   */
    2407   private function random_string($alphaonly = false, $length = 15) {
     2438  private function random_string(bool $alphaonly = false, int $length = 15): string|false {
    24082439    if ($alphaonly) {
    24092440      return substr(str_shuffle(str_repeat($x = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil($length / strlen($x)))), 1, $length);
     
    24242455   * @since 3.2.0
    24252456   */
    2426   private function dnd($a, $die = true) {
     2457  private function dnd(array $a, bool $die = true): string {
    24272458    $dump = highlight_string("<?php\n\$data =\n" . var_export($a, true) . ";\n?>");
    2428     if ($die) die($dump);
    2429     else return $dump;
     2459    if ($die) {
     2460      die($dump);
     2461    } else {
     2462      return $dump;
     2463    }
    24302464  }
    24312465}
  • chordpress/tags/3.9.3/languages/chordpress.pot

    r3298894 r3307608  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Lewe ChordPress 3.9.0\n"
     5"Project-Id-Version: Lewe ChordPress 3.9.2\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/chordpress\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2025-05-22T18:00:03+02:00\n"
     12"POT-Creation-Date: 2025-06-06T19:11:35+02:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.4.0\n"
     
    550550
    551551#: admin/partials/chordpress-admin-options.php:394
    552 msgid "With this option selected, the interaction menu will be fixed at the bottom of the page. Note, that this might lead to unexpected results depending on the WordPress theme you use. You can overwrite this setting per shortcut with \"fixedinteraction=yes/no\""
     552msgid "With this option selected, the interaction menu will be fixed at the bottom of the page. Note, that this might lead to unexpected results depending on the WordPress theme you use and if you use more than one ChordPress songsheet on a page. You can overwrite this setting per shortcut with \"fixedinteraction=yes/no\""
    553553msgstr ""
    554554
     
    12481248msgstr ""
    12491249
    1250 #: includes/class-chordpress-renderer.php:740
    1251 msgid "Font"
    1252 msgstr ""
    1253 
    1254 #: includes/class-chordpress-renderer.php:767
    1255 #: includes/class-chordpress-renderer.php:786
     1250#: includes/class-chordpress-renderer.php:763
     1251msgid "Composer"
     1252msgstr ""
     1253
     1254#: includes/class-chordpress-renderer.php:764
     1255msgid "Artist"
     1256msgstr ""
     1257
     1258#: includes/class-chordpress-renderer.php:765
     1259msgid "Year"
     1260msgstr ""
     1261
     1262#: includes/class-chordpress-renderer.php:766
     1263msgid "Album"
     1264msgstr ""
     1265
     1266#: includes/class-chordpress-renderer.php:769
     1267msgid "Key (original)"
     1268msgstr ""
     1269
     1270#: includes/class-chordpress-renderer.php:770
     1271msgid "Key (transposed)"
     1272msgstr ""
     1273
     1274#: includes/class-chordpress-renderer.php:777
     1275msgid "Time"
     1276msgstr ""
     1277
     1278#: includes/class-chordpress-renderer.php:778
     1279msgid "Tempo"
     1280msgstr ""
     1281
     1282#: includes/class-chordpress-renderer.php:779
     1283msgid "Capo"
     1284msgstr ""
     1285
     1286#: includes/class-chordpress-renderer.php:809
     1287msgid "These known chords are used in this song"
     1288msgstr ""
     1289
    12561290#: includes/class-chordpress-renderer.php:854
     1291msgid "Font Size"
     1292msgstr ""
     1293
     1294#: includes/class-chordpress-renderer.php:881
     1295#: includes/class-chordpress-renderer.php:900
     1296#: includes/class-chordpress-renderer.php:969
    12571297msgid "Transpose"
    12581298msgstr ""
    12591299
    1260 #: includes/class-chordpress-renderer.php:788
     1300#: includes/class-chordpress-renderer.php:902
    12611301msgid "Only works for international key names"
    12621302msgstr ""
    12631303
    1264 #: includes/class-chordpress-renderer.php:835
     1304#: includes/class-chordpress-renderer.php:949
    12651305msgid "Harmonica"
    12661306msgstr ""
    12671307
    1268 #: includes/class-chordpress-renderer.php:840
     1308#: includes/class-chordpress-renderer.php:955
    12691309msgid "Only works when using harmonica notation"
    12701310msgstr ""
    12711311
    1272 #: includes/class-chordpress-renderer.php:842
     1312#: includes/class-chordpress-renderer.php:957
    12731313msgid "Diatonic"
    12741314msgstr ""
    12751315
    1276 #: includes/class-chordpress-renderer.php:843
     1316#: includes/class-chordpress-renderer.php:958
    12771317msgid "Chromatic"
    12781318msgstr ""
    12791319
    1280 #: includes/class-chordpress-renderer.php:844
     1320#: includes/class-chordpress-renderer.php:959
    12811321msgid "Tremolo"
    12821322msgstr ""
    12831323
    1284 #: includes/class-chordpress-renderer.php:870
     1324#: includes/class-chordpress-renderer.php:989
    12851325msgid "Print"
    12861326msgstr ""
    12871327
    1288 #: includes/class-chordpress-renderer.php:906
    1289 msgid "Composer"
    1290 msgstr ""
    1291 
    1292 #: includes/class-chordpress-renderer.php:907
    1293 msgid "Artist"
    1294 msgstr ""
    1295 
    1296 #: includes/class-chordpress-renderer.php:908
    1297 msgid "Year"
    1298 msgstr ""
    1299 
    1300 #: includes/class-chordpress-renderer.php:909
    1301 msgid "Album"
    1302 msgstr ""
    1303 
    1304 #: includes/class-chordpress-renderer.php:912
    1305 msgid "Key (original)"
    1306 msgstr ""
    1307 
    1308 #: includes/class-chordpress-renderer.php:913
    1309 msgid "Key (transposed)"
    1310 msgstr ""
    1311 
    1312 #: includes/class-chordpress-renderer.php:920
    1313 msgid "Time"
    1314 msgstr ""
    1315 
    1316 #: includes/class-chordpress-renderer.php:921
    1317 msgid "Tempo"
    1318 msgstr ""
    1319 
    1320 #: includes/class-chordpress-renderer.php:922
    1321 msgid "Capo"
    1322 msgstr ""
    1323 
    1324 #: includes/class-chordpress-renderer.php:952
    1325 msgid "These known chords are used in this song"
    1326 msgstr ""
    1327 
    1328 #: includes/class-chordpress-renderer.php:1070
     1328#: includes/class-chordpress-renderer.php:1093
    13291329msgid "Missing square bracket in line"
    13301330msgstr ""
  • chordpress/tags/3.9.3/readme.txt

    r3307598 r3307608  
    55Requires at least: 4.0
    66Tested up to: 6.8
    7 Stable tag: 3.9.2
     7Stable tag: 3.9.3
    88Requires PHP: 5.2.4
    99License: GPLv3
     
    130130
    131131== Changelog ==
     132= 3.9.3 =
     133* 2025-06-06
     134* Improved interaction menu (but do not use fixed position when more than one song on a page)
     135
    132136= 3.9.2 =
    133137* 2025-06-02
  • chordpress/trunk/admin/partials/chordpress-admin-options.php

    r3243398 r3307608  
    392392              <td>
    393393                <input type='checkbox' id='<?php echo $pname; ?>_checkbox_fixed_interaction' name='<?php echo $pname; ?>_checkbox_fixed_interaction' <?php checked(get_option($pname . '_checkbox_fixed_interaction'), 1); ?> value='1'>
    394                 <p class="description"><?php echo esc_html(__('With this option selected, the interaction menu will be fixed at the bottom of the page. Note, that this might lead to unexpected results depending on the WordPress theme you use. You can overwrite this setting per shortcut with "fixedinteraction=yes/no"', 'chordpress')); ?>.</p>
     394                <p class="description"><?php echo esc_html(__('With this option selected, the interaction menu will be fixed at the bottom of the page. Note, that this might lead to unexpected results depending on the WordPress theme you use and if you use more than one ChordPress songsheet on a page. You can overwrite this setting per shortcut with "fixedinteraction=yes/no"', 'chordpress')); ?>.</p>
    395395              </td>
    396396            </tr>
  • chordpress/trunk/chordpress.php

    r3305993 r3307608  
    1919 * Plugin URI:        https://lewe.gitbook.io/lewe-chordpress/
    2020 * Description:       This plugin renders ChordPro formatted text and chord diagrams in WordPress sites.
    21  * Version:           3.9.2
     21 * Version:           3.9.3
    2222 * Author:            George Lewe
    2323 * Author URI:        https://www.lewe.com
     
    3838 */
    3939define('CHORDPRESS_NAME', 'ChordPress');
    40 define('CHORDPRESS_VERSION', '3.9.2');
     40define('CHORDPRESS_VERSION', '3.9.3');
    4141define('CHORDPRESS_AUTHOR', 'George Lewe');
    4242define('CHORDPRESS_AUTHOR_URI', 'https://www.lewe.com');
  • chordpress/trunk/includes/class-chordpress-renderer.php

    r3305993 r3307608  
    5555   * @var      array $harmonicaTypes Harmonica types.
    5656   */
    57   private $harmonicaTypes = array( 'tremolo', 'diatonic', 'chromatic' );
     57  private $harmonicaTypes = [ 'tremolo', 'diatonic', 'chromatic' ];
    5858
    5959  /**
     
    499499
    500500  private $arrChromaticTranspose = array(
    501     '1' => ['1', '1s', '-1', '-1s', '2', '-2', '-2s', '3', '3s', '-3', '-3s', '-4'],
    502     '1s' => ['1s', '-1', '-1s', '2', '-2', '-2s', '3', '3s', '-3', '-3s', '-4', '4' ],
    503     '-1' => ['-1', '-1s', '2', '-2', '-2s', '3', '3s', '-3', '-3s', '-4', '4', '4s' ],
    504     '-1s' => ['-1s', '2', '-2', '-2s', '3', '3s', '-3', '-3s', '-4', '4', '4s', '-5' ],
    505     '2' => ['2', '-2', '-2s', '3', '3s', '-3', '-3s', '-4', '4', '4s', '-5', '-5s' ],
    506     '-2' => ['-2', '-2s', '3', '3s', '-3', '-3s', '-4', '4', '4s', '-5', '-5s', '6' ],
    507     '-2s' => ['-2s', '3', '3s', '-3', '-3s', '-4', '4', '4s', '-5', '-5s', '6', '-6' ],
    508     '3' => ['3', '3s', '-3', '-3s', '-4', '4', '4s', '-5', '-5s', '6', '-6', '-6s' ],
    509     '3s' => ['3s', '-3', '-3s', '-4', '4', '4s', '-5', '-5s', '6', '-6', '-6s', '7' ],
    510     '-3' => ['-3', '-3s', '-4', '4', '4s', '-5', '-5s', '6', '-6', '-6s', '7', '7s' ],
    511     '-3s' => ['-3s', '-4', '4', '4s', '-5', '-5s', '6', '-6', '-6s', '7', '7s', '-7' ],
    512     '-4' => ['-4', '4', '4s', '-5', '-5s', '6', '-6', '-6s', '7', '7s', '-7', '-7s' ],
    513     '4' => ['4', '4s', '-5', '-5s', '6', '-6', '-6s', '7', '7s', '-7', '-7s', '-8' ],
    514     '4s' => ['4s', '-5', '-5s', '6', '-6', '-6s', '7', '7s', '-7', '-7s', '-8', '8' ],
    515     '-5' => ['-5', '-5s', '6', '-6', '-6s', '7', '7s', '-7', '-7s', '-8', '8', '9' ],
    516     '-5s' => ['-5s', '6', '-6', '-6s', '7', '7s', '-7', '-7s', '-8', '8', '9', '9s' ],
    517     '6' => ['6', '-6', '-6s', '7', '7s', '-7', '-7s', '-8', '8', '9', '9s', '-9' ],
    518     '-6' => ['-6', '-6s', '7', '7s', '-7', '-7s', '-8', '8', '9', '9s', '-9', '-9s' ],
    519     '-6s' => ['-6s', '7', '7s', '-7', '-7s', '-8', '8', '9', '9s', '-9', '-9s', '10' ],
    520     '7' => ['7', '7s', '-7', '-7s', '-8', '8', '9', '9s', '-9', '-9s', '10', '-10' ],
    521     '7s' => ['7s', '-7', '-7s', '-8', '8', '9', '9s', '-9', '-9s', '10', '-10', '-10s' ],
    522     '-7' => ['-7', '-7s', '-8', '8', '9', '9s', '-9', '-9s', '10', '-10', '-10s', '11' ],
    523     '-7s' => ['-7s', '-8', '8', '9', '9s', '-9', '-9s', '10', '-10', '-10s', '11', '11s' ],
    524     '-8' => ['-8', '8', '9', '9s', '-9', '-9s', '10', '-10', '-10s', '11', '11s', '-11' ],
    525     '8' => ['8', '9', '9s', '-9', '-9s', '10', '-10', '-10s', '11', '11s', '-11', '-11s' ],
    526     '9' => ['9', '9s', '-9', '-9s', '10', '-10', '-10s', '11', '11s', '-11', '-11s', '-12' ],
    527     '9s' => ['9s', '-9', '-9s', '10', '-10', '-10s', '11', '11s', '-11', '-11s', '-12', '12' ],
    528     '-9' => ['-9', '-9s', '10', '-10', '-10s', '11', '11s', '-11', '-11s', '-12', '12', '12s' ],
    529     '-9s' => ['-9s', '10', '-10', '-10s', '11', '11s', '-11', '-11s', '-12', '12', '12s', ' ' ],
    530     '10' => ['10', '-10', '-10s', '11', '11s', '-11', '-11s', '-12', '12', '12s', ' ', ' ' ],
    531     '-10' => ['-10', '-10s', '11', '11s', '-11', '-11s', '-12', '12', '12s', ' ', ' ', ' ' ],
    532     '-10s' => ['-10s', '11', '11s', '-11', '-11s', '-12', '12', '12s', ' ', ' ', ' ', ' ' ],
    533     '11' => ['11', '11s', '-11', '-11s', '-12', '12', '12s', ' ', ' ', ' ', ' ', ' ' ],
    534     '11s' => ['11s', '-11', '-11s', '-12', '12', '12s', ' ', ' ', ' ', ' ', ' ', ' ' ],
    535     '-11' => ['-11', '-11s', '-12', '12', '12s', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
    536     '-11s' => ['-11s', '-12', '12', '12s', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
    537     '-12' => ['-12', '12', '12s', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
    538     '12' => ['12', '12s', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
    539     '12s' => ['12s', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
     501    '1' => [ '1', '1s', '-1', '-1s', '2', '-2', '-2s', '3', '3s', '-3', '-3s', '-4' ],
     502    '1s' => [ '1s', '-1', '-1s', '2', '-2', '-2s', '3', '3s', '-3', '-3s', '-4', '4' ],
     503    '-1' => [ '-1', '-1s', '2', '-2', '-2s', '3', '3s', '-3', '-3s', '-4', '4', '4s' ],
     504    '-1s' => [ '-1s', '2', '-2', '-2s', '3', '3s', '-3', '-3s', '-4', '4', '4s', '-5' ],
     505    '2' => [ '2', '-2', '-2s', '3', '3s', '-3', '-3s', '-4', '4', '4s', '-5', '-5s' ],
     506    '-2' => [ '-2', '-2s', '3', '3s', '-3', '-3s', '-4', '4', '4s', '-5', '-5s', '6' ],
     507    '-2s' => [ '-2s', '3', '3s', '-3', '-3s', '-4', '4', '4s', '-5', '-5s', '6', '-6' ],
     508    '3' => [ '3', '3s', '-3', '-3s', '-4', '4', '4s', '-5', '-5s', '6', '-6', '-6s' ],
     509    '3s' => [ '3s', '-3', '-3s', '-4', '4', '4s', '-5', '-5s', '6', '-6', '-6s', '7' ],
     510    '-3' => [ '-3', '-3s', '-4', '4', '4s', '-5', '-5s', '6', '-6', '-6s', '7', '7s' ],
     511    '-3s' => [ '-3s', '-4', '4', '4s', '-5', '-5s', '6', '-6', '-6s', '7', '7s', '-7' ],
     512    '-4' => [ '-4', '4', '4s', '-5', '-5s', '6', '-6', '-6s', '7', '7s', '-7', '-7s' ],
     513    '4' => [ '4', '4s', '-5', '-5s', '6', '-6', '-6s', '7', '7s', '-7', '-7s', '-8' ],
     514    '4s' => [ '4s', '-5', '-5s', '6', '-6', '-6s', '7', '7s', '-7', '-7s', '-8', '8' ],
     515    '-5' => [ '-5', '-5s', '6', '-6', '-6s', '7', '7s', '-7', '-7s', '-8', '8', '9' ],
     516    '-5s' => [ '-5s', '6', '-6', '-6s', '7', '7s', '-7', '-7s', '-8', '8', '9', '9s' ],
     517    '6' => [ '6', '-6', '-6s', '7', '7s', '-7', '-7s', '-8', '8', '9', '9s', '-9' ],
     518    '-6' => [ '-6', '-6s', '7', '7s', '-7', '-7s', '-8', '8', '9', '9s', '-9', '-9s' ],
     519    '-6s' => [ '-6s', '7', '7s', '-7', '-7s', '-8', '8', '9', '9s', '-9', '-9s', '10' ],
     520    '7' => [ '7', '7s', '-7', '-7s', '-8', '8', '9', '9s', '-9', '-9s', '10', '-10' ],
     521    '7s' => [ '7s', '-7', '-7s', '-8', '8', '9', '9s', '-9', '-9s', '10', '-10', '-10s' ],
     522    '-7' => [ '-7', '-7s', '-8', '8', '9', '9s', '-9', '-9s', '10', '-10', '-10s', '11' ],
     523    '-7s' => [ '-7s', '-8', '8', '9', '9s', '-9', '-9s', '10', '-10', '-10s', '11', '11s' ],
     524    '-8' => [ '-8', '8', '9', '9s', '-9', '-9s', '10', '-10', '-10s', '11', '11s', '-11' ],
     525    '8' => [ '8', '9', '9s', '-9', '-9s', '10', '-10', '-10s', '11', '11s', '-11', '-11s' ],
     526    '9' => [ '9', '9s', '-9', '-9s', '10', '-10', '-10s', '11', '11s', '-11', '-11s', '-12' ],
     527    '9s' => [ '9s', '-9', '-9s', '10', '-10', '-10s', '11', '11s', '-11', '-11s', '-12', '12' ],
     528    '-9' => [ '-9', '-9s', '10', '-10', '-10s', '11', '11s', '-11', '-11s', '-12', '12', '12s' ],
     529    '-9s' => [ '-9s', '10', '-10', '-10s', '11', '11s', '-11', '-11s', '-12', '12', '12s', ' ' ],
     530    '10' => [ '10', '-10', '-10s', '11', '11s', '-11', '-11s', '-12', '12', '12s', ' ', ' ' ],
     531    '-10' => [ '-10', '-10s', '11', '11s', '-11', '-11s', '-12', '12', '12s', ' ', ' ', ' ' ],
     532    '-10s' => [ '-10s', '11', '11s', '-11', '-11s', '-12', '12', '12s', ' ', ' ', ' ', ' ' ],
     533    '11' => [ '11', '11s', '-11', '-11s', '-12', '12', '12s', ' ', ' ', ' ', ' ', ' ' ],
     534    '11s' => [ '11s', '-11', '-11s', '-12', '12', '12s', ' ', ' ', ' ', ' ', ' ', ' ' ],
     535    '-11' => [ '-11', '-11s', '-12', '12', '12s', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
     536    '-11s' => [ '-11s', '-12', '12', '12s', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
     537    '-12' => [ '-12', '12', '12s', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
     538    '12' => [ '12', '12s', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
     539    '12s' => [ '12s', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
    540540  );
    541541
     
    558558   */
    559559  private $allowedChordPrefixes = array( '~', '|', '/', '.', '-', '+', '1', '2', '3', '4', '5', '6', '7', '8', '9' );
     560
     561  /**
     562   * Holds the styles for the songsheet
     563   *
     564   * @since    3.9.3
     565   * @access   private
     566   * @var      string
     567   */
     568  private $songsheetStyles = '';
    560569
    561570  /**
     
    616625   * Get the ChordPro directives and store the supported ones in an array.
    617626   *
    618    * @param object $text - Text inside shortcode wrapper.
     627   * @param array $text - Text inside shortcode wrapper in an array (each line is an array element).
    619628   *
    620629   * @since 1.0.0
    621630   */
    622   public function getDirectives($text) {
     631  public function getDirectives(array $text) {
    623632    foreach ($text as $line) {
    624633      $line = trim($this->stripTags($line));
     
    698707   * </div>
    699708   *
    700    * @param object $text - Text inside shortcode wrapper.
     709   * @param array $text - Text inside shortcode wrapper in an array (each line is an array element).
    701710   *
    702711   * @return string - Formatted HTML of the ChordPro text.
    703712   * @since 1.0.0
    704713   */
    705   public function displayText($text): string {
    706     /**
    707      * Start of ChordPress wrapper
    708      */
    709     $cpressStyles = "<style>div.cpress { float: " . $this->float . "; } div.cpress_line { " . $this->lineStyle . "; } div.cpress_line_section { display: inline; float: left; } div.cpress_line_section .chord .chordshort { " . $this->chordStyle . "; } div.cpress_line_section .lyric { " . $this->lyricsStyle . "; } div.cpress_chorus { " . $this->chorusStyle . "; } div.cpress_verse { " . $this->verseStyle . "; } div.cpress_clear { clear: both; } div.cpress_meta { " . $this->metaStyle . "; } div.cpress_interaction { float: right; } div.cpress_interaction select { width: auto; } span.cpress_comment { " . $this->commentStyle . "; } div.cpress_chordsheet { text-align: center; }</style>";
    710 
    711     $returnText = "\n\n
     714  public function displayText(array $text): string {
     715    /**
     716     * The styles need to be a one-line string in a separate variable because it is passed to the Javascript print function
     717     */
     718    $this->songsheetStyles = "<style>div.cpress { float: " . $this->float . "; } div.cpress_line { " . $this->lineStyle . "; } div.cpress_line_section { display: inline; float: left; } div.cpress_line_section .chord .chordshort { " . $this->chordStyle . "; } div.cpress_line_section .lyric { " . $this->lyricsStyle . "; } div.cpress_chorus { " . $this->chorusStyle . "; } div.cpress_verse { " . $this->verseStyle . "; } div.cpress_clear { clear: both; } div.cpress_meta { " . $this->metaStyle . "; } div.cpress_interaction { float: right; } div.cpress_interaction select { width: auto; } span.cpress_comment { " . $this->commentStyle . "; } div.cpress_chordsheet { text-align: center; }</style>";
     719
     720    $songsheetHtml = "\n\n
    712721      <!--begin: ChordPress SongSheet -->
    713722      <div>
    714       " . $cpressStyles . "
     723      " . $this->songsheetStyles . "
    715724      </div>\n";
    716725
     
    719728     */
    720729    if (in_array(strtolower($this->interactive), array( "yes", "1", "true" ))) {
    721       $interactionForm = "<div class=\"cpress-interaction cpress-row";
    722       if ($this->fixedInteraction) {
    723         $interactionForm .= " fixed";
     730      $songsheetHtml .= $this->buildInteractionMenu();
     731    }
     732
     733    $songsheetHtml .= "<div id=\"%cpressID%\" class=\"cpress\">\n";
     734
     735    /**
     736     * Print header and subtitle if directives exist
     737     */
     738    $randId = $this->random_string(true);
     739    if (strlen($this->arrDirectives['title']) && !$this->hideTitle) {
     740      $cpressID = str_replace(' ', '-', strtolower(trim($this->arrDirectives['title']))) . '-' . $randId;
     741      $songsheetHtml = str_replace('%cpressID%', $cpressID, $songsheetHtml);
     742      $songsheetHtml .= '<' . $this->titleLevel . '>' . $this->arrDirectives['title'] . '</' . $this->titleLevel . ">\n";
     743    } else {
     744      $cpressID = 'ccpress-id-' . $randId;
     745      $songsheetHtml = str_replace('%cpressID%', $cpressID, $songsheetHtml);
     746    }
     747    if (strlen($this->arrDirectives['subtitle']) && !$this->hideSubtitle) {
     748      $songsheetHtml .= '<' . $this->subtitleLevel . '>' . $this->arrDirectives['subtitle'] . '</' . $this->subtitleLevel . ">\n";
     749    }
     750
     751    /**
     752     * Print meta data if directives exist
     753     */
     754    if (
     755      strlen($this->arrDirectives['album']) ||
     756      strlen($this->arrDirectives['artist']) ||
     757      strlen($this->arrDirectives['capo']) ||
     758      strlen($this->arrDirectives['composer']) ||
     759      strlen($this->arrDirectives['key']) ||
     760      strlen($this->arrDirectives['tempo']) ||
     761      strlen($this->arrDirectives['time']) ||
     762      strlen($this->arrDirectives['year'])
     763    ) {
     764      $songsheetHtml .= "<div class=\"cpress_meta\">\n";
     765      if (strlen($this->arrDirectives['composer']) && !$this->hideComposer) $songsheetHtml .= esc_html(__('Composer', 'chordpress')) . ': ' . $this->arrDirectives['composer'] . "<br>\n";
     766      if (strlen($this->arrDirectives['artist']) && !$this->hideArtist) $songsheetHtml .= esc_html(__('Artist', 'chordpress')) . ': ' . $this->arrDirectives['artist'] . "<br>\n";
     767      if (strlen($this->arrDirectives['year']) && !$this->hideYear) $songsheetHtml .= esc_html(__('Year', 'chordpress')) . ': ' . $this->arrDirectives['year'] . "<br>\n";
     768      if (strlen($this->arrDirectives['album']) && !$this->hideAlbum) $songsheetHtml .= esc_html(__('Album', 'chordpress')) . ': ' . $this->arrDirectives['album'] . "<br>\n";
     769
     770      if (strlen($this->arrDirectives['key']) && !$this->hideKey) {
     771        $songsheetHtml .= esc_html(__('Key (original)', 'chordpress')) . ': ' . $this->arrDirectives['key'] . "<br>\n";
     772        $songsheetHtml .= esc_html(__('Key (transposed)', 'chordpress')) . ': <span class="chord-hidable-%cpressID% key-%cpressID%-0">' . $this->arrDirectives['key'] . '</span>';
     773        for ($t = 1; $t <= 11; $t++) {
     774          $songsheetHtml .= '<span class="chord-hidable-%cpressID% key-%cpressID%-' . $t . '" style="display:none">' . $this->arrTransposeValues[$this->arrDirectives['key']][$t] . '</span>';
     775        }
     776        $songsheetHtml .= "<br>\n";
    724777      }
    725       $interactionForm .= "\">";
    726 
    727       if (!$this->hideFontsize) {
    728         $interactionForm .= "<div class='cpress-col cpress-pl-0'>" . __('Font', 'chordpress') . "<br>
     778
     779      if (strlen($this->arrDirectives['time'])) $songsheetHtml .= esc_html(__('Time', 'chordpress')) . ': ' . $this->arrDirectives['time'] . "<br>\n";
     780      if (strlen($this->arrDirectives['tempo'])) $songsheetHtml .= esc_html(__('Tempo', 'chordpress')) . ': ' . $this->arrDirectives['tempo'] . "<br>\n";
     781      if (strlen($this->arrDirectives['capo'])) $songsheetHtml .= esc_html(__('Capo', 'chordpress')) . ': ' . $this->arrDirectives['capo'] . "<br>\n";
     782      $songsheetHtml = preg_replace('/<br>$/', '', $songsheetHtml); // Remove last <br>
     783      $songsheetHtml .= "</div>\n";
     784    }
     785
     786    /**
     787     * Go through each line and process it
     788     */
     789    $this->inMonospace = false;
     790    foreach ($text as $line) {
     791      if ($this->inMonospace && strpos($line, "{end_of_monospace}") === false) {
     792        $songsheetHtml .= $line;
     793      } else {
     794        $songsheetHtml .= $this->formatAndDisplayLine($line);
     795      }
     796    }
     797    $songsheetHtml = str_replace('%cpressID%', $cpressID, $songsheetHtml);
     798
     799    /**
     800     * End of ChordPress song
     801     */
     802    $songsheetHtml .= "</div>\n<!--end: ChordPress SongSheet-->\n";
     803
     804    /**
     805     * Build chord sheet if option set to true.
     806     */
     807    if ($this->showChordSheet) {
     808      $chordSheetText = "\n<!--begin: ChordPress ChordSheet-->\n";
     809      $chordSheetText .= "<div class='cpress_chordsheet'>\n";
     810      $chordSheetText .= "<div><hr></div>\n";
     811      $chordSheetText .= "<p><i>" . esc_html(__('These known chords are used in this song', 'chordpress')) . ".</i></p>";
     812      $this->uniqueChords = array_unique($this->allChords);
     813      foreach ($this->uniqueChords as $uc) {
     814        if ($postid = $this->find_guitar_chord_post($uc)) {
     815          $this->load_guitar_chord($postid);
     816          $chordSheetText .= $this->C->createSvgChord(true);
     817        }
     818      }
     819      $chordSheetText .= "</div>\n<div style=\"clear:both; padding: 16px 0 16px 0;\"><hr></div>\n<!--end: ChordPress ChordSheet-->\n\n";
     820      if ($this->showChordSheetOnTop) {
     821        $songsheetHtml = $chordSheetText . $songsheetHtml;
     822      } else {
     823        $songsheetHtml = $songsheetHtml . $chordSheetText;
     824      }
     825    }
     826
     827// $this->C->dnd($songsheetHtml);
     828    return $songsheetHtml . "\n\n";
     829  }
     830
     831  /**
     832   * --------------------------------------------------------------------------
     833   * Builds the Interactive Menu
     834   * --------------------------------------------------------------------------
     835   *
     836   * Builds the interaction menu for the ChordPress song sheet.
     837   *
     838   * This function generates the HTML for the interaction menu, which includes
     839   * options for font size adjustment, transposition, and printing. The menu
     840   * can be fixed at the bottom of the page if the `fixedInteraction` property
     841   * is set. The function also handles harmonica-specific options if applicable.
     842   *
     843   * @return string The HTML string for the interaction menu.
     844   * @since  3.9.2
     845   * @access private
     846   *
     847   */
     848  private function buildInteractionMenu(): string {
     849    $interactionForm = "<div class=\"cpress-interaction cpress-row";
     850    if ($this->fixedInteraction) {
     851      $interactionForm .= " fixed";
     852    }
     853    $interactionForm .= "\">";
     854
     855    if (!$this->hideFontsize) {
     856      $interactionForm .= "<div class='cpress-col cpress-mb-2'>" . __('Font Size', 'chordpress') . "<br>
    729857          <div class='cpress-btn-group' role='group'>
    730858            <button type='button' class='cpress-btn cpress-btn-secondary cpress-btn-sm' onclick=\"changeFontSize('%cpressID%', -5);\">-</button>
     
    733861          </div>
    734862        </div>";
    735       }
    736 
    737       if (!$this->hideTranspose) {
    738         $interactionForm .= "<div class='cpress-col' style='display: inline-block;'>";
    739 
    740         if (!$this->harmonica) {
     863    }
     864
     865    if (!$this->hideTranspose) {
     866      $interactionForm .= "<div class='cpress-col' style='display: inline-block;'>";
     867
     868      if (!$this->harmonica) {
     869        //
     870        // Guitar chords
     871        //
     872        if ($this->showNumericTranspose && !$this->harmonica) {
    741873          //
    742           // Guitar chords
     874          // Let's see if a 'Key' directive was given. If so, we can add the transposed keys to the list.
    743875          //
    744           if ($this->showNumericTranspose && !$this->harmonica) {
    745             //
    746             // Let's see if a 'Key' directive was given. If so, we can add the transposed keys to the list.
    747             //
    748             if (strlen($this->arrDirectives['key']) && in_array($this->arrDirectives['key'], $this->arrKeys)) {
    749               $songKey = "'" . $this->arrDirectives['key'] . "'";
    750               $initialText = '0 (' . $this->arrDirectives['key'] . ')';
    751             } else {
    752               $songKey = "''";
    753               $initialText = '0';
    754             }
    755             $interactionForm .= __('Transpose', 'chordpress') . "<br>
     876          if (strlen($this->arrDirectives['key']) && in_array($this->arrDirectives['key'], $this->arrKeys)) {
     877            $songKey = "'" . $this->arrDirectives['key'] . "'";
     878            $initialText = '0 (' . $this->arrDirectives['key'] . ')';
     879          } else {
     880            $songKey = "''";
     881            $initialText = '0';
     882          }
     883          $interactionForm .= __('Transpose', 'chordpress') . "<br>
    756884              <div class='cpress-btn-group' role='group'>
    757885                <button type='button' class='cpress-btn cpress-btn-secondary cpress-btn-sm' onclick=\"transposeChords('%cpressID%', 'btnTranspose-', 'down', " . $songKey . ");\">-</button>
     
    759887                <button type='button' class='cpress-btn cpress-btn-secondary cpress-btn-sm' onclick=\"transposeChords('%cpressID%', 'btnTranspose-', 'up', " . $songKey . ");\">+</button>
    760888              </div>";
     889        } else {
     890          //
     891          // Let's see if a 'Key' directive was given. If so, we can add the transposed keys to the list.
     892          //
     893          if (strlen($this->arrDirectives['key']) && in_array($this->arrDirectives['key'], $this->arrKeys)) {
     894            $i = 0;
     895            foreach ($this->arrTransposeValues[$this->arrDirectives['key']] as $val) {
     896              $tvalues[] = (string)$i . ' => ' . $val;
     897              $i++;
     898            }
    761899          } else {
    762             //
    763             // Let's see if a 'Key' directive was given. If so, we can add the transposed keys to the list.
    764             //
    765             if (strlen($this->arrDirectives['key']) && in_array($this->arrDirectives['key'], $this->arrKeys)) {
    766               $i = 0;
    767               foreach ($this->arrTransposeValues[$this->arrDirectives['key']] as $val) {
    768                 $tvalues[] = (string)$i . ' => ' . $val;
    769                 $i++;
    770               }
    771             } else {
    772               $tvalues = array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11' );
    773             }
    774             $interactionForm .= __('Transpose', 'chordpress') . "
     900            $tvalues = array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11' );
     901          }
     902          $interactionForm .= __('Transpose', 'chordpress') . "
    775903              <div class=\"float-right\">
    776904                <select class=\"cpress-form-control cpress-form-control-sm cpress-py-0 cpress-px-2\" id=\"selTranspose-%cpressID%\" onchange=\"transposeChords('%cpressID%', 'selTranspose-');return false;\" title=\"" . __('Only works for international key names', 'chordpress') . ".\">
     
    789917                </select>
    790918              </div>";
    791           }
    792         } else {
    793           //
    794           // Harmonica notes
    795           //
    796           switch ($this->harmonica) {
    797             case 'tremolo':
    798               $selectedDiatonic = '';
    799               $selectedChromatic = '';
    800               $selectedTremolo = ' selected';
    801               break;
    802             case 'diatonic':
    803               $selectedDiatonic = ' selected';
    804               $selectedChromatic = '';
    805               $selectedTremolo = '';
    806               break;
    807             case 'chromatic':
    808               $selectedDiatonic = '';
    809               $selectedChromatic = ' selected';
    810               $selectedTremolo = '';
    811               break;
    812             default:
    813               $selectedDiatonic = '';
    814               $selectedChromatic = '';
    815               $selectedTremolo = '';
    816               break;
    817           }
    818 
    819           $interactionForm .=
    820             "<div class='cpress-row'>
     919        }
     920      } else {
     921        //
     922        // Harmonica notes
     923        //
     924        switch ($this->harmonica) {
     925          case 'tremolo':
     926            $selectedDiatonic = '';
     927            $selectedChromatic = '';
     928            $selectedTremolo = ' selected';
     929            break;
     930          case 'diatonic':
     931            $selectedDiatonic = ' selected';
     932            $selectedChromatic = '';
     933            $selectedTremolo = '';
     934            break;
     935          case 'chromatic':
     936            $selectedDiatonic = '';
     937            $selectedChromatic = ' selected';
     938            $selectedTremolo = '';
     939            break;
     940          default:
     941            $selectedDiatonic = '';
     942            $selectedChromatic = '';
     943            $selectedTremolo = '';
     944            break;
     945        }
     946
     947        $interactionForm .=
     948          "<div class='cpress-row'>
    821949              <div class='cpress-col'>";
    822950
    823           $interactionForm .= __('Harmonica', 'chordpress') . "<br>
     951        $interactionForm .= __('Harmonica', 'chordpress') . "<br>
    824952            <select
    825953              class=\"cpress-form-control cpress-form-control-sm cpress-py-0 cpress-px-2\"
     
    834962            </select>";
    835963
    836           $interactionForm .= "
     964        $interactionForm .= "
    837965            </div>
    838966            <div class='cpress-col'>";
    839967
    840           if ($this->harmonica == 'chromatic') {
    841             $baseNote = "''";
    842             $initialText = '0';
    843             $interactionForm .= "<span id='btnTranspose-chromatic'>" . __('Transpose', 'chordpress') . "<br>
     968        if ($this->harmonica == 'chromatic') {
     969          $baseNote = "''";
     970          $initialText = '0';
     971          $interactionForm .= "<span id='btnTranspose-chromatic'>" . __('Transpose', 'chordpress') . "<br>
    844972              <div class='cpress-btn-group' role='group'>
    845973                <button type='button' class='cpress-btn cpress-btn-secondary cpress-btn-sm' onclick=\"transposeChromatic('%cpressID%', 'btnTranspose-', 'down', " . $baseNote . ");\">-</button>
     
    848976              </div>
    849977              </span>";
    850           }
    851           $interactionForm .= "
     978        }
     979        $interactionForm .= "
    852980              </div>
    853981            </div>";
    854         }
    855         $interactionForm .= "</div>";
    856       }
    857       $interactionForm .= "<div class='cpress-col cpress-pr-0'>";
    858       if (!$this->hidePrint) {
    859         $printTitle = 'ChordPress SongSheet';
    860         if (strlen($this->arrDirectives['title']) && !$this->hideTitle) {
    861           $printTitle = $this->arrDirectives['title'];
    862         }
    863         $interactionForm .= "<br><button class='cpress-btn cpress-btn-secondary cpress-btn-sm' onclick=\"printElement('%cpressID%', '" . $printTitle . "', '" . $cpressStyles . "');\">" . __('Print', 'chordpress') . "</button>\n";
    864 //        $interactionForm .= "<br><button class='cpress-btn cpress-btn-secondary cpress-btn-sm' onclick=\"window.print();\">" . __('Print', 'chordpress') . "</button>\n";
    865982      }
    866983      $interactionForm .= "</div>";
    867       $returnText .= $interactionForm . "</div>\n";
    868     }
    869 
    870     $returnText .= "<div id=\"%cpressID%\" class=\"cpress\">\n";
    871 
    872     /**
    873      * Print header if directives exist
    874      */
    875     $randId = $this->random_string(true);
    876     if (strlen($this->arrDirectives['title']) && !$this->hideTitle) {
    877       $cpressID = str_replace(' ', '-', strtolower(trim($this->arrDirectives['title']))) . '-' . $randId;
    878       $returnText = str_replace('%cpressID%', $cpressID, $returnText);
    879       $returnText .= '<' . $this->titleLevel . '>' . $this->arrDirectives['title'] . '</' . $this->titleLevel . ">\n";
    880     } else {
    881       $cpressID = 'ccpress-id-' . $randId;
    882       $returnText = str_replace('%cpressID%', $cpressID, $returnText);
    883     }
    884 
    885     if (strlen($this->arrDirectives['subtitle']) && !$this->hideSubtitle) {
    886       $returnText .= '<' . $this->subtitleLevel . '>' . $this->arrDirectives['subtitle'] . '</' . $this->subtitleLevel . ">\n";
    887     }
    888 
    889     if (
    890       strlen($this->arrDirectives['album']) ||
    891       strlen($this->arrDirectives['artist']) ||
    892       strlen($this->arrDirectives['capo']) ||
    893       strlen($this->arrDirectives['composer']) ||
    894       strlen($this->arrDirectives['key']) ||
    895       strlen($this->arrDirectives['tempo']) ||
    896       strlen($this->arrDirectives['time']) ||
    897       strlen($this->arrDirectives['year'])
    898     ) {
    899       $returnText .= "<div class=\"cpress_meta\">\n";
    900       if (strlen($this->arrDirectives['composer']) && !$this->hideComposer) $returnText .= esc_html(__('Composer', 'chordpress')) . ': ' . $this->arrDirectives['composer'] . "<br>\n";
    901       if (strlen($this->arrDirectives['artist']) && !$this->hideArtist) $returnText .= esc_html(__('Artist', 'chordpress')) . ': ' . $this->arrDirectives['artist'] . "<br>\n";
    902       if (strlen($this->arrDirectives['year']) && !$this->hideYear) $returnText .= esc_html(__('Year', 'chordpress')) . ': ' . $this->arrDirectives['year'] . "<br>\n";
    903       if (strlen($this->arrDirectives['album']) && !$this->hideAlbum) $returnText .= esc_html(__('Album', 'chordpress')) . ': ' . $this->arrDirectives['album'] . "<br>\n";
    904 
    905       if (strlen($this->arrDirectives['key']) && !$this->hideKey) {
    906         $returnText .= esc_html(__('Key (original)', 'chordpress')) . ': ' . $this->arrDirectives['key'] . "<br>\n";
    907         $returnText .= esc_html(__('Key (transposed)', 'chordpress')) . ': <span class="chord-hidable-%cpressID% key-%cpressID%-0">' . $this->arrDirectives['key'] . '</span>';
    908         for ($t = 1; $t <= 11; $t++) {
    909           $returnText .= '<span class="chord-hidable-%cpressID% key-%cpressID%-' . $t . '" style="display:none">' . $this->arrTransposeValues[$this->arrDirectives['key']][$t] . '</span>';
    910         }
    911         $returnText .= "<br>\n";
     984    }
     985    $interactionForm .= "<div class='cpress-col cpress-pr-0'>";
     986    if (!$this->hidePrint) {
     987      $printTitle = 'ChordPress SongSheet';
     988      if (strlen($this->arrDirectives['title']) && !$this->hideTitle) {
     989        $printTitle = $this->arrDirectives['title'];
    912990      }
    913 
    914       if (strlen($this->arrDirectives['time'])) $returnText .= esc_html(__('Time', 'chordpress')) . ': ' . $this->arrDirectives['time'] . "<br>\n";
    915       if (strlen($this->arrDirectives['tempo'])) $returnText .= esc_html(__('Tempo', 'chordpress')) . ': ' . $this->arrDirectives['tempo'] . "<br>\n";
    916       if (strlen($this->arrDirectives['capo'])) $returnText .= esc_html(__('Capo', 'chordpress')) . ': ' . $this->arrDirectives['capo'] . "<br>\n";
    917       $returnText = preg_replace('/<br>$/', '', $returnText); // Remove last <br>
    918       $returnText .= "</div>\n";
    919     }
    920 
    921     /**
    922      * Go through each line and process it
    923      */
    924     $this->inMonospace = false;
    925     foreach ($text as $line) {
    926       if ($this->inMonospace && strpos($line, "{end_of_monospace}") === false) {
    927         $returnText .= $line;
    928       } else {
    929         $returnText .= $this->formatAndDisplayLine($line);
    930       }
    931     }
    932     $returnText = str_replace('%cpressID%', $cpressID, $returnText);
    933 
    934     /**
    935      * End of ChordPress song
    936      */
    937     $returnText .= "</div>\n<!--end: ChordPress SongSheet-->\n";
    938 
    939     /**
    940      * Build chord sheet if option set to true.
    941      */
    942     if ($this->showChordSheet) {
    943       $chordSheetText = "\n<!--begin: ChordPress ChordSheet-->\n";
    944       $chordSheetText .= "<div class='cpress_chordsheet'>\n";
    945       $chordSheetText .= "<div><hr></div>\n";
    946       $chordSheetText .= "<p><i>" . esc_html(__('These known chords are used in this song', 'chordpress')) . ".</i></p>";
    947       $this->uniqueChords = array_unique($this->allChords);
    948       foreach ($this->uniqueChords as $uc) {
    949         if ($postid = $this->find_guitar_chord_post($uc)) {
    950           $this->load_guitar_chord($postid);
    951           $chordSheetText .= $this->C->createSvgChord(true);
    952         }
    953       }
    954       $chordSheetText .= "</div>\n<div style=\"clear:both; padding: 16px 0 16px 0;\"><hr></div>\n<!--end: ChordPress ChordSheet-->\n\n";
    955       if ($this->showChordSheetOnTop) {
    956         $returnText = $chordSheetText . $returnText;
    957       } else {
    958         $returnText = $returnText . $chordSheetText;
    959       }
    960     }
    961 
    962 // $this->C->dnd($returnText);
    963     return $returnText . "\n\n";
     991      $interactionForm .= "<br><button class='cpress-btn cpress-btn-secondary cpress-btn-sm' onclick=\"printElement('%cpressID%', '" . $printTitle . "', '" . $this->songsheetStyles . "');\">" . __('Print', 'chordpress') . "</button>\n";
     992    }
     993    $interactionForm .= "</div>";
     994    return $interactionForm;
    964995  }
    965996
     
    9761007   * @since 1.0.0
    9771008   */
    978   public function formatAndDisplayLine($line) {
     1009  public function formatAndDisplayLine(string $line): string {
    9791010    $returnText = "";
    9801011
     
    12611292   * @since 1.0.0
    12621293   */
    1263   private function stripTags($string) {
     1294  private function stripTags(string $string): string {
    12641295    $retString = "";
    12651296    $isVisible = true;
     
    12891320   * @since 1.0.0
    12901321   */
    1291   public function formatChord($ch) {
     1322  public function formatChord(string $ch): string {
    12921323    $useFlats = false;
    12931324    if (strlen($ch) == 0) return '';
     
    13521383   * Processes a Chromatic harmonica note and returns the formatted HTML.
    13531384   *
    1354    * @param string $note - Chromatic note, e.g. "1" or "1s" or "-1" or "-1s".
     1385   * @param string $note      - Chromatic note, e.g. "1" or "1s" or "-1" or "-1s".
     1386   * @param int    $transpose - Numeric transpose value, 0-11.
    13551387   *
    13561388   * @return string - Transposed chromatic note
    13571389   * @since 2.8.0
    13581390   */
    1359   public function transposeChromaticNote($note, $transpose) {
     1391  public function transposeChromaticNote(string $note, int $transpose): string {
    13601392    if (strlen($note) == 0) return '';
    13611393    if ($transpose === 0 || $transpose > 11) return $note;
     
    13961428   * @since 1.0.0
    13971429   */
    1398   public function formatRemainder($remainder) {
     1430  public function formatRemainder(string $remainder): string {
    13991431    $indexOfSlash = strpos($remainder, '/');
    14001432    if ($indexOfSlash === false) return $remainder;
     
    14651497   * @since 1.0.0
    14661498   */
    1467   public function noteToNumber($n) {
     1499  public function noteToNumber(string $n): int {
    14681500    $regularNotation = array(
    14691501      'A' => 0,
     
    15151547   * @since 1.0.0
    15161548   */
    1517   public function numberToNote($n, $useFlats = false) {
     1549  public function numberToNote(string $n, bool $useFlats = false): string {
    15181550    $retVal = '';
    15191551
     
    15861618   * @since 3.8.0
    15871619   */
    1588   public function translateHarmonicaNote($note, $from, $to) {
     1620  public function translateHarmonicaNote(string $note, string $from, string $to): string {
    15891621
    15901622    $from = strtolower($from);
     
    16871719   * @since 1.0.0
    16881720   */
    1689   public function getDisplayHBNotation() {
     1721  public function getDisplayHBNotation(): bool {
    16901722    return $this->displayHBNotation;
    16911723  }
     
    17021734   * @since 1.0.0
    17031735   */
    1704   public function setDisplayHBNotation($g) {
     1736  public function setDisplayHBNotation(bool $g): void {
    17051737    $this->displayHBNotation = $g;
    17061738  }
     
    17161748   * @since 1.0.0
    17171749   */
    1718   public function getFloat() {
     1750  public function getFloat(): string {
    17191751    return $this->float;
    17201752  }
     
    17311763   * @since 1.0.0
    17321764   */
    1733   public function setFloat($f) {
     1765  public function setFloat(string $f): void {
    17341766    $this->float = $f;
    17351767  }
     
    17451777   * @since 3.8.0
    17461778   */
    1747   public function getHarmonica() {
     1779  public function getHarmonica(): string {
    17481780    return $this->harmonica;
    17491781  }
     
    17601792   * @since 3.8.0
    17611793   */
    1762   public function setHarmonica($h) {
     1794  public function setHarmonica(string $h): void {
    17631795    if (in_array(strtolower($h), $this->harmonicaTypes)) {
    17641796      $this->harmonica = strtolower($h);
     
    17781810   * @since 1.0.0
    17791811   */
    1780   public function getHBNotation() {
     1812  public function getHBNotation(): string {
    17811813    return $this->hbNotation;
    17821814  }
     
    17931825   * @since 1.0.0
    17941826   */
    1795   public function setHBNotation($g) {
     1827  public function setHBNotation(string $g): void {
    17961828    $this->hbNotation = $g;
    17971829  }
     
    18071839   * @since 3.5.0
    18081840   */
    1809   public function getHideChords() {
     1841  public function getHideChords(): string {
    18101842    return $this->hideChords;
    18111843  }
     
    18221854   * @since 3.5.0
    18231855   */
    1824   public function setHideChords($g) {
     1856  public function setHideChords(string $g): void {
    18251857    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    18261858      $this->hideChords = true;
     
    18401872   * @since 3.5.0
    18411873   */
    1842   public function getHideComments() {
     1874  public function getHideComments(): string {
    18431875    return $this->hideComments;
    18441876  }
     
    18551887   * @since 3.5.0
    18561888   */
    1857   public function setHideComments($g) {
     1889  public function setHideComments(string $g): void {
    18581890    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    18591891      $this->hideComments = 1;
     
    18731905   * @since 3.5.0
    18741906   */
    1875   public function getHideComposer() {
     1907  public function getHideComposer(): string {
    18761908    return $this->hideComposer;
    18771909  }
     
    18881920   * @since 3.5.0
    18891921   */
    1890   public function setHideComposer($g) {
     1922  public function setHideComposer(string $g): void {
    18911923    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    18921924      $this->hideComposer = 1;
     
    19061938   * @since 3.5.0
    19071939   */
    1908   public function getHidePrint() {
     1940  public function getHidePrint(): string {
    19091941    return $this->hidePrint;
    19101942  }
     
    19211953   * @since 3.5.0
    19221954   */
    1923   public function setHidePrint($g) {
     1955  public function setHidePrint(string $g): void {
    19241956    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    19251957      $this->hidePrint = 1;
     
    19391971   * @since 3.5.0
    19401972   */
    1941   public function getHideSubtitle() {
     1973  public function getHideSubtitle(): string {
    19421974    return $this->hideSubtitle;
    19431975  }
     
    19541986   * @since 3.5.0
    19551987   */
    1956   public function setHideSubtitle($g) {
     1988  public function setHideSubtitle(string $g): void {
    19571989    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    19581990      $this->hideSubtitle = 1;
     
    19722004   * @since 3.5.0
    19732005   */
    1974   public function getHideTitle() {
     2006  public function getHideTitle(): string {
    19752007    return $this->hideTitle;
    19762008  }
     
    19872019   * @since 3.5.0
    19882020   */
    1989   public function setHideTitle($g) {
     2021  public function setHideTitle(string $g): void {
    19902022    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    19912023      $this->hideTitle = 1;
     
    20052037   * @since 3.8.1
    20062038   */
    2007   public function getFontsize() {
     2039  public function getFontsize(): string {
    20082040    return $this->hideFontsize;
    20092041  }
     
    20202052   * @since 3.8.1
    20212053   */
    2022   public function setHideFontsize($g) {
     2054  public function setHideFontsize(string $g): void {
    20232055    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    20242056      $this->hideFontsize = 1;
     
    20382070   * @since 3.5.0
    20392071   */
    2040   public function getHideTranspose() {
     2072  public function getHideTranspose(): string {
    20412073    return $this->hideTranspose;
    20422074  }
     
    20532085   * @since 3.5.0
    20542086   */
    2055   public function setHideTranspose($g) {
     2087  public function setHideTranspose(string $g): void {
    20562088    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    20572089      $this->hideTranspose = 1;
     
    20712103   * @since 3.6.0
    20722104   */
    2073   public function getNumericTranspose() {
     2105  public function getNumericTranspose(): string {
    20742106    return $this->showNumericTranspose;
    20752107  }
     
    20862118   * @since 3.6.0
    20872119   */
    2088   public function setNumericTranspose($g) {
     2120  public function setNumericTranspose(string $g): void {
    20892121    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    20902122      $this->showNumericTranspose = 1;
     
    21042136   * @since 3.6.0
    21052137   */
    2106   public function getFixedInteraction() {
     2138  public function getFixedInteraction(): string {
    21072139    return $this->fixedInteraction;
    21082140  }
     
    21192151   * @since 3.6.0
    21202152   */
    2121   public function setFixedInteraction($g) {
     2153  public function setFixedInteraction(string $g): void {
    21222154    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    21232155      $this->fixedInteraction = 1;
     
    21372169   * @since 3.5.0
    21382170   */
    2139   public function getHideYear() {
     2171  public function getHideYear(): string {
    21402172    return $this->hideYear;
    21412173  }
     
    21522184   * @since 3.5.0
    21532185   */
    2154   public function setHideYear($g) {
     2186  public function setHideYear(string $g): void {
    21552187    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    21562188      $this->hideYear = 1;
     
    21702202   * @since 1.0.0
    21712203   */
    2172   public function getInteractive() {
     2204  public function getInteractive(): string {
    21732205    return $this->interactive;
    21742206  }
     
    21852217   * @since 1.0.0
    21862218   */
    2187   public function setInteractive($i) {
     2219  public function setInteractive(string $i): void {
    21882220    $this->interactive = $i;
    21892221  }
     
    21992231   * @since 3.5.0
    22002232   */
    2201   public function getShowChordSheet() {
     2233  public function getShowChordSheet(): string {
    22022234    return $this->showChordSheet;
    22032235  }
     
    22142246   * @since 3.5.0
    22152247   */
    2216   public function setShowChordSheet($g) {
     2248  public function setShowChordSheet(string $g): void {
    22172249    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    22182250      $this->showChordSheet = 1;
     
    22322264   * @since 3.5.0
    22332265   */
    2234   public function getShowChordSheetOnTop() {
     2266  public function getShowChordSheetOnTop(): string {
    22352267    return $this->showChordSheetOnTop;
    22362268  }
     
    22472279   * @since 3.5.0
    22482280   */
    2249   public function setShowChordSheetOnTop($g) {
     2281  public function setShowChordSheetOnTop(string $g): void {
    22502282    if (in_array(strtolower($g), array( "yes", "1", "true" ))) {
    22512283      $this->showChordSheetOnTop = 1;
     
    22652297   * @since 1.0.0
    22662298   */
    2267   public function getTranspose() {
     2299  public function getTranspose(): int {
    22682300    return $this->transpose;
    22692301  }
     
    22802312   * @since 1.0.0
    22812313   */
    2282   public function setTranspose($t) {
     2314  public function setTranspose(int $t): void {
    22832315    $this->transpose = $t;
    22842316  }
     
    22952327   * @return integer - Post ID or NULL
    22962328   */
    2297   private function find_guitar_chord_post($shortname) {
     2329  private function find_guitar_chord_post(string $shortname): int {
    22982330    $query_args = array(
    22992331      'posts_per_page' => 1,
     
    23222354   * @return void
    23232355   */
    2324   private function load_guitar_chord($postid) {
     2356  private function load_guitar_chord(int $postid): void {
    23252357    $my_chord = array();
    23262358    $post = get_post($postid);
     
    23612393   * @return string - Modal chord dialog HTML
    23622394   */
    2363 //    private function create_modal_chord($postid, $chord)
    2364 //    {
     2395//    private function create_modal_chord(int $postid, string $chord): string {
    23652396//        $modal_chord = '<!-- <button id="cpress-chord-' . $postid . '-modal-button">Click here to trigger the modal!</button> -->
    23662397//        <div id="cpress-chord-' . $postid . '-modal" class="cpress-modal">
     
    24052436   * @return false|string
    24062437   */
    2407   private function random_string($alphaonly = false, $length = 15) {
     2438  private function random_string(bool $alphaonly = false, int $length = 15): string|false {
    24082439    if ($alphaonly) {
    24092440      return substr(str_shuffle(str_repeat($x = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil($length / strlen($x)))), 1, $length);
     
    24242455   * @since 3.2.0
    24252456   */
    2426   private function dnd($a, $die = true) {
     2457  private function dnd(array $a, bool $die = true): string {
    24272458    $dump = highlight_string("<?php\n\$data =\n" . var_export($a, true) . ";\n?>");
    2428     if ($die) die($dump);
    2429     else return $dump;
     2459    if ($die) {
     2460      die($dump);
     2461    } else {
     2462      return $dump;
     2463    }
    24302464  }
    24312465}
  • chordpress/trunk/languages/chordpress.pot

    r3298894 r3307608  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Lewe ChordPress 3.9.0\n"
     5"Project-Id-Version: Lewe ChordPress 3.9.2\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/chordpress\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2025-05-22T18:00:03+02:00\n"
     12"POT-Creation-Date: 2025-06-06T19:11:35+02:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.4.0\n"
     
    550550
    551551#: admin/partials/chordpress-admin-options.php:394
    552 msgid "With this option selected, the interaction menu will be fixed at the bottom of the page. Note, that this might lead to unexpected results depending on the WordPress theme you use. You can overwrite this setting per shortcut with \"fixedinteraction=yes/no\""
     552msgid "With this option selected, the interaction menu will be fixed at the bottom of the page. Note, that this might lead to unexpected results depending on the WordPress theme you use and if you use more than one ChordPress songsheet on a page. You can overwrite this setting per shortcut with \"fixedinteraction=yes/no\""
    553553msgstr ""
    554554
     
    12481248msgstr ""
    12491249
    1250 #: includes/class-chordpress-renderer.php:740
    1251 msgid "Font"
    1252 msgstr ""
    1253 
    1254 #: includes/class-chordpress-renderer.php:767
    1255 #: includes/class-chordpress-renderer.php:786
     1250#: includes/class-chordpress-renderer.php:763
     1251msgid "Composer"
     1252msgstr ""
     1253
     1254#: includes/class-chordpress-renderer.php:764
     1255msgid "Artist"
     1256msgstr ""
     1257
     1258#: includes/class-chordpress-renderer.php:765
     1259msgid "Year"
     1260msgstr ""
     1261
     1262#: includes/class-chordpress-renderer.php:766
     1263msgid "Album"
     1264msgstr ""
     1265
     1266#: includes/class-chordpress-renderer.php:769
     1267msgid "Key (original)"
     1268msgstr ""
     1269
     1270#: includes/class-chordpress-renderer.php:770
     1271msgid "Key (transposed)"
     1272msgstr ""
     1273
     1274#: includes/class-chordpress-renderer.php:777
     1275msgid "Time"
     1276msgstr ""
     1277
     1278#: includes/class-chordpress-renderer.php:778
     1279msgid "Tempo"
     1280msgstr ""
     1281
     1282#: includes/class-chordpress-renderer.php:779
     1283msgid "Capo"
     1284msgstr ""
     1285
     1286#: includes/class-chordpress-renderer.php:809
     1287msgid "These known chords are used in this song"
     1288msgstr ""
     1289
    12561290#: includes/class-chordpress-renderer.php:854
     1291msgid "Font Size"
     1292msgstr ""
     1293
     1294#: includes/class-chordpress-renderer.php:881
     1295#: includes/class-chordpress-renderer.php:900
     1296#: includes/class-chordpress-renderer.php:969
    12571297msgid "Transpose"
    12581298msgstr ""
    12591299
    1260 #: includes/class-chordpress-renderer.php:788
     1300#: includes/class-chordpress-renderer.php:902
    12611301msgid "Only works for international key names"
    12621302msgstr ""
    12631303
    1264 #: includes/class-chordpress-renderer.php:835
     1304#: includes/class-chordpress-renderer.php:949
    12651305msgid "Harmonica"
    12661306msgstr ""
    12671307
    1268 #: includes/class-chordpress-renderer.php:840
     1308#: includes/class-chordpress-renderer.php:955
    12691309msgid "Only works when using harmonica notation"
    12701310msgstr ""
    12711311
    1272 #: includes/class-chordpress-renderer.php:842
     1312#: includes/class-chordpress-renderer.php:957
    12731313msgid "Diatonic"
    12741314msgstr ""
    12751315
    1276 #: includes/class-chordpress-renderer.php:843
     1316#: includes/class-chordpress-renderer.php:958
    12771317msgid "Chromatic"
    12781318msgstr ""
    12791319
    1280 #: includes/class-chordpress-renderer.php:844
     1320#: includes/class-chordpress-renderer.php:959
    12811321msgid "Tremolo"
    12821322msgstr ""
    12831323
    1284 #: includes/class-chordpress-renderer.php:870
     1324#: includes/class-chordpress-renderer.php:989
    12851325msgid "Print"
    12861326msgstr ""
    12871327
    1288 #: includes/class-chordpress-renderer.php:906
    1289 msgid "Composer"
    1290 msgstr ""
    1291 
    1292 #: includes/class-chordpress-renderer.php:907
    1293 msgid "Artist"
    1294 msgstr ""
    1295 
    1296 #: includes/class-chordpress-renderer.php:908
    1297 msgid "Year"
    1298 msgstr ""
    1299 
    1300 #: includes/class-chordpress-renderer.php:909
    1301 msgid "Album"
    1302 msgstr ""
    1303 
    1304 #: includes/class-chordpress-renderer.php:912
    1305 msgid "Key (original)"
    1306 msgstr ""
    1307 
    1308 #: includes/class-chordpress-renderer.php:913
    1309 msgid "Key (transposed)"
    1310 msgstr ""
    1311 
    1312 #: includes/class-chordpress-renderer.php:920
    1313 msgid "Time"
    1314 msgstr ""
    1315 
    1316 #: includes/class-chordpress-renderer.php:921
    1317 msgid "Tempo"
    1318 msgstr ""
    1319 
    1320 #: includes/class-chordpress-renderer.php:922
    1321 msgid "Capo"
    1322 msgstr ""
    1323 
    1324 #: includes/class-chordpress-renderer.php:952
    1325 msgid "These known chords are used in this song"
    1326 msgstr ""
    1327 
    1328 #: includes/class-chordpress-renderer.php:1070
     1328#: includes/class-chordpress-renderer.php:1093
    13291329msgid "Missing square bracket in line"
    13301330msgstr ""
  • chordpress/trunk/readme.txt

    r3307598 r3307608  
    55Requires at least: 4.0
    66Tested up to: 6.8
    7 Stable tag: 3.9.2
     7Stable tag: 3.9.3
    88Requires PHP: 5.2.4
    99License: GPLv3
     
    130130
    131131== Changelog ==
     132= 3.9.3 =
     133* 2025-06-06
     134* Improved interaction menu (but do not use fixed position when more than one song on a page)
     135
    132136= 3.9.2 =
    133137* 2025-06-02
Note: See TracChangeset for help on using the changeset viewer.