Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • @koads Cool, I’m glad I could help

    @koads
    Hi, you can patch the file by pasting the code in an empty textfile and then run
    patch audio-player.php < textfile
    on a *nix system in the terminal. I don’t know how to do this on a windows machine, but there’s probably a tool for that too.
    I just uploaded the patched file at https://claas.cabird.de/files/audio-player.php.txt
    You just have to rename it to audio-player.php and replace the old file in the root directory of the audio-player plugin. Please let me know if that works for you. Greetings, abird

    @koads
    as I posted before I wrote a fix for that problem. I think the diff I posted is not working. Try to patch the audio-player.php in the plugin root with the following diff

    --- audio-player/audio-player.php       2008-08-25 16:06:18.000000000 +0200
    +++ audio-player.php    2009-02-01 22:28:05.000000000 +0100
    @@ -147,6 +147,7 @@
                            add_filter("the_excerpt_rss", array(&$this, "processContent"));
    
                            add_filter("attachment_fields_to_edit", array(&$this, "insertAudioPlayerButton"), 10, 2);
    +      add_filter("media_send_to_editor", array(&$this, "stripLinkTagAtEditorInsert"));
                    }
    
                    /**
    @@ -324,6 +325,18 @@
                    // Sets a flag so we know we are in an automatically created excerpt
                    // ------------------------------------------------------------------------------
    
    +    /**
    +     * Strips the link tag wrapped around the audio insert statement
    +     * @return the filtered html
    +     * @param $html String
    +     */
    +    function stripLinkTagAtEditorInsert($html) {
    +      if (preg_match("/href='(\[audio:.*\])'/", $html, $matches)) {
    +        return $matches[1];
    +      }
    +      return $html;
    +    }
    +
                    /**
                     * Sets a flag when getting an excerpt
                     * @return excerpt text
    @@ -644,10 +657,7 @@
    
                            // Only add the extra button if the attachment is an mp3 file
                            if ($post->post_mime_type == 'audio/mpeg') {
    -                               $form_fields["url"]["html"] .= "<button type='button' class='button audio-player-" . $post->ID . "' value='[audio:" . attribute_escape($file) . "]'>Audio Player</button>";
    -                               $form_fields["url"]["html"] .= "<script type='text/javascript'>
    -                               jQuery('button.audio-player-" . $post->ID . "').bind('click', function(){jQuery(this).siblings('input').val(this.value);});
    -                               </script>\n";
    +                               $form_fields["url"]["html"] .= "<button type='button' class='button' title='[audio:" . attribute_escape($file) . "]'>Audio Player</button>";
                            }
    
                            return $form_fields;
    @@ -814,4 +824,4 @@
            echo $AudioPlayer->processContent($source);
     }
    
    -?>
    \ No newline at end of file
    +?>

    If that doesn’t work I can upload or email you the patched file.

    I wrote a little fix to get the media library button to work with WP 2.7. I’m new to WP so the code is probably not very good, but works for me. Here is a diff of the audio-player.php (applies to version 2.0b6 of audio player)

    149a150
    >       add_filter("media_send_to_editor", array(&$this, "stripLinkTagAtEditorInsert"));
    326a328,339
    >     /**
    >      * Strips the link tag wrapped around the audio insert statement
    >      * @return the filtered html
    >      * @param $html String
    >      */
    >     function stripLinkTagAtEditorInsert($html) {
    >       if (preg_match("/href='(\[audio:.*\])'/", $html, $matches)) {
    >         return $matches[1];
    >       }
    >       return $html;
    >     }
    >
    647,650c660
    <                               $form_fields["url"]["html"] .= "<button type='button' class='button audio-player-" . $post->ID . "' value='[audio:" . attribute_escape($file) . "]'>Audio Player</button>";
    <                               $form_fields["url"]["html"] .= "<script type='text/javascript'>
    <                               jQuery('button.audio-player-" . $post->ID . "').bind('click', function(){jQuery(this).siblings('input').val(this.value);});
    <                               </script>\n";
    ---
    >                               $form_fields["url"]["html"] .= "<button type='button' class='button' title='[audio:" . attribute_escape($file) . "]'>Audio Player</button>";
    817c827
    < ?>
    \ No newline at end of file
    ---
    > ?>

    Hope it’s usefull for anyone.
    Great plugin btw.

Viewing 4 replies - 1 through 4 (of 4 total)