[abcjs]. For a complete description of the syntax, see the Plugin Site.
Version: 3.0.0
Author: Paul Rosen
Author URI: http://paulrosen.net
License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
/*
Copyright (C) 2015 Paul Rosen
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
//-- Add the javascript.
add_action('wp_enqueue_scripts','abcjs_loader');
function abcjs_loader() {
wp_enqueue_script( 'abcjs-plugin', plugins_url( '/abcjs_basic_midi_3.0-min.js', __FILE__ ));
}
// This turns the shortcode parameter back into the originally pasted string.
function process_abc( $content ) {
$content2 = preg_replace("&
\n&", "\x01", $content);
$content2 = preg_replace("&\r\n&", "\x01", $content2);
$content2 = preg_replace("&\n&", "\x01", $content2);
$content2 = preg_replace("-”-", "\\\"", $content2);
$content2 = preg_replace("-’-", "'", $content2);
$content2 = preg_replace("-″-", "\\\"", $content2);
$content2 = preg_replace("-“-", "\\\"", $content2);
return $content2;
}
//-- Interpret the [abcjs] shortcode
function create_music( $atts, $content ) {
$a = shortcode_atts( array(
'class' => 'abc-paper',
'parser' => '{}',
'engraver' => '{}'
), $atts );
$content2 = process_abc($content);
$id = 'abc-paper-' . uniqid();
$output = '