public static function admin_init()
 {
     add_settings_section(LastTrackPlugin::get_name_with_prefix('general'), __('General', LastTrackPlugin::domain()), function () {
     }, LastTrackPlugin::get_name_with_prefix('options'));
     add_settings_section(LastTrackPlugin::get_name_with_prefix('parsing'), __('Parsing config', LastTrackPlugin::domain()), function () {
     }, LastTrackPlugin::get_name_with_prefix('options'));
     add_settings_field(LastTrackPlugin::get_name_with_prefix('url'), __('Link', LastTrackPlugin::domain()), ElementsLibrary::echo_text(LastTrackPlugin::get_name_with_prefix('url'), LastTrackPlugin::get_option('url')), LastTrackPlugin::get_name_with_prefix('options'), LastTrackPlugin::get_name_with_prefix('general'));
     $is_require_auth = LastTrackPlugin::get_option('require_auth') != '';
     add_settings_field(LastTrackPlugin::get_name_with_prefix('require_auth'), __('Use authrization', LastTrackPlugin::domain()), ElementsLibrary::echo_checkbox(LastTrackPlugin::get_name_with_prefix('require_auth'), $is_require_auth), LastTrackPlugin::get_name_with_prefix('options'), LastTrackPlugin::get_name_with_prefix('general'));
     $tags = array();
     if (!$is_require_auth) {
         $tags['readonly'] = true;
     }
     add_settings_field(LastTrackPlugin::get_name_with_prefix('login'), __('Login', LastTrackPlugin::domain()), ElementsLibrary::echo_text(LastTrackPlugin::get_name_with_prefix('login'), $is_require_auth ? LastTrackPlugin::get_option('login') : '', null, $tags), LastTrackPlugin::get_name_with_prefix('options'), LastTrackPlugin::get_name_with_prefix('general'));
     add_settings_field(LastTrackPlugin::get_name_with_prefix('password'), __('Password', LastTrackPlugin::domain()), ElementsLibrary::echo_text(LastTrackPlugin::get_name_with_prefix('password'), $is_require_auth ? LastTrackPlugin::get_option('password') : '', null, $tags), LastTrackPlugin::get_name_with_prefix('options'), LastTrackPlugin::get_name_with_prefix('general'));
     add_settings_field(LastTrackPlugin::get_name_with_prefix('connect_timeout'), __('Connect timeout', LastTrackPlugin::domain()), ElementsLibrary::echo_text(LastTrackPlugin::get_name_with_prefix('connect_timeout'), LastTrackPlugin::get_option('connect_timeout')), LastTrackPlugin::get_name_with_prefix('options'), LastTrackPlugin::get_name_with_prefix('general'));
     add_settings_field(LastTrackPlugin::get_name_with_prefix('timeout'), __('Timeout', LastTrackPlugin::domain()), ElementsLibrary::echo_text(LastTrackPlugin::get_name_with_prefix('timeout'), LastTrackPlugin::get_option('timeout')), LastTrackPlugin::get_name_with_prefix('options'), LastTrackPlugin::get_name_with_prefix('general'));
     add_settings_field(LastTrackPlugin::get_name_with_prefix('parse_format'), __('Parse format', LastTrackPlugin::domain()), ElementsLibrary::echo_text(LastTrackPlugin::get_name_with_prefix('parse_format'), LastTrackPlugin::get_option('parse_format')), LastTrackPlugin::get_name_with_prefix('options'), LastTrackPlugin::get_name_with_prefix('parsing'));
     add_settings_field(LastTrackPlugin::get_name_with_prefix('exclude'), __('Excludes', LastTrackPlugin::domain()), ElementsLibrary::echo_text(LastTrackPlugin::get_name_with_prefix('exclude'), LastTrackPlugin::get_option('exclude')), LastTrackPlugin::get_name_with_prefix('options'), LastTrackPlugin::get_name_with_prefix('parsing'));
     register_setting(LastTrackPlugin::PREFIX, LastTrackPlugin::get_name_with_prefix('url'));
     register_setting(LastTrackPlugin::PREFIX, LastTrackPlugin::get_name_with_prefix('require_auth'));
     register_setting(LastTrackPlugin::PREFIX, LastTrackPlugin::get_name_with_prefix('login'));
     register_setting(LastTrackPlugin::PREFIX, LastTrackPlugin::get_name_with_prefix('password'));
     register_setting(LastTrackPlugin::PREFIX, LastTrackPlugin::get_name_with_prefix('connect_timeout'));
     register_setting(LastTrackPlugin::PREFIX, LastTrackPlugin::get_name_with_prefix('timeout'));
     register_setting(LastTrackPlugin::PREFIX, LastTrackPlugin::get_name_with_prefix('exclude'));
     register_setting(LastTrackPlugin::PREFIX, LastTrackPlugin::get_name_with_prefix('parse_format'));
 }
 public static function settings()
 {
     $post_options = array(LastTrackPlugin::get_name_with_prefix('information'), LastTrackPlugin::get_name_with_prefix('information_message'), LastTrackPlugin::get_name_with_prefix('title'), LastTrackPlugin::get_name_with_prefix('current_song'), LastTrackPlugin::get_name_with_prefix('last_songs'), LastTrackPlugin::get_name_with_prefix('count_songs'), LastTrackPlugin::get_name_with_prefix('href'));
     foreach ($post_options as $option) {
         if (!empty($_REQUEST[$option])) {
             update_option($option, $_REQUEST[$option]);
         }
     }
     $options = array(LastTrackPlugin::INFORMATION_NONE => __('None', LastTrackPlugin::domain()), LastTrackPlugin::INFORMATION_MESSAGE => __('Specified message', LastTrackPlugin::domain()), LastTrackPlugin::INFORMATION_FULL => __('Full', LastTrackPlugin::domain()));
     echo ElementsLibrary::draw_label(__('Error notification', LastTrackPlugin::domain()));
     echo ElementsLibrary::draw_select(LastTrackPlugin::get_name_with_prefix('information'), $options, LastTrackPlugin::get_option('information'));
     echo ElementsLibrary::draw_label(__('Error message', LastTrackPlugin::domain()));
     echo ElementsLibrary::draw_text(LastTrackPlugin::get_name_with_prefix('information_message'), LastTrackPlugin::get_option('information_message'));
     echo ElementsLibrary::draw_label(__('Title', LastTrackPlugin::domain()));
     echo ElementsLibrary::draw_text(LastTrackPlugin::get_name_with_prefix('title'), LastTrackPlugin::get_option('title'));
     echo ElementsLibrary::draw_label(__('Current track title', LastTrackPlugin::domain()));
     echo ElementsLibrary::draw_text(LastTrackPlugin::get_name_with_prefix('current_song'), LastTrackPlugin::get_option('current_song'));
     echo ElementsLibrary::draw_label(__('Last tracks title', LastTrackPlugin::domain()));
     echo ElementsLibrary::draw_text(LastTrackPlugin::get_name_with_prefix('last_songs'), LastTrackPlugin::get_option('last_songs'));
     echo ElementsLibrary::draw_label(__('Count last songs', LastTrackPlugin::domain()));
     echo ElementsLibrary::draw_text(LastTrackPlugin::get_name_with_prefix('count_songs'), LastTrackPlugin::get_option('count_songs'));
     echo ElementsLibrary::draw_label(__('Link to radio', LastTrackPlugin::domain()));
     echo ElementsLibrary::draw_text(LastTrackPlugin::get_name_with_prefix('href'), LastTrackPlugin::get_option('href'));
 }
 public static function echo_select($name, $options, $value = null, $tags = array())
 {
     return function () use($name, $options, $value, $tags) {
         echo ElementsLibrary::draw_select($name, $options, $value, $tags);
     };
 }