暂无描述

MC4WP.php 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. /*******************************************************************************
  3. * Copyright (c) 2020, WP Popup Maker
  4. ******************************************************************************/
  5. class PUM_Integration_Form_MC4WP extends PUM_Abstract_Integration_Form {
  6. /**
  7. * Unique key identifier for this provider.
  8. *
  9. * @var string
  10. */
  11. public $key = 'mc4wp';
  12. /**
  13. * Text label that will be used throughout the various options screens.
  14. *
  15. * @return string
  16. */
  17. public function label() {
  18. return __( 'MailChimp for WordPress' );
  19. }
  20. /**
  21. * Should return true when the required form plugin is active.
  22. *
  23. * @return bool
  24. */
  25. public function enabled() {
  26. return defined( 'MC4WP_VERSION' ) && MC4WP_VERSION;
  27. }
  28. /**
  29. * Return a useable array of all forms from this provider.
  30. *
  31. * @return MC4WP_Form[]
  32. */
  33. public function get_forms() {
  34. return mc4wp_get_forms();
  35. }
  36. /**
  37. * Return a single form by ID.
  38. *
  39. * @param string $id
  40. *
  41. * @return MC4WP_Form
  42. */
  43. public function get_form( $id ) {
  44. return mc4wp_get_form( $id );
  45. }
  46. /**
  47. * Returns an array of options for a select list.
  48. *
  49. * Should be in the format of $formId => $formLabel
  50. *
  51. * @return array
  52. */
  53. public function get_form_selectlist() {
  54. $form_selectlist = [];
  55. $forms = $this->get_forms();
  56. foreach ( $forms as $form ) {
  57. $form_selectlist[ $form->ID ] = $form->name;
  58. }
  59. return $form_selectlist;
  60. }
  61. /**
  62. * Load a custom script file to handle AJAX based submissions or other integrations with Popup Maker frontend.
  63. *
  64. * @param array $js
  65. *
  66. * @return array
  67. */
  68. public function custom_scripts( $js = [] ) {
  69. return $js;
  70. }
  71. /**
  72. * Load custom styles for hacking some elements specifically inside popups, such as datepickers.
  73. *
  74. * @param array $css
  75. *
  76. * @return array
  77. */
  78. public function custom_styles( $css = [] ) {
  79. return $css;
  80. }
  81. }