config.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. gawpp_access();
  3. if (!gawpp_manage()) return;
  4. if (isset($_GET["settings-updated"])) {
  5. $errors = count(get_settings_errors("gawpp_messages"));
  6. add_settings_error(
  7. "gawpp_messages",
  8. "gawpp_message",
  9. sprintf(
  10. esc_html__("Settings saved%s!", GAWPP_TEXT_DOMAIN),
  11. (function($errors) {
  12. switch ($errors) {
  13. case 0:
  14. return null;
  15. default:
  16. return sprintf(
  17. __(", but with %d %s", GAWPP_TEXT_DOMAIN),
  18. $errors,
  19. _n("error", "errors", $errors, GAWPP_TEXT_DOMAIN)
  20. );
  21. }
  22. })($errors)
  23. ),
  24. "updated"
  25. );
  26. if ($errors == 0) {
  27. if (!empty($err = Gogs_API_Plugin::verify()) && is_string($err))
  28. add_settings_error(
  29. "gawpp_messages",
  30. "gawpp_messages",
  31. sprintf("%s", esc_html($err)),
  32. "error"
  33. );
  34. }
  35. }
  36. settings_errors("gawpp_messages");
  37. ?>
  38. <div class="wrap">
  39. <h1><?=esc_html(get_admin_page_title());?></h1>
  40. <form action="options.php" method="post">
  41. <?php
  42. settings_fields("gawpp");
  43. do_settings_sections("gawpp");
  44. submit_button("Save configuration");
  45. ?>
  46. </form>
  47. <center><?=Gogs_API_Plugin::get_credit(true, true);?></center>
  48. </div>