load(); add_filter('the_content', array(&$qae, 'the_content')); add_action('admin_menu', array(&$qae, 'admin_menu')); if (isset($_REQUEST['qae'])) { if (is_array($_REQUEST['qae'])) { if (isset($_REQUEST['qae']['_nonce'])) { if (wp_verify_nonce($_REQUEST['qae']['_nonce'], 'quick-audio-embed')) { $qae->save($_REQUEST['qae']); } } } } } function load() { $this->settings = array( 'dimensions' => '300x50' ); $options = get_option('quick-audio-embed-settings'); if (is_array($options)) { $this->settings = array_merge($this->settings, $options); } } function save($info) { foreach ($info as $key => $value) { switch ($key) { case 'dimensions': if (count($result = explode('x', $value)) !== 2) { unset($info[$key]); } else { $result = array_map('intval', $result); $info[$key] = implode('x', $result); } break; } } $this->settings = $info; update_option('quick-audio-embed-settings', $info); } function admin_menu() { add_settings_section('quick-audio-embed', __('Quick Audio Embed', 'quick-audio-embed'), array(&$this, 'media_settings'), 'media'); add_settings_field('qae-dimensions', __('Dimensions', 'quick-audio-embed'), array(&$this, 'qae_dimensions'), 'media', 'quick-audio-embed'); } function the_content($content = '') { return preg_replace_callback('#]+href="(?P[^\"]+\.mp3)"[^\>]*>.*#mis', array(&$this, '_the_content_callback'), $content); } function media_settings() { ?>

Quick Audio Embed takes any linked-to MP3 file and wraps it in Google Reader's Audio Player.

The dimensions of the player as widthxheight: 300x50

settings['dimensions']); if (preg_match('#rel="(?P[^\"]+)"#', $matches[0], $rel_match) > 0) { foreach (explode(',', $rel_match['rel']) as $part) { $values = explode('=', $part); $key = array_shift($values); $values = implode('=', $values); switch ($key) { case 'noembed': } } } return sprintf(' ', esc_url($matches['url']), esc_attr($dimensions[0]), esc_attr($dimensions[1])); } } add_action('init', array('QuickAudioEmbed', 'init'));