'Plugin Name', 'PluginURI' => 'Plugin URI', ); $plugin_data = get_file_data(__FILE__, $default_headers, 'plugin'); $url = $plugin_data['PluginURI']; $name = $plugin_data['Name']; $data['name'] = $name; $data['url'] = $url; return $data; } /** * This function processes [audiomack src=""] shortcode and replaces it with Audiomack player. * It expects the src to contain album or song prefix e.g. * - http://www.audiomack.com/song/hiphopfeeling/nowish * - http://www.audiomack.com/album/tutankhamun-brothers/whats-a-black-beatle * @param array $attr * @return string */ function audiomack_shortcode_audiomack($attr = array()) { $plugin_data = audiomack_get_plugin_data(); $opts = audiomack_get_options(); // should be like this. // - http://www.audiomack.com/song/djsemtex/say-my-name-kendrick-lamar-response // - http://www.audiomack.com/album/tutankhamun-brothers/whats-a-black-beatle $src = empty($attr['src']) ? '' : $attr['src']; $buff = ''; $buff .= "\n\n"; // Embed source needs to be like this // http://www.audiomack.com/embed3/hiphopfeeling/nowish?c1=fc881e&bg=f2f2f2&c2=222222 // http://www.audiomack.com/embed3-album/tutankhamun-brothers/whats-a-black-beatle?c1=fc881e&bg=f2f2f2&c2=222222 $embed_src = $src; $width = $opts['width']; // % or a number $height = 144; /* * The height of the player based on the embedded media * - Album - 352px * - Song Regular - 144px * - Song Slim - 62px */ if (stripos($embed_src, '/song/') !== false) { // song if (!empty($opts['slim'])) { $height = 62; $embed_src = str_replace('/song/', '/embed3-thin/', $embed_src); } else { $embed_src = str_replace('/song/', '/embed3/', $embed_src); } } else { $height = 352; $embed_src = str_replace('/album/', '/embed3-album/', $embed_src); } // the embed code expects the colours not to have pound signs $player_opts['c1'] = $opts['player_color']; $player_opts['c2'] = $opts['text_color']; $player_opts['bg'] = $opts['background_color']; $player_params = http_build_query($player_opts); $embed_src .= '?' . $player_params; $height_str = "height='$height'"; $embed_code = "\n"; $buff .= "
This plugin allows you to embed a song or an album from Audiomack on your site.
Settings were saved.