'football_league', 'description' => __('Плагин для показывания таблицы 7 определенных лиг.', 'football_league') ); /* Widget control settings. */ $control_ops = array('id_base' => 'football_league-widget' ); /* Create the widget. */ $this->WP_Widget( 'football_league-widget', __('7 футбольных лиг', 'football_league'), $widget_ops, $control_ops ); /* Setup the explode function */ function explode_leagues($league, $limit){ switch ($league) { case 'Russian league': $html = implode('', file('http://futnik.ru/widget/russian.php')); break; case 'English league': $html = implode('', file('http://futnik.ru/widget/england.php')); break; case 'Italian league': $html = implode('', file('http://futnik.ru/widget/italian.php')); break; case 'Spain league': $html = implode('', file('http://futnik.ru/widget/spain.php')); break; case 'Ukrain league': $html = implode('', file('http://futnik.ru/widget/ukrain.php')); break; case 'FNK league': $html = implode('', file('http://futnik.ru/widget/fnk.php')); break; case 'Germany league': $html = implode('', file('http://futnik.ru/widget/germany.php')); break; } $output=''.$html.'
'; echo $output; } } function widget( $args, $instance ) { extract( $args ); /* Our variables from the widget settings. */ $title = apply_filters('widget_title', $instance['title'] ); $name = $instance['name']; $league = $instance['league']; /* Before widget (defined by themes). */ echo $before_widget; /* Display the widget title if one was input (before and after defined by themes). */ if ( $title ) echo $before_title . $title . $after_title; /* If show league was selected, display the user's league. */ if ( $league ) explode_leagues($instance['league'], $instance['limit_teams']); /* After widget (defined by themes). */ echo $after_widget; } function update( $new_instance, $old_instance ) { $instance = $old_instance; /* Strip tags for title and name to remove HTML (important for text inputs). */ $instance['title'] = strip_tags( $new_instance['title'] ); $instance['limit_teams'] = strip_tags( $new_instance['limit_teams'] ); $instance['league'] = $new_instance['league']; return $instance; } function form( $instance ) { /* Set up some default widget settings. */ $defaults = array( 'title' => __('FL', 'football_league'), 'name' => __('John Doe', 'football_league'), 'league' => 'male', 'show_league' => true ); $instance = wp_parse_args( (array) $instance, $defaults ); ?>


ПКлубИгрО