From df93dd00ab23432c8d47bfda91b91e93d6c08c03 Mon Sep 17 00:00:00 2001 From: Martin Schuette Date: Thu, 3 Apr 2014 22:05:35 +0000 Subject: [PATCH] register settings and label option inputs --- freifunkmeta.php | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/freifunkmeta.php b/freifunkmeta.php index 0d2f698..8125be5 100644 --- a/freifunkmeta.php +++ b/freifunkmeta.php @@ -123,10 +123,18 @@ function ff_meta_admin_menu() { add_action( 'admin_init', 'ff_meta_admin_init' ); function ff_meta_admin_init() { + register_setting( + 'ff_meta_settings-group', // group name + 'ff_meta_cachetime' // option name + ); register_setting( 'ff_meta_settings-group', // group name 'ff_meta_url' // option name ); + register_setting( + 'ff_meta_settings-group', // group name + 'ff_meta_dir' // option name + ); add_settings_section( 'ff_meta_section-one', // ID 'Section One', // Title @@ -138,21 +146,24 @@ function ff_meta_admin_init() { 'Cache time', // Title 'ff_meta_cachetime_callback', // callback to fill field 'ff_meta_plugin', // menu page=slug to display field on - 'ff_meta_section-one' // section to display the field in + 'ff_meta_section-one', // section to display the field in + array('label_for' => 'ff_meta_cachetime_id') // ID of input element ); add_settings_field( 'ff_meta_url', // ID 'URL of meta.json', // Title 'ff_meta_url_callback', // callback to fill field 'ff_meta_plugin', // menu page=slug to display field on - 'ff_meta_section-one' // section to display the field in + 'ff_meta_section-one', // section to display the field in + array('label_for' => 'ff_meta_url_id') // ID of input element ); add_settings_field( 'ff_meta_dir', // ID 'URL of directory.json', // Title 'ff_meta_dir_callback', // callback to fill field 'ff_meta_plugin', // menu page=slug to display field on - 'ff_meta_section-one' // section to display the field in + 'ff_meta_section-one', // section to display the field in + array('label_for' => 'ff_meta_dir_id') // ID of input element ); } @@ -165,7 +176,7 @@ function ff_meta_cachetime_callback() { if (empty($time)) { $time = "15"; } - echo " minutes" + echo " minutes" ."

Data from external URLs is cached for this number of minutes.

"; } @@ -174,7 +185,7 @@ function ff_meta_dir_callback() { if (empty($url)) { $url = "https://raw.githubusercontent.com/freifunk/directory.api.freifunk.net/master/directory.json"; } - echo "" + echo "" ."

Please keep the default unless you really know what you are doing.

"; } @@ -183,7 +194,7 @@ function ff_meta_url_callback() { if (empty($url)) { $url = "http://meta.hamburg.freifunk.net/ffhh.json"; } - echo "" + echo "" ."

This will be the default for all tags without url=\"xyz\" parameter.

"; }