-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathwp-exhibit-admin-options.php
More file actions
69 lines (50 loc) · 2.83 KB
/
Copy pathwp-exhibit-admin-options.php
File metadata and controls
69 lines (50 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
// mt_options_page() displays the page content for the Test Options submenu
function exhibit_options_page() {
// variables for the field and option names
$opt_name = 'google_map_api_key';
$hidden_field_name = 'mt_submit_hidden';
$data_field_name = 'google_map_api_key';
$et_opt_name = 'datapress_et_phone_home';
$et_opt_field_name = 'send_statistics';
// Read in existing option value from database
$google_map_api_key = get_option( $opt_name );
$et_phone_home = get_option($et_opt_name);
// See if the user has posted us some information
// If they did, this hidden field will be set to 'Y'
if( $_POST[ $hidden_field_name ] == 'Y' ) {
// Read their posted value
$google_map_api_key = $_POST[ $data_field_name ];
$et_phone_home = ("YES" === $_POST[ $et_opt_field_name ]) ? "Y" : "N" ;
// Save the posted value in the database
update_option( $opt_name, $google_map_api_key );
update_option( $et_opt_name, $et_phone_home );
// Put an options updated message on the screen
?>
<div class="updated"><p><strong><?php _e('Options saved.', 'mt_trans_domain' ); ?></strong></p></div>
<?php
}
// Now display the options editing screen
echo '<div class="wrap">';
// header
echo "<h2>" . __( 'DataPress Options', 'mt_trans_domain' ) . "</h2>";
// options form
?>
<form name="form1" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">
<input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
<h3><?php _e("Google Maps API Key", 'mt_trans_domain' ); ?></h3>
<input type="text" style="width: 350px;" name="<?php echo $data_field_name; ?>" value="<?php echo $google_map_api_key; ?>" size="20">(<a href="http://code.google.com/apis/maps/signup.html">Get a Google Maps Key</a>)<br />
<p>This key allows your Exhibits to access to Google Map functionality.</p>
<h3><?php _e("Participate in Usage Study", 'mt_trans_domain' ); ?></h3>
<p><input type="checkbox" style="width: 350px;" name="<?php echo $et_opt_field_name; ?>" <?php echo (($et_phone_home == "Y") ? "checked" : "" ) ?> value="YES" /> <b>Help Research!</b></p>
<p>The <a href="http://haystack.csail.mit.edu">Haystack Research Group</a> at <a href="http://www.mit.edu">MIT</a> <a href="http://csail.mit.edu/">CSAIL</a> is studying whether tools like Datapress will help promote data publishing on the web.<br />
If the above box is checked, Datapress will ping MIT every time one of your DataPress Exhibits is viewed so that we can count the number of viewers.
<br />Learn more at the <a href="http://projects.csail.mit.edu/datapress">Datapress Website</a>.</p>
<p class="submit">
<input type="submit" name="Submit" value="<?php _e('Update Options', 'mt_trans_domain' ) ?>" />
</p>
</form>
</div>
<?php
}
?>