'PlayThru Settings',
'button' => 'Update Settings',
'flash_message' => '
These are your current keys, they should not need to be changed once set.
'
);
// Displayed if settings were saved
if (isset($_POST['ayah'])) {
$page_opts['flash_message'] = "Your settings have been saved!";
}
switch ($_SESSION['ayah_page_action']) {
case 'install':
$page_opts = ayah_get_install_page();
break;
case 'upgrade':
$page_opts = ayah_get_upgrade_page();
break;
}
$ayah_options = $_SESSION['ayah_options'];
echo "";
echo "
Are You a Human " . $page_opts['title'] . "
";
if ($page_opts['flash_message']) {
echo $page_opts['flash_message'];
}
echo ayah_get_form($page_opts['button']);
echo "";
}
/**
* Sets the page options for the upgrade page
*/
function ayah_get_upgrade_page() {
$page_opts = array();
$page_opts['title'] = 'Upgrade';
$page_opts['button'] = 'Complete Upgrade';
$page_opts['flash_message'] = "Please take a moment to make sure the following is correct and complete your upgrade.";
if ($_SESSION['ayah_page_action'] == 'upgrade' && isset($_POST['ayah'])) {
$page_opts['flash_message'] = "Your plugin has been successfully upgraded.";
$page_opts['button'] = 'Update Settings';
}
return $page_opts;
}
/**
* Sets the page options for the install page
*/
function ayah_get_install_page() {
$page_opts = array();
$page_opts['title'] = "Installation";
$page_opts['button'] = "Complete Installation";
$page_opts['flash_message'] = "To complete your installation:
- Register for an account on Are You a Human.
- Copy and paste the Publisher and Scoring keys into the fields below.
";
if ($_SESSION['ayah_page_action'] == 'install' && isset($_POST['ayah'])) {
$page_opts['flash_message'] = "The plugin has been successfully installed.
";
$page_opts['button'] = 'Update Settings';
}
return $page_opts;
}
/**
* Returns the settings page HTML with the settings inputs filled in
*/
function ayah_get_form($button) {
$ayah_options = $_SESSION['ayah_options'];
// set up our checkbox checked
$chk_enable_register_form = ($ayah_options['enable_register_form'] == '1') ? 'checked' : '';
$chk_enable_lost_password_form = ($ayah_options['enable_lost_password_form'] == '1') ? 'checked' : '';
$chk_enable_comment_form = ($ayah_options['enable_comment_form'] == '1') ? 'checked' : '';
$chk_hide_registered_users = ($ayah_options['hide_registered_users'] == '1') ? 'checked' : '';
$form_html = "
";
return $form_html;
}
function ayah_clear_options_button() {
return "
";
}