'widget_AppStore_Widget', 'description' => 'Zeigt die Top 10 der AppStore Charts' ); $this->WP_Widget('AppStore_Widget', 'Appstore', $widget_ops); if ( is_active_widget(false, false, $this->id_base) ) add_action( 'wp_head', array(&$this, 'recent_widget_style') ); } function recent_widget_style() { // echo ''; } function widget($args, $instance) { extract($args, EXTR_SKIP); $wtitle = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Top 10 Apps' ) : $instance['title']); //$freePaid = apply_filters('widget_title', empty( $instance['freePaid'] ) ? __( 'free' ) : $instance['freePaid']); $topCount = apply_filters('widget_title', empty( $instance['topCount'] ) ? __( '10' ) : $instance['topCount']); $freePaid = attribute_escape($instance['freePaid']) ; $Country = attribute_escape($instance['Country']) ; echo $before_widget .$before_title . $wtitle . $after_title; $doc = new DOMDocument(); if ($freePaid == "free") { $feed = RSS_TOPFREE.$Country."/lang=de_de/limit=".$topCount."/xml"; } else { $feed = RSS_TOPPAID.$Country."/lang=de_de/limit=".$topCount."/xml"; } $doc->load($feed); $appList = '"; echo $appList; echo $after_widget; } function update($new_instance, $old_instance) { $instance = $old_instance; $instance['title'] = strip_tags($new_instance['title']); $instance['freePaid'] = strip_tags($new_instance['freePaid']); $instance['topCount'] = strip_tags($new_instance['topCount']); $instance['Country'] = strip_tags($new_instance['Country']); return $instance; } function form($instance) { $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'freePaid' => '', 'topCount' => '', 'Country' => '' ) ); $title = attribute_escape($instance['title']); $freePaid = attribute_escape($instance['freePaid']) ; $topCount = attribute_escape($instance['topCount']) ; $Country = attribute_escape($instance['Country']) ; if ($freePaid == "free" ) { $checked = "checked" ; } else { $checked = "" ; } if ($topCount == "" ) { $topCount = "10" ; } if ($title == "" ) { $title = "Top Apps" ; } if ($Country == "" ) { $Country = "143445" ; } $Countries = array( 143445 => "Austria", 143443 => "Germany", 143452 => "Netherlands", 143441 => "USA", 143469 => "Russia", 143444 => "UK", 143459 => "Switzerland", 143465 => "China", 143448 => "Greece", 143450 => "Italy", 143461 => "New Zealand" ); asort($Countries); ?>