<commit_before><?php
/**
 * $Id$
 *
 * @author <NAME>, 2011-2012 <<EMAIL>>
 */

//STATUS: wip

/*
 COMPATIBLITY, 2011-09-20:
  audio/wav   - works in FF6, Chrome14, Safari, Opera
  audio/mp3   - works in IE9, Chrome14, Safari, NOT IN FF6
  audio/ogg   - works in FF6, Chrome14, Safari, Opera
  audio/x-m4a - works in Chrome14, NOT IN FF6, ??? in IE9
  "webm audio" - XXXX test
*/

namespace cd;

require_once('XhtmlComponent.php');

class AudioComponent
{
    var $src;
    var $mimetype = '';
}

class XhtmlComponentAudio extends XhtmlComponent
{
    var $src;
    var $preload = 'auto'; ///< "auto", "metadata" or "none"
    private $components = array();

    function addComponent($src, $mimetype = '')
    {
        $c = new AudioComponent();
        $c->src = $src;
        $c->mimetype = $mimetype;

        $this->components[] = $c;
    }

    function render()
    {
        //IE9 fix: without the css snippet, it will not display the embedded player
        $res =
        '<audio controls="controls" preload="'.$this->preload.' style="height:32px;width:100%;">';

        foreach ($this->components as $c)
            $res .= '<source src="'.$c->src.'"'.($c->mimetype ? ' type="'.$c->mimetype.'"' : '').'/>';

        $res .=
            'Your browser does not support the audio element.'.
        '</audio>';

        return $res;
    }

}

?><commit_msg>FIX typo, missing ending "<commit_after><?php
/**
 * $Id$
 *
 * @author <NAME>, 2011-2012 <<EMAIL>>
 */

//STATUS: wip

/*
 COMPATIBLITY, 2011-09-20:
  audio/wav   - works in FF6, Chrome14, Safari, Opera
  audio/mp3   - works in IE9, Chrome14, Safari, NOT IN FF6
  audio/ogg   - works in FF6, Chrome14, Safari, Opera
  audio/x-m4a - works in Chrome14, NOT IN FF6, ??? in IE9
  "webm audio" - XXXX test
*/

namespace cd;

require_once('XhtmlComponent.php');

class AudioComponent
{
    var $src;
    var $mimetype = '';
}

class XhtmlComponentAudio extends XhtmlComponent
{
    var $src;
    var $preload = 'auto'; ///< "auto", "metadata" or "none"
    private $components = array();

    function addComponent($src, $mimetype = '')
    {
        $c = new AudioComponent();
        $c->src = $src;
        $c->mimetype = $mimetype;

        $this->components[] = $c;
    }

    function render()
    {
        //IE9 fix: without the css snippet, it will not display the embedded player
        $res =
        '<audio controls="controls" preload="'.$this->preload.'" style="height:32px;width:100%;">';

        foreach ($this->components as $c)
            $res .= '<source src="'.$c->src.'"'.($c->mimetype ? ' type="'.$c->mimetype.'"' : '').'/>';

        $res .=
            'Your browser does not support the audio element.'.
        '</audio>';

        return $res;
    }

}

?>
{'fraction_non_alphanumeric': 0.1750363901018923, 'fraction_numerical': 0.027656477438136828, 'mean_word_length': 2.414906832298137, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '663501', 'n_tokens_mistral': 988, 'n_tokens_neox': 929, 'n_words': 250}