/** * Displays the administrator's MailChimp Integration configuration form to retrieve the MailChimp API Key * * @param array $errors, if provided, will list the errors in a list format, with the 'red_alert' stylesheet class. * @param boolean $success, if true, will create a success message with the 'green_alert' stylesheet class. * */ function configuration($errors = null, $success = false) { //define the current key. If current key is now invalid, reset to null and display error $currentKey = MailChimpController::get_valid_mailchimp_key(); if (MailChimpController::mailchimp_is_error($currentKey)) { $errors = $currentKey; $currentKey = null; } ?> <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?> "> <ul> <?php //if errors occurred, display them here. if (MailChimpController::mailchimp_is_error($errors)) { echo "<li style='width: 40%' class='red_alert'>"; foreach ($errors as $error) { echo "<p>{$error}</p>"; } echo "</li>"; } //if the credentials were successfully modified with no errors, let the user know. if ($success) { echo "<li style='width: 40%' class='green_alert'>"; echo "<p>MailChimp API Key Updated</p>"; echo "</li>"; } ?> <li>MailChimp API Key</li> <li><input size="45" type="text" name="mailchimp_api_key" value="<?php echo $currentKey; ?> " /> <a class="thickbox" href="#TB_inline?height=400&width=500&inlineId=api-key-help" target="_blank"><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/question-frame.png" width="16" height="16" alt="Help Link" /></a></li> <li><input class="button-primary" name="update_mailchimp_settings_post" value="Save MailChimp API Key" type="submit" /></li> </ul> </form> <?php ### help dialogue ### ?> <div id="api-key-help" style="display:none"> <div class="TB-ee-frame"> <h2><?php _e("MailChimp API Key", "event_espresso"); ?> </h2> <p><?php _e("If you do not have a MailChimp API key, please <a href='http://kb.mailchimp.com/article/where-can-i-find-my-api-key/' target='_blank'>click here</a> to learn how to create one. </p><p>An API key is required for this plugin.", 'event-espresso'); ?> </p> </div> </div> <?php }
/** * Handles the form logic of the MailChimp API Key save routines within the administrator's control panel. */ function event_espresso_mailchimp_settings() { MailChimpView::head(); if (isset($_REQUEST["update_mailchimp_settings_post"])) { $process = MailChimpController::update_mailchimp_settings(); if (MailChimpController::mailchimp_is_error($process)) { MailChimpView::configuration($process); } else { MailChimpView::configuration(null, 1); } } else { MailChimpView::configuration(); } MailChimpView::foot(); }
/** * Displays the administrator's MailChimp Integration configuration form to retrieve the MailChimp API Key * * @param array $errors, if provided, will list the errors in a list format, with the 'red_alert' stylesheet class. * @param boolean $success, if true, will create a success message with the 'green_alert' stylesheet class. * */ function configuration($errors = null, $success = false) { //define the current key. If current key is now invalid, reset to null and display error $currentKey = MailChimpController::get_valid_mailchimp_key(); if (MailChimpController::mailchimp_is_error($currentKey)) { $errors = $currentKey; $currentKey = null; } ?> <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?> "> <ul> <?php //if errors occurred, display them here. if (MailChimpController::mailchimp_is_error($errors)) { echo "<li style='width: 40%' class='red_alert'>"; foreach ($errors as $error) { echo "<p>{$error}</p>"; } echo "</li>"; } //if the credentials were successfully modified with no errors, let the user know. if ($success) { echo "<li style='width: 40%' class='green_alert'>"; echo "<p>MailChimp API Key Updated</p>"; echo "</li>"; } ?> <li>MailChimp API Key</li> <li><input type="text" name="mailchimp_api_key" value="<?php echo $currentKey; ?> " /> <a class="ev_reg-fancylink" href="#api-key"><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> /images/question-frame.png" width="16" height="16" /></a></li> <li><input class="button-primary" name="update_mailchimp_settings_post" value="Save MailChimp API Key" type="submit"></li> </ul> <?php }