WordPress.org

Plugin Directory

Changeset 139380


Ignore:
Timestamp:
07/26/09 11:21:27 (5 years ago)
Author:
abelcheung
Message:

0.3.1 Release

Location:
scorerender/branches/scorerender-0-3-branch
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • scorerender/branches/scorerender-0-3-branch/ChangeLog

    r114490 r139380  
     12009-07-26  Abel Cheung  <abelcheung@gmail.com> 
     2 
     3    * wp-scorerender.php: 
     4    - Also define notation URLs and names. (trunk) 
     5    - (scorerender_get_def_settings) Replaced by trunk version, which has 
     6      better auto detection of binaries. (trunk) 
     7    * scorerender-admin.php (scorerender_admin_options): 
     8    - Strip redundant description. (trunk) 
     9 
     102009-07-26  Abel Cheung  <abelcheung@gmail.com> 
     11 
     12    * scorerender-class.php (is_prog_usable): 
     13    - Fix program checking logic, which fails if desired matching string 
     14      is not shown on the first line of program output. (trunk) 
     15 
     162009-05-09  Abel Cheung  <abelcheung@gmail.com> 
     17 
     18    * wp-scorerender.php (scorerender_process_content): 
     19    - Also show image dimension in output image tag. (trunk) 
     20    - Always use \r\n as line break when showing image code, otherwise 
     21      copy and paste can be problematic under Windows. (trunk) 
     22    * scorerender*.php: 
     23    - Update copyright and version. (trunk) 
     24 
    125=== ScoreRender 0.3.0 === 
    2262009-04-30  Abel Cheung  <abelcheung@gmail.com> 
  • scorerender/branches/scorerender-0-3-branch/readme.txt

    r136062 r139380  
    33Tags: music, music notation, music typesetting, score, abc, mup, lilypond, guido, pmw 
    44Requires at least: 2.2 
    5 Tested up to: 2.7.1 
     5Tested up to: 2.8.1 
    66Stable tag: scorerender-0-3-0 
    77 
    8 Renders inline sheet music fragments in post, pages and comments. 
     8Renders inline sheet music fragments in excerpts, posts, pages and comments. 
    99 
    1010== Description == 
    1111 
    12 ScoreRender is a Wordpress plugin for rendering sheet music fragments into images.  It supports converting fragments in posts, pages and (optionally) comments.  Currently it supports 5 music notations: ABC, Guido, Lilypond, Mup and Philip's Music Writer. 
     12ScoreRender is a Wordpress plugin for rendering sheet music fragments into images.  It supports converting fragments in excerpts, posts, pages and (optionally) comments.  Currently it supports 5 music notations: ABC, Guido, Lilypond, Mup and Philip's Music Writer. 
    1313 
    1414ScoreRender started its life from Chris Lamb’s FigureRender plugin, which is a Wordpress plugin for rendering LaTeX and Lilypond music fragments into images. Its maintainership changed later. While continue enhancing FigureRender, all LaTeX related functionalities are submitted to [LatexRender](http://sixthform.info/steve/wordpress/), thus preserving this plugin for music rendering only and the rename. 
  • scorerender/branches/scorerender-0-3-branch/scorerender-admin.php

    r114489 r139380  
    44 * ScoreRender documentation 
    55 * @package ScoreRender 
    6  * @version 0.2.50 
     6 * @version 0.3 
    77 * @author Abel Cheung <abelcheung at gmail dot com> 
    88 * @copyright Copyright (C) 2006 Chris Lamb <chris at chris-lamb dot co dot uk> 
    9  * @copyright Copyright (C) 2007, 08 Abel Cheung 
     9 * @copyright Copyright (C) 2007-09 Abel Cheung 
    1010 * @license http://opensource.org/licenses/gpl-license.php GNU Public License 
    1111 */ 
     
    632632    <h2><?php _e('ScoreRender options', TEXTDOMAIN) ?></h2> 
    633633 
    634     <p><?php _e('ScoreRender renders inline music fragments inside blog post and/or comment as images. Currently it supports the following notations (each notation name is followed by its starting and ending tag):', TEXTDOMAIN); ?></p> 
     634    <p><?php _e('The following notations are supported by ScoreRender, along with starting and ending tag after each notation name. Each music fragment must be enclosed by corresponding pair of tags.', TEXTDOMAIN); ?></p> 
    635635    <ul> 
    636         <li><a target="_blank" href="http://www.lilypond.org/">Lilypond</a> 
    637         (<?php printf ('<code>%s</code>, <code>%s</code>', $notations['lilypond']['starttag'], $notations['lilypond']['endtag']); ?>)</li> 
    638         <li><a target="_blank" href="http://www.arkkra.com/">Mup</a> 
    639         (<?php printf ('<code>%s</code>, <code>%s</code>', $notations['mup']['starttag'], $notations['mup']['endtag']); ?>) 
    640         <?php printf ('Used by Mup itself and %s', '<a target="_blank" href="http://noteedit.berlios.de/">Noteedit</a>'); ?></li> 
    641         <li><a target="_blank" href="http://www.informatik.tu-darmstadt.de/AFS/GUIDO/">GUIDO</a> 
    642         (<?php printf ('<code>%s</code>, <code>%s</code>', $notations['guido']['starttag'], $notations['guido']['endtag']); ?>)</li> 
    643         <li><a target="_blank" href="http://abcnotation.org.uk/">ABC</a> 
    644         (<?php printf ('<code>%s</code>, <code>%s</code>', $notations['abc']['starttag'], $notations['abc']['endtag']); ?>) 
    645         <?php printf ('Used by various programs like %s, %s or %s', 
    646             '<a target="_blank" href="http://www.ihp-ffo.de/~msm/">abc2ps</a>', 
    647             '<a target="_blank" href="http://moinejf.free.fr/">abcm2ps</a>', 
    648             '<a target="_blank" href="http://trillian.mit.edu/~jc/music/abc/src/">jcabc2ps</a>'); ?></li> 
    649         <li><a target="_blank" href="http://www.quercite.com/pmw.html">Philip's Music Writer</a> 
    650         (<?php printf ('<code>%s</code>, <code>%s</code>', $notations['pmw']['starttag'], $notations['pmw']['endtag']); ?>)</li> 
     636<?php   foreach ($notations as $tag => $notation_data) : ?> 
     637    <li><a target="_blank" href="<?php echo $notation_data['url']; ?>"><?php echo $notation_data['name']; ?></a> 
     638    (<code><?php echo $notation_data['starttag']; ?></code>, <code><?php echo $notation_data['endtag']; ?></code>)</li> 
     639<?php   endforeach; ?> 
    651640    </ul> 
    652641 
  • scorerender/branches/scorerender-0-3-branch/scorerender-class.php

    r114489 r139380  
    1818 * ScoreRender documentation 
    1919 * @package ScoreRender 
     20 * @version 0.3.1 
     21 * @author Abel Cheung <abelcheung at gmail dot com> 
     22 * @copyright Copyright (C) 2006 Chris Lamb <chris at chris-lamb dot co dot uk> 
     23 * @copyright Copyright (C) 2007-09 Abel Cheung 
     24 * @license http://opensource.org/licenses/gpl-license.php GNU Public License 
    2025 */ 
    2126 
     
    564569 
    565570    $output = fread ($handle, 2048); 
    566     $ok = true; 
     571    $ok = false; 
    567572 
    568573    $needles = (array) $match; 
    569574    foreach ($needles as $needle) 
    570575    { 
    571         if (is_string ($needle) && (false === strpos ($output, $needle))) 
     576        if (is_string ($needle) && (false !== strpos ($output, $needle))) 
    572577        { 
    573             $ok = false; 
     578            $ok = true; 
    574579            break; 
    575580        } 
  • scorerender/branches/scorerender-0-3-branch/scorerender-utils.php

    r114489 r139380  
    44 * ScoreRender documentation 
    55 * @package ScoreRender 
    6  * @version 0.2.50 
     6 * @version 0.3.1 
    77 * @author Abel Cheung <abelcheung at gmail dot com> 
    88 * @copyright Copyright (C) 2006 Chris Lamb <chris at chris-lamb dot co dot uk> 
    9  * @copyright Copyright (C) 2007, 08 Abel Cheung 
     9 * @copyright Copyright (C) 2007-09 Abel Cheung 
    1010 * @license http://opensource.org/licenses/gpl-license.php GNU Public License 
    1111 */ 
  • scorerender/branches/scorerender-0-3-branch/wp-scorerender.php

    r114506 r139380  
    55Description: Renders inline music score fragments in WordPress. Heavily based on FigureRender from Chris Lamb. 
    66Author: Abel Cheung 
    7 Version: 0.3.0 
     7Version: 0.3.1 
    88Author URI: http://me.abelcheung.org/ 
    99*/ 
     
    1212 * ScoreRender documentation 
    1313 * @package ScoreRender 
    14  * @version 0.3.0 
     14 * @version 0.3.1 
    1515 * @author Abel Cheung <abelcheung at gmail dot com> 
    1616 * @copyright Copyright (C) 2006 Chris Lamb <chris at chris-lamb dot co dot uk> 
     
    5656define ('MSG_FATAL', 2); 
    5757 
     58define ('TYPES_AND_VALUES', 0); 
    5859define ('TYPES_ONLY', 1); 
    5960define ('VALUES_ONLY', 2); 
     
    8889        'classname'   => 'abcRender', 
    8990        'includefile' => 'notation/abc.php', 
    90         'progs'       => array ('ABCM2PS_BIN')), 
     91        'progs'       => array ('ABCM2PS_BIN'), 
     92        'url'         => 'http://abcnotation.org.uk/', 
     93        'name'        => 'ABC', 
     94    ), 
    9195    'guido'    => array ( 
    9296        'regex'       => '~\[guido\](.*?)\[/guido\]~si', 
     
    9599        'classname'   => 'guidoRender', 
    96100        'includefile' => 'notation/guido.php', 
    97         'progs'       => array ()), 
     101        'progs'       => array (), 
     102        'url'         => 'http://www.informatik.tu-darmstadt.de/AFS/GUIDO/', 
     103        'name'        => 'GUIDO', 
     104    ), 
    98105    'lilypond' => array ( 
    99106        'regex'       => '~\[lilypond\](.*?)\[/lilypond\]~si', 
     
    102109        'classname'   => 'lilypondRender', 
    103110        'includefile' => 'notation/lilypond.php', 
    104         'progs'       => array ('LILYPOND_BIN')), 
     111        'progs'       => array ('LILYPOND_BIN'), 
     112        'url'         => 'http://www.lilypond.org/', 
     113        'name'        => 'Lilypond', 
     114    ), 
    105115    'mup'      => array ( 
    106116        'regex'       => '~\[mup\](.*?)\[/mup\]~si', 
     
    109119        'classname'   => 'mupRender', 
    110120        'includefile' => 'notation/mup.php', 
    111         'progs'       => array ('MUP_BIN')), 
     121        'progs'       => array ('MUP_BIN'), 
     122        'url'         => 'http://www.arkkra.com/', 
     123        'name'        => 'Mup', 
     124    ), 
    112125    'pmw'      => array ( 
    113126        'regex'       => '~\[pmw\](.*?)\[/pmw\]~si', 
     
    116129        'classname'   => 'pmwRender', 
    117130        'includefile' => 'notation/pmw.php', 
    118         'progs'       => array ('PMW_BIN')), 
     131        'progs'       => array ('PMW_BIN'), 
     132        'url'         => 'http://www.quercite.com/pmw.html', 
     133        'name'        => "Philip's Music Writer", 
     134    ), 
    119135); 
    120136 
     
    142158 * @global array $default_settings 
    143159 */ 
    144 function scorerender_get_def_settings ($return_type = 0) 
    145 { 
    146     // ImageMagick use versioned folders, abcm2ps don't have Win32 installer 
    147     // So just make up some close enough paths for them 
    148     // PMW doesn't even have public available Win32 binary, perhaps 
    149     // somebody might be able to compile it with MinGW? 
    150  
    151     if (is_windows ()) 
    152         $defprog = array ( 
    153             'abc2ps' => 'C:\Program Files\abcm2ps\abcm2ps.exe', 
    154             'convert' => 'C:\Program Files\ImageMagick\convert.exe', 
    155             'lilypond' => 'C:\Program Files\Lilypond\usr\bin\lilypond.exe', 
    156             'mup' => 'C:\Program Files\mupmate\mup.exe', 
    157             'pmw' => '', 
    158         ); 
    159     else 
    160         $defprog = array ( 
    161             'abc2ps' => '/usr/bin/abcm2ps', 
    162             'convert' => '/usr/bin/convert', 
    163             'lilypond' => '/usr/bin/lilypond', 
    164             'mup' => '/usr/local/bin/mup', 
    165             'pmw' => '/usr/local/bin/pmw', 
    166         ); 
    167  
    168     $cachefolder = scorerender_get_upload_dir (); 
     160function scorerender_get_def_settings ($return_type = TYPES_AND_VALUES) 
     161{ 
     162    $retval = array(); 
    169163 
    170164    $default_settings = array 
     
    172166        'DB_VERSION'           => array ('type' =>   'none', 'value' => DATABASE_VERSION), 
    173167        'TEMP_DIR'             => array ('type' =>   'path', 'value' => sys_get_temp_dir()), 
    174         'CACHE_DIR'            => array ('type' =>   'path', 'value' => $cachefolder['path']), 
    175         'CACHE_URL'            => array ('type' =>    'url', 'value' => $cachefolder['url']), 
     168        'CACHE_DIR'            => array ('type' =>   'path', 'value' => ''), 
     169        'CACHE_URL'            => array ('type' =>    'url', 'value' => ''), 
    176170 
    177171        'IMAGE_MAX_WIDTH'      => array ('type' =>    'int', 'value' => 360), 
    178172        'INVERT_IMAGE'         => array ('type' =>   'bool', 'value' => false), 
    179         'TRANSPARENT_IMAGE'    => array ('type' =>   'bool', 'value' => true), 
    180173        'USE_IE6_PNG_ALPHA_FIX'=> array ('type' =>   'bool', 'value' => true), 
    181174        'SHOW_SOURCE'          => array ('type' =>   'bool', 'value' => false), 
     
    186179        'FRAGMENT_PER_COMMENT' => array ('type' =>    'int', 'value' => 1), 
    187180 
    188         'CONVERT_BIN'          => array ('type' =>   'prog', 'value' => $defprog['convert']), 
    189         'LILYPOND_BIN'         => array ('type' =>   'prog', 'value' => $defprog['lilypond']), 
    190         'MUP_BIN'              => array ('type' =>   'prog', 'value' => $defprog['mup']), 
    191         'ABCM2PS_BIN'          => array ('type' =>   'prog', 'value' => $defprog['abc2ps']), 
    192         'PMW_BIN'              => array ('type' =>   'prog', 'value' => $defprog['pmw']), 
     181        'CONVERT_BIN'          => array ('type' =>   'prog', 'value' => ''), 
     182        'LILYPOND_BIN'         => array ('type' =>   'prog', 'value' => ''), 
     183        'MUP_BIN'              => array ('type' =>   'prog', 'value' => ''), 
     184        'ABCM2PS_BIN'          => array ('type' =>   'prog', 'value' => ''), 
     185        'PMW_BIN'              => array ('type' =>   'prog', 'value' => ''), 
    193186        'MUP_MAGIC_FILE'       => array ('type' =>   'path', 'value' => ''), 
    194187    ); 
    195188 
    196     $retval = array(); 
    197     switch ($return_type) 
    198     { 
    199       case TYPES_ONLY: 
     189    if (TYPES_ONLY == $return_type) 
     190    { 
    200191        foreach ($default_settings as $key => $val) 
    201192            $retval += array ($key => $val['type']); 
    202193        return $retval; 
     194    } 
     195 
     196    $convert = ''; 
     197    $lilypond = ''; 
     198    $mup = ''; 
     199    $abcm2ps = ''; 
     200    $pmw = ''; 
     201 
     202    if (is_windows ()) 
     203    { 
     204        if ( function_exists ('glob') ) // just in case this is disabled 
     205        { 
     206            $convert  = glob ('C:\Program Files\ImageMagick*\convert.exe'); 
     207            $abcm2ps  = glob ('C:\Program Files\*\abcm2ps.exe'); 
     208            $lilypond = glob ('C:\Program Files\Lilypond\usr\bin\lilypond.exe'); 
     209            $mup      = glob ('C:\Program Files\mupmate\mup.exe'); 
     210 
     211            // PMW doesn't even have public available Win32 binary, perhaps 
     212            // somebody might be able to compile it with MinGW? 
     213 
     214            $convert  = empty($convert)  ? '' : $convert[0]; 
     215            $abcm2ps  = empty($abcm2ps)  ? '' : $abcm2ps[0]; 
     216            $lilypond = empty($lilypond) ? '' : $lilypond[0]; 
     217            $mup      = empty($mup)      ? '' : $mup[0]; 
     218        } 
     219        else 
     220        { 
     221            $convert  = 'C:\Program Files\ImageMagick\convert.exe'; 
     222            $abcm2ps  = 'C:\Program Files\abcm2ps\abcm2ps.exe'; 
     223            $lilypond = 'C:\Program Files\Lilypond\usr\bin\lilypond.exe'; 
     224            $mup      = 'C:\Program Files\mupmate\mup.exe'; 
     225        } 
     226    } 
     227    else 
     228    { 
     229        if ( function_exists ('shell_exec') ) 
     230        { 
     231            $convert  = shell_exec ('which convert'); 
     232            $abc2mps  = shell_exec ('which abcm2ps'); 
     233            $lilypond = shell_exec ('which lilypond'); 
     234            $mup      = shell_exec ('which mup'); 
     235            $pmw      = shell_exec ('which pmw'); 
     236        } 
     237        else 
     238        { 
     239            $convert  = '/usr/bin/convert'; 
     240            $abcm2ps  = '/usr/bin/abcm2ps'; 
     241            $lilypond = '/usr/bin/lilypond'; 
     242            $mup      = '/usr/local/bin/mup'; 
     243            $pmw      = '/usr/local/bin/pmw'; 
     244        } 
     245    } 
     246 
     247    $default_settings['CONVERT_BIN']['value']  = $convert; 
     248    $default_settings['LILYPOND_BIN']['value'] = $lilypond; 
     249    $default_settings['MUP_BIN']['value']      = $mup; 
     250    $default_settings['ABCM2PS_BIN']['value']  = $abcm2ps; 
     251    $default_settings['PMW_BIN']['value']      = $pmw; 
     252 
     253    $cachefolder = scorerender_get_upload_dir (); 
     254    $default_settings['CACHE_DIR']['value'] = $cachefolder['path']; 
     255    $default_settings['CACHE_URL']['value'] = $cachefolder['url']; 
     256 
     257    switch ($return_type) 
     258    { 
    203259      case VALUES_ONLY: 
    204260        foreach ($default_settings as $key => $val) 
    205261            $retval += array ($key => $val['value']); 
    206262        return $retval; 
    207       default: 
     263      case TYPES_AND_VALUES: 
    208264        return $default_settings; 
    209265    } 
     
    431487            return '[ScoreRender Error: Unknown notation type!]'; 
    432488 
    433         $content = $notations[$name]['starttag'] . "\n" . 
    434             $render->get_music_fragment() . "\n" . 
     489        $content = $notations[$name]['starttag'] . "\r\n" . 
     490            preg_replace ("/(?<!\r)\n/s", "\r\n", $render->get_music_fragment()) . "\r\n" . 
    435491            $notations[$name]['endtag']; 
    436492 
     
    440496    else 
    441497    { 
    442         $html .= sprintf ("<img class='scorerender-image' title='%s' alt='%s' src='%s/%s' />\n", 
     498        list ($width, $height, $type, $attr) = getimagesize( $sr_options['CACHE_DIR'].'/'.$result ); 
     499        $html .= sprintf ("<img class='scorerender-image' $attr title='%s' alt='%s' src='%s/%s' />\n", 
    443500            __('Music fragment', TEXTDOMAIN), 
    444501            __('Music fragment', TEXTDOMAIN), 
Note: See TracChangeset for help on using the changeset viewer.