'; $o.=''; $playlist=get_microcast(); if (is_array($playlist)){ foreach ($playlist as $pl_item){ $o.=""; $o.=""; $o.=""; $o.=""; $o.=""; } } $o.="
{$pl_item['LogTime']}{$pl_item['ARTIST']}{$pl_item['SONGTITLE']}
"; $o.=""; $ret=str_replace("", $o, $content); return $ret; } function get_microcast(){ $bookmark=get_bookmark(37); //print_r($bookmark); $cachefile="xmlcache.txt"; $setting=(int)$bookmark->link_rating; $cachedur=$setting*60; $now=time(); $lastcache=$now-$cachedur; $day=date("d.m.Y ", $now); $file = str_replace("#38;", "", $bookmark->link_url); //var_dump($file); //$file="http://moodmixer-microcasting.net/MMPlaylogWeb/Datenpages/GetChannelLogDatenByFields.aspx?authurl=http://moodmixer-microcasting.net/MMAuth/ChannelAuth.asmx&channelid=d90f2416-3b9b-4d52-9bbe-dc894dec3496&artistfield=Artist&titlefield=Title"; //var_dump($file); $cachecontent=file_get_contents($cachefile); //echo $cachecontent; $cachearr=explode("||", $cachecontent); $cachetime=(int)$cachearr[0]; //echo $lastcache."

".$cachetime."

"; if ($cachetime<$lastcache){ $data = file_get_contents($file); $cachefile=fopen("xmlcache.txt", "w+"); fwrite($cachefile, $now."||".$data); fclose($cachefile); } else { $data=$cachearr[1]; } $data=str_replace($day, "", $data); $output=xml2array($data); $outputarr=$output['MoodMixerPlaylist']['LogEntry']; //print_r($output); return $outputarr; } function xp_get_displayed_tags(){ return array("LogTime"=>"time","ARTIST"=>"artist","SONGNAME"=>"title"); } function xp_playlist_css($a){ $o=''; return $o; } function xp_get_taglist($a){ $keep=xp_get_displayed_tags(); $tags=array(); $l=strlen($a); $c=substr_count($a, "", $p1); $tlen=$p2-$p1; $tag=substr($a, $p1, $tlen); if (!isset($keep[$tag])){ $tags[$tag]=$i; } $p=$p2; $i++; //echo "# $p1 $p2 $tlen # \n"; } $tags=array_flip($tags); $display_none=implode(",",$tags); return $display_none; } function get_my_xml(){ return '27.01.2009 12:32:14HafenHamburg Bierbar27.01.2009 12:29:44Pop Around The ClockPlaying06b48da2-6100-46d5-874d-c53c28ce2f8d5TravisMy EyesMann1000000000001800H:\Audiokopien\SmoothPop\sept07\normalisiert\1002785.mp324935The Boy with No Name2009-01-25T19:35:23.3943752009-01-25T19:35:23.41false27.01.2009 12:25:43Pop Around The ClockPlayed9607SadeBy Your SideFrau173555010959365619570534005Platin Vol. 10 (Disc 2)2000\\Pwsoft2003\Kerstin\Musikausgeliefert_Normalisiert\HotelHH_alt\10959.mp3258137Platin Vol. 10 (Disc 2)jaAduNULLnixEnglisch2009-01-25T19:35:23.3943752009-01-25T19:35:23.41false27.01.2009 12:22:01Pop Around The ClockPlayed994d3d83-9c46-48f7-bbda-168c033073e512MarquessLo Pensa A TeMann100000000000Marquess2006H:\Audiokopien\SmoothPop\jun08\normalisiert\1004196.mp322735...2009-01-25T19:35:23.3943752009-01-25T19:35:23.41false27.01.2009 12:17:47Pop Around The ClockPlayed240933DesirelessVoyage VoyageFrau1055503040406204482408800Kneipen Hits - Disco Fox (Disc1987\\Pwsoft2003\Kerstin\Musikausgeliefert_Normalisiert\30404.mp325834Kneipen Hits - Disco Fox (DiscjaNULLNULLnixEnglisch2009-01-25T19:35:23.3943752009-01-25T19:35:23.41false27.01.2009 12:14:55Pop Around The ClockPlayed975035SashaComing HomeMann105550100025934070352000C:\audio\HotelHafenHH\updatedez06\normalisiert\10002593.mp317735Greatest HitsNULL2009-01-25T19:35:23.3943752009-01-25T19:35:23.41false'; } /** * Add to extended_valid_elements for TinyMCE * * @param $init assoc. array of TinyMCE options * @return $init the changed assoc. array */ function my_change_mce_options( $init ) { // Command separated string of extended elements $ext = 'iframe[id|name|class|style|src|frameborder|scrolling]'; // Add to extended_valid_elements if it alreay exists if ( isset( $init['extended_valid_elements'] ) ) { $init['extended_valid_elements'] .= ',' . $ext; } else { $init['extended_valid_elements'] = $ext; } // Super important: return $init! return $init; } add_filter('tiny_mce_before_init', 'my_change_mce_options'); add_filter('the_content', 'write_microcast'); function xml2array($contents, $get_attributes=1, $priority = 'tag') { if(!$contents) return array(); if(!function_exists('xml_parser_create')) { //print "'xml_parser_create()' function not found!"; return array(); } //Get the XML parser of PHP - PHP must have this module for the parser to work $parser = xml_parser_create(''); xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8"); # http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($parser, trim($contents), $xml_values); xml_parser_free($parser); if(!$xml_values) return;//Hmm... //Initializations $xml_array = array(); $parents = array(); $opened_tags = array(); $arr = array(); $current = &$xml_array; //Refference //Go through the tags. $repeated_tag_index = array();//Multiple tags with same name will be turned into an array foreach($xml_values as $data) { unset($attributes,$value);//Remove existing values, or there will be trouble //This command will extract these variables into the foreach scope // tag(string), type(string), level(int), attributes(array). extract($data);//We could use the array by itself, but this cooler. $result = array(); $attributes_data = array(); if(isset($value)) { if($priority == 'tag') $result = $value; else $result['value'] = $value; //Put the value in a assoc array if we are in the 'Attribute' mode } //Set the attributes too. if(isset($attributes) and $get_attributes) { foreach($attributes as $attr => $val) { if($priority == 'tag') $attributes_data[$attr] = $val; else $result['attr'][$attr] = $val; //Set all the attributes in a array called 'attr' } } //See tag status and do the needed. if($type == "open") {//The starting of the tag '' $parent[$level-1] = &$current; if(!is_array($current) or (!in_array($tag, array_keys($current)))) { //Insert New tag $current[$tag] = $result; if($attributes_data) $current[$tag. '_attr'] = $attributes_data; $repeated_tag_index[$tag.'_'.$level] = 1; $current = &$current[$tag]; } else { //There was another element with the same tag name if(isset($current[$tag][0])) {//If there is a 0th element it is already an array $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result; $repeated_tag_index[$tag.'_'.$level]++; } else {//This section will make the value an array if multiple tags with the same name appear together $current[$tag] = array($current[$tag],$result);//This will combine the existing item and the new item together to make an array $repeated_tag_index[$tag.'_'.$level] = 2; if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well $current[$tag]['0_attr'] = $current[$tag.'_attr']; unset($current[$tag.'_attr']); } } $last_item_index = $repeated_tag_index[$tag.'_'.$level]-1; $current = &$current[$tag][$last_item_index]; } } elseif($type == "complete") { //Tags that ends in 1 line '' //See if the key is already taken. if(!isset($current[$tag])) { //New Key $current[$tag] = $result; $repeated_tag_index[$tag.'_'.$level] = 1; if($priority == 'tag' and $attributes_data) $current[$tag. '_attr'] = $attributes_data; } else { //If taken, put all things inside a list(array) if(isset($current[$tag][0]) and is_array($current[$tag])) {//If it is already an array... // ...push the new element into that array. $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result; if($priority == 'tag' and $get_attributes and $attributes_data) { $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data; } $repeated_tag_index[$tag.'_'.$level]++; } else { //If it is not an array... $current[$tag] = array($current[$tag],$result); //...Make it an array using using the existing value and the new value $repeated_tag_index[$tag.'_'.$level] = 1; if($priority == 'tag' and $get_attributes) { if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well $current[$tag]['0_attr'] = $current[$tag.'_attr']; unset($current[$tag.'_attr']); } if($attributes_data) { $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data; } } $repeated_tag_index[$tag.'_'.$level]++; //0 and 1 index is already taken } } } elseif($type == 'close') { //End of tag '' $current = &$parent[$level-1]; } } return($xml_array); } ?>
Sitemap