Skip to content

Commit

Permalink
response changed from input to textarea
Browse files Browse the repository at this point in the history
  • Loading branch information
bipoza committed Mar 21, 2023
1 parent 7a22266 commit 9d07b5d
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions wp-uptime.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function get_option_or_value($key, $default_value)
add_action('rest_api_init', function () {
register_rest_route(
'wp-uptime',
'/' . get_option_or_value("endpoint_path", 'ok') . '/',
'/' . get_option_or_value("wp_uptime_endpoint_path", 'ok') . '/',
array(
'methods' => 'GET',
'callback' => 'wp_uptime_route_handler',
Expand All @@ -47,7 +47,7 @@ function wp_uptime_route_handler($request)


if ($result) {
echo get_option_or_value("response_value", 'OK');
echo get_option_or_value("wp_uptime_response_value", 'OK');
}
}

Expand All @@ -59,7 +59,7 @@ function wp_uptime_menu()

function wp_uptime_settings_page()
{
$url = get_rest_url(null, 'wp-uptime/' . get_option_or_value("endpoint_path", 'ok') . '/');
$url = get_rest_url(null, 'wp-uptime/' . get_option_or_value("wp_uptime_endpoint_path", 'ok') . '/');


?>
Expand All @@ -75,13 +75,14 @@ function wp_uptime_settings_page()
<table class="form-table">
<tr valign="top">
<th scope="row">Endpoint path</th>
<td><input type="text" name="endpoint_path"
value="<?php echo esc_attr(get_option_or_value('endpoint_path', 'ok')); ?>"></td>
<td><input type="text" name="wp_uptime_endpoint_path"
value="<?php echo esc_attr(get_option_or_value('wp_uptime_endpoint_path', 'ok')); ?>"></td>
</tr>
<tr valign="top">
<th scope="row">OK response value</th>
<td><input type="text" name="response_value"
value="<?php echo esc_attr(get_option_or_value('response_value', 'OK')); ?>"></td>
<td>
<?php echo "<textarea name='wp_uptime_response_value'>" . esc_attr(get_option_or_value('wp_uptime_response_value', 'OK')) . '</textarea>'; ?>
</td>
</tr>
</table>
<?php submit_button(); ?>
Expand All @@ -94,6 +95,6 @@ function wp_uptime_settings_page()

function wp_uptime_settings()
{
register_setting('wp_uptime_settings', 'endpoint_path');
register_setting('wp_uptime_settings', 'response_value');
register_setting('wp_uptime_settings', 'wp_uptime_endpoint_path');
register_setting('wp_uptime_settings', 'wp_uptime_response_value');
}

0 comments on commit 9d07b5d

Please sign in to comment.